mirror of
https://github.com/ClusterCockpit/cc-backend
synced 2024-12-27 05:49:04 +01:00
Re-enable /monitoring/systems and /monitoring/node
This commit is contained in:
parent
7b61582b42
commit
3d5aa9f904
83
server.go
83
server.go
@ -415,8 +415,7 @@ func prepareRoute(r *http.Request) (map[string]interface{}, map[string]interface
|
|||||||
return conf, infos, nil
|
return conf, infos, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func monitoringRoutes(router *mux.Router, resolver *graph.Resolver) {
|
func buildFilterPresets(query url.Values) map[string]interface{} {
|
||||||
buildFilterPresets := func(query url.Values) map[string]interface{} {
|
|
||||||
filterPresets := map[string]interface{}{}
|
filterPresets := map[string]interface{}{}
|
||||||
|
|
||||||
if query.Get("cluster") != "" {
|
if query.Get("cluster") != "" {
|
||||||
@ -463,7 +462,9 @@ func monitoringRoutes(router *mux.Router, resolver *graph.Resolver) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
return filterPresets
|
return filterPresets
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func monitoringRoutes(router *mux.Router, resolver *graph.Resolver) {
|
||||||
|
|
||||||
router.HandleFunc("/monitoring/jobs/", func(rw http.ResponseWriter, r *http.Request) {
|
router.HandleFunc("/monitoring/jobs/", func(rw http.ResponseWriter, r *http.Request) {
|
||||||
conf, infos, err := prepareRoute(r)
|
conf, infos, err := prepareRoute(r)
|
||||||
@ -559,49 +560,12 @@ func monitoringRoutes(router *mux.Router, resolver *graph.Resolver) {
|
|||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
router.HandleFunc("/monitoring/analysis/", func(rw http.ResponseWriter, r *http.Request) {
|
|
||||||
conf, infos, err := prepareRoute(r)
|
|
||||||
if err != nil {
|
|
||||||
http.Error(rw, err.Error(), http.StatusInternalServerError)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
filterPresets := map[string]interface{}{}
|
|
||||||
query := r.URL.Query()
|
|
||||||
if query.Get("cluster") != "" {
|
|
||||||
filterPresets["clusterId"] = query.Get("cluster")
|
|
||||||
}
|
|
||||||
|
|
||||||
templates.Render(rw, r, "monitoring/analysis.tmpl", &templates.Page{
|
|
||||||
Title: "Analysis View - ClusterCockpit",
|
|
||||||
Config: conf,
|
|
||||||
Infos: infos,
|
|
||||||
FilterPresets: filterPresets,
|
|
||||||
})
|
|
||||||
})
|
|
||||||
|
|
||||||
router.HandleFunc("/monitoring/systems/", func(rw http.ResponseWriter, r *http.Request) {
|
router.HandleFunc("/monitoring/systems/", func(rw http.ResponseWriter, r *http.Request) {
|
||||||
conf, infos, err := prepareRoute(r)
|
// TODO: List all clusters?
|
||||||
if err != nil {
|
http.Redirect(rw, r, "/", http.StatusTemporaryRedirect)
|
||||||
http.Error(rw, err.Error(), http.StatusInternalServerError)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
filterPresets := map[string]interface{}{}
|
|
||||||
query := r.URL.Query()
|
|
||||||
if query.Get("cluster") != "" {
|
|
||||||
filterPresets["clusterId"] = query.Get("cluster")
|
|
||||||
}
|
|
||||||
|
|
||||||
templates.Render(rw, r, "monitoring/systems.tmpl", &templates.Page{
|
|
||||||
Title: "System View - ClusterCockpit",
|
|
||||||
Config: conf,
|
|
||||||
Infos: infos,
|
|
||||||
FilterPresets: filterPresets,
|
|
||||||
})
|
|
||||||
})
|
})
|
||||||
|
|
||||||
router.HandleFunc("/monitoring/node/{clusterId}/{nodeId}", func(rw http.ResponseWriter, r *http.Request) {
|
router.HandleFunc("/monitoring/systems/{cluster}", func(rw http.ResponseWriter, r *http.Request) {
|
||||||
conf, infos, err := prepareRoute(r)
|
conf, infos, err := prepareRoute(r)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
http.Error(rw, err.Error(), http.StatusInternalServerError)
|
http.Error(rw, err.Error(), http.StatusInternalServerError)
|
||||||
@ -609,11 +573,38 @@ func monitoringRoutes(router *mux.Router, resolver *graph.Resolver) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
vars := mux.Vars(r)
|
vars := mux.Vars(r)
|
||||||
infos["nodeId"] = vars["nodeId"]
|
infos["cluster"] = vars["cluster"]
|
||||||
infos["clusterId"] = vars["clusterId"]
|
from, to := r.URL.Query().Get("from"), r.URL.Query().Get("to")
|
||||||
|
if from != "" || to != "" {
|
||||||
|
infos["from"] = from
|
||||||
|
infos["to"] = to
|
||||||
|
}
|
||||||
|
|
||||||
|
templates.Render(rw, r, "monitoring/systems.tmpl", &templates.Page{
|
||||||
|
Title: fmt.Sprintf("Cluster %s - ClusterCockpit", vars["cluster"]),
|
||||||
|
Config: conf,
|
||||||
|
Infos: infos,
|
||||||
|
})
|
||||||
|
})
|
||||||
|
|
||||||
|
router.HandleFunc("/monitoring/node/{cluster}/{hostname}", func(rw http.ResponseWriter, r *http.Request) {
|
||||||
|
conf, infos, err := prepareRoute(r)
|
||||||
|
if err != nil {
|
||||||
|
http.Error(rw, err.Error(), http.StatusInternalServerError)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
vars := mux.Vars(r)
|
||||||
|
infos["cluster"] = vars["cluster"]
|
||||||
|
infos["hostname"] = vars["hostname"]
|
||||||
|
from, to := r.URL.Query().Get("from"), r.URL.Query().Get("to")
|
||||||
|
if from != "" || to != "" {
|
||||||
|
infos["from"] = from
|
||||||
|
infos["to"] = to
|
||||||
|
}
|
||||||
|
|
||||||
templates.Render(rw, r, "monitoring/node.tmpl", &templates.Page{
|
templates.Render(rw, r, "monitoring/node.tmpl", &templates.Page{
|
||||||
Title: fmt.Sprintf("Node %s - ClusterCockpit", vars["nodeId"]),
|
Title: fmt.Sprintf("Host %s - ClusterCockpit", vars["hostname"]),
|
||||||
Config: conf,
|
Config: conf,
|
||||||
Infos: infos,
|
Infos: infos,
|
||||||
})
|
})
|
||||||
|
@ -38,7 +38,7 @@
|
|||||||
<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>
|
||||||
@ -47,7 +47,7 @@
|
|||||||
<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/{{.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}}
|
||||||
|
@ -1,18 +0,0 @@
|
|||||||
{{define "content"}}
|
|
||||||
<div id="svelte-app"></div>
|
|
||||||
{{end}}
|
|
||||||
|
|
||||||
{{define "stylesheets"}}
|
|
||||||
<link rel='stylesheet' href='/build/analysis.css'>
|
|
||||||
{{end}}
|
|
||||||
{{define "javascript"}}
|
|
||||||
<script>
|
|
||||||
const filterPresets = {{ .FilterPresets }};
|
|
||||||
const clusterCockpitConfigPromise = Promise.resolve({
|
|
||||||
plot_view_plotsPerRow: {{ .Config.plot_view_plotsPerRow }},
|
|
||||||
analysis_view_histogramMetrics: {{ .Config.analysis_view_histogramMetrics }},
|
|
||||||
analysis_view_scatterPlotMetrics: {{ .Config.analysis_view_scatterPlotMetrics }}
|
|
||||||
});
|
|
||||||
</script>
|
|
||||||
<script src='/build/analysis.js'></script>
|
|
||||||
{{end}}
|
|
@ -7,15 +7,8 @@
|
|||||||
{{end}}
|
{{end}}
|
||||||
{{define "javascript"}}
|
{{define "javascript"}}
|
||||||
<script>
|
<script>
|
||||||
const nodeInfos = {
|
const infos = {{ .Infos }};
|
||||||
nodeId: "{{ .Infos.nodeId }}",
|
const clusterCockpitConfig = {{ .Config }};
|
||||||
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 }},
|
|
||||||
});
|
|
||||||
</script>
|
</script>
|
||||||
<script src='/build/node.js'></script>
|
<script src='/build/node.js'></script>
|
||||||
{{end}}
|
{{end}}
|
||||||
|
@ -7,13 +7,8 @@
|
|||||||
{{end}}
|
{{end}}
|
||||||
{{define "javascript"}}
|
{{define "javascript"}}
|
||||||
<script>
|
<script>
|
||||||
const filterPresets = {{ .FilterPresets }};
|
const infos = {{ .Infos }};
|
||||||
const clusterCockpitConfigPromise = Promise.resolve({
|
const clusterCockpitConfig = {{ .Config }};
|
||||||
plot_view_plotsPerRow: {{ .Config.plot_view_plotsPerRow }},
|
|
||||||
plot_general_colorscheme: {{ .Config.plot_general_colorscheme }},
|
|
||||||
plot_general_lineWidth: {{ .Config.plot_general_lineWidth }},
|
|
||||||
plot_general_colorBackground: {{ .Config.plot_general_colorBackground }},
|
|
||||||
});
|
|
||||||
</script>
|
</script>
|
||||||
<script src='/build/systems.js'></script>
|
<script src='/build/systems.js'></script>
|
||||||
{{end}}
|
{{end}}
|
||||||
|
@ -34,9 +34,8 @@ func init() {
|
|||||||
"monitoring/job.tmpl",
|
"monitoring/job.tmpl",
|
||||||
"monitoring/list.tmpl",
|
"monitoring/list.tmpl",
|
||||||
"monitoring/user.tmpl",
|
"monitoring/user.tmpl",
|
||||||
// "monitoring/analysis.tmpl",
|
"monitoring/systems.tmpl",
|
||||||
// "monitoring/systems.tmpl",
|
"monitoring/node.tmpl",
|
||||||
// "monitoring/node.tmpl",
|
|
||||||
}
|
}
|
||||||
|
|
||||||
for _, file := range files {
|
for _, file := range files {
|
||||||
|
Loading…
Reference in New Issue
Block a user