From 835c7859c5c31807b9f46cf79462459238571f5e Mon Sep 17 00:00:00 2001 From: Petr Vobornik Date: Mon, 3 Sep 2012 16:43:13 +0200 Subject: Update of confirmation of actions This patch is changing confirmation of actions according to ticket #3035, see the ticket description. It does following changes: * Confirmation of update action was removed. * Action lists resets to first action (which is usually a NOP: '-- select action --') on change of displayed entry. * New confirmation dialog was implemented. It is used for action confirmation. It is used in IPA.action to replace the call of window.confirm(message). The old call is a modal window which blocks all JS functionality and has different style than other dialogs in Web UI. The new one has same design and doesn't block background operations. https://fedorahosted.org/freeipa/ticket/3035 --- install/ui/facet.js | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) (limited to 'install/ui/facet.js') diff --git a/install/ui/facet.js b/install/ui/facet.js index 0de08d3f..372022db 100644 --- a/install/ui/facet.js +++ b/install/ui/facet.js @@ -655,6 +655,7 @@ IPA.facet_header = function(spec) { that.clear = function() { that.load(); + if (that.action_list) that.action_list.clear(); }; return that; @@ -1300,6 +1301,10 @@ IPA.action = function(spec) { that.needs_confirm = spec.needs_confirm !== undefined ? spec.needs_confirm : false; that.confirm_msg = spec.confirm_msg || IPA.messages.actions.confirm; + that.confirm_dialog = spec.confirm_dialog !== undefined ? spec.confirm_dialog : + IPA.confirm_dialog; + + that.execute_action = function(facet, on_success, on_error) { @@ -1319,9 +1324,13 @@ IPA.action = function(spec) { if (that.confirm_dialog) { var dialog = IPA.build(that.confirm_dialog); - confirmed = dialog.confirm(that.facet); + dialog.message = that.get_confirm_message(facet); + dialog.on_ok = function () { + that.execute_action(facet, on_success, on_error); + }; + dialog.open(); } else { - var msg = that.get_confirm_message(); + var msg = that.get_confirm_message(facet); confirmed = IPA.confirm(msg); } @@ -1331,7 +1340,7 @@ IPA.action = function(spec) { that.execute_action(facet, on_success, on_error); }; - that.get_confirm_message = function() { + that.get_confirm_message = function(facet) { return that.confirm_msg; }; @@ -2022,5 +2031,10 @@ IPA.action_list_widget = function(spec) { that.action_select.update([first]); }; + that.clear = function() { + + that.select_first_enabled(); + }; + return that; }; \ No newline at end of file -- cgit