From 7f3bbdd57610c651870a91a44dfbfc71c003a8f0 Mon Sep 17 00:00:00 2001 From: Lou Knauer Date: Mon, 17 Jan 2022 13:31:40 +0100 Subject: [PATCH] update templates and frontend --- frontend | 2 +- server.go | 26 ++++++++++++++++++++++---- templates/home.html | 9 +++++---- templates/monitoring/job.html | 13 +------------ templates/monitoring/list.html | 15 +++++++++++++++ templates/monitoring/users.html | 14 -------------- templates/templates.go | 15 +++++++++------ 7 files changed, 53 insertions(+), 41 deletions(-) create mode 100644 templates/monitoring/list.html delete mode 100644 templates/monitoring/users.html diff --git a/frontend b/frontend index cc48461..6854301 160000 --- a/frontend +++ b/frontend @@ -1 +1 @@ -Subproject commit cc48461a810dbd3565000150fc99332743de92ba +Subproject commit 68543017064707625d788d1e7f987434d0bb0714 diff --git a/server.go b/server.go index 288eb7a..1f1bc2f 100644 --- a/server.go +++ b/server.go @@ -111,7 +111,7 @@ var programConfig ProgramConfig = ProgramConfig{ "plot_general_lineWidth": 1, "plot_list_jobsPerPage": 10, "plot_list_selectedMetrics": []string{"cpu_load", "mem_used", "flops_any", "mem_bw", "clock"}, - "plot_view_plotsPerRow": 4, + "plot_view_plotsPerRow": 2, "plot_view_showPolarplot": true, "plot_view_showRoofline": true, "plot_view_showStatTable": true, @@ -372,6 +372,7 @@ func monitoringRoutes(router *mux.Router, resolver *graph.Resolver) { } if query.Get("project") != "" { filterPresets["project"] = query.Get("project") + filterPresets["projectMatch"] = "eq" } if query.Get("state") != "" && schema.JobState(query.Get("state")).Valid() { filterPresets["state"] = query.Get("state") @@ -437,9 +438,26 @@ func monitoringRoutes(router *mux.Router, resolver *graph.Resolver) { return } - templates.Render(rw, r, "monitoring/users.html", &templates.Page{ - Title: "Users - ClusterCockpit", - Config: conf, + templates.Render(rw, r, "monitoring/list.html", &templates.Page{ + Title: "Users - ClusterCockpit", + Config: conf, + FilterPresets: buildFilterPresets(r.URL.Query()), + Infos: map[string]interface{}{"listType": "USER"}, + }) + }) + + router.HandleFunc("/monitoring/projects/", func(rw http.ResponseWriter, r *http.Request) { + conf, err := config.GetUIConfig(r) + if err != nil { + http.Error(rw, err.Error(), http.StatusInternalServerError) + return + } + + templates.Render(rw, r, "monitoring/list.html", &templates.Page{ + Title: "Projects - ClusterCockpit", + Config: conf, + FilterPresets: buildFilterPresets(r.URL.Query()), + Infos: map[string]interface{}{"listType": "PROJECT"}, }) }) diff --git a/templates/home.html b/templates/home.html index b357374..eef64c7 100644 --- a/templates/home.html +++ b/templates/home.html @@ -20,6 +20,7 @@ {{else}} @@ -37,8 +38,8 @@ Name Jobs - System View - Analysis View + + @@ -46,8 +47,8 @@ {{.Name}} Jobs - System View - Analysis View + + {{end}} diff --git a/templates/monitoring/job.html b/templates/monitoring/job.html index 5f8b7f6..662b2f4 100644 --- a/templates/monitoring/job.html +++ b/templates/monitoring/job.html @@ -12,18 +12,7 @@ jobId: "{{ .Infos.jobId }}", clusterId: "{{ .Infos.clusterId }}" }; - const clusterCockpitConfigPromise = Promise.resolve({ - plot_general_colorscheme: {{ .Config.plot_general_colorscheme }}, - plot_general_lineWidth: {{ .Config.plot_general_lineWidth }}, - plot_general_colorBackground: {{ .Config.plot_general_colorBackground }}, - plot_view_showRoofline: {{ .Config.plot_view_showRoofline }}, - plot_view_showPolarplot: {{ .Config.plot_view_showPolarplot }}, - plot_view_showStatTable: {{ .Config.plot_view_showStatTable }}, - plot_view_plotsPerRow: {{ .Config.plot_view_plotsPerRow }}, - job_view_selectedMetrics: {{ .Config.job_view_selectedMetrics }}, - job_view_nodestats_selectedMetrics: {{ .Config.job_view_nodestats_selectedMetrics }}, - job_view_polarPlotMetrics: {{ .Config.plot_view_polarPlotMetrics }}, - }); + const clusterCockpitConfig = {{ .Config }}; {{end}} diff --git a/templates/monitoring/list.html b/templates/monitoring/list.html new file mode 100644 index 0000000..0c1994e --- /dev/null +++ b/templates/monitoring/list.html @@ -0,0 +1,15 @@ +{{define "content"}} +
+{{end}} + +{{define "stylesheets"}} + +{{end}} +{{define "javascript"}} + + +{{end}} diff --git a/templates/monitoring/users.html b/templates/monitoring/users.html deleted file mode 100644 index ff7c9d6..0000000 --- a/templates/monitoring/users.html +++ /dev/null @@ -1,14 +0,0 @@ -{{define "content"}} -
-{{end}} - -{{define "stylesheets"}} - -{{end}} -{{define "javascript"}} - - -{{end}} diff --git a/templates/templates.go b/templates/templates.go index 1ab66d7..b2eea1e 100644 --- a/templates/templates.go +++ b/templates/templates.go @@ -4,10 +4,11 @@ import ( "html/template" "log" "net/http" + "os" ) var templatesDir string -var debugMode bool = true +var debugMode bool = os.Getenv("DEBUG") == "1" var templates map[string]*template.Template = map[string]*template.Template{} type Page struct { @@ -28,11 +29,13 @@ func init() { base := template.Must(template.ParseFiles(templatesDir + "base.html")) files := []string{ "home.html", "404.html", "login.html", - "monitoring/jobs.html", "monitoring/job.html", - "monitoring/users.html", "monitoring/user.html", - "monitoring/analysis.html", - "monitoring/systems.html", - "monitoring/node.html", + "monitoring/jobs.html", + "monitoring/job.html", + "monitoring/list.html", + "monitoring/user.html", + // "monitoring/analysis.html", + // "monitoring/systems.html", + // "monitoring/node.html", } for _, file := range files {