Add /monitoring/analysis route

This commit is contained in:
Lou Knauer 2022-02-03 10:42:15 +01:00
parent efc3e1735b
commit e8c6a7d589
4 changed files with 24 additions and 2 deletions

View File

@ -160,6 +160,11 @@ func setupNodeRoute(i InfoType, r *http.Request) InfoType {
return i
}
func setupAnalysisRoute(i InfoType, r *http.Request) InfoType {
i["cluster"] = mux.Vars(r)["cluster"]
return i
}
var routes []Route = []Route{
{"/monitoring/jobs/", "monitoring/jobs.tmpl", "Jobs - ClusterCockpit", true, func(i InfoType, r *http.Request) InfoType { return i }},
{"/monitoring/job/{id:[0-9]+}", "monitoring/job.tmpl", "Job <ID> - ClusterCockpit", false, setupJobRoute},
@ -168,6 +173,7 @@ var routes []Route = []Route{
{"/monitoring/user/{id}", "monitoring/user.tmpl", "User <ID> - ClusterCockpit", true, setupUserRoute},
{"/monitoring/systems/{cluster}", "monitoring/systems.tmpl", "Cluster <ID> - ClusterCockpit", false, setupClusterRoute},
{"/monitoring/node/{cluster}/{hostname}", "monitoring/node.tmpl", "Node <ID> - ClusterCockpit", false, setupNodeRoute},
{"/monitoring/analysis/{cluster}", "monitoring/analysis.tmpl", "Analaysis - ClusterCockpit", true, setupAnalysisRoute},
}
func main() {

View File

@ -39,7 +39,7 @@
<th>Name</th>
<th>Jobs</th>
<th>System View</th>
<!-- <th>Analysis View</th> -->
<th>Analysis View</th>
</tr>
</thead>
<tbody>
@ -48,7 +48,7 @@
<td>{{.Name}}</td>
<td><a href="/monitoring/jobs/?cluster={{.Name}}">Jobs</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/{{.Name}}">Analysis View</a></td>
</tr>
{{end}}
</tbody>

View File

@ -0,0 +1,15 @@
{{define "content"}}
<div id="svelte-app"></div>
{{end}}
{{define "stylesheets"}}
<link rel='stylesheet' href='/build/analysis.css'>
{{end}}
{{define "javascript"}}
<script>
const cluster = {{ .Infos.cluster }};
const filterPresets = {{ .FilterPresets }};
const clusterCockpitConfig = {{ .Config }};
</script>
<script src='/build/analysis.js'></script>
{{end}}

View File

@ -33,6 +33,7 @@ func init() {
"monitoring/user.tmpl",
"monitoring/systems.tmpl",
"monitoring/node.tmpl",
"monitoring/analysis.tmpl",
}
for _, file := range files {