diff options
author | Petr Vobornik <pvoborni@redhat.com> | 2012-08-29 17:35:07 +0200 |
---|---|---|
committer | Petr Vobornik <pvoborni@redhat.com> | 2012-09-06 09:44:15 +0200 |
commit | 6a8d6d3fde0ede2e0b976cd5af67a57c0691b1f8 (patch) | |
tree | 0e46119ffafca1f15b0da8868f72c3d9a16b8da8 | |
parent | 6ae286a8f5ec7d1633ec733fbe116550bff7141a (diff) | |
download | freeipa-6a8d6d3fde0ede2e0b976cd5af67a57c0691b1f8.tar.gz freeipa-6a8d6d3fde0ede2e0b976cd5af67a57c0691b1f8.tar.xz freeipa-6a8d6d3fde0ede2e0b976cd5af67a57c0691b1f8.zip |
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
-rw-r--r-- | install/ui/add.js | 12 | ||||
-rw-r--r-- | install/ui/association.js | 5 | ||||
-rw-r--r-- | install/ui/details.js | 10 | ||||
-rw-r--r-- | install/ui/dns.js | 17 | ||||
-rw-r--r-- | install/ui/hbac.js | 1 | ||||
-rw-r--r-- | install/ui/netgroup.js | 1 | ||||
-rw-r--r-- | install/ui/selinux.js | 1 | ||||
-rw-r--r-- | install/ui/sudo.js | 3 | ||||
-rw-r--r-- | install/ui/test/data/ipa_init.json | 7 | ||||
-rw-r--r-- | ipalib/plugins/internal.py | 7 |
10 files changed, 54 insertions, 10 deletions
diff --git a/install/ui/add.js b/install/ui/add.js index caa1ab5a0..d85587945 100644 --- a/install/ui/add.js +++ b/install/ui/add.js @@ -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]; diff --git a/install/ui/association.js b/install/ui/association.js index bb10387a5..edba681f0 100644 --- a/install/ui/association.js +++ b/install/ui/association.js @@ -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(); diff --git a/install/ui/details.js b/install/ui/details.js index 883bb06bf..cdb6a82bf 100644 --- a/install/ui/details.js +++ b/install/ui/details.js @@ -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) { diff --git a/install/ui/dns.js b/install/ui/dns.js index 0803fdd3c..33db481b8 100644 --- a/install/ui/dns.js +++ b/install/ui/dns.js @@ -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(); diff --git a/install/ui/hbac.js b/install/ui/hbac.js index a3683e7bb..63c928aab 100644 --- a/install/ui/hbac.js +++ b/install/ui/hbac.js @@ -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) { diff --git a/install/ui/netgroup.js b/install/ui/netgroup.js index f7dccbeee..73deec100 100644 --- a/install/ui/netgroup.js +++ b/install/ui/netgroup.js @@ -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) { diff --git a/install/ui/selinux.js b/install/ui/selinux.js index c754fabf1..ca4700609 100644 --- a/install/ui/selinux.js +++ b/install/ui/selinux.js @@ -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) { diff --git a/install/ui/sudo.js b/install/ui/sudo.js index d18415ff6..ce020b6a2 100644 --- a/install/ui/sudo.js +++ b/install/ui/sudo.js @@ -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(); diff --git a/install/ui/test/data/ipa_init.json b/install/ui/test/data/ipa_init.json index ff4c7489d..74d01706d 100644 --- a/install/ui/test/data/ipa_init.json +++ b/install/ui/test/data/ipa_init.json @@ -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", diff --git a/ipalib/plugins/internal.py b/ipalib/plugins/internal.py index 890ebb452..26e1b63fb 100644 --- a/ipalib/plugins/internal.py +++ b/ipalib/plugins/internal.py @@ -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"), |