mirror of
https://github.com/ClusterCockpit/cc-backend
synced 2026-01-15 09:11:45 +01:00
Reintroduce Clusters as string list of cluster names
This commit is contained in:
@@ -245,6 +245,7 @@ type Page struct {
|
|||||||
User schema.User // Information about the currently logged in user (Full User Info)
|
User schema.User // Information about the currently logged in user (Full User Info)
|
||||||
Roles map[string]schema.Role // Available roles for frontend render checks
|
Roles map[string]schema.Role // Available roles for frontend render checks
|
||||||
Build Build // Latest information about the application
|
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
|
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.
|
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>)
|
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)
|
cclog.Errorf("WEB/WEB > template '%s' not found", file)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if page.Clusters == nil {
|
||||||
|
page.Clusters = make([]string, 2)
|
||||||
|
}
|
||||||
|
|
||||||
if page.SubClusters == nil {
|
if page.SubClusters == nil {
|
||||||
page.SubClusters = make(map[string][]string)
|
page.SubClusters = make(map[string][]string)
|
||||||
for _, cluster := range archive.Clusters {
|
for _, cluster := range archive.Clusters {
|
||||||
|
page.Clusters = append(page.Clusters, cluster.Name)
|
||||||
|
|
||||||
for _, sc := range cluster.SubClusters {
|
for _, sc := range cluster.SubClusters {
|
||||||
page.SubClusters[cluster.Name] = append(page.SubClusters[cluster.Name], sc.Name)
|
page.SubClusters[cluster.Name] = append(page.SubClusters[cluster.Name], sc.Name)
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user