Notify success on add, delete and update

Notification of success was added to:
 * details facet: update
 * association facet and association widget: add, delete items
 * attribute facet: delete items (notification of add should be handled in entity adder dialog)
 * sudo rule: add, remove option
 * dnsrecord: add, update, delete

https://fedorahosted.org/freeipa/ticket/2977
This commit is contained in:
Petr Vobornik 2012-08-29 17:35:07 +02:00
parent 6ae286a8f5
commit 6a8d6d3fde
10 changed files with 54 additions and 10 deletions

View File

@ -52,6 +52,7 @@ IPA.entity_adder_dialog = function(spec) {
var facet = IPA.current_entity.get_facet();
facet.refresh();
that.close();
IPA.notify_success(that.get_success_message());
},
that.on_error);
}
@ -65,10 +66,7 @@ IPA.entity_adder_dialog = function(spec) {
that.add(
function(data, text_status, xhr) {
that.added.notify();
var message = IPA.messages.dialogs.add_confirmation;
message = message.replace('${entity}', that.subject);
that.show_message(message);
that.show_message(that.get_success_message());
var facet = IPA.current_entity.get_facet();
facet.refresh();
that.reset();
@ -88,6 +86,7 @@ IPA.entity_adder_dialog = function(spec) {
that.close();
var result = data.result.result;
that.show_edit_page(that.entity, result);
IPA.notify_success(that.get_success_message());
},
that.on_error);
}
@ -103,6 +102,11 @@ IPA.entity_adder_dialog = function(spec) {
});
};
that.get_success_message = function() {
var message = IPA.messages.dialogs.add_confirmation;
return message.replace('${entity}', that.subject);
};
function show_edit_page(entity,result) {
var pkey_name = entity.metadata.primary_key;
var pkey = result[pkey_name];

View File

@ -571,6 +571,7 @@ IPA.association_table_widget = function (spec) {
function() {
that.refresh();
dialog.close();
IPA.notify_success(IPA.messages.association.added);
},
function() {
that.refresh();
@ -632,6 +633,7 @@ IPA.association_table_widget = function (spec) {
function() {
that.refresh();
dialog.close();
IPA.notify_success(IPA.messages.association.removed);
},
function() {
that.refresh();
@ -998,6 +1000,7 @@ IPA.association_facet = function (spec, no_init) {
on_success: function() {
that.refresh();
dialog.close();
IPA.notify_success(IPA.messages.association.added);
},
on_error: function() {
that.refresh();
@ -1049,6 +1052,7 @@ IPA.association_facet = function (spec, no_init) {
on_success: function() {
that.refresh();
dialog.close();
IPA.notify_success(IPA.messages.association.removed);
},
on_error: function() {
that.refresh();
@ -1308,6 +1312,7 @@ IPA.attribute_facet = function(spec, no_init) {
that.load(data);
that.show_content();
dialog.close();
IPA.notify_success(IPA.messages.association.removed);
},
function() {
that.refresh();

View File

@ -508,10 +508,20 @@ IPA.details_facet = function(spec, no_init) {
return valid;
};
that.nofify_update_success = function() {
var msg = IPA.messages.details.updated;
var key = that.get_primary_key();
key = key[key.length -1] || '';
msg = msg.replace('${entity}', that.entity.metadata.label_singular);
msg = msg.replace('${primary_key}', key);
IPA.notify_success(msg);
};
that.update_on_success = function(data, text_status, xhr) {
that.load(data);
that.on_update.notify();
that.nofify_update_success();
};
that.update_on_error = function(xhr, text_status, error_thrown) {

View File

@ -384,6 +384,7 @@ IPA.dnszone_details_facet = function(spec, no_init) {
that.update_on_success = function(data, text_status, xhr) {
that.refresh();
that.on_update.notify();
that.nofify_update_success();
};
that.update_on_error = function(xhr, text_status, error_thrown) {
@ -1815,6 +1816,7 @@ IPA.dns.record_type_table_widget = function(spec) {
that.reload_facet(data);
dialog.close();
that.notify_facet_update();
that.facet.nofify_update_success();
},
function() {
that.refresh_facet();
@ -1872,6 +1874,13 @@ IPA.dns.record_type_table_widget = function(spec) {
dialog.on_error = IPA.create_4304_error_handler(dialog);
dialog.get_add_message = function() {
var label = that.entity.metadata.label_singular;
var message = IPA.messages.dialogs.add_confirmation;
message = message.replace('${entity}', label);
return message;
};
dialog.create_button({
name: 'add',
label: IPA.messages.buttons.add,
@ -1887,6 +1896,7 @@ IPA.dns.record_type_table_widget = function(spec) {
}
dialog.close();
that.notify_facet_update();
IPA.notify_success(dialog.get_add_message());
},
dialog.on_error);
}
@ -1899,10 +1909,8 @@ IPA.dns.record_type_table_widget = function(spec) {
dialog.hide_message();
dialog.add(
function(data, text_status, xhr) {
var label = that.entity.metadata.label_singular;
var message = IPA.messages.dialogs.add_confirmation;
message = message.replace('${entity}', label);
dialog.show_message(message);
dialog.show_message(dialog.get_add_message());
if (data.result.result.dnsrecords) {
that.reload_facet(data);
@ -2003,6 +2011,7 @@ IPA.dns.record_type_table_widget = function(spec) {
that.reload_facet(data);
dialog.close();
that.notify_facet_update();
that.facet.nofify_update_success();
};
command.on_error = function() {
that.refresh_facet();

View File

@ -538,6 +538,7 @@ IPA.hbacrule_details_facet = function(spec) {
that.update_on_success = function(data, text_status, xhr) {
that.refresh();
that.on_update.notify();
that.nofify_update_success();
};
that.update_on_error = function(xhr, text_status, error_thrown) {

View File

@ -293,6 +293,7 @@ IPA.netgroup.details_facet = function(spec) {
that.update_on_success = function(data, text_status, xhr) {
that.refresh();
that.on_update.notify();
that.nofify_update_success();
};
that.update_on_error = function(xhr, text_status, error_thrown) {

View File

@ -302,6 +302,7 @@ IPA.selinux_details_facet = function(spec) {
that.update_on_success = function(data, text_status, xhr) {
that.refresh();
that.on_update.notify();
that.nofify_update_success();
};
that.update_on_error = function(xhr, text_status, error_thrown) {

View File

@ -653,6 +653,7 @@ IPA.sudorule_details_facet = function(spec) {
that.update_on_success = function(data, text_status, xhr) {
that.refresh();
that.on_update.notify();
that.nofify_update_success();
};
that.update_on_error = function(xhr, text_status, error_thrown) {
@ -819,6 +820,7 @@ IPA.sudo.options_section = function(spec) {
on_success: function(data) {
that.table.load(data.result.result);
dialog.close();
IPA.notify_success(IPA.messages.objects.sudorule.option_added);
},
on_error: function(data) {
that.reload();
@ -880,6 +882,7 @@ IPA.sudo.options_section = function(spec) {
}
dialog.close();
IPA.notify_success(IPA.messages.objects.sudorule.option_removed);
},
on_error: function(data) {
that.reload();

View File

@ -31,6 +31,7 @@
"memberof": "Add ${entity} ${primary_key} into ${other_entity}",
"sourcehost": "Add Source ${other_entity} into ${entity} ${primary_key}"
},
"added": "Items added",
"direct_membership": "Direct Membership",
"indirect_membership": "Indirect Membership",
"no_entries": "No entries.",
@ -45,6 +46,7 @@
"memberof": "Remove ${entity} ${primary_key} from ${other_entity}",
"sourcehost": "Remove Source ${other_entity} from ${entity} ${primary_key}"
},
"removed": "Items removed",
"show_results": "Show Results"
},
"buttons": {
@ -80,7 +82,8 @@
"general": "General",
"identity": "Identity Settings",
"settings": "${entity} ${primary_key} Settings",
"to_top": "Back to Top"
"to_top": "Back to Top",
"updated": "${entity} ${primary_key} updated"
},
"dialogs": {
"add_confirmation": "${entity} successfully added",
@ -430,6 +433,8 @@
"external": "External",
"host": "Access this host",
"ipaenabledflag": "Rule status",
"option_added": "Option added",
"option_removed": "Option(s) removed",
"options": "Options",
"runas": "As Whom",
"specified_commands": "Specified Commands and Groups",

View File

@ -166,6 +166,7 @@ class i18n_messages(Command):
"memberof": _("Add ${entity} ${primary_key} into ${other_entity}"),
"sourcehost": _("Add Source ${other_entity} into ${entity} ${primary_key}"),
},
"added": _("Items added"),
"direct_membership": _("Direct Membership"),
"indirect_membership": _("Indirect Membership"),
"no_entries": _("No entries."),
@ -180,6 +181,7 @@ class i18n_messages(Command):
"memberof": _("Remove ${entity} ${primary_key} from ${other_entity}"),
"sourcehost": _("Remove Source ${other_entity} from ${entity} ${primary_key}"),
},
"removed": _("Items removed"),
"show_results": _("Show Results"),
},
"buttons": {
@ -215,7 +217,8 @@ class i18n_messages(Command):
"general": _("General"),
"identity": _("Identity Settings"),
"settings": _("${entity} ${primary_key} Settings"),
"to_top": _("Back to Top")
"to_top": _("Back to Top"),
"updated": _("${entity} ${primary_key} updated"),
},
"dialogs": {
"add_confirmation": _("${entity} successfully added"),
@ -569,6 +572,8 @@ class i18n_messages(Command):
"external": _("External"),
"host": _("Access this host"),
"ipaenabledflag": _("Rule status"),
"option_added": _("Option added"),
"option_removed": _("Option(s) removed"),
"options": _("Options"),
"runas": _("As Whom"),
"specified_commands": _("Specified Commands and Groups"),