From 74f6236ba6ea84c289a870a20791047b8e5e927a Mon Sep 17 00:00:00 2001 From: ronahk <74967920+ronahk@users.noreply.github.com> Date: Tue, 29 Nov 2022 18:10:52 +0200 Subject: [PATCH] Display better status message (#125) --- pkg/dashboard/static/details-view.js | 18 ++++++++++++++---- pkg/dashboard/static/index.html | 2 +- 2 files changed, 15 insertions(+), 5 deletions(-) diff --git a/pkg/dashboard/static/details-view.js b/pkg/dashboard/static/details-view.js index 7144a7c..36c3532 100644 --- a/pkg/dashboard/static/details-view.js +++ b/pkg/dashboard/static/details-view.js @@ -165,8 +165,8 @@ function showResources(namespace, chart, revision) {
-
-
Getting status...
+
+
Getting status...
`) @@ -189,10 +189,10 @@ function showResources(namespace, chart, revision) { } else { badge.addClass("bg-danger") } - const statusBlock = resBlock.find(".res-status"); statusBlock.empty().append(badge).attr("title", data.status.phase) - resBlock.find(".res-statusmsg").html("" + (data.status.message ? data.status.message : '') + "") + const statusMessage = getStatusMessage(data.status) + resBlock.find(".res-statusmsg").html("" + (statusMessage ? statusMessage : '') + "") if (badge.text() !== "NotFound" && revision == $("#specRev").data("last-rev")) { resBlock.find(".res-actions") @@ -216,6 +216,16 @@ function showResources(namespace, chart, revision) { }) } +function getStatusMessage(status) { + if (!status) { + return + } + if (status.conditions) { + return status.conditions[0].message || status.conditions[0].reason + } + return status.message || status.reason +} + function showDescribe(ns, kind, name, badge) { $("#describeModal .offcanvas-header p").text(kind) $("#describeModalLabel").text(name).append(badge.addClass("ms-3 small fw-normal")) diff --git a/pkg/dashboard/static/index.html b/pkg/dashboard/static/index.html index 35b7173..5535d32 100644 --- a/pkg/dashboard/static/index.html +++ b/pkg/dashboard/static/index.html @@ -268,7 +268,7 @@ style="text-transform: uppercase">
Resource Type
Name
-
Status
+
Status
Status Message