Blob Blame History Raw
From 1f64220204383bea38c52d5e96e0c5ba05e98ccb Mon Sep 17 00:00:00 2001
From: Ivan Devat <idevat@redhat.com>
Date: Thu, 15 Jun 2017 11:46:12 +0200
Subject: [PATCH] web UI: fix timeout when cluster setup takes long

---
 pcsd/public/js/pcsd.js | 14 ++++++++++++--
 1 file changed, 12 insertions(+), 2 deletions(-)

diff --git a/pcsd/public/js/pcsd.js b/pcsd/public/js/pcsd.js
index b7ad72f..4754139 100644
--- a/pcsd/public/js/pcsd.js
+++ b/pcsd/public/js/pcsd.js
@@ -1080,7 +1080,7 @@ function update_create_cluster_dialog(nodes, version_info) {
     ajax_wrapper({
       type: "POST",
       url: "/manage/newcluster",
-      timeout: pcs_timeout,
+      timeout: 60*1000,
       data: $('#create_new_cluster_form').serialize(),
       success: function(data) {
         if (data) {
@@ -1090,7 +1090,17 @@ function update_create_cluster_dialog(nodes, version_info) {
         Pcs.update();
       },
       error: function (xhr, status, error) {
-        alert(xhr.responseText);
+        var err_msg = "";
+        if ((status == "timeout") || ($.trim(error) == "timeout")) {
+          err_msg = (
+            "Operation takes longer to complete than expected. " +
+            "It may continue running in the background. Later, you can try " +
+            "to add this cluster as existing one."
+          );
+        } else {
+          err_msg = xhr.responseText;
+        }
+        alert(err_msg);
         $("#create_cluster_submit_btn").button("option", "disabled", false);
       }
     });
-- 
1.8.3.1