Blame SOURCES/bz1284404-02-web-ui-fix-timeout-when-cluster-setup-takes-long.patch

f778fe
From 1f64220204383bea38c52d5e96e0c5ba05e98ccb Mon Sep 17 00:00:00 2001
f778fe
From: Ivan Devat <idevat@redhat.com>
f778fe
Date: Thu, 15 Jun 2017 11:46:12 +0200
f778fe
Subject: [PATCH] web UI: fix timeout when cluster setup takes long
f778fe
f778fe
---
f778fe
 pcsd/public/js/pcsd.js | 14 ++++++++++++--
f778fe
 1 file changed, 12 insertions(+), 2 deletions(-)
f778fe
f778fe
diff --git a/pcsd/public/js/pcsd.js b/pcsd/public/js/pcsd.js
f778fe
index b7ad72f..4754139 100644
f778fe
--- a/pcsd/public/js/pcsd.js
f778fe
+++ b/pcsd/public/js/pcsd.js
f778fe
@@ -1080,7 +1080,7 @@ function update_create_cluster_dialog(nodes, version_info) {
f778fe
     ajax_wrapper({
f778fe
       type: "POST",
f778fe
       url: "/manage/newcluster",
f778fe
-      timeout: pcs_timeout,
f778fe
+      timeout: 60*1000,
f778fe
       data: $('#create_new_cluster_form').serialize(),
f778fe
       success: function(data) {
f778fe
         if (data) {
f778fe
@@ -1090,7 +1090,17 @@ function update_create_cluster_dialog(nodes, version_info) {
f778fe
         Pcs.update();
f778fe
       },
f778fe
       error: function (xhr, status, error) {
f778fe
-        alert(xhr.responseText);
f778fe
+        var err_msg = "";
f778fe
+        if ((status == "timeout") || ($.trim(error) == "timeout")) {
f778fe
+          err_msg = (
f778fe
+            "Operation takes longer to complete than expected. " +
f778fe
+            "It may continue running in the background. Later, you can try " +
f778fe
+            "to add this cluster as existing one."
f778fe
+          );
f778fe
+        } else {
f778fe
+          err_msg = xhr.responseText;
f778fe
+        }
f778fe
+        alert(err_msg);
f778fe
         $("#create_cluster_submit_btn").button("option", "disabled", false);
f778fe
       }
f778fe
     });
f778fe
-- 
f778fe
1.8.3.1
f778fe