diff --git a/web/web.go b/web/web.go index 37f1c2b2..6ff01403 100644 --- a/web/web.go +++ b/web/web.go @@ -245,6 +245,7 @@ type Page struct { User schema.User // Information about the currently logged in user (Full User Info) Roles map[string]schema.Role // Available roles for frontend render checks Build Build // Latest information about the application + Clusters []string // List of all cluster names SubClusters map[string][]string // Map per cluster of all subClusters for use in the Header FilterPresets map[string]any // For pages with the Filter component, this can be used to set initial filters. Infos map[string]any // For generic use (e.g. username for /monitoring/user/, job id for /monitoring/job/) @@ -259,9 +260,15 @@ func RenderTemplate(rw http.ResponseWriter, file string, page *Page) { cclog.Errorf("WEB/WEB > template '%s' not found", file) } + if page.Clusters == nil { + page.Clusters = make([]string, 2) + } + if page.SubClusters == nil { page.SubClusters = make(map[string][]string) for _, cluster := range archive.Clusters { + page.Clusters = append(page.Clusters, cluster.Name) + for _, sc := range cluster.SubClusters { page.SubClusters[cluster.Name] = append(page.SubClusters[cluster.Name], sc.Name) }