Commit 5fcff1a4 by Torkel Ödegaard Committed by GitHub

Provisioning: Fixed problem with getting started panel being added to custom…

Provisioning: Fixed problem with getting started panel being added to custom home dashboard (#28750)

* Provisioning: Fixed problem with getting started panel being added to custom home dashboard

* Fixed comment

* Update pkg/api/dashboard.go

Co-authored-by: Arve Knudsen <arve.knudsen@gmail.com>

Co-authored-by: Arve Knudsen <arve.knudsen@gmail.com>
parent 6a97c456
......@@ -356,14 +356,20 @@ func (hs *HTTPServer) GetHomeDashboard(c *models.ReqContext) Response {
return Error(500, "Failed to load home dashboard", err)
}
if c.HasUserRole(models.ROLE_ADMIN) && !c.HasHelpFlag(models.HelpFlagGettingStartedPanelDismissed) {
addGettingStartedPanelToHomeDashboard(dash.Dashboard)
}
hs.addGettingStartedPanelToHomeDashboard(c, dash.Dashboard)
return JSON(200, &dash)
}
func addGettingStartedPanelToHomeDashboard(dash *simplejson.Json) {
func (hs *HTTPServer) addGettingStartedPanelToHomeDashboard(c *models.ReqContext, dash *simplejson.Json) {
// We only add this getting started panel for Admins who have not dismissed it,
// and if a custom default home dashboard hasn't been configured
if !c.HasUserRole(models.ROLE_ADMIN) ||
c.HasHelpFlag(models.HelpFlagGettingStartedPanelDismissed) ||
hs.Cfg.DefaultHomeDashboardPath != "" {
return
}
panels := dash.Get("panels").MustArray()
newpanel := simplejson.NewFromAny(map[string]interface{}{
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment