The EntityBuilder has been modified to obtain the pkey value by invoking getPKey(). This function can be overriden for different entities. The addOptionsFunction() has been renamed to getOptions() and it can be overriden for different entities. Each entity that uses this function has been modified accordingly. The addEdit(), addAnother(), add_fail() has been moved into the EntityBuilder class. The global builders is no longer needed because a reference to the builder object can be obtained via enclosure. The ServiceForms has been modified to take service name and hostname and combine them to generate the service principal by overriding the getPKey().
94 lines
2.0 KiB
JavaScript
94 lines
2.0 KiB
JavaScript
function setupService(facet) {
|
|
serviceForms.setup(facet);
|
|
}
|
|
|
|
var serviceForms = new ServiceForms();
|
|
|
|
function ServiceForms() {
|
|
|
|
this.obj = "service";
|
|
|
|
this.facets = ['details', 'hosts', 'assignhosts'];
|
|
|
|
this.setup = function(facet) {
|
|
if (this[facet]) {
|
|
this[facet].setup();
|
|
} else {
|
|
this.unspecified.setup();
|
|
}
|
|
};
|
|
|
|
this.hostListColumns = [ {title:"host",column:"managedby_host"} ];
|
|
|
|
this.hosts = new AssociationList(
|
|
this.obj,
|
|
"hosts",
|
|
"assignhosts",
|
|
this.hostListColumns,
|
|
this.facets
|
|
);
|
|
|
|
this.assignhosts = new AssociationForm(
|
|
this.obj,
|
|
"host",
|
|
"assignhosts",
|
|
this.facets,
|
|
"fqdn",
|
|
function() {
|
|
return 'Add Hosts to service : ' + qs['pkey'];
|
|
},
|
|
BulkAssociator,
|
|
"add_host"
|
|
);
|
|
|
|
this.detailsList = [
|
|
['identity', 'Service Details', [
|
|
['krbprincipalname', 'Kerberos Principal']
|
|
]]
|
|
];
|
|
|
|
this.details = new DetailsForm(
|
|
"service",
|
|
this.detailsList,
|
|
"krbprincipalname",
|
|
this.facets
|
|
);
|
|
|
|
this.addProperties = [
|
|
{title: 'Service', id: 'service', type: 'text'},
|
|
{title: 'Host Name', id: 'host', type: 'text'}
|
|
];
|
|
|
|
this.add = new EntityBuilder(
|
|
"service",
|
|
this.addProperties
|
|
);
|
|
|
|
this.add.getPKey = function() {
|
|
return $("#service").val()+"/"+$("#host").val();
|
|
}
|
|
|
|
this.searchColumns = [
|
|
{
|
|
title: "Service",
|
|
column: "krbprincipalname",
|
|
render: function (current, cell) {
|
|
renderPkeyColumn2('service', 'krbprincipalname', current, cell);
|
|
}
|
|
},
|
|
{
|
|
title: "Has Keytab",
|
|
column: "has_keytab",
|
|
render: renderSimpleColumn
|
|
}
|
|
];
|
|
|
|
this.search = new SearchForm(
|
|
"service",
|
|
"find",
|
|
this.searchColumns
|
|
);
|
|
|
|
this.unspecified = this.search;
|
|
}
|