mirror of
https://github.com/ClusterCockpit/cc-backend
synced 2025-07-23 04:51:39 +02:00
add navbar select, add continous scroll, paging persistance
This commit is contained in:
11
web/web.go
11
web/web.go
@@ -13,6 +13,7 @@ import (
|
||||
|
||||
"github.com/ClusterCockpit/cc-backend/internal/config"
|
||||
"github.com/ClusterCockpit/cc-backend/internal/util"
|
||||
"github.com/ClusterCockpit/cc-backend/pkg/archive"
|
||||
"github.com/ClusterCockpit/cc-backend/pkg/log"
|
||||
"github.com/ClusterCockpit/cc-backend/pkg/schema"
|
||||
)
|
||||
@@ -95,6 +96,7 @@ type Page struct {
|
||||
Roles map[string]schema.Role // Available roles for frontend render checks
|
||||
Build Build // Latest information about the application
|
||||
Clusters []schema.ClusterConfig // List of all clusters for use in the Header
|
||||
SubClusters map[string][]string // Map per cluster of all subClusters for use in the Header
|
||||
FilterPresets map[string]interface{} // For pages with the Filter component, this can be used to set initial filters.
|
||||
Infos map[string]interface{} // For generic use (e.g. username for /monitoring/user/<id>, job id for /monitoring/job/<id>)
|
||||
Config map[string]interface{} // UI settings for the currently logged in user (e.g. line width, ...)
|
||||
@@ -114,6 +116,15 @@ func RenderTemplate(rw http.ResponseWriter, file string, page *Page) {
|
||||
}
|
||||
}
|
||||
|
||||
if page.SubClusters == nil {
|
||||
page.SubClusters = make(map[string][]string)
|
||||
for _, cluster := range archive.Clusters {
|
||||
for _, sc := range cluster.SubClusters {
|
||||
page.SubClusters[cluster.Name] = append(page.SubClusters[cluster.Name], sc.Name)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
log.Debugf("Page config : %v\n", page.Config)
|
||||
if err := t.Execute(rw, page); err != nil {
|
||||
log.Errorf("Template error: %s", err.Error())
|
||||
|
Reference in New Issue
Block a user