From 1e6e89121ca8649cf27eb82d221c926fff2659dd Mon Sep 17 00:00:00 2001 From: David Kaltschmidt Date: Fri, 27 Apr 2018 11:39:14 +0200 Subject: [PATCH] Settings to enable Explore UI --- conf/defaults.ini | 5 +++++ conf/sample.ini | 5 +++++ pkg/api/index.go | 22 ++++++++++++---------- pkg/setting/setting.go | 6 ++++++ 4 files changed, 28 insertions(+), 10 deletions(-) diff --git a/conf/defaults.ini b/conf/defaults.ini index 11d173d955d..d45e270d65d 100644 --- a/conf/defaults.ini +++ b/conf/defaults.ini @@ -442,6 +442,11 @@ enabled = true # Makes it possible to turn off alert rule execution but alerting UI is visible execute_alerts = true +#################################### Explore ############################# +[explore] +# Enable the Explore section +enabled = false + #################################### Internal Grafana Metrics ############ # Metrics available at HTTP API Url /metrics [metrics] diff --git a/conf/sample.ini b/conf/sample.ini index 9f0c2a73c25..f12d917039d 100644 --- a/conf/sample.ini +++ b/conf/sample.ini @@ -377,6 +377,11 @@ log_queries = # Makes it possible to turn off alert rule execution but alerting UI is visible ;execute_alerts = true +#################################### Explore ############################# +[explore] +# Enable the Explore section +;enabled = false + #################################### Internal Grafana Metrics ########################## # Metrics available at HTTP API Url /metrics [metrics] diff --git a/pkg/api/index.go b/pkg/api/index.go index 64eaddcd1a7..75e3594d854 100644 --- a/pkg/api/index.go +++ b/pkg/api/index.go @@ -117,16 +117,18 @@ func setIndexViewData(c *m.ReqContext) (*dtos.IndexViewData, error) { Children: dashboardChildNavs, }) - // data.NavTree = append(data.NavTree, &dtos.NavLink{ - // Text: "Explore", - // Id: "explore", - // SubTitle: "Explore your data", - // Icon: "fa fa-rocket", - // Url: setting.AppSubUrl + "/explore", - // Children: []*dtos.NavLink{ - // {Text: "New tab", Icon: "gicon gicon-dashboard-new", Url: setting.AppSubUrl + "/explore/new"}, - // }, - // }) + if setting.ExploreEnabled { + data.NavTree = append(data.NavTree, &dtos.NavLink{ + Text: "Explore", + Id: "explore", + SubTitle: "Explore your data", + Icon: "fa fa-rocket", + Url: setting.AppSubUrl + "/explore", + Children: []*dtos.NavLink{ + {Text: "New tab", Icon: "gicon gicon-dashboard-new", Url: setting.AppSubUrl + "/explore/new"}, + }, + }) + } if c.IsSignedIn { // Only set login if it's different from the name diff --git a/pkg/setting/setting.go b/pkg/setting/setting.go index 30a40602b1c..37646979095 100644 --- a/pkg/setting/setting.go +++ b/pkg/setting/setting.go @@ -168,6 +168,9 @@ var ( AlertingEnabled bool ExecuteAlerts bool + // Explore UI + ExploreEnabled bool + // logger logger log.Logger @@ -609,6 +612,9 @@ func NewConfigContext(args *CommandLineArgs) error { AlertingEnabled = alerting.Key("enabled").MustBool(true) ExecuteAlerts = alerting.Key("execute_alerts").MustBool(true) + explore := Cfg.Section("explore") + ExploreEnabled = explore.Key("enabled").MustBool(true) + readSessionConfig() readSmtpSettings() readQuotaSettings()