mirror of
https://github.com/ClusterCockpit/cc-backend
synced 2024-12-26 21:39:06 +01:00
Add template for status page
This commit is contained in:
parent
c9740e587d
commit
b572ef2aef
@ -1,6 +1,7 @@
|
|||||||
package main
|
package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"fmt"
|
||||||
"net/http"
|
"net/http"
|
||||||
"net/url"
|
"net/url"
|
||||||
"strconv"
|
"strconv"
|
||||||
@ -39,6 +40,7 @@ var routes []Route = []Route{
|
|||||||
{"/monitoring/systems/{cluster}", "monitoring/systems.tmpl", "Cluster <ID> - ClusterCockpit", false, setupClusterRoute},
|
{"/monitoring/systems/{cluster}", "monitoring/systems.tmpl", "Cluster <ID> - ClusterCockpit", false, setupClusterRoute},
|
||||||
{"/monitoring/node/{cluster}/{hostname}", "monitoring/node.tmpl", "Node <ID> - ClusterCockpit", false, setupNodeRoute},
|
{"/monitoring/node/{cluster}/{hostname}", "monitoring/node.tmpl", "Node <ID> - ClusterCockpit", false, setupNodeRoute},
|
||||||
{"/monitoring/analysis/{cluster}", "monitoring/analysis.tmpl", "Analaysis - ClusterCockpit", true, setupAnalysisRoute},
|
{"/monitoring/analysis/{cluster}", "monitoring/analysis.tmpl", "Analaysis - ClusterCockpit", true, setupAnalysisRoute},
|
||||||
|
{"/monitoring/status/{cluster}", "monitoring/status.tmpl", "Status of <ID> - ClusterCockpit", false, setupClusterRoute},
|
||||||
}
|
}
|
||||||
|
|
||||||
func setupHomeRoute(i InfoType, r *http.Request) InfoType {
|
func setupHomeRoute(i InfoType, r *http.Request) InfoType {
|
||||||
@ -118,6 +120,7 @@ func setupNodeRoute(i InfoType, r *http.Request) InfoType {
|
|||||||
vars := mux.Vars(r)
|
vars := mux.Vars(r)
|
||||||
i["cluster"] = vars["cluster"]
|
i["cluster"] = vars["cluster"]
|
||||||
i["hostname"] = vars["hostname"]
|
i["hostname"] = vars["hostname"]
|
||||||
|
i["id"] = fmt.Sprintf("%s (%s)", vars["cluster"], vars["hostname"])
|
||||||
from, to := r.URL.Query().Get("from"), r.URL.Query().Get("to")
|
from, to := r.URL.Query().Get("from"), r.URL.Query().Get("to")
|
||||||
if from != "" || to != "" {
|
if from != "" || to != "" {
|
||||||
i["from"] = from
|
i["from"] = from
|
||||||
|
@ -13,6 +13,7 @@ import (
|
|||||||
"net/url"
|
"net/url"
|
||||||
"os"
|
"os"
|
||||||
"os/signal"
|
"os/signal"
|
||||||
|
"runtime/debug"
|
||||||
"strings"
|
"strings"
|
||||||
"sync"
|
"sync"
|
||||||
"syscall"
|
"syscall"
|
||||||
@ -476,6 +477,9 @@ func main() {
|
|||||||
api.OngoingArchivings.Wait()
|
api.OngoingArchivings.Wait()
|
||||||
}()
|
}()
|
||||||
|
|
||||||
|
if os.Getenv("GOGC") == "" {
|
||||||
|
debug.SetGCPercent(25)
|
||||||
|
}
|
||||||
systemdNotifiy(true, "running")
|
systemdNotifiy(true, "running")
|
||||||
wg.Wait()
|
wg.Wait()
|
||||||
log.Print("Gracefull shutdown completed!")
|
log.Print("Gracefull shutdown completed!")
|
||||||
|
14
templates/monitoring/status.tmpl
Normal file
14
templates/monitoring/status.tmpl
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
{{define "content"}}
|
||||||
|
<div id="svelte-app"></div>
|
||||||
|
{{end}}
|
||||||
|
|
||||||
|
{{define "stylesheets"}}
|
||||||
|
<link rel='stylesheet' href='/build/status.css'>
|
||||||
|
{{end}}
|
||||||
|
{{define "javascript"}}
|
||||||
|
<script>
|
||||||
|
const infos = {{ .Infos }};
|
||||||
|
const clusterCockpitConfig = {{ .Config }};
|
||||||
|
</script>
|
||||||
|
<script src='/build/status.js'></script>
|
||||||
|
{{end}}
|
@ -48,6 +48,7 @@ func init() {
|
|||||||
"monitoring/list.tmpl",
|
"monitoring/list.tmpl",
|
||||||
"monitoring/user.tmpl",
|
"monitoring/user.tmpl",
|
||||||
"monitoring/systems.tmpl",
|
"monitoring/systems.tmpl",
|
||||||
|
"monitoring/status.tmpl",
|
||||||
"monitoring/node.tmpl",
|
"monitoring/node.tmpl",
|
||||||
"monitoring/analysis.tmpl",
|
"monitoring/analysis.tmpl",
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user