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.
-- Endi S. Dewata
From b05f930e7538c69658b9cb3711584ef745dd3548 Mon Sep 17 00:00:00 2001 From: Endi S. Dewata <edew...@redhat.com> Date: Tue, 8 Feb 2011 15:41:24 -0600 Subject: [PATCH] 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. --- install/ui/aci.js | 135 +++++++++++++++-------------- install/ui/details.js | 3 + install/ui/entity.js | 23 +++++- install/ui/group.js | 59 +++++++------ install/ui/hbacrule.js | 14 ++-- install/ui/hbacsvc.js | 13 ++-- install/ui/hbacsvcgroup.js | 13 ++-- install/ui/host.js | 12 ++-- install/ui/hostgroup.js | 50 ++++++------ install/ui/netgroup.js | 51 ++++++------ install/ui/policy.js | 199 +++++++++++++++++++++----------------------- install/ui/search.js | 52 ++++-------- install/ui/service.js | 15 ++-- install/ui/sudocmd.js | 13 ++-- install/ui/sudocmdgroup.js | 13 ++-- install/ui/sudorule.js | 13 ++-- install/ui/user.js | 22 +++--- 17 files changed, 355 insertions(+), 345 deletions(-) diff --git a/install/ui/aci.js b/install/ui/aci.js index fbfb6ba3aebaa12a76156c9140573f4d1a6e2db6..e515902c5c83451389b5c9dde8115e087f9686f3 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 6445c5a8700551a1b6d9675e10bb808a5f3ddeea..b62f049419b819def729bc75d89b1d9a6aa999e1 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 4a8971d351ef0649be6d495328617116ec383d3c..fdc45d8272fdbf1a0f60d33832ff2cfccbd5a1be 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 0188031f7334e10226bed8a5ae8d4fefc0706670..f7e7e51f888e68349f7ca0332d8b1d927720cfb0 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 6859e6fdc5ffea7cbcfe06fc63098cb92d8a81e8..9525f2b79d58ee4cb179e7990ae600ea90639ef1 100644 --- a/install/ui/hbacrule.js +++ b/install/ui/hbacrule.js @@ -30,17 +30,17 @@ IPA.entity_factories.hbacrule = function () { that.init = function() { - var dialog = IPA.hbacrule_add_dialog({ - 'name': 'add', - 'title': 'Add New Rule' - }); - that.add_dialog(dialog); - - var facet = IPA.hbacrule_search_facet({ 'name': 'search', 'label': 'Search' }); + + var dialog = IPA.hbacrule_add_dialog({ + 'name': 'add', + 'title': 'Add New Rule' + }); + facet.dialog(dialog); + that.add_facet(facet); facet = IPA.hbacrule_details_facet({ diff --git a/install/ui/hbacsvc.js b/install/ui/hbacsvc.js index 1c204967513d42b5f4edd6e5651c3c7e641badcc..23e9da7887eb5b20661565f58c951e21d13a0a97 100644 --- a/install/ui/hbacsvc.js +++ b/install/ui/hbacsvc.js @@ -30,16 +30,17 @@ IPA.entity_factories.hbacsvc = function () { that.init = function() { - var dialog = IPA.hbacsvc_add_dialog({ - 'name': 'add', - 'title': 'Add New HBAC Service' - }); - that.add_dialog(dialog); - var facet = IPA.hbacsvc_search_facet({ 'name': 'search', 'label': 'Search' }); + + var dialog = IPA.hbacsvc_add_dialog({ + 'name': 'add', + 'title': 'Add New HBAC Service' + }); + facet.dialog(dialog); + that.add_facet(facet); facet = IPA.hbacsvc_details_facet({ diff --git a/install/ui/hbacsvcgroup.js b/install/ui/hbacsvcgroup.js index 28fd82c163e73712e3c7bfa942b5797630f018e9..e0f476b99262409848665789f22f7def8dd46379 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 dialog = IPA.hbacsvcgroup_add_dialog({ - 'name': 'add', - 'title': 'Add New HBAC Service Group' - }); - that.add_dialog(dialog); - var facet = IPA.hbacsvcgroup_search_facet({ 'name': 'search', 'label': 'Search' }); + + var dialog = IPA.hbacsvcgroup_add_dialog({ + 'name': 'add', + 'title': 'Add New HBAC Service Group' + }); + facet.dialog(dialog); + that.add_facet(facet); facet = IPA.hbacsvcgroup_details_facet({ diff --git a/install/ui/host.js b/install/ui/host.js index f6af82cb15397cb2b19c69a56f0d9617c07ef3a0..86a5b820aeaaea9e6819444d27dc1d8142e4a097 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 b7d3e8d3cd16204688f21cffd0c03bbe0cd907ff..9c66ff6139d62812af87216ebb08ba8b372819df 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.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})))); + that.facet( + IPA.details_facet({name:'details'}). + section( + IPA.stanza({name:'identity', label:'Hostgroup Settings'}). + input({name:'cn'}). + input({name: 'description'}))); - var dialog = IPA.add_dialog({ - name: 'add', - title: 'Add Hostgroup' - }); - that.add_dialog(dialog); - - 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 0520084395846df3f1e995937a4bd991ffb5c0ba..d7908ef3279aca961984d21e8fde026c434e4590 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.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})))); - - var dialog = IPA.add_dialog({ - name: 'add', - title: 'Add Netgroup' - }); - that.add_dialog(dialog); - - 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 7f078a728301e36513ded7b3514e2d98fd76cdbb..7cafd1776bde531826d5fecdee408283f64fc22e 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'})); + 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})))); - 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.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.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.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.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.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.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.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 d675e0d3a6e39d4b783c781aeda54ac82e887882..9130613f660eb4042c8ace488a5e27418e8fe360 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 360386a1380ab6383e82942b746ceefa4d1e14da..409aa5dfaede03ef85b9c6cec57fd258967cec01 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 c254452ffd82e36987a8d7cbad0861b243bfa065..88147b7860a2d8ef05fb550bfea93da46295f511 100644 --- a/install/ui/sudocmd.js +++ b/install/ui/sudocmd.js @@ -30,16 +30,17 @@ IPA.entity_factories.sudocmd = function () { that.init = function() { - var dialog = IPA.sudocmd_add_dialog({ - 'name': 'add', - 'title': 'Add New SUDO Command' - }); - that.add_dialog(dialog); - var facet = IPA.sudocmd_search_facet({ 'name': 'search', 'label': 'Search' }); + + var dialog = IPA.sudocmd_add_dialog({ + 'name': 'add', + 'title': 'Add New SUDO Command' + }); + facet.dialog(dialog); + that.add_facet(facet); facet = IPA.sudocmd_details_facet({ diff --git a/install/ui/sudocmdgroup.js b/install/ui/sudocmdgroup.js index 1ffbc0966fd470e189c5be5e0722983b9f1f85df..8e45341f374168e0cdf5c1ed72fa1298fa5695d8 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 bab457e8881bef43949b85c3ee1e3b20721478ce..5f062e731528caf4c35fac084dd5c8d037175e9c 100644 --- a/install/ui/sudorule.js +++ b/install/ui/sudorule.js @@ -30,16 +30,17 @@ IPA.entity_factories.sudorule = function () { that.init = function() { - var dialog = IPA.sudorule_add_dialog({ - 'name': 'add', - 'title': 'Add New Rule' - }); - that.add_dialog(dialog); - var facet = IPA.sudorule_search_facet({ 'name': 'search', 'label': 'Search' }); + + var dialog = IPA.sudorule_add_dialog({ + 'name': 'add', + 'title': 'Add New Rule' + }); + facet.dialog(dialog); + that.add_facet(facet); facet = IPA.sudorule_details_facet({ diff --git a/install/ui/user.js b/install/ui/user.js index c30836c59d48a5347b35d6d97edd3389e7b25494..f60a511c6f5e52a6cef4236982ebee45038d793f 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 */ -- 1.6.6.1
_______________________________________________ Freeipa-devel mailing list Freeipa-devel@redhat.com https://www.redhat.com/mailman/listinfo/freeipa-devel