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 <pvoborni@redhat.com>
This commit is contained in:
Pavel Vomacka authored and Petr Vobornik committed 2016-07-01 09:39:49 +02:00
1 parent acf2234ebc
commit df56fd3371
1 file changed
+11 -3
+11 -3
View File
@@ -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');
}
};
/**