diff options
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 2e53ce79..c8b7edf8 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; |