mirror of
https://github.com/ClusterCockpit/cc-backend
synced 2024-12-26 13:29:05 +01:00
update templates and frontend
This commit is contained in:
parent
1a9f67fa28
commit
7f3bbdd576
2
frontend
2
frontend
@ -1 +1 @@
|
|||||||
Subproject commit cc48461a810dbd3565000150fc99332743de92ba
|
Subproject commit 68543017064707625d788d1e7f987434d0bb0714
|
26
server.go
26
server.go
@ -111,7 +111,7 @@ var programConfig ProgramConfig = ProgramConfig{
|
|||||||
"plot_general_lineWidth": 1,
|
"plot_general_lineWidth": 1,
|
||||||
"plot_list_jobsPerPage": 10,
|
"plot_list_jobsPerPage": 10,
|
||||||
"plot_list_selectedMetrics": []string{"cpu_load", "mem_used", "flops_any", "mem_bw", "clock"},
|
"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_showPolarplot": true,
|
||||||
"plot_view_showRoofline": true,
|
"plot_view_showRoofline": true,
|
||||||
"plot_view_showStatTable": true,
|
"plot_view_showStatTable": true,
|
||||||
@ -372,6 +372,7 @@ func monitoringRoutes(router *mux.Router, resolver *graph.Resolver) {
|
|||||||
}
|
}
|
||||||
if query.Get("project") != "" {
|
if query.Get("project") != "" {
|
||||||
filterPresets["project"] = query.Get("project")
|
filterPresets["project"] = query.Get("project")
|
||||||
|
filterPresets["projectMatch"] = "eq"
|
||||||
}
|
}
|
||||||
if query.Get("state") != "" && schema.JobState(query.Get("state")).Valid() {
|
if query.Get("state") != "" && schema.JobState(query.Get("state")).Valid() {
|
||||||
filterPresets["state"] = query.Get("state")
|
filterPresets["state"] = query.Get("state")
|
||||||
@ -437,9 +438,26 @@ func monitoringRoutes(router *mux.Router, resolver *graph.Resolver) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
templates.Render(rw, r, "monitoring/users.html", &templates.Page{
|
templates.Render(rw, r, "monitoring/list.html", &templates.Page{
|
||||||
Title: "Users - ClusterCockpit",
|
Title: "Users - ClusterCockpit",
|
||||||
Config: conf,
|
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"},
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
|
@ -20,6 +20,7 @@
|
|||||||
<ul>
|
<ul>
|
||||||
<li><a href="/monitoring/jobs/">All jobs</a></li>
|
<li><a href="/monitoring/jobs/">All jobs</a></li>
|
||||||
<li><a href="/monitoring/users/">All users</a></li>
|
<li><a href="/monitoring/users/">All users</a></li>
|
||||||
|
<li><a href="/monitoring/projects/">All projects</a></li>
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
{{else}}
|
{{else}}
|
||||||
@ -37,8 +38,8 @@
|
|||||||
<tr>
|
<tr>
|
||||||
<th>Name</th>
|
<th>Name</th>
|
||||||
<th>Jobs</th>
|
<th>Jobs</th>
|
||||||
<th>System View</th>
|
<!-- <th>System View</th> -->
|
||||||
<th>Analysis View</th>
|
<!-- <th>Analysis View</th> -->
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
@ -46,8 +47,8 @@
|
|||||||
<tr>
|
<tr>
|
||||||
<td>{{.Name}}</td>
|
<td>{{.Name}}</td>
|
||||||
<td><a href="/monitoring/jobs/?cluster={{.Name}}">Jobs</a></td>
|
<td><a href="/monitoring/jobs/?cluster={{.Name}}">Jobs</a></td>
|
||||||
<td><a href="/monitoring/systems/?cluster={{.Name}}">System View</a></td>
|
<!-- <td><a href="/monitoring/systems/?cluster={{.Name}}">System View</a></td> -->
|
||||||
<td><a href="/monitoring/analysis/?cluster={{.Name}}">Analysis View</a></td>
|
<!-- <td><a href="/monitoring/analysis/?cluster={{.Name}}">Analysis View</a></td> -->
|
||||||
</tr>
|
</tr>
|
||||||
{{end}}
|
{{end}}
|
||||||
</tbody>
|
</tbody>
|
||||||
|
@ -12,18 +12,7 @@
|
|||||||
jobId: "{{ .Infos.jobId }}",
|
jobId: "{{ .Infos.jobId }}",
|
||||||
clusterId: "{{ .Infos.clusterId }}"
|
clusterId: "{{ .Infos.clusterId }}"
|
||||||
};
|
};
|
||||||
const clusterCockpitConfigPromise = Promise.resolve({
|
const clusterCockpitConfig = {{ .Config }};
|
||||||
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 }},
|
|
||||||
});
|
|
||||||
</script>
|
</script>
|
||||||
<script src='/build/job.js'></script>
|
<script src='/build/job.js'></script>
|
||||||
{{end}}
|
{{end}}
|
||||||
|
15
templates/monitoring/list.html
Normal file
15
templates/monitoring/list.html
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
{{define "content"}}
|
||||||
|
<div id="svelte-app"></div>
|
||||||
|
{{end}}
|
||||||
|
|
||||||
|
{{define "stylesheets"}}
|
||||||
|
<link rel='stylesheet' href='/build/list.css'>
|
||||||
|
{{end}}
|
||||||
|
{{define "javascript"}}
|
||||||
|
<script>
|
||||||
|
const listType = {{ .Infos.listType }};
|
||||||
|
const filterPresets = {{ .FilterPresets }};
|
||||||
|
const clusterCockpitConfig = {{ .Config }};
|
||||||
|
</script>
|
||||||
|
<script src='/build/list.js'></script>
|
||||||
|
{{end}}
|
@ -1,14 +0,0 @@
|
|||||||
{{define "content"}}
|
|
||||||
<div id="svelte-app"></div>
|
|
||||||
{{end}}
|
|
||||||
|
|
||||||
{{define "stylesheets"}}
|
|
||||||
<link rel='stylesheet' href='/build/users.css'>
|
|
||||||
{{end}}
|
|
||||||
{{define "javascript"}}
|
|
||||||
<script>
|
|
||||||
const filterPresets = null;
|
|
||||||
const clusterCockpitConfigPromise = Promise.resolve({});
|
|
||||||
</script>
|
|
||||||
<script src='/build/users.js'></script>
|
|
||||||
{{end}}
|
|
@ -4,10 +4,11 @@ import (
|
|||||||
"html/template"
|
"html/template"
|
||||||
"log"
|
"log"
|
||||||
"net/http"
|
"net/http"
|
||||||
|
"os"
|
||||||
)
|
)
|
||||||
|
|
||||||
var templatesDir string
|
var templatesDir string
|
||||||
var debugMode bool = true
|
var debugMode bool = os.Getenv("DEBUG") == "1"
|
||||||
var templates map[string]*template.Template = map[string]*template.Template{}
|
var templates map[string]*template.Template = map[string]*template.Template{}
|
||||||
|
|
||||||
type Page struct {
|
type Page struct {
|
||||||
@ -28,11 +29,13 @@ func init() {
|
|||||||
base := template.Must(template.ParseFiles(templatesDir + "base.html"))
|
base := template.Must(template.ParseFiles(templatesDir + "base.html"))
|
||||||
files := []string{
|
files := []string{
|
||||||
"home.html", "404.html", "login.html",
|
"home.html", "404.html", "login.html",
|
||||||
"monitoring/jobs.html", "monitoring/job.html",
|
"monitoring/jobs.html",
|
||||||
"monitoring/users.html", "monitoring/user.html",
|
"monitoring/job.html",
|
||||||
"monitoring/analysis.html",
|
"monitoring/list.html",
|
||||||
"monitoring/systems.html",
|
"monitoring/user.html",
|
||||||
"monitoring/node.html",
|
// "monitoring/analysis.html",
|
||||||
|
// "monitoring/systems.html",
|
||||||
|
// "monitoring/node.html",
|
||||||
}
|
}
|
||||||
|
|
||||||
for _, file := range files {
|
for _, file := range files {
|
||||||
|
Loading…
Reference in New Issue
Block a user