diff options
author | Endi S. Dewata <edewata@redhat.com> | 2010-11-19 23:52:33 -0600 |
---|---|---|
committer | Adam Young <ayoung@redhat.com> | 2010-11-30 14:58:30 -0500 |
commit | c90bff232dcc9dbab2cd6d5a1bb482cb1c5f16f9 (patch) | |
tree | e270c50dbff183e94590bd20d0d8e42100abc390 /install/static/sudocmdgroup.js | |
parent | d644d17adf117321747db1e4e22a771fbea3b09e (diff) | |
download | freeipa-c90bff232dcc9dbab2cd6d5a1bb482cb1c5f16f9.tar.gz freeipa-c90bff232dcc9dbab2cd6d5a1bb482cb1c5f16f9.tar.xz freeipa-c90bff232dcc9dbab2cd6d5a1bb482cb1c5f16f9.zip |
Multicolumn association facet
The association facet has been modified to support multiple columns.
By default the facet will have one column which is the primary key of
the associated object (e.g. username of a group member), so the
existing code will work like before. Other fields (e.g. user's full
name) can be added by subclassing the ipa_association_facet class and
specifying the additional columns to display. These additional fields
will be retrieved using a batch operation.
Previously a single association facet instance will be used for all
associations in an entity. Now each association will have its own
association facet. This way each association facet can be customized
differently as needed. The <entity>-enroll URL parameter has been
removed because it's no longer needed.
The ipa_entity.create_association_facets() is provided to generate
the default association facets with one column for the primary key.
The column click handler has been moved out of ipa_column to provide
more flexibility for customization.
The get_action_panel() and get_client_area() have been modified to
search within the entity's container.
The group entity has been fully converted to use the new UI framework.
Association facets that have been modified to use multiple columns are:
- User Group's member_user
- HBAC Service Group's member_hbacsvc
- SUDO Command Group's member_sudocmd
- Service's managedby_host
New test data files have been added. Unit tests have been updated.
Diffstat (limited to 'install/static/sudocmdgroup.js')
-rwxr-xr-x | install/static/sudocmdgroup.js | 56 |
1 files changed, 40 insertions, 16 deletions
diff --git a/install/static/sudocmdgroup.js b/install/static/sudocmdgroup.js index 2e53ce791..c8b7edf8d 100755 --- a/install/static/sudocmdgroup.js +++ b/install/static/sudocmdgroup.js @@ -53,8 +53,10 @@ function ipa_sudocmdgroup() { }); that.add_facet(facet); - facet = ipa_sudocmdgroup_association_facet({ - 'name': 'associate' + facet = ipa_sudocmdgroup_member_sudocmd_facet({ + 'name': 'member_sudocmd', + 'label': 'Commands', + 'other_entity': 'sudocmd' }); that.add_facet(facet); @@ -76,10 +78,10 @@ function ipa_sudocmdgroup_add_dialog(spec) { that.init = function() { - this.superior_init(); + that.superior_init(); - this.add_field(ipa_text_widget({name:'cn', label:'Name', undo: false})); - this.add_field(ipa_text_widget({name:'description', label:'Description', undo: false})); + that.add_field(ipa_text_widget({name:'cn', label:'Name', undo: false})); + that.add_field(ipa_text_widget({name:'description', label:'Description', undo: false})); }; return that; @@ -91,10 +93,6 @@ function ipa_sudocmdgroup_search_facet(spec) { var that = ipa_search_facet(spec); - that.get_action_panel = function() { - return $('#sudorule .action-panel'); - }; - that.init = function() { that.create_column({name:'cn', label:'Group', primary_key: true}); @@ -164,10 +162,6 @@ function ipa_sudocmdgroup_details_facet(spec) { var that = ipa_details_facet(spec); - that.get_action_panel = function() { - return $('#sudorule .action-panel'); - }; - that.init = function() { var section = ipa_details_list_section({ @@ -185,14 +179,44 @@ function ipa_sudocmdgroup_details_facet(spec) { return that; } -function ipa_sudocmdgroup_association_facet(spec) { +function ipa_sudocmdgroup_member_sudocmd_facet(spec) { spec = spec || {}; var that = ipa_association_facet(spec); - that.get_action_panel = function() { - return $('#sudorule .action-panel'); + that.init = function() { + + var column = that.create_column({ + name: 'sudocmd', + label: 'Command', + primary_key: true + }); + + column.setup = function(container, record) { + container.empty(); + + var value = record[column.name]; + value = value ? value.toString() : ''; + + $('<a/>', { + 'href': '#'+value, + 'html': value, + 'click': function (value) { + return function() { + var state = IPA.tab_state(that.other_entity); + state[that.other_entity + '-facet'] = 'details'; + state[that.other_entity + '-pkey'] = value; + $.bbq.pushState(state); + return false; + } + }(value) + }).appendTo(container); + }; + + that.create_column({name: 'description', label: 'Description'}); + + that.association_facet_init(); }; return that; |