Public Dashboards: Add Public Tag to Dashboard Title (#52351)

Adds Public tag to dashboard title when it has an enabled public dashboard
This commit is contained in:
owensmallwood
2022-07-19 17:44:41 -06:00
committed by GitHub
parent acd85314b3
commit 3bc13e2335
13 changed files with 143 additions and 6 deletions

View File

@@ -77,6 +77,18 @@ func (hs *HTTPServer) GetDashboard(c *models.ReqContext) response.Response {
if rsp != nil {
return rsp
}
var (
hasPublicDashboard bool
err error
)
if hs.Features.IsEnabled(featuremgmt.FlagPublicDashboards) {
hasPublicDashboard, err = hs.PublicDashboardsApi.PublicDashboardService.PublicDashboardEnabled(c.Req.Context(), dash.Uid)
if err != nil {
return response.Error(500, "Error while retrieving public dashboards", err)
}
}
// When dash contains only keys id, uid that means dashboard data is not valid and json decode failed.
if dash.Data != nil {
isEmptyData := true
@@ -139,6 +151,7 @@ func (hs *HTTPServer) GetDashboard(c *models.ReqContext) response.Response {
Url: dash.GetUrl(),
FolderTitle: "General",
AnnotationsPermissions: annotationPermissions,
PublicDashboardEnabled: hasPublicDashboard,
}
// lookup folder title