Reintroduce Clusters as string list of cluster names

This commit is contained in:
2026-01-14 10:37:07 +01:00
parent 19402d30af
commit 0ea0270fe1

View File

@@ -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/<id>, job id for /monitoring/job/<id>)
@@ -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)
}