summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEndi S. Dewata <edewata@redhat.com>2011-02-08 15:41:24 -0600
committerAdam Young <ayoung@redhat.com>2011-02-09 19:46:49 -0500
commit8d597dcbb03ca70a342f470e0229c9934f75cb16 (patch)
tree7311deb7976b677efba19d864e893d8406aebd0f
parent25abf07360ea6824f3584edd847e080e6fdca981 (diff)
downloadfreeipa-8d597dcbb03ca70a342f470e0229c9934f75cb16.tar.gz
freeipa-8d597dcbb03ca70a342f470e0229c9934f75cb16.tar.xz
freeipa-8d597dcbb03ca70a342f470e0229c9934f75cb16.zip
Moved add dialog into search facet.
Previously the add dialog is added into entity. The dialog is only used by the search facet, so it's now moved into the search facet.
-rw-r--r--install/ui/aci.js135
-rw-r--r--install/ui/details.js3
-rw-r--r--install/ui/entity.js23
-rw-r--r--install/ui/group.js59
-rw-r--r--install/ui/hbacrule.js12
-rw-r--r--install/ui/hbacsvc.js11
-rw-r--r--install/ui/hbacsvcgroup.js11
-rw-r--r--install/ui/host.js12
-rw-r--r--install/ui/hostgroup.js50
-rw-r--r--install/ui/netgroup.js51
-rw-r--r--install/ui/policy.js207
-rw-r--r--install/ui/search.js52
-rw-r--r--install/ui/service.js15
-rw-r--r--install/ui/sudocmd.js11
-rw-r--r--install/ui/sudocmdgroup.js13
-rw-r--r--install/ui/sudorule.js11
-rw-r--r--install/ui/user.js22
17 files changed, 354 insertions, 344 deletions
diff --git a/install/ui/aci.js b/install/ui/aci.js
index fbfb6ba3a..e515902c5 100644
--- a/install/ui/aci.js
+++ b/install/ui/aci.js
@@ -523,26 +523,26 @@ IPA.entity_factories.permission = function() {
return IPA.entity({
'name': 'permission'
- }).add_dialog(
- IPA.add_dialog({
- name: 'add',
- title: 'Add New Permission',
- width: '700px'
- }).
- field(IPA.text_widget({
- name: 'cn',
- undo: false
- })).
- field(IPA.rights_widget({name: 'permissions', label: 'Permissions', join: true, undo: false})).
- section(IPA.target_section({name: 'target', label: 'Target', undo: false}))).
- facet(IPA.search_facet().
- column({name:'cn'})).
- facet(IPA.permission_details_facet({ name: 'details' }).
- section(
- IPA.stanza({name:'identity', label:'Identity'}).
- input({name: 'cn', 'read_only': true})).
- section(IPA.rights_section()).
- section(IPA.target_section({name: 'target', label: 'Target'})));
+ }).
+ facet(
+ IPA.search_facet().
+ column({name:'cn'}).
+ dialog(
+ IPA.add_dialog({
+ name: 'add',
+ title: 'Add New Permission',
+ width: '700px'
+ }).
+ field(IPA.text_widget({name: 'cn', undo: false})).
+ field(IPA.rights_widget({name: 'permissions', label: 'Permissions', join: true, undo: false})).
+ section(IPA.target_section({name: 'target', label: 'Target', undo: false})))).
+ facet(
+ IPA.permission_details_facet({ name: 'details' }).
+ section(
+ IPA.stanza({name:'identity', label:'Identity'}).
+ input({name: 'cn', 'read_only': true})).
+ section(IPA.rights_section()).
+ section(IPA.target_section({name: 'target', label: 'Target'})));
};
@@ -554,19 +554,20 @@ IPA.entity_factories.privilege = function() {
facet(
IPA.search_facet().
column({name:'cn'}).
- column({name:'description'})).
+ column({name:'description'}).
+ dialog(
+ IPA.add_dialog({
+ name: 'add',
+ title: 'Add Privilege'
+ }).
+ field(IPA.text_widget({ name: 'cn', undo: false})).
+ field(IPA.text_widget({ name: 'description', undo: false})))).
facet(
IPA.details_facet({name:'details'}).
section(
IPA.stanza({name:'identity', label:'Privilege Settings'}).
input({name:'cn'}).
input({name: 'description'}))).
- add_dialog(
- IPA.add_dialog({
- name: 'add',
- title: 'Add Privilege'}).
- field(IPA.text_widget({ name: 'cn', undo: false})).
- field(IPA.text_widget({ name: 'description', undo: false}))).
association({
name: 'permission',
other_entity: 'privilege',
@@ -585,22 +586,23 @@ IPA.entity_factories.role = function() {
return IPA.entity({
'name': 'role'
}).
- facet(IPA.search_facet().
- column({name:'cn'}).
- column({name:'description'})).
+ facet(
+ IPA.search_facet().
+ column({name:'cn'}).
+ column({name:'description'}).
+ dialog(
+ IPA.add_dialog({
+ name: 'add',
+ title: 'Add Role'
+ }).
+ field(IPA.text_widget({ name: 'cn', undo: false})).
+ field(IPA.text_widget({ name: 'description', undo: false})))).
facet(
IPA.details_facet({name:'details'}).
section(
IPA.stanza({name:'identity', label:'Role Settings'}).
input({name:'cn'}).
input({name: 'description'}))).
- add_dialog(
- IPA.add_dialog({
- name: 'add',
- title: 'Add Role'
- }).
- field(IPA.text_widget({ name: 'cn', undo: false})).
- field(IPA.text_widget({ name: 'description', undo: false}))).
association({
name: 'privilege',
add_method: 'add_privilege',
@@ -614,8 +616,19 @@ IPA.entity_factories.selfservice = function() {
return IPA.entity({
'name': 'selfservice'
}).
- facet(IPA.search_facet().
- column({name:'aciname'})).
+ facet(
+ IPA.search_facet().
+ column({name:'aciname'}).
+ dialog(
+ IPA.add_dialog({
+ name: 'add',
+ title: 'Add Self Service Definition'
+ }).
+ field(IPA.text_widget({ name: 'aciname', undo: false})).
+ field(IPA.attributes_widget({
+ object_type:'user',
+ name:'attrs'
+ })))).
facet(
IPA.details_facet({'name':'details'}).
section(
@@ -624,26 +637,30 @@ IPA.entity_factories.selfservice = function() {
custom_input(IPA.attributes_widget({
object_type:'user',
name:'attrs'
- })))).
- add_dialog(
- IPA.add_dialog({
- name: 'add',
- title: 'Add Self Service Definition'
- }).
- field(IPA.text_widget({ name: 'aciname', undo: false})).
- field(IPA.attributes_widget({
- object_type:'user',
- name:'attrs'
- })));
+ }))));
};
IPA.entity_factories.delegation = function() {
var that = IPA.entity({
'name': 'delegation'
- }).facet(
- IPA.search_facet().
- column({name:'aciname'})).
+ }).
+ facet(
+ IPA.search_facet().
+ column({name:'aciname'}).
+ dialog(
+ IPA.add_dialog({
+ name: 'add',
+ title: 'Add Delegation',
+ width: '700px'
+ }).
+ field(IPA.text_widget({name: 'aciname', undo: false})).
+ field(IPA.entity_select_widget({name: 'group',
+ entity: 'group', undo: false})).
+ field(IPA.entity_select_widget({name: 'memberof', entity: 'group',
+ join: true, undo: false})).
+ field(IPA.attributes_widget({name: 'attrs', object_type: 'user',
+ join: true, undo: false})))).
facet(
IPA.details_facet().
section(
@@ -660,18 +677,6 @@ IPA.entity_factories.delegation = function() {
custom_input(
IPA.attributes_widget({
name:'attrs', object_type:'user', join: true})))).
- add_dialog(IPA.add_dialog({
- name: 'add',
- title: 'Add Delegation',
- width: '700px'
- }).
- field(IPA.text_widget({ name: 'aciname', undo: false})).
- field(IPA.entity_select_widget({name:'group',
- entity:'group', undo: false})).
- field(IPA.entity_select_widget({name:'memberof', entity:'group',
- join: true, undo: false})).
- field(IPA.attributes_widget({ name: 'attrs', object_type:'user',
- join: true, undo: false}))).
standard_associations();
return that;
diff --git a/install/ui/details.js b/install/ui/details.js
index 6445c5a87..b62f04941 100644
--- a/install/ui/details.js
+++ b/install/ui/details.js
@@ -330,6 +330,9 @@ IPA.details_facet = function(spec) {
};
that.init = function() {
+
+ that.facet_init();
+
for (var i=0; i<that.sections.length; i++) {
var section = that.sections[i];
section.init();
diff --git a/install/ui/entity.js b/install/ui/entity.js
index 4a8971d35..fdc45d827 100644
--- a/install/ui/entity.js
+++ b/install/ui/entity.js
@@ -40,17 +40,35 @@ IPA.facet = function (spec) {
that.setup = spec.setup || setup;
that.load = spec.load || load;
- that.__defineGetter__("entity_name", function(){
+ that.dialogs = [];
+ that.dialogs_by_name = {};
+
+ that.__defineGetter__('entity_name', function() {
return that._entity_name;
});
- that.__defineSetter__("entity_name", function(entity_name){
+ that.__defineSetter__('entity_name', function(entity_name) {
that._entity_name = entity_name;
});
that.create_action_panel = IPA.facet_create_action_panel;
+ that.get_dialog = function(name) {
+ return that.dialogs_by_name[name];
+ };
+
+ that.dialog = function(dialog) {
+ that.dialogs.push(dialog);
+ that.dialogs_by_name[dialog.name] = dialog;
+ return that;
+ };
+
function init() {
+ for (var i=0; i<that.dialogs.length; i++){
+ var dialog = that.dialogs[i];
+ dialog.entity_name = that._entity_name;
+ dialog.init();
+ }
}
function create(container) {
@@ -75,6 +93,7 @@ IPA.facet = function (spec) {
return $('.action-panel', that.container);
};
+ // methods that should be invoked by subclasses
that.facet_init = that.init;
that.facet_create = that.create;
that.facet_setup = that.setup;
diff --git a/install/ui/group.js b/install/ui/group.js
index 0188031f7..f7e7e51f8 100644
--- a/install/ui/group.js
+++ b/install/ui/group.js
@@ -29,21 +29,38 @@ IPA.entity_factories.group = function () {
return IPA.entity({
'name': 'group'
}).
- facet(IPA.search_facet().
- column({name:'cn'}).
- column({name:'gidnumber'}).
- column({name:'description'})).
facet(
- IPA.details_facet().section(
- IPA.stanza({label: 'Group Settings' }).
- input({name: 'cn' }).
- input({name: 'description'}).
- input({name: 'gidnumber' }))).
- facet( IPA.group_member_user_facet({
- 'name': 'member_user',
- 'label': 'Users',
- 'other_entity': 'user'
- })).
+ IPA.search_facet().
+ column({name: 'cn'}).
+ column({name: 'gidnumber'}).
+ column({name: 'description'}).
+ dialog(
+ IPA.add_dialog({
+ 'name': 'add',
+ 'title': 'Add New Group'
+ }).
+ field(IPA.text_widget({name: 'cn', undo: false})).
+ field(IPA.text_widget({name: 'description', undo: false})).
+ // TODO: Replace with i18n label
+ field(IPA.checkbox_widget({
+ name: 'posix',
+ label: 'Is this a POSIX group?',
+ undo: false,
+ checked: 'checked'})).
+ field(IPA.text_widget({name: 'gidnumber', undo: false})))).
+ facet(
+ IPA.details_facet().
+ section(
+ IPA.stanza({label: 'Group Settings' }).
+ input({name: 'cn' }).
+ input({name: 'description'}).
+ input({name: 'gidnumber' }))).
+ facet(
+ IPA.group_member_user_facet({
+ 'name': 'member_user',
+ 'label': 'Users',
+ 'other_entity': 'user'
+ })).
association({
name: 'netgroup',
associator: 'serial'
@@ -56,20 +73,6 @@ IPA.entity_factories.group = function () {
name: 'taskgroup',
associator: 'serial'
}).
- add_dialog(
- IPA.add_dialog({
- 'name': 'add',
- 'title': 'Add New Group'
- }).
- field(IPA.text_widget({name:'cn', undo: false})).
- field(IPA.text_widget({name:'description', undo: false})).
- // TODO: Replace with i18n label
- field(IPA.checkbox_widget({
- name:'posix',
- label:'Is this a POSIX group?',
- undo: false,
- checked:'checked'})).
- field(IPA.text_widget({name:'gidnumber', undo: false}))).
standard_associations();
};
diff --git a/install/ui/hbacrule.js b/install/ui/hbacrule.js
index 6859e6fdc..9525f2b79 100644
--- a/install/ui/hbacrule.js
+++ b/install/ui/hbacrule.js
@@ -30,17 +30,17 @@ IPA.entity_factories.hbacrule = function () {
that.init = function() {
+ var facet = IPA.hbacrule_search_facet({
+ 'name': 'search',
+ 'label': 'Search'
+ });
+
var dialog = IPA.hbacrule_add_dialog({
'name': 'add',
'title': 'Add New Rule'
});
- that.add_dialog(dialog);
+ facet.dialog(dialog);
-
- var facet = IPA.hbacrule_search_facet({
- 'name': 'search',
- 'label': 'Search'
- });
that.add_facet(facet);
facet = IPA.hbacrule_details_facet({
diff --git a/install/ui/hbacsvc.js b/install/ui/hbacsvc.js
index 1c2049675..23e9da788 100644
--- a/install/ui/hbacsvc.js
+++ b/install/ui/hbacsvc.js
@@ -30,16 +30,17 @@ IPA.entity_factories.hbacsvc = function () {
that.init = function() {
+ var facet = IPA.hbacsvc_search_facet({
+ 'name': 'search',
+ 'label': 'Search'
+ });
+
var dialog = IPA.hbacsvc_add_dialog({
'name': 'add',
'title': 'Add New HBAC Service'
});
- that.add_dialog(dialog);
+ facet.dialog(dialog);
- var facet = IPA.hbacsvc_search_facet({
- 'name': 'search',
- 'label': 'Search'
- });
that.add_facet(facet);
facet = IPA.hbacsvc_details_facet({
diff --git a/install/ui/hbacsvcgroup.js b/install/ui/hbacsvcgroup.js
index 28fd82c16..e0f476b99 100644
--- a/install/ui/hbacsvcgroup.js
+++ b/install/ui/hbacsvcgroup.js
@@ -36,16 +36,17 @@ IPA.entity_factories.hbacsvcgroup = function () {
'remove_method': 'remove_member'
});
+ var facet = IPA.hbacsvcgroup_search_facet({
+ 'name': 'search',
+ 'label': 'Search'
+ });
+
var dialog = IPA.hbacsvcgroup_add_dialog({
'name': 'add',
'title': 'Add New HBAC Service Group'
});
- that.add_dialog(dialog);
+ facet.dialog(dialog);
- var facet = IPA.hbacsvcgroup_search_facet({
- 'name': 'search',
- 'label': 'Search'
- });
that.add_facet(facet);
facet = IPA.hbacsvcgroup_details_facet({
diff --git a/install/ui/host.js b/install/ui/host.js
index f6af82cb1..86a5b820a 100644
--- a/install/ui/host.js
+++ b/install/ui/host.js
@@ -42,18 +42,18 @@ IPA.entity_factories.host = function () {
'associator': 'serial'
});
- var dialog = IPA.host_add_dialog({
- 'name': 'add',
- 'title': 'Add New Host'
- });
- that.add_dialog(dialog);
-
var facet = IPA.host_search_facet({
'name': 'search',
'label': 'Search'
});
that.add_facet(facet);
+ var dialog = IPA.host_add_dialog({
+ 'name': 'add',
+ 'title': 'Add New Host'
+ });
+ facet.dialog(dialog);
+
facet = IPA.host_details_facet({
'name': 'details'
});
diff --git a/install/ui/hostgroup.js b/install/ui/hostgroup.js
index b7d3e8d3c..9c66ff613 100644
--- a/install/ui/hostgroup.js
+++ b/install/ui/hostgroup.js
@@ -23,41 +23,41 @@
/* REQUIRES: ipa.js, details.js, search.js, add.js, entity.js */
-IPA.entity_factories.hostgroup = function() {
+IPA.entity_factories.hostgroup = function() {
+
var that = IPA.entity({
'name': 'hostgroup'
});
- that.init = function() {
- var search_facet = IPA.search_facet({
- name: 'search',
- label: 'Search',
- entity_name: that.name
- });
- search_facet.create_column({name:'cn'});
- search_facet.create_column({name:'description'});
- that.add_facet(search_facet);
- that.add_facet(function() {
- var that = IPA.details_facet({name:'details'});
- that.add_section(
- IPA.stanza({name:'identity', label:'Hostgroup Settings'}).
- input({name:'cn'}).
- input({name: 'description'}));
- return that;
- }());
+ that.init = function() {
+ that.facet(
+ IPA.search_facet({
+ name: 'search',
+ label: 'Search',
+ entity_name: that.name
+ }).
+ column({name:'cn'}).
+ column({name:'description'}).
+ dialog(
+ IPA.add_dialog({
+ name: 'add',
+ title: 'Add Hostgroup'
+ }).
+ field(IPA.text_widget({name: 'cn', undo: false})).
+ field(IPA.text_widget({name: 'description', undo: false}))));
- var dialog = IPA.add_dialog({
- name: 'add',
- title: 'Add Hostgroup'
- });
- that.add_dialog(dialog);
+ that.facet(
+ IPA.details_facet({name:'details'}).
+ section(
+ IPA.stanza({name:'identity', label:'Hostgroup Settings'}).
+ input({name:'cn'}).
+ input({name: 'description'})));
- dialog.add_field(IPA.text_widget({name: 'cn', undo: false}));
- dialog.add_field(IPA.text_widget({name: 'description', undo: false}));
that.create_association_facets();
that.entity_init();
};
+
return that;
};
diff --git a/install/ui/netgroup.js b/install/ui/netgroup.js
index 052008439..d7908ef32 100644
--- a/install/ui/netgroup.js
+++ b/install/ui/netgroup.js
@@ -23,42 +23,41 @@
/* REQUIRES: ipa.js, details.js, search.js, add.js, entity.js */
IPA.entity_factories.netgroup = function() {
+
var that = IPA.entity({
'name': 'netgroup'
});
- that.init = function() {
- var search_facet = IPA.search_facet({
- name: 'search',
- label: 'Search',
- entity_name: that.name
- });
- search_facet.create_column({name:'cn'});
- search_facet.create_column({name:'description'});
- that.add_facet(search_facet);
-
- that.add_facet(function() {
- var that = IPA.details_facet({name:'details'});
- that.add_section(
- IPA.stanza({name:'identity', label:'Netgroup Settings'}).
- input({name:'cn'}).
- input({name: 'description'}).
- input({name:'nisdomainname'}));
- return that;
- }());
+ that.init = function() {
- var dialog = IPA.add_dialog({
- name: 'add',
- title: 'Add Netgroup'
- });
- that.add_dialog(dialog);
+ that.facet(
+ IPA.search_facet({
+ name: 'search',
+ label: 'Search',
+ entity_name: that.name
+ }).
+ column({name:'cn'}).
+ column({name:'description'}).
+ dialog(
+ IPA.add_dialog({
+ name: 'add',
+ title: 'Add Netgroup'
+ }).
+ field(IPA.text_widget({ name: 'cn', undo: false})).
+ field(IPA.text_widget({ name: 'description', undo: false}))));
- dialog.add_field(IPA.text_widget({ name: 'cn', undo: false}));
- dialog.add_field(IPA.text_widget({ name: 'description', undo: false}));
+ that.facet(
+ IPA.details_facet({name: 'details'}).
+ section(
+ IPA.stanza({name: 'identity', label: 'Netgroup Settings'}).
+ input({name: 'cn'}).
+ input({name: 'description'}).
+ input({name: 'nisdomainname'})));
that.create_association_facets();
that.entity_init();
};
+
return that;
};
diff --git a/install/ui/policy.js b/install/ui/policy.js
index 7f078a728..7cafd1776 100644
--- a/install/ui/policy.js
+++ b/install/ui/policy.js
@@ -25,55 +25,52 @@
/* DNS */
IPA.entity_factories.dnszone = function() {
+
var that = IPA.entity({
name: 'dnszone'
});
that.init = function() {
- var search_facet = IPA.search_facet({
- name: 'search',
- label: 'Search',
- entity_name: that.name
- });
- search_facet.create_column({name:'idnsname'});
- that.add_facet(search_facet);
-
- that.add_facet(function() {
- var that = IPA.details_facet({name:'details'});
- that.add_section(
- IPA.stanza({name:'identity', label:'DNS Zone Settings'}).
- input({name:'idnsname'}).
- input({name:'idnszoneactive'}).
- input({name:'idnssoamname'}).
- input({name:'idnssoarname'}).
- input({name:'idnssoaserial'}).
- input({name:'idnssoarefresh'}).
- input({name:'idnssoaretry'}).
- input({name:'idnssoaexpire'}).
- input({name:'idnssoaminimum'}).
- input({name:'dnsttl'}).
- input({name:'dnsclass'}).
- input({name:'idnsallowdynupdate'}).
- input({name:'idnsupdatepolicy'}));
-
- return that;
- }());
-
- that.add_facet( IPA.records_facet({
- 'name': 'records',
- 'label': IPA.metadata.dnsrecord.label
- }));
-
- var dialog = IPA.add_dialog({
- name: 'add',
- title: 'Add DNS Zone'
- });
- that.add_dialog(dialog);
-
- dialog.add_field(IPA.text_widget({ name: 'idnsname', undo: false}));
- dialog.add_field(IPA.text_widget({ name: 'idnssoamname', undo: false}));
- dialog.add_field(IPA.text_widget({ name: 'idnssoarname', undo: false}));
+ that.facet(
+ IPA.search_facet({
+ name: 'search',
+ label: 'Search',
+ entity_name: that.name
+ }).
+ column({name:'idnsname'}).
+ dialog(
+ IPA.add_dialog({
+ name: 'add',
+ title: 'Add DNS Zone'
+ }).
+ field(IPA.text_widget({ name: 'idnsname', undo: false})).
+ field(IPA.text_widget({ name: 'idnssoamname', undo: false})).
+ field(IPA.text_widget({ name: 'idnssoarname', undo: false}))));
+
+ that.facet(
+ IPA.details_facet({name:'details'}).
+ section(
+ IPA.stanza({name:'identity', label:'DNS Zone Settings'}).
+ input({name:'idnsname'}).
+ input({name:'idnszoneactive'}).
+ input({name:'idnssoamname'}).
+ input({name:'idnssoarname'}).
+ input({name:'idnssoaserial'}).
+ input({name:'idnssoarefresh'}).
+ input({name:'idnssoaretry'}).
+ input({name:'idnssoaexpire'}).
+ input({name:'idnssoaminimum'}).
+ input({name:'dnsttl'}).
+ input({name:'dnsclass'}).
+ input({name:'idnsallowdynupdate'}).
+ input({name:'idnsupdatepolicy'})));
+
+ that.facet(
+ IPA.records_facet({
+ 'name': 'records',
+ 'label': IPA.metadata.dnsrecord.label
+ }));
that.create_association_facets();
that.entity_init();
@@ -496,42 +493,38 @@ IPA.records_facet = function (spec){
/**Automount*/
-IPA.entity_factories.automountlocation = function (){
+IPA.entity_factories.automountlocation = function() {
+
var that = IPA.entity({
name: 'automountlocation'
});
-
- var search_facet = IPA.search_facet({
- name: 'search',
- label: 'Search',
- entity_name: that.name
- });
that.init = function() {
- search_facet.create_column({name:'cn'});
- that.add_facet(search_facet);
-
-
- that.add_facet(function() {
- var that = IPA.details_facet({name:'details'});
- that.add_section(
- IPA.stanza({name:'identity', label:'Automount Location Settings'}).
- input({name:'cn'}));
- return that;
- }());
- var dialog = IPA.add_dialog({
- name: 'add',
- title: 'Add Automount Location'
- });
- that.add_dialog(dialog);
-
- dialog.add_field(IPA.text_widget({ name: 'cn', undo: false}));
+ that.facet(
+ IPA.search_facet({
+ name: 'search',
+ label: 'Search',
+ entity_name: that.name
+ }).
+ column({name:'cn'}).
+ dialog(
+ IPA.add_dialog({
+ name: 'add',
+ title: 'Add Automount Location'
+ }).
+ field(IPA.text_widget({ name: 'cn', undo: false}))));
+
+ that.facet(
+ IPA.details_facet({name:'details'}).
+ section(
+ IPA.stanza({name:'identity', label:'Automount Location Settings'}).
+ input({name:'cn'})));
that.create_association_facets();
that.entity_init();
-
};
+
return that;
};
@@ -540,47 +533,43 @@ IPA.entity_factories.automountlocation = function (){
IPA.entity_factories.pwpolicy = function() {
+
var that = IPA.entity({
name: 'pwpolicy'
});
-
- var search_facet = IPA.search_facet({
- name: 'search',
- label: 'Search',
- entity_name: that.name
- });
that.init = function() {
- search_facet.create_column({name:'cn'});
- that.add_facet(search_facet);
-
-
- that.add_facet(function() {
- var that = IPA.details_facet({name:'details'});
- that.add_section(
-
- IPA.stanza({name:'identity', label:'Password Policy'}).
- input({name:'krbmaxpwdlife'}).
- input({name:'krbminpwdlife'}).
- input({name:'krbpwdhistorylength'}).
- input({name:'krbpwdmindiffchars'}).
- input({name:'krbpwdminlength'}));
- return that;
- }());
-
- var dialog = IPA.add_dialog({
- name: 'add',
- title: 'Add Password Policy',
- entity_name:'pwpolicy'
- });
- that.add_dialog(dialog);
- dialog.add_field(IPA.text_widget({ name: 'cn', undo: false}));
+ that.facet(
+ IPA.search_facet({
+ name: 'search',
+ label: 'Search',
+ entity_name: that.name
+ }).
+ column({name:'cn'}).
+ dialog(
+ IPA.add_dialog({
+ name: 'add',
+ title: 'Add Password Policy',
+ entity_name:'pwpolicy'
+ }).
+ field(IPA.text_widget({name: 'cn', undo: false}))));
+
+ that.facet(
+ IPA.details_facet({name:'details'}).
+ section(
+ IPA.stanza({name:'identity', label:'Password Policy'}).
+ input({name:'krbmaxpwdlife'}).
+ input({name:'krbminpwdlife'}).
+ input({name:'krbpwdhistorylength'}).
+ input({name:'krbpwdmindiffchars'}).
+ input({name:'krbpwdminlength'})));
that.create_association_facets();
that.entity_init();
};
+
return that;
};
@@ -591,18 +580,20 @@ IPA.entity_factories.pwpolicy = function() {
Does not have search
*/
IPA.entity_factories.krbtpolicy = function() {
+
var that = IPA.entity({
name: 'krbtpolicy'
});
- var details = IPA.details_facet({
- 'name': 'details'
- });
- details.add_section(
- IPA.stanza({name:'identity', label:'Kerberos ticket policy'}).
- //input({name:'uid',label:' '}).
- input({name:'krbmaxrenewableage'}).
- input({name:'krbmaxticketlife'}));
- that.add_facet(details);
+ that.facet(
+ IPA.details_facet({
+ name: 'details'
+ }).
+ section(
+ IPA.stanza({name: 'identity', label: 'Kerberos ticket policy'}).
+ //input({name: 'uid',label:' '}).
+ input({name: 'krbmaxrenewableage'}).
+ input({name: 'krbmaxticketlife'})));
+
return that;
};
diff --git a/install/ui/search.js b/install/ui/search.js
index d675e0d3a..9130613f6 100644
--- a/install/ui/search.js
+++ b/install/ui/search.js
@@ -24,7 +24,7 @@
/* REQUIRES: ipa.js */
-IPA.search_widget = function (spec) {
+IPA.search_widget = function (spec) {
spec = spec || {};
@@ -92,7 +92,7 @@ IPA.search_widget = function (spec) {
that.find_button = IPA.button({
'label': IPA.messages.button.find,
'icon': 'ui-icon-search',
- 'click': function() { that.find(that.container); }
+ 'click': function() { that.find(); }
});
button.replaceWith(that.find_button);
@@ -113,7 +113,7 @@ IPA.search_widget = function (spec) {
that.add_button = IPA.action_button({
'label': IPA.messages.button.add,
'icon': 'ui-icon-plus',
- 'click': function() { that.add(that.container); }
+ 'click': function() { that.add(); }
});
button.replaceWith(that.add_button);
@@ -121,18 +121,16 @@ IPA.search_widget = function (spec) {
this.filter.val(filter);
};
- that.find = function(container) {
+ that.find = function() {
var filter = this.filter.val();
var state = {};
state[that.entity_name + '-filter'] = filter;
$.bbq.pushState(state);
};
- that.add = function(container) {
+ that.add = function() {
- var entity = IPA.get_entity(that.entity_name);
-
- var dialog = entity.get_dialog('add');
+ var dialog = that.facet.get_dialog('add');
dialog.open(that.container);
return false;
@@ -264,31 +262,25 @@ IPA.search_widget = function (spec) {
return that;
};
-IPA.search_facet = function (spec) {
+IPA.search_facet = function(spec) {
spec = spec || {};
spec.name = spec.name || 'search';
spec.label = spec.label || IPA.messages.facets.search;
-
spec.display_class = 'search-facet';
var that = IPA.facet(spec);
- that.init = spec.init || init;
- that.create = spec.create || create;
- that.setup = spec.setup || setup;
- that.refresh = spec.refresh || refresh;
-
that.columns = [];
that.columns_by_name = {};
- that.__defineGetter__("entity_name", function(){
+ that.__defineGetter__('entity_name', function() {
return that._entity_name;
});
- that.__defineSetter__("entity_name", function(entity_name){
+ that.__defineSetter__('entity_name', function(entity_name) {
that._entity_name = entity_name;
for (var i=0; i<that.columns.length; i++) {
@@ -344,7 +336,7 @@ IPA.search_facet = function (spec) {
};
};
- function init() {
+ that.init = function() {
that.facet_init();
@@ -369,42 +361,34 @@ IPA.search_facet = function (spec) {
}
that.table.init();
- }
+ };
that.is_dirty = function() {
var filter = $.bbq.getState(that.entity_name + '-filter', true) || '';
return filter != that.filter;
};
- function create(container) {
+ that.create = function(container) {
container.attr('title', that.entity_name);
var span = $('<span/>', { 'name': 'search' }).appendTo(container);
that.table.create(span);
+ };
- }
-
- function setup(container) {
+ that.setup = function(container) {
that.facet_setup(container);
var span = $('span[name=search]', that.container);
that.table.setup(span);
- }
+ };
- function refresh() {
+ that.refresh = function() {
that.filter = $.bbq.getState(that.entity_name + '-filter', true) || '';
that.table.refresh();
- }
-
- if (spec.columns) {
- for (var i=0; i<spec.columns.length; i++) {
- var column = spec.columns[i];
- column.facet = that;
- that.add_column(column);
- }
- }
+ };
+ // methods that should be invoked by subclasses
that.search_facet_init = that.init;
that.search_facet_create = that.create;
that.search_facet_setup = that.setup;
diff --git a/install/ui/service.js b/install/ui/service.js
index 360386a13..409aa5dfa 100644
--- a/install/ui/service.js
+++ b/install/ui/service.js
@@ -33,13 +33,14 @@ IPA.entity_factories.service = function () {
'add_method': 'add_host',
'remove_method': 'remove_host'
}).
- dialog(
- IPA.service_add_dialog({
- 'name': 'add',
- 'title': 'Add New Service'
- })).
- facet( IPA.search_facet().
- column({name:'krbprincipalname'})).
+ facet(
+ IPA.search_facet().
+ column({name: 'krbprincipalname'}).
+ dialog(
+ IPA.service_add_dialog({
+ 'name': 'add',
+ 'title': 'Add New Service'
+ }))).
facet( IPA.service_details_facet()).
facet( IPA.service_managedby_host_facet({
'name': 'managedby_host',
diff --git a/install/ui/sudocmd.js b/install/ui/sudocmd.js
index c254452ff..88147b786 100644
--- a/install/ui/sudocmd.js
+++ b/install/ui/sudocmd.js
@@ -30,16 +30,17 @@ IPA.entity_factories.sudocmd = function () {
that.init = function() {
+ var facet = IPA.sudocmd_search_facet({
+ 'name': 'search',
+ 'label': 'Search'
+ });
+
var dialog = IPA.sudocmd_add_dialog({
'name': 'add',
'title': 'Add New SUDO Command'
});
- that.add_dialog(dialog);
+ facet.dialog(dialog);
- var facet = IPA.sudocmd_search_facet({
- 'name': 'search',
- 'label': 'Search'
- });
that.add_facet(facet);
facet = IPA.sudocmd_details_facet({
diff --git a/install/ui/sudocmdgroup.js b/install/ui/sudocmdgroup.js
index 1ffbc0966..8e45341f3 100644
--- a/install/ui/sudocmdgroup.js
+++ b/install/ui/sudocmdgroup.js
@@ -36,16 +36,17 @@ IPA.entity_factories.sudocmdgroup = function () {
'remove_method': 'remove_member'
});
- var dialog = IPA.sudocmdgroup_add_dialog({
- 'name': 'add',
- 'title': 'Add New SUDO Command Group'
- });
- that.add_dialog(dialog);
-
var facet = IPA.sudocmdgroup_search_facet({
'name': 'search',
'label': 'Search'
});
+
+ var dialog = IPA.sudocmdgroup_add_dialog({
+ 'name': 'add',
+ 'title': 'Add New SUDO Command Group'
+ });
+ facet.dialog(dialog);
+
that.add_facet(facet);
facet = IPA.sudocmdgroup_details_facet({
diff --git a/install/ui/sudorule.js b/install/ui/sudorule.js
index bab457e88..5f062e731 100644
--- a/install/ui/sudorule.js
+++ b/install/ui/sudorule.js
@@ -30,16 +30,17 @@ IPA.entity_factories.sudorule = function () {
that.init = function() {
+ var facet = IPA.sudorule_search_facet({
+ 'name': 'search',
+ 'label': 'Search'
+ });
+
var dialog = IPA.sudorule_add_dialog({
'name': 'add',
'title': 'Add New Rule'
});
- that.add_dialog(dialog);
+ facet.dialog(dialog);
- var facet = IPA.sudorule_search_facet({
- 'name': 'search',
- 'label': 'Search'
- });
that.add_facet(facet);
facet = IPA.sudorule_details_facet({
diff --git a/install/ui/user.js b/install/ui/user.js
index c30836c59..f60a511c6 100644
--- a/install/ui/user.js
+++ b/install/ui/user.js
@@ -23,7 +23,7 @@
/* REQUIRES: ipa.js, details.js, search.js, add.js, entity.js */
-IPA.entity_factories.user = function (){
+IPA.entity_factories.user = function() {
return IPA.entity({
name: 'user'
@@ -43,7 +43,15 @@ IPA.entity_factories.user = function (){
column({name:'uidnumber'}).
column({name:'mail'}).
column({name:'telephonenumber'}).
- column({name:'title'})).
+ column({name:'title'}).
+ dialog(
+ IPA.add_dialog({
+ 'name': 'add',
+ 'title': 'Add User'
+ }).
+ field(IPA.text_widget({ name: 'uid', undo: false })).
+ field(IPA.text_widget({ name: 'givenname', undo: false })).
+ field(IPA.text_widget({ name: 'sn', undo: false })))).
facet(IPA.details_facet().
section(
IPA.stanza({name: 'identity', label: IPA.messages.details.identity}).
@@ -82,15 +90,7 @@ IPA.entity_factories.user = function (){
section(
IPA.stanza({name: 'misc', label: IPA.messages.details.misc}).
input({name:'carlicense'}))).
- standard_associations().
- add_dialog(
- IPA.add_dialog({
- 'name': 'add',
- 'title': 'Add User'
- }).
- field(IPA.text_widget({ name: 'uid', undo: false })).
- field(IPA.text_widget({ name: 'givenname', undo: false })).
- field(IPA.text_widget({ name: 'sn', undo: false })));
+ standard_associations();
};
/* ATTRIBUTE CALLBACKS */