While deleting an entry it now resets a facet if there are unsaved changes. It prevents pop up of various error dialogs when UI tries to redirect to search page after successful delete.

https://fedorahosted.org/freeipa/ticket/3047
--
Petr Vobornik
From eb8b01780c2da205b13f95a275c56269320db6c4 Mon Sep 17 00:00:00 2001
From: Petr Vobornik <pvobo...@redhat.com>
Date: Wed, 5 Sep 2012 16:55:57 +0200
Subject: [PATCH] Fixed problem while deleting entry with unsaved changes

While deleting an entry it now resets a facet if there are unsaved changes. It prevents pop up of various error dialogs when UI tries to redirect to search page after successful delete.

https://fedorahosted.org/freeipa/ticket/3047
---
 install/ui/details.js | 9 +++++++++
 install/ui/ipa.js     | 2 ++
 2 files changed, 11 insertions(+)

diff --git a/install/ui/details.js b/install/ui/details.js
index 883bb06bfd56ffd800f1ce60e229bc0c1f4ec1bb..13a895da99f9be24ca2f7c2ab65ba744c51192f8 100644
--- a/install/ui/details.js
+++ b/install/ui/details.js
@@ -1150,6 +1150,8 @@ IPA.object_action = function(spec) {
         return IPA.confirm(msg);
     };
 
+    that.object_execute_action = that.execute_action;
+
     return that;
 };
 
@@ -1191,6 +1193,13 @@ IPA.delete_action = function(spec) {
 
     var that = IPA.object_action(spec);
 
+    that.execute_action = function(facet, on_success, on_error) {
+
+        if (facet.is_dirty()) facet.reset();
+
+        that.object_execute_action(facet, on_success, on_error);
+    };
+
     that.on_success = function(facet, data, text_status, xhr) {
 
         IPA.notify_success(data.result.summary);
diff --git a/install/ui/ipa.js b/install/ui/ipa.js
index 7df4deed3f1b6e064a832ff3a2a0ba91d1538da7..23c9933dfb97cb39a932f78d235fdaf844e42b7c 100644
--- a/install/ui/ipa.js
+++ b/install/ui/ipa.js
@@ -2042,6 +2042,8 @@ IPA.confirm = function(msg) {
 
 IPA.notify_success = function(message) {
 
+    if (!message) return; // don't show undefined, null and such
+
     function destroy_timeout() {
         if (IPA.notify_success.timeout) window.clearTimeout(IPA.notify_success.timeout);
     }
-- 
1.7.11.4

_______________________________________________
Freeipa-devel mailing list
Freeipa-devel@redhat.com
https://www.redhat.com/mailman/listinfo/freeipa-devel

Reply via email to