diff --git a/rules/ast/functions.go b/rules/ast/functions.go
index ccfe3e271..ab0cce47c 100644
--- a/rules/ast/functions.go
+++ b/rules/ast/functions.go
@@ -275,7 +275,7 @@ func dropCommonLabelsImpl(timestamp clientmodel.Timestamp, view *viewAdapter, ar
}
for _, el := range vector {
- for k, _ := range el.Metric {
+ for k := range el.Metric {
if _, ok := common[k]; ok {
delete(el.Metric, k)
}
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 4cfd9da12..2bbe02f1e 100644
--- a/web/web.go
+++ b/web/web.go
@@ -132,10 +132,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 {