Repository: drill Updated Branches: refs/heads/2653-merge [created] 1b51850f3
DRILL-2653: Improve web UI experience when there is an error in a storage plugin configuration Fixed success message, made the error messages red This closes #343 Project: http://git-wip-us.apache.org/repos/asf/drill/repo Commit: http://git-wip-us.apache.org/repos/asf/drill/commit/9fa7b28c Tree: http://git-wip-us.apache.org/repos/asf/drill/tree/9fa7b28c Diff: http://git-wip-us.apache.org/repos/asf/drill/diff/9fa7b28c Branch: refs/heads/2653-merge Commit: 9fa7b28c299b9d2dc4fda49271fe929db62f5e49 Parents: a515719 Author: Jason Altekruse <[email protected]> Authored: Thu Jan 28 10:01:30 2016 -0800 Committer: Jason Altekruse <[email protected]> Committed: Thu Jan 28 14:02:06 2016 -0800 ---------------------------------------------------------------------- .../src/main/resources/rest/storage/update.ftl | 21 ++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/drill/blob/9fa7b28c/exec/java-exec/src/main/resources/rest/storage/update.ftl ---------------------------------------------------------------------- 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 2a276e1..5e7de5e 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,25 @@ }); function doUpdate() { $("#updateForm").ajaxForm(function(data) { - $("#message").removeClass("hidden").text(data.result).alert(); - setTimeout(function() { location.reload(); }, 800); + var messageEl = $("#message"); + 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); + } }); }; function deleteFunction() {
