summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAdam Young <ayoung@redhat.com>2010-09-08 10:00:00 -0400
committerAdam Young <ayoung@redhat.com>2010-09-09 12:42:37 -0400
commit3a022fe51043f71bdb50aefea828377b8f0c09fb (patch)
treed6ce89a78293f47530c03f4cfe5c5412e0903b90
parent0a47351fd6a72e475f1e61fe1699dd84f008c9c1 (diff)
downloadfreeipa-3a022fe51043f71bdb50aefea828377b8f0c09fb.tar.gz
freeipa-3a022fe51043f71bdb50aefea828377b8f0c09fb.tar.xz
freeipa-3a022fe51043f71bdb50aefea828377b8f0c09fb.zip
Netgroup associations
netgroup->user,group,host,hostgroup -- Added facets to netgroup -- added links into lists for associations
-rw-r--r--install/static/associate.js9
-rw-r--r--install/static/hostgroup.js2
-rw-r--r--install/static/netgroup.js124
-rw-r--r--install/static/sampledata/netgroup_add_member.json40
-rw-r--r--install/static/sampledata/netgroup_show.json14
-rw-r--r--install/static/user.js2
6 files changed, 156 insertions, 35 deletions
diff --git a/install/static/associate.js b/install/static/associate.js
index c11642ba9..cd07c9f75 100644
--- a/install/static/associate.js
+++ b/install/static/associate.js
@@ -218,8 +218,15 @@ function AssociationList(obj,facet,assignFacet,associationColumns,facets) {
var row = $("<tr/>").appendTo($('#searchResultsTable thead:last'));
for (var k = 0; k < associationColumns.length ;k++){
var column = this.associationColumns[k].column;
+ var link =
+ "#tab="+this.associationColumns[k].title
+ +"&facet=details"
+ +"&pkey="+userData.result.result[column][j];
$("<td/>",{
- html: userData.result.result[column][j]
+ html: $("<a />",{
+ href:link,
+ html:userData.result.result[column][j]
+ })
}).appendTo(row);
}
}
diff --git a/install/static/hostgroup.js b/install/static/hostgroup.js
index e58a11530..2f40f0b3f 100644
--- a/install/static/hostgroup.js
+++ b/install/static/hostgroup.js
@@ -54,7 +54,7 @@ function HostgroupsForms(){
/**
Facets
*/
- this.hostListColumns = [ {title:"Host",column:"member_host" }];
+ this.hostListColumns = [ {title:"host",column:"member_host" }];
this.obj="hostgroup";
this.hosts = new AssociationList(
this.obj,
diff --git a/install/static/netgroup.js b/install/static/netgroup.js
index 88338b1db..295e41366 100644
--- a/install/static/netgroup.js
+++ b/install/static/netgroup.js
@@ -1,29 +1,7 @@
function setupNetgroup(facet){
- if (facet == "details"){
- netgroupDetailsForm.setup();
- }else if(facet == "add"){
- netgroupBuilder.setup();
- }else{
- netgroupSearchForm.setup();
- }
+ netgroupForms.setup(facet);
}
-
-var netgroup_details_list =
- [['identity', 'Netgroup Details', [
- ['cn', 'Netgroup Name'],
- ['description', 'Description'],
- ['nisdomainname', 'NIS Domain']]]];
-
-
-var netgroupDetailsForm = new DetailsForm("netgroup",netgroup_details_list,"cn", ["details","hosts","groups","users"]) ;
-
-
-var netgroupAddProperties =
- [{title: 'Netgroup Name', id: 'pkey', type: 'text'},
- {title: 'Description', id: 'description', type: 'text'}];
-
-
function netgroupAddOptionsFunction (){
var options = {
name: $('#pkey').val(),
@@ -32,14 +10,98 @@ function netgroupAddOptionsFunction (){
return options;
}
-var netgroupBuilder = new EntityBuilder("netgroup",netgroupAddProperties,netgroupAddOptionsFunction);
+var netgroupForms = new NetgroupForms();
+
+function NetgroupForms(){
+ this.obj='netgroup';
+ this.pkeycol = 'cn';
+ this.facets = ["details","users","assignusers","groups","assigngroups","hosts","assignhosts","hostgroups","assignhostgroups"];
+
+ this.netgroupSearchColumns = [
+ {title:"Netgroup",column:"cn",render: function(current,cell){
+ renderPkeyColumn2('netgroup', 'cn', current,cell);
+ }},
+ {title:"Description", column:"description",render: renderSimpleColumn}];
+
+
+ this.details_list =
+ [['identity', 'Netgroup Details', [
+ ['cn', 'Netgroup Name'],
+ ['description', 'Description'],
+ ['nisdomainname', 'NIS Domain']]]];
+
+ this.details = new DetailsForm(this.obj,this.details_list,this.pkeycol,
+ this.facets) ;
+
+
+
+ this.add_properties =
+ [{title: 'Netgroup Name', id: 'pkey', type: 'text'},
+ {title: 'Description', id: 'description', type: 'text'}];
+
+ this.add = new EntityBuilder("netgroup",this.add_properties,
+ netgroupAddOptionsFunction);
+ this.search = new SearchForm("netgroup", "find", this.netgroupSearchColumns);
+ this.userListColumns = [ {title:"user",column:"memberuser_user", }];
+ this.users = new AssociationList(
+ this.obj, "users", "assignusers", this.userListColumns, this.facets );
-var netgroupSearchColumns = [
- {title:"Netgroup",column:"cn",render: function(current,cell){
- renderPkeyColumn(netgroupDetailsForm, current,cell);
- }},
- {title:"Description", column:"description",render: renderSimpleColumn}];
+ this.assignusers = new AssociationForm(
+ this.obj, "user", "assignuser", this.facets, "uid",
+ function(){
+ return 'Add Hosts to to netgroup : ' + qs['pkey'] ;
+ },
+ BulkAssociator);
-var netgroupSearchForm =
- new SearchForm("netgroup", "find", netgroupSearchColumns);
+
+ this.groupListColumns = [ {title:"group",column:"memberuser_group", }];
+ this.groups = new AssociationList(
+ this.obj, "groups", "assigngroups", this.groupListColumns, this.facets );
+
+ this.assigngroups = new AssociationForm(
+ this.obj, "group", "assigngroup", this.facets, "cn",
+ function(){
+ return 'Add Hosts to to netgroup : ' + qs['pkey'] ;
+ },
+ BulkAssociator);
+
+
+
+ this.hostListColumns = [ {title:"host",column:"memberhost_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 to netgroup : ' + qs['pkey'] ;
+ },
+ BulkAssociator);
+
+
+ this.hostgroupListColumns = [ {title:"hostgroup",column:"memberhost_hostgroup", }];
+
+ this.hostgroups = new AssociationList(
+ this.obj, "hostgroups", "assignhostgroups", this.hostgroupListColumns, this.facets );
+
+ this.assignhostgroups = new AssociationForm(
+ this.obj, "hostgroup", "assignhostgroups", this.facets, "cn",
+ function(){
+ return 'Add Hostgroups to to netgroup : ' + qs['pkey'] ;
+ },
+ BulkAssociator);
+
+
+
+ this.unspecified = this.search;
+ this.setup = function(facet){
+ if (this[facet]){
+ this[facet].setup();
+ }else{
+ this.unspecified.setup();
+ }
+ }
+
+}
diff --git a/install/static/sampledata/netgroup_add_member.json b/install/static/sampledata/netgroup_add_member.json
new file mode 100644
index 000000000..5fbae9e14
--- /dev/null
+++ b/install/static/sampledata/netgroup_add_member.json
@@ -0,0 +1,40 @@
+{
+ "error": null,
+ "id": 0,
+ "result": {
+ "completed": 3,
+ "failed": {
+ "memberhost": {
+ "host": [],
+ "hostgroup": []
+ },
+ "memberuser": {
+ "group": [],
+ "user": []
+ }
+ },
+ "result": {
+ "cn": [
+ "net-live"
+ ],
+ "description": [
+ "live servers"
+ ],
+ "dn": "ipauniqueid=2e08b2c2-baac-11df-a0cf-525400674dcd,cn=ng,cn=alt,dc=ayoung,dc=boston,dc=devel,dc=redhat,dc=com",
+ "memberhost_host": [
+ "live3.pbs.org",
+ "live2.pbs.org",
+ "live1.pbs.org"
+ ],
+ "memberhost_hostgroup": [
+ "host-live"
+ ],
+ "memberuser_group": [
+ "muppets"
+ ],
+ "nisdomainname": [
+ "ayoung.boston.devel.redhat.com"
+ ]
+ }
+ }
+} \ No newline at end of file
diff --git a/install/static/sampledata/netgroup_show.json b/install/static/sampledata/netgroup_show.json
index 476550ce2..aa77e8885 100644
--- a/install/static/sampledata/netgroup_show.json
+++ b/install/static/sampledata/netgroup_show.json
@@ -9,13 +9,25 @@
"description": [
"live servers"
],
- "dn": "ipauniqueid=51451097-abef-11df-ad3a-525400674dcd,cn=ng,cn=alt,dc=ayoung,dc=boston,dc=devel,dc=redhat,dc=com",
+ "dn": "ipauniqueid=2e08b2c2-baac-11df-a0cf-525400674dcd,cn=ng,cn=alt,dc=ayoung,dc=boston,dc=devel,dc=redhat,dc=com",
+ "memberhost_host": [
+ "live3.pbs.org",
+ "live2.pbs.org",
+ "live1.pbs.org",
+ "www1.pbs.org",
+ "www2.pbs.org",
+ "www3.pbs.org"
+ ],
"memberhost_hostgroup": [
"host-live"
],
"memberuser_group": [
"muppets"
],
+ "memberuser_user": [
+ "kfrog",
+ "count123"
+ ],
"nisdomainname": [
"ayoung.boston.devel.redhat.com"
]
diff --git a/install/static/user.js b/install/static/user.js
index 190afca64..a0087e278 100644
--- a/install/static/user.js
+++ b/install/static/user.js
@@ -190,7 +190,7 @@ var userGroupMembershipForm = new AssociationForm("user","group","groupmembershi
/*Group Membership*/
var groupMembershipColumns = [
- {title:"Group", column:"memberof_group"},
+ {title:"group", column:"memberof_group"},
];
function populateUserEnrollments(userData){