mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
PublicDashboards: Time range setting added (#60487)
Time range added for public dashboard: - Enable/Disable switch added in public dashboard configuration. - Time range picker shown in public dashboard for viewer user
This commit is contained in:
@@ -101,9 +101,10 @@ func (hs *HTTPServer) GetDashboard(c *models.ReqContext) response.Response {
|
||||
}
|
||||
|
||||
var (
|
||||
hasPublicDashboard = false
|
||||
publicDashboardEnabled = false
|
||||
err error
|
||||
hasPublicDashboard = false
|
||||
publicDashboardEnabled = false
|
||||
publicDashboardTimeSelectionEnabled = false
|
||||
err error
|
||||
)
|
||||
|
||||
// If public dashboards is enabled and we have a public dashboard, update meta
|
||||
@@ -116,6 +117,7 @@ func (hs *HTTPServer) GetDashboard(c *models.ReqContext) response.Response {
|
||||
|
||||
if publicDashboard != nil {
|
||||
hasPublicDashboard = true
|
||||
publicDashboardTimeSelectionEnabled = publicDashboard.TimeSelectionEnabled
|
||||
publicDashboardEnabled = publicDashboard.IsEnabled
|
||||
}
|
||||
}
|
||||
@@ -167,27 +169,28 @@ func (hs *HTTPServer) GetDashboard(c *models.ReqContext) response.Response {
|
||||
}
|
||||
|
||||
meta := dtos.DashboardMeta{
|
||||
IsStarred: isStarred,
|
||||
Slug: dash.Slug,
|
||||
Type: models.DashTypeDB,
|
||||
CanStar: c.IsSignedIn,
|
||||
CanSave: canSave,
|
||||
CanEdit: canEdit,
|
||||
CanAdmin: canAdmin,
|
||||
CanDelete: canDelete,
|
||||
Created: dash.Created,
|
||||
Updated: dash.Updated,
|
||||
UpdatedBy: updater,
|
||||
CreatedBy: creator,
|
||||
Version: dash.Version,
|
||||
HasACL: dash.HasACL,
|
||||
IsFolder: dash.IsFolder,
|
||||
FolderId: dash.FolderId,
|
||||
Url: dash.GetUrl(),
|
||||
FolderTitle: "General",
|
||||
AnnotationsPermissions: annotationPermissions,
|
||||
PublicDashboardEnabled: publicDashboardEnabled,
|
||||
HasPublicDashboard: hasPublicDashboard,
|
||||
IsStarred: isStarred,
|
||||
Slug: dash.Slug,
|
||||
Type: models.DashTypeDB,
|
||||
CanStar: c.IsSignedIn,
|
||||
CanSave: canSave,
|
||||
CanEdit: canEdit,
|
||||
CanAdmin: canAdmin,
|
||||
CanDelete: canDelete,
|
||||
Created: dash.Created,
|
||||
Updated: dash.Updated,
|
||||
UpdatedBy: updater,
|
||||
CreatedBy: creator,
|
||||
Version: dash.Version,
|
||||
HasACL: dash.HasACL,
|
||||
IsFolder: dash.IsFolder,
|
||||
FolderId: dash.FolderId,
|
||||
Url: dash.GetUrl(),
|
||||
FolderTitle: "General",
|
||||
AnnotationsPermissions: annotationPermissions,
|
||||
PublicDashboardEnabled: publicDashboardEnabled,
|
||||
HasPublicDashboard: hasPublicDashboard,
|
||||
PublicDashboardTimeSelectionEnabled: publicDashboardTimeSelectionEnabled,
|
||||
}
|
||||
|
||||
// lookup folder title
|
||||
|
||||
Reference in New Issue
Block a user