mirror of
https://github.com/komodorio/helm-dashboard.git
synced 2026-03-24 11:48:04 +00:00
Display resource health aggregate icons on list of releases (#235)
* Display aggregate resource health status * Reuse old API request, show icons * Take progress indication from deployment conditions * Improve status * Cleanup * Fixups * Squares approach
This commit is contained in:
@@ -136,6 +136,26 @@ func (h *HelmHandler) Resources(c *gin.Context) {
|
||||
return
|
||||
}
|
||||
|
||||
if c.Query("health") != "" { // we need to query k8s for health status
|
||||
app := h.GetApp(c)
|
||||
if app == nil {
|
||||
_ = c.AbortWithError(http.StatusInternalServerError, err)
|
||||
return
|
||||
}
|
||||
for _, obj := range res {
|
||||
ns := obj.Namespace
|
||||
if ns == "" {
|
||||
ns = c.Param("ns")
|
||||
}
|
||||
info, err := app.K8s.GetResourceInfo(obj.Kind, ns, obj.Name)
|
||||
if err != nil {
|
||||
_ = c.AbortWithError(http.StatusInternalServerError, err)
|
||||
return
|
||||
}
|
||||
obj.Status = *EnhanceStatus(info)
|
||||
}
|
||||
}
|
||||
|
||||
c.IndentedJSON(http.StatusOK, res)
|
||||
}
|
||||
|
||||
@@ -587,23 +607,24 @@ func (h *HelmHandler) repoFromArtifactHub(name string) (string, error) {
|
||||
return true
|
||||
}
|
||||
|
||||
// more popular
|
||||
if ri.Stars != rj.Stars {
|
||||
return ri.Stars > rj.Stars
|
||||
}
|
||||
|
||||
// or from verified publishers
|
||||
if ri.Repository.VerifiedPublisher && !rj.Repository.VerifiedPublisher {
|
||||
return true
|
||||
}
|
||||
|
||||
// or just more popular
|
||||
if ri.Stars > rj.Stars {
|
||||
return true
|
||||
}
|
||||
|
||||
// or with more recent app version
|
||||
|
||||
if semver.Compare("v"+ri.AppVersion, "v"+rj.AppVersion) > 0 {
|
||||
return true
|
||||
c := semver.Compare("v"+ri.AppVersion, "v"+rj.AppVersion)
|
||||
if c != 0 {
|
||||
return c > 0
|
||||
}
|
||||
|
||||
return false
|
||||
// shorter repo name is usually closer to officials
|
||||
return len(ri.Repository.Name) < len(rj.Repository.Name)
|
||||
})
|
||||
|
||||
r := results[0]
|
||||
|
||||
Reference in New Issue
Block a user