Skip to content

Commit

Permalink
Display better status message (#125)
Browse files Browse the repository at this point in the history
  • Loading branch information
ronahk authored Nov 29, 2022
1 parent 9b8edb6 commit 74f6236
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 5 deletions.
18 changes: 14 additions & 4 deletions pkg/dashboard/static/details-view.js
Original file line number Diff line number Diff line change
Expand Up @@ -165,8 +165,8 @@ function showResources(namespace, chart, revision) {
<div class="row px-3 py-2 mb-3 bg-white rounded">
<div class="col-2 res-kind text-break"></div>
<div class="col-3 res-name text-break fw-bold"></div>
<div class="col-1 res-status overflow-hidden"><span class="spinner-border spinner-border-sm" role="status" aria-hidden="true"></span></div>
<div class="col-4 res-statusmsg"><span class="text-muted small">Getting status...</span></div>
<div class="col-2 res-status overflow-hidden"><span class="spinner-border spinner-border-sm" role="status" aria-hidden="true"></span></div>
<div class="col-3 res-statusmsg text-break"><span class="text-muted small">Getting status...</span></div>
<div class="col-2 res-actions"><button class='btn btn-sm ms-2 visually-hidden'>Vertical-sizer</button></div>
</div>
`)
Expand All @@ -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("<span class='text-muted small'>" + (data.status.message ? data.status.message : '') + "</span>")
const statusMessage = getStatusMessage(data.status)
resBlock.find(".res-statusmsg").html("<span class='text-muted small'>" + (statusMessage ? statusMessage : '') + "</span>")

if (badge.text() !== "NotFound" && revision == $("#specRev").data("last-rev")) {
resBlock.find(".res-actions")
Expand All @@ -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"))
Expand Down
2 changes: 1 addition & 1 deletion pkg/dashboard/static/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -268,7 +268,7 @@ <h1 class="name float-start">Name</h1>
style="text-transform: uppercase">
<div class="col-2">Resource Type</div>
<div class="col-3">Name</div>
<div class="col-1">Status</div>
<div class="col-2">Status</div>
<div class="col-5">Status Message</div>
<div class="col-1"></div>
</div>
Expand Down

0 comments on commit 74f6236

Please sign in to comment.