Add back consoles link.

Goes in index.html in consoles or else user data, if present.

Change-Id: I5303d30aa24ca0c20d2e0f49121e04a260b9c4f4
This commit is contained in:
Brian Brazil 2014-10-02 15:44:47 +01:00 committed by Bjoern Rabenstein
parent e389e63684
commit fd34e4061d
2 changed files with 18 additions and 1 deletions

View file

@ -17,6 +17,10 @@
<div class="container-fluid">
<a class="brand" href="/">Prometheus</a>
<ul class="nav">
{{$consoles := getConsoles}}
{{if $consoles}}
<li><a href="{{$consoles}}">Consoles</a></li>
{{ end }}
<li><a href="/alerts">Alerts</a></li>
<li><a href="/graph">Graph</a></li>
<li><a href="/">Status</a></li>

View file

@ -128,10 +128,23 @@ func getTemplateFile(name string) (string, error) {
}
}
func getConsoles() string {
if _, err := os.Stat(*consoleTemplatesPath + "/index.html"); !os.IsNotExist(err) {
return "/consoles/index.html"
}
if *userAssetsPath != "" {
if _, err := os.Stat(*userAssetsPath + "/index.html"); !os.IsNotExist(err) {
return "/user/index.html"
}
}
return ""
}
func getTemplate(name string) (t *template.Template, err error) {
t = template.New("_base")
t.Funcs(template.FuncMap{
"since": time.Since,
"since": time.Since,
"getConsoles": getConsoles,
})
file, err := getTemplateFile("_base")
if err != nil {