diff options
author | Adam Young <ayoung@redhat.com> | 2011-01-19 21:10:18 -0500 |
---|---|---|
committer | Adam Young <ayoung@redhat.com> | 2011-01-27 16:46:44 -0500 |
commit | f904df0f0dfd4734f978cdc3ddf5badabc067ed6 (patch) | |
tree | a9da10718ae2982b0f8721cdf7df4bad05532f93 /install/ui/group.js | |
parent | 442d6ad30ce1156914e6245aa7502499e50ec0da (diff) | |
download | freeipa-f904df0f0dfd4734f978cdc3ddf5badabc067ed6.tar.gz freeipa-f904df0f0dfd4734f978cdc3ddf5badabc067ed6.tar.xz freeipa-f904df0f0dfd4734f978cdc3ddf5badabc067ed6.zip |
declarative defintions
Delay the creation of entities until after ipa init is called
made the user and group entity definitions declarative
removed unused facet from groups
adjusted unit tests
made review changes:
factories are now in an associative array
entity init called right after factory
init dialogs in entity init
fixed type on search
Diffstat (limited to 'install/ui/group.js')
-rw-r--r-- | install/ui/group.js | 153 |
1 files changed, 43 insertions, 110 deletions
diff --git a/install/ui/group.js b/install/ui/group.js index 13017ac5a..0188031f7 100644 --- a/install/ui/group.js +++ b/install/ui/group.js @@ -2,6 +2,8 @@ /* Authors: * Pavel Zuna <pzuna@redhat.com> + * Endi Dewata <edewata@redhat.com> + * Adam Young <ayoung@redhat.com> * * Copyright (C) 2010 Red Hat * see file 'COPYING' for use and warranty information @@ -22,123 +24,53 @@ /* REQUIRES: ipa.js, details.js, search.js, add.js, entity.js */ -IPA.group = function () { +IPA.entity_factories.group = function () { - var that = IPA.entity({ + return IPA.entity({ 'name': 'group' - }); - - that.init = function() { - - that.create_association({ + }). + 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' + })). + association({ name: 'netgroup', associator: 'serial' - }); - - that.create_association({ + }). + association({ name: 'rolegroup', associator: 'serial' - }); - - that.create_association({ + }). + association({ name: 'taskgroup', associator: 'serial' - }); - - var dialog = IPA.group_add_dialog({ - 'name': 'add', - 'title': 'Add New Group' - }); - that.add_dialog(dialog); - dialog.init(); - - var facet = IPA.group_search_facet({ - 'name': 'search', - 'label': 'Search' - }); - that.add_facet(facet); - - facet = IPA.group_details_facet({ - 'name': 'details' - }); - that.add_facet(facet); - - that.create_association_facets(); - - that.entity_init(); - }; - - return that; -}; - - -IPA.add_entity(IPA.group()); - - -IPA.group_add_dialog = function (spec) { - - spec = spec || {}; - - var that = IPA.add_dialog(spec); - - that.init = function() { - - that.add_field(IPA.text_widget({name:'cn', undo: false})); - that.add_field(IPA.text_widget({name:'description', undo: false})); - // TODO: Replace with i18n label - that.add_field(IPA.checkbox_widget({ - name:'posix', - label:'Is this a POSIX group?', - undo: false, - checked:'checked'})); - that.add_field(IPA.text_widget({name:'gidnumber', undo: false})); - - that.add_dialog_init(); - }; - - return that; -}; - - -IPA.group_search_facet = function (spec) { - - spec = spec || {}; - - var that = IPA.search_facet(spec); - - that.init = function() { - that.create_column({name:'cn'}); - that.create_column({name:'gidnumber'}); - that.create_column({name:'description'}); - that.search_facet_init(); - }; - - return that; -}; - - -IPA.group_details_facet = function (spec) { - - spec = spec || {}; - - var that = IPA.details_facet(spec); - - that.init = function() { - - var section = IPA.details_list_section({ - name: 'details', - label: 'Group Settings' - }); - that.add_section(section); - - section.create_field({name: 'cn' }); - section.create_field({name: 'description'}); - section.create_field({name: 'gidnumber' }); - - that.details_facet_init(); - }; - - return that; + }). + 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(); }; @@ -198,4 +130,5 @@ IPA.group_member_user_facet = function (spec) { }; return that; -}; + +};
\ No newline at end of file |