summaryrefslogtreecommitdiffstats
path: root/install/static/hostgroup.js
diff options
context:
space:
mode:
authorAdam Young <ayoung@redhat.com>2010-09-07 10:08:19 -0400
committerAdam Young <ayoung@redhat.com>2010-09-07 10:08:19 -0400
commitdde15772700da41ec931bb55087fbec6f30fab55 (patch)
tree890bd7ecd8bb4d906c4b670b772b2a960c50f3c1 /install/static/hostgroup.js
parente93932b3235fc27b31a59c0cb77250acf15d3f31 (diff)
downloadfreeipa.git-dde15772700da41ec931bb55087fbec6f30fab55.tar.gz
freeipa.git-dde15772700da41ec931bb55087fbec6f30fab55.tar.xz
freeipa.git-dde15772700da41ec931bb55087fbec6f30fab55.zip
associations
-Refactored the associations code into a set of objects that are configured by the entities -Added support for associations that can be done in a single rpc -hostgroup to host and group to user associations working -Restructed sampledata so that the file is matched automatically by the RPC method name -The new ipa_cmd/sampledata scheme insists on there being sample data for any commands or the ipa_command fails. -Added sampledata files for all the calls we make -renamed several of the sampledata files to match their rpc calls -Started a pattern of refactoring where all the forms for the entity fall under a single object
Diffstat (limited to 'install/static/hostgroup.js')
-rw-r--r--install/static/hostgroup.js80
1 files changed, 57 insertions, 23 deletions
diff --git a/install/static/hostgroup.js b/install/static/hostgroup.js
index 290460d8..e58a1153 100644
--- a/install/static/hostgroup.js
+++ b/install/static/hostgroup.js
@@ -1,11 +1,6 @@
+
function setupHostgroup(facet){
- if (facet == "details"){
- hostgroupDetailsForm.setup();
- }else if (facet == "add"){
- hostgroupBuilder.setup();
- }else{
- hostgroupSearchForm.setup();
- }
+ hostgroupForms.setup(facet);
}
var hostgroup_details_list =
@@ -13,8 +8,7 @@ var hostgroup_details_list =
['cn', 'Hostgroup Name'],
['description', 'Description']]]];
-
-var hostgroupDetailsForm = new DetailsForm("hostgroup",hostgroup_details_list,"cn","sampledata/hostgroupshow.json") ;
+var hostgroupFacets = ["details","hosts","assignhosts"];
@@ -26,23 +20,63 @@ function hostgroupAddOptionsFunction (){
return options;
}
-var hostgroupAddProperties =
+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'}];
-var hostgroupBuilder = new EntityBuilder("hostgroup",hostgroupAddProperties,hostgroupAddOptionsFunction);
+ /**
+ Facets
+ */
+ this.hostListColumns = [ {title:"Host",column:"member_host" }];
+ this.obj="hostgroup";
+ this.hosts = new AssociationList(
+ this.obj,
+ "hosts",
+ "assignhosts",
+ this.hostListColumns, hostgroupFacets );
-var hostgroupSearchColumns = [
- {
- title:"Hostgroup",
- column:"cn",
- render: function(current,cell){
- renderPkeyColumn(hostgroupDetailsForm, current,cell);
- }
- },
- {title:"Description", column:"description",render: renderSimpleColumn}];
+ this.assignhosts = new AssociationForm(
+ this.obj,
+ "host",
+ "assignhosts",
+ hostgroupFacets,
+ "fqdn",
+ function(){
+ return 'Add Hosts to to hostgroup : ' + qs['pkey'] ;
+ },
+ BulkAssociator);
-var hostgroupSearchForm =
- new SearchForm("hostgroup", "find", hostgroupSearchColumns,
- "sampledata/hostgrouplist.json");
+ this.details = new DetailsForm("hostgroup",hostgroup_details_list,"cn",hostgroupFacets) ;
+
+ this.add = new EntityBuilder("hostgroup",this.hostgroupAddProperties,hostgroupAddOptionsFunction);
+
+ this.search = new SearchForm("hostgroup", "find", this.hostgroupSearchColumns);
+ this.unspecified = this.search;
+}