From df56fd3371bd20a2ce8f5d0097e05437b7827e29 Mon Sep 17 00:00:00 2001 From: Pavel Vomacka Date: Thu, 30 Jun 2016 14:32:27 +0200 Subject: Change error handling in custom_command_multivalued_widget The custom_command_multivalued_widget now handles remove and add commands errors correctly and shows error message. Part of: https://fedorahosted.org/freeipa/ticket/5381 add_error Reviewed-By: Petr Vobornik --- install/ui/src/freeipa/widget.js | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/install/ui/src/freeipa/widget.js b/install/ui/src/freeipa/widget.js index 0972efadb..68ed43f8b 100644 --- a/install/ui/src/freeipa/widget.js +++ b/install/ui/src/freeipa/widget.js @@ -1533,8 +1533,13 @@ IPA.custom_command_multivalued_widget = function(spec) { /** * Called on error of add command. Override point. */ - that.on_error_add = function(data) { + that.on_error_add = function(xhr, text_status, error_thrown) { that.adder_dialog.focus_first_element(); + + if (error_thrown.message) { + var msg = error_thrown.message; + IPA.notify(msg, 'error'); + } }; /** @@ -1548,8 +1553,11 @@ IPA.custom_command_multivalued_widget = function(spec) { /** * Called on error of remove command. Override point. */ - that.on_error_remove = function(data) { - IPA.notify(data.result.summary, 'error'); + that.on_error_remove = function(xhr, text_status, error_thrown) { + if (error_thrown.message) { + var msg = error_thrown.message; + IPA.notify(msg, 'error'); + } }; /** -- cgit