Skip to content

Commit

Permalink
Improve upgradable status display
Browse files Browse the repository at this point in the history
  • Loading branch information
undera committed Mar 7, 2023
1 parent a0680a4 commit 209f5b5
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 7 deletions.
14 changes: 9 additions & 5 deletions pkg/dashboard/static/list-view.js
Original file line number Diff line number Diff line change
Expand Up @@ -88,14 +88,18 @@ function buildChartCard(elm) {
return
}

if (isNewerVersion(elm.chartVersion, data[0].version)) {
const icon = $("<span class='ms-2 text-success' data-bs-toggle='tooltip' data-bs-placement='bottom' data-bs-title='Upgrade available: " + data[0].version + " from " + data[0].repository + "'></span>")
if (isNewerVersion(elm.chartVersion, data[0].version) || data[0].isSuggestedRepo) {
const icon = $("<br/><span class='ms-2 fw-bold' data-bs-toggle='tooltip' data-bs-placement='bottom'></span>")
if (data[0].isSuggestedRepo) {
icon.addClass("bi-arrow-up-circle")
icon.addClass("bi-plus-circle-fill text-primary")
icon.text(" ADD REPO")
icon.attr("data-bs-title", "Add '" + data[0].repository+"' to list of known repositories")
} else {
icon.addClass("bi-arrow-up-circle-fill")
icon.addClass("bi-arrow-up-circle-fill text-primary")
icon.text(" UPGRADE")
icon.attr("data-bs-title", "Upgrade available: " + data[0].version + " from " + data[0].repository)
}
card.find(".rel-name span").append(icon)
card.find(".rel-chart div").append(icon)

const tooltipTriggerList = card.find('[data-bs-toggle="tooltip"]')
const tooltipList = [...tooltipTriggerList].map(tooltipTriggerEl => new bootstrap.Tooltip(tooltipTriggerEl))
Expand Down
4 changes: 2 additions & 2 deletions pkg/dashboard/static/scripts.js
Original file line number Diff line number Diff line change
Expand Up @@ -117,8 +117,8 @@ $("#topNav ul a").click(function () {
initView()
})

const myAlert = document.getElementById('errorAlert')
myAlert.addEventListener('close.bs.alert', event => {
const errAlert = document.getElementById('errorAlert')
errAlert.addEventListener('close.bs.alert', event => {
event.preventDefault()
$("#errorAlert").hide()
})
Expand Down

0 comments on commit 209f5b5

Please sign in to comment.