diff options
Diffstat (limited to 'install/ui/hbactest.js')
-rw-r--r-- | install/ui/hbactest.js | 97 |
1 files changed, 86 insertions, 11 deletions
diff --git a/install/ui/hbactest.js b/install/ui/hbactest.js index b5bf3de2..715c0449 100644 --- a/install/ui/hbactest.js +++ b/install/ui/hbactest.js @@ -204,22 +204,31 @@ IPA.hbac.test_facet = function(spec) { style: 'float: right' }).appendTo(container); - that.back_button = IPA.button({ - name: 'back', - label: 'Back', - click: function() { - if (!that.back_button.hasClass('action-button-disabled')) { - that.back(); + var facet_group = that.entity.get_facet_group('default'); + var index = facet_group.get_facet_index(that.name); + + if (index > 0) { + that.back_button = IPA.button({ + name: 'back', + label: 'Back', + icon: 'ui-icon ui-icon-triangle-1-w', + click: function() { + if (!that.back_button.hasClass('action-button-disabled')) { + that.back(); + } + return false; } - return false; - } - }).appendTo(buttons); + }).appendTo(buttons); + + buttons.append(' '); + } that.next_button = IPA.button({ name: 'next', label: 'Next', + icon: 'ui-icon ui-icon-triangle-1-e', click: function() { - if (!that.add_button.hasClass('action-button-disabled')) { + if (!that.next_button.hasClass('action-button-disabled')) { that.next(); } return false; @@ -227,6 +236,30 @@ IPA.hbac.test_facet = function(spec) { }).appendTo(buttons); }; + that.back = function() { + var facet_group = that.entity.get_facet_group('default'); + var index = facet_group.get_facet_index(that.name); + if (index <= 0) return; + + var facet = facet_group.get_facet_by_index(index - 1); + + var state = {}; + state[that.entity.name+'-facet'] = facet.name; + IPA.nav.push_state(state); + }; + + that.next = function() { + var facet_group = that.entity.get_facet_group('default'); + var index = facet_group.get_facet_index(that.name); + if (index >= facet_group.get_facet_count() - 1) return; + + var facet = facet_group.get_facet_by_index(index + 1); + + var state = {}; + state[that.entity.name+'-facet'] = facet.name; + IPA.nav.push_state(state); + }; + that.get_pkeys = function(data) { var result = data.result.result; var pkey_name = that.managed_entity.metadata.primary_key; @@ -261,7 +294,7 @@ IPA.hbac.test_facet = function(spec) { command.on_success = function(data, text_status, xhr) { if (that.filter) that.filter.focus(); - that.load(data); // table_facet.load() + that.load(data); }; command.on_error = function(xhr, text_status, error_thrown) { @@ -271,6 +304,10 @@ IPA.hbac.test_facet = function(spec) { command.execute(); }; + that.reset = function() { + that.table.set_values([]); + }; + that.save = function(record) { if (that.selected_values && that.selected_values.length) { record[that.name] = that.selected_values[0]; @@ -336,6 +373,11 @@ IPA.hbac.test_rules_facet = function(spec) { that.create_buttons(container); }; + that.reset = function() { + that.table.set_values([]); + if (that.enabled) that.enabled.attr('checked', false); + if (that.disabled) that.enabled.attr('checked', false); + }; that.save = function(record) { if (that.selected_values && that.selected_values.length) { @@ -409,6 +451,7 @@ IPA.hbac.test_run_facet = function(spec) { that.back_button = IPA.button({ name: 'back', label: 'Back', + icon: 'ui-icon ui-icon-triangle-1-w', click: function() { if (!that.back_button.hasClass('action-button-disabled')) { that.back(); @@ -417,6 +460,8 @@ IPA.hbac.test_run_facet = function(spec) { } }).appendTo(buttons); + buttons.append(' '); + that.new_test_button = IPA.button({ name: 'new_test', label: 'New Test', @@ -429,6 +474,36 @@ IPA.hbac.test_run_facet = function(spec) { }).appendTo(buttons); }; + that.new_test = function() { + var facet = that.entity.get_facet('user'); + facet.reset(); + + facet = that.entity.get_facet('targethost'); + facet.reset(); + + facet = that.entity.get_facet('service'); + facet.reset(); + + facet = that.entity.get_facet('sourcehost'); + facet.reset(); + + facet = that.entity.get_facet('rules'); + facet.reset(); + + facet = that.entity.get_facet('run'); + facet.reset(); + + var state = {}; + state[that.entity.name+'-facet'] = 'user'; + IPA.nav.push_state(state); + }; + + that.reset = function() { + that.test_result.text(''); + that.table.empty(); + that.table.set_values([]); + }; + that.refresh = function() { }; |