freeipa/install/static/hostgroup.js
Endi DeWata fd056918e6 Splitting service principal into service name and hostname.
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().
2010-09-10 12:59:33 -04:00

83 lines
2.0 KiB
JavaScript

function setupHostgroup(facet){
hostgroupForms.setup(facet);
}
var hostgroup_details_list =
[['identity', 'Hostgroup Details', [
['cn', 'Hostgroup Name'],
['description', 'Description']]]];
var hostgroupFacets = ["details","hosts","assignhosts"];
var hostgroupForms = new HostgroupsForms();
function HostgroupsForms(){
this.setup = function(facet){
if (this[facet]){
this[facet].setup();
}else{
this.unspecified.setup();
}
}
/**
* used to initialize the search
*/
this.hostgroupSearchColumns = [
{
title:"Hostgroup",
column:"cn",
render: function(current,cell){
renderPkeyColumn2('hostgroup', 'cn', current,cell);
}
},
{title:"Description", column:"description",render: renderSimpleColumn}];
this.hostgroupAddProperties =
[{title: 'Hostgroup Name', id: 'pkey', type: 'text'},
{title: 'Description', id: 'description', type: 'text'}];
/**
Facets
*/
this.hostListColumns = [ {title:"host",column:"member_host" }];
this.obj="hostgroup";
this.hosts = new AssociationList(
this.obj,
"hosts",
"assignhosts",
this.hostListColumns, hostgroupFacets );
this.assignhosts = new AssociationForm(
this.obj,
"host",
"assignhosts",
hostgroupFacets,
"fqdn",
function(){
return 'Add Hosts to to hostgroup : ' + qs['pkey'] ;
},
BulkAssociator);
this.details = new DetailsForm("hostgroup",hostgroup_details_list,"cn",hostgroupFacets) ;
this.add = new EntityBuilder("hostgroup",this.hostgroupAddProperties);
this.add.getOptions = function() {
var options = {
name: $('#pkey').val(),
description: $('#description').val()
};
return options;
}
this.search = new SearchForm("hostgroup", "find", this.hostgroupSearchColumns);
this.unspecified = this.search;
}