diff --git a/web/templates/_base.html b/web/templates/_base.html
index 764c51a5f..a0f642256 100644
--- a/web/templates/_base.html
+++ b/web/templates/_base.html
@@ -17,6 +17,10 @@
Prometheus
+ {{$consoles := getConsoles}}
+ {{if $consoles}}
+ - Consoles
+ {{ end }}
- Alerts
- Graph
- Status
diff --git a/web/web.go b/web/web.go
index 8851f5e16..2a8321a9b 100644
--- a/web/web.go
+++ b/web/web.go
@@ -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 {