mirror of
https://github.com/komodorio/helm-dashboard.git
synced 2026-03-24 03:38:04 +00:00
Display UI indication if chart is upgradable (#211)
This commit is contained in:
@@ -527,8 +527,8 @@ type RepoChartElement struct {
|
||||
AppVersion string `json:"app_version"`
|
||||
Description string `json:"description"`
|
||||
|
||||
InstalledNamespace string `json:"installed_namespace"` // custom addition on top of Helm
|
||||
InstalledName string `json:"installed_name"` // custom addition on top of Helm
|
||||
InstalledNamespace string `json:"installed_namespace"`
|
||||
InstalledName string `json:"installed_name"`
|
||||
Repository string `json:"repository"`
|
||||
}
|
||||
|
||||
@@ -540,6 +540,8 @@ func HReleaseToJSON(o *release.Release) *ReleaseElement {
|
||||
Updated: o.Info.LastDeployed,
|
||||
Status: o.Info.Status,
|
||||
Chart: fmt.Sprintf("%s-%s", o.Chart.Name(), o.Chart.Metadata.Version),
|
||||
ChartName: o.Chart.Name(),
|
||||
ChartVersion: o.Chart.Metadata.Version,
|
||||
AppVersion: o.Chart.AppVersion(),
|
||||
Icon: o.Chart.Metadata.Icon,
|
||||
Description: o.Chart.Metadata.Description,
|
||||
@@ -553,6 +555,8 @@ type ReleaseElement struct {
|
||||
Updated helmtime.Time `json:"updated"`
|
||||
Status release.Status `json:"status"`
|
||||
Chart string `json:"chart"`
|
||||
ChartName string `json:"chartName"`
|
||||
ChartVersion string `json:"chartVersion"`
|
||||
AppVersion string `json:"app_version"`
|
||||
Icon string `json:"icon"`
|
||||
Description string `json:"description"`
|
||||
|
||||
@@ -79,6 +79,20 @@ function buildChartCard(elm) {
|
||||
|
||||
loadChartHistory(chart.namespace, chart.name, elm.chart_name)
|
||||
})
|
||||
|
||||
// check if upgrade is possible
|
||||
$.getJSON("/api/helm/repositories/latestver?name=" + elm.chartName).fail(function (xhr) {
|
||||
reportError("Failed to find chart in repo", xhr)
|
||||
}).done(function (data) {
|
||||
if (!data || !data.length) {
|
||||
return
|
||||
}
|
||||
|
||||
if (isNewerVersion(elm.chartVersion, data[0].version)) {
|
||||
card.find(".rel-name span").append("<span class='bi-arrow-up-circle-fill ms-2 text-success' title='Upgrade available: "+data[0].version+"'></span>")
|
||||
}
|
||||
})
|
||||
|
||||
return card;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user