From 3d12ac5d97f32657643196ade616643fa62735e5 Mon Sep 17 00:00:00 2001 From: Jason Altekruse Date: Thu, 28 Jan 2016 10:01:30 -0800 Subject: [PATCH 1/2] DRILL-2653: Improve web UI experience when there is an error in a storage plugin configuration --- .../src/main/resources/rest/storage/update.ftl | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/exec/java-exec/src/main/resources/rest/storage/update.ftl b/exec/java-exec/src/main/resources/rest/storage/update.ftl index 2a276e15f02..264b62a00da 100644 --- a/exec/java-exec/src/main/resources/rest/storage/update.ftl +++ b/exec/java-exec/src/main/resources/rest/storage/update.ftl @@ -53,8 +53,17 @@ }); function doUpdate() { $("#updateForm").ajaxForm(function(data) { - $("#message").removeClass("hidden").text(data.result).alert(); - setTimeout(function() { location.reload(); }, 800); + var messageEl = $("#message"); + messageEl.addClass("hidden"); + // Wait a fraction of a second before showing the message again. This + // makes it clear if a second attempt gives the same error as + // the first that a "new" message came back from the server + setTimeout(function() { + messageEl.removeClass("hidden").text("Please retry: " + data.result).alert(); + }, 200); + if (data.result == "success") { + setTimeout(function() { location.reload(); }, 800); + } }); }; function deleteFunction() { From b76ed969089b135bf63f34105229ae87bae4cc00 Mon Sep 17 00:00:00 2001 From: Jason Altekruse Date: Thu, 28 Jan 2016 13:34:42 -0800 Subject: [PATCH 2/2] Fixed success message, made the error messages red --- .../main/resources/rest/storage/update.ftl | 22 +++++++++++++------ 1 file changed, 15 insertions(+), 7 deletions(-) diff --git a/exec/java-exec/src/main/resources/rest/storage/update.ftl b/exec/java-exec/src/main/resources/rest/storage/update.ftl index 264b62a00da..5e7de5e90f2 100644 --- a/exec/java-exec/src/main/resources/rest/storage/update.ftl +++ b/exec/java-exec/src/main/resources/rest/storage/update.ftl @@ -54,15 +54,23 @@ function doUpdate() { $("#updateForm").ajaxForm(function(data) { var messageEl = $("#message"); - messageEl.addClass("hidden"); - // Wait a fraction of a second before showing the message again. This - // makes it clear if a second attempt gives the same error as - // the first that a "new" message came back from the server - setTimeout(function() { - messageEl.removeClass("hidden").text("Please retry: " + data.result).alert(); - }, 200); if (data.result == "success") { + messageEl.removeClass("hidden") + .removeClass("alert-danger") + .addClass("alert-info") + .text(data.result).alert(); setTimeout(function() { location.reload(); }, 800); + } else { + messageEl.addClass("hidden"); + // Wait a fraction of a second before showing the message again. This + // makes it clear if a second attempt gives the same error as + // the first that a "new" message came back from the server + setTimeout(function() { + messageEl.removeClass("hidden") + .removeClass("alert-info") + .addClass("alert-danger") + .text("Please retry: " + data.result).alert(); + }, 200); } }); };