mirror of
https://github.com/ClusterCockpit/cc-backend
synced 2024-12-26 13:29:05 +01:00
Re-enable /monitoring/systems and /monitoring/node
This commit is contained in:
parent
7b61582b42
commit
3d5aa9f904
81
server.go
81
server.go
@ -415,8 +415,7 @@ func prepareRoute(r *http.Request) (map[string]interface{}, map[string]interface
|
||||
return conf, infos, nil
|
||||
}
|
||||
|
||||
func monitoringRoutes(router *mux.Router, resolver *graph.Resolver) {
|
||||
buildFilterPresets := func(query url.Values) map[string]interface{} {
|
||||
func buildFilterPresets(query url.Values) map[string]interface{} {
|
||||
filterPresets := map[string]interface{}{}
|
||||
|
||||
if query.Get("cluster") != "" {
|
||||
@ -465,6 +464,8 @@ func monitoringRoutes(router *mux.Router, resolver *graph.Resolver) {
|
||||
return filterPresets
|
||||
}
|
||||
|
||||
func monitoringRoutes(router *mux.Router, resolver *graph.Resolver) {
|
||||
|
||||
router.HandleFunc("/monitoring/jobs/", func(rw http.ResponseWriter, r *http.Request) {
|
||||
conf, infos, err := prepareRoute(r)
|
||||
if err != nil {
|
||||
@ -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) {
|
||||
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/systems.tmpl", &templates.Page{
|
||||
Title: "System View - ClusterCockpit",
|
||||
Config: conf,
|
||||
Infos: infos,
|
||||
FilterPresets: filterPresets,
|
||||
})
|
||||
// TODO: List all clusters?
|
||||
http.Redirect(rw, r, "/", http.StatusTemporaryRedirect)
|
||||
})
|
||||
|
||||
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)
|
||||
if err != nil {
|
||||
http.Error(rw, err.Error(), http.StatusInternalServerError)
|
||||
@ -609,11 +573,38 @@ func monitoringRoutes(router *mux.Router, resolver *graph.Resolver) {
|
||||
}
|
||||
|
||||
vars := mux.Vars(r)
|
||||
infos["nodeId"] = vars["nodeId"]
|
||||
infos["clusterId"] = vars["clusterId"]
|
||||
infos["cluster"] = vars["cluster"]
|
||||
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{
|
||||
Title: fmt.Sprintf("Node %s - ClusterCockpit", vars["nodeId"]),
|
||||
Title: fmt.Sprintf("Host %s - ClusterCockpit", vars["hostname"]),
|
||||
Config: conf,
|
||||
Infos: infos,
|
||||
})
|
||||
|
@ -38,7 +38,7 @@
|
||||
<tr>
|
||||
<th>Name</th>
|
||||
<th>Jobs</th>
|
||||
<!-- <th>System View</th> -->
|
||||
<th>System View</th>
|
||||
<!-- <th>Analysis View</th> -->
|
||||
</tr>
|
||||
</thead>
|
||||
@ -47,7 +47,7 @@
|
||||
<tr>
|
||||
<td>{{.Name}}</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> -->
|
||||
</tr>
|
||||
{{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}}
|
||||
{{define "javascript"}}
|
||||
<script>
|
||||
const nodeInfos = {
|
||||
nodeId: "{{ .Infos.nodeId }}",
|
||||
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 }},
|
||||
});
|
||||
const infos = {{ .Infos }};
|
||||
const clusterCockpitConfig = {{ .Config }};
|
||||
</script>
|
||||
<script src='/build/node.js'></script>
|
||||
{{end}}
|
||||
|
@ -7,13 +7,8 @@
|
||||
{{end}}
|
||||
{{define "javascript"}}
|
||||
<script>
|
||||
const filterPresets = {{ .FilterPresets }};
|
||||
const clusterCockpitConfigPromise = Promise.resolve({
|
||||
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 }},
|
||||
});
|
||||
const infos = {{ .Infos }};
|
||||
const clusterCockpitConfig = {{ .Config }};
|
||||
</script>
|
||||
<script src='/build/systems.js'></script>
|
||||
{{end}}
|
||||
|
@ -34,9 +34,8 @@ func init() {
|
||||
"monitoring/job.tmpl",
|
||||
"monitoring/list.tmpl",
|
||||
"monitoring/user.tmpl",
|
||||
// "monitoring/analysis.tmpl",
|
||||
// "monitoring/systems.tmpl",
|
||||
// "monitoring/node.tmpl",
|
||||
"monitoring/systems.tmpl",
|
||||
"monitoring/node.tmpl",
|
||||
}
|
||||
|
||||
for _, file := range files {
|
||||
|
Loading…
Reference in New Issue
Block a user