diff options
author | Petr Vobornik <pvoborni@redhat.com> | 2011-08-26 18:36:54 +0200 |
---|---|---|
committer | Endi S. Dewata <edewata@redhat.com> | 2011-08-29 15:21:15 +0000 |
commit | 508217ada7330de8be576e04289c379fac45b276 (patch) | |
tree | 2f8178d43f40a2ce18b960d518f41c05cb8e4fef /install/ui/sudo.js | |
parent | 64c100947bd596d30716a9345743ccf376dd2a2d (diff) | |
download | freeipa-508217ada7330de8be576e04289c379fac45b276.tar.gz freeipa-508217ada7330de8be576e04289c379fac45b276.tar.xz freeipa-508217ada7330de8be576e04289c379fac45b276.zip |
Modifying sudo options refreshes the whole page
https://fedorahosted.org/freeipa/ticket/1689
Currently adding or deleting sudo options will refresh the entire page. It's not a problem but the code could be optimized to refresh only the sudo options table
Diffstat (limited to 'install/ui/sudo.js')
-rw-r--r-- | install/ui/sudo.js | 41 |
1 files changed, 33 insertions, 8 deletions
diff --git a/install/ui/sudo.js b/install/ui/sudo.js index 8d33550c..1a6b03b1 100644 --- a/install/ui/sudo.js +++ b/install/ui/sudo.js @@ -574,12 +574,12 @@ IPA.sudo.options_section = function(spec) { options: { ipasudoopt: value }, - on_success: function() { - that.facet.refresh(); + on_success: function(data) { + that.load(data.result.result); dialog.close(); }, - on_error: function() { - that.facet.refresh(); + on_error: function(data) { + that.update(); dialog.close(); } }); @@ -618,12 +618,24 @@ IPA.sudo.options_section = function(spec) { dialog.execute = function() { var batch = IPA.batch_command({ - on_success: function() { - that.facet.refresh(); + on_success: function(data) { + //last successful result of batch results contains valid data + var result; + for(var i = data.result.results.length - 1; i > -1; i--) { + result = data.result.results[i].result; + if(result) break; + } + + if(result) { + that.load(result); + } else { + that.update(); + } + dialog.close(); }, - on_error: function() { - that.facet.refresh(); + on_error: function(data) { + that.update(); dialog.close(); } }); @@ -646,6 +658,19 @@ IPA.sudo.options_section = function(spec) { dialog.open(that.container); }; + that.update = function() { + var command = IPA.command({ + entity: that.facet.entity.name, + method: 'show', + args: that.facet.get_primary_key(true), + on_success: function(data) { + that.load(data.result.result); + } + }); + + command.execute(); + }; + /*initialization*/ setup_table(); |