Blame SOURCES/bz1346852-02-web-UI-fix-error-when-removing-resources-takes-long.patch

15f218
From 06cef95211b84150fece67970426267849e74a36 Mon Sep 17 00:00:00 2001
15f218
From: Ondrej Mular <omular@redhat.com>
15f218
Date: Fri, 22 Jul 2016 08:34:21 +0200
15f218
Subject: [PATCH] web UI: fix error when removing resources takes long
15f218
15f218
---
15f218
 pcsd/public/js/pcsd.js | 24 +++++++++++++++++-------
15f218
 1 file changed, 17 insertions(+), 7 deletions(-)
15f218
15f218
diff --git a/pcsd/public/js/pcsd.js b/pcsd/public/js/pcsd.js
15f218
index 6c88888..e763482 100644
15f218
--- a/pcsd/public/js/pcsd.js
15f218
+++ b/pcsd/public/js/pcsd.js
15f218
@@ -1262,7 +1262,9 @@ function remove_nodes(ids, force) {
15f218
 }
15f218
 
15f218
 function remove_resource(ids, force) {
15f218
-  var data = {};
15f218
+  var data = {
15f218
+    no_error_if_not_exists: true
15f218
+  };
15f218
   if (force) {
15f218
     data["force"] = force;
15f218
   }
15f218
@@ -1287,12 +1289,20 @@ function remove_resource(ids, force) {
15f218
       Pcs.update();
15f218
     },
15f218
     error: function (xhr, status, error) {
15f218
-      error = $.trim(error)
15f218
-      var message = "Unable to remove resources (" + error + ")";
15f218
-      if (
15f218
-        (xhr.responseText.substring(0,6) == "Error:") || ("Forbidden" == error)
15f218
-      ) {
15f218
-        message += "\n\n" + xhr.responseText.replace("--force", "'Enforce removal'");
15f218
+      error = $.trim(error);
15f218
+      var message = "";
15f218
+      if (status == "timeout" || error == "timeout") {
15f218
+        message = "Operation takes longer to complete than expected.";
15f218
+      } else {
15f218
+        message = "Unable to remove resources (" + error + ")";
15f218
+        if (
15f218
+          (xhr.responseText.substring(0, 6) == "Error:") ||
15f218
+          ("Forbidden" == error)
15f218
+        ) {
15f218
+          message += "\n\n" + xhr.responseText.replace(
15f218
+            "--force", "'Enforce removal'"
15f218
+          );
15f218
+        }
15f218
       }
15f218
       alert(message);
15f218
       $("#dialog_verify_remove_resources.ui-dialog-content").each(
15f218
-- 
15f218
1.8.3.1
15f218