From 9565b13925e99f49e0468b2c8ec5c15c2fbf733d Mon Sep 17 00:00:00 2001 From: Christian Inkster Date: Wed, 2 Nov 2022 17:06:02 +0800 Subject: [PATCH 1/3] Allow editors to publish dashboards --- pkg/api/accesscontrol.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkg/api/accesscontrol.go b/pkg/api/accesscontrol.go index 3fd170c6b7035..1b528ad14c714 100644 --- a/pkg/api/accesscontrol.go +++ b/pkg/api/accesscontrol.go @@ -419,7 +419,7 @@ func (hs *HTTPServer) declareFixedRoles() error { {Action: dashboards.ActionDashboardsPublicWrite, Scope: dashboards.ScopeDashboardsAll}, }, }, - Grants: []string{"Admin"}, + Grants: []string{string(org.RoleEditor)}, } return hs.accesscontrolService.DeclareFixedRoles( From 8e1b8c4cfe7f939e18e595a067563c548886aa21 Mon Sep 17 00:00:00 2001 From: Christian Inkster Date: Tue, 8 Nov 2022 15:16:21 +0800 Subject: [PATCH 2/3] Enable public dashboards --- conf/defaults.ini | 2 ++ 1 file changed, 2 insertions(+) diff --git a/conf/defaults.ini b/conf/defaults.ini index cc2c8f0946656..f0b64da98dbef 100644 --- a/conf/defaults.ini +++ b/conf/defaults.ini @@ -1238,6 +1238,8 @@ license_path = # enable = feature1,feature2 enable = +publicDashboards = true + # The new prometheus visual query builder promQueryBuilder = true From 43e021a9aa65730f6966bdeb99f802fd5ab64f2b Mon Sep 17 00:00:00 2001 From: Christian Inkster Date: Tue, 19 Nov 2024 12:16:04 +0800 Subject: [PATCH 3/3] Allow hidden queries in Public dashboards --- .../publicdashboards/service/query.go | 23 +++++++++---------- 1 file changed, 11 insertions(+), 12 deletions(-) diff --git a/pkg/services/publicdashboards/service/query.go b/pkg/services/publicdashboards/service/query.go index d5c94b86993ee..9b47853f31734 100644 --- a/pkg/services/publicdashboards/service/query.go +++ b/pkg/services/publicdashboards/service/query.go @@ -247,19 +247,18 @@ func groupQueriesByPanelId(dashboard *simplejson.Json) map[int64][]*simplejson.J for _, queryObj := range panel.Get("targets").MustArray() { query := simplejson.NewFromAny(queryObj) - if hideAttr, exists := query.CheckGet("hide"); !exists || !hideAttr.MustBool() { - // We dont support exemplars for public dashboards currently - query.Del("exemplar") - - // if query target has no datasource, set it to have the datasource on the panel - if _, ok := query.CheckGet("datasource"); !ok { - uid := getDataSourceUidFromJson(panel) - datasource := map[string]interface{}{"type": "public-ds", "uid": uid} - query.Set("datasource", datasource) - } - - panelQueries = append(panelQueries, query) + // We dont support exemplars for public dashboards currently + query.Del("exemplar") + + // if query target has no datasource, set it to have the datasource on the panel + if _, ok := query.CheckGet("datasource"); !ok { + uid := getDataSourceUidFromJson(panel) + datasource := map[string]interface{}{"type": "public-ds", "uid": uid} + query.Set("datasource", datasource) } + + panelQueries = append(panelQueries, query) + } result[panel.Get("id").MustInt64()] = panelQueries