Public Dashboards: Query Caching (#51403)
* passes id and uid to PublicDashboardDatasource * betterer results * If for a public dashboard, return the PublicDashboardDataSource first or else getDatasourceSrv.get() will fail bc of no authed user. Added some unit tests for resolving the uid from the many possible datasource types. * updates betterer * Exports DashboardService. Adds method to DashboardService to build anonymous user for use with public dashboards where there is no authed user. Adds method on dashboard_queries to get all dashboard uids from a dashboard. * refactors to get unique datasource uids * Adds tests for getting all unique datasource uids off a dashboard * adds test for building anonymous user with read and query actions that are scoped to each datasource uid in the dashboard * updates casing of DashboardService * updates test case to have additional panel with a different datasource * gives default interval to public dashboard data source
This commit is contained in:
+2
-2
@@ -407,7 +407,7 @@ func (hs *HTTPServer) buildStarredItemsNavLinks(c *models.ReqContext, prefs *pre
|
||||
Id: dashboardId,
|
||||
OrgId: c.OrgId,
|
||||
}
|
||||
err := hs.dashboardService.GetDashboard(c.Req.Context(), query)
|
||||
err := hs.DashboardService.GetDashboard(c.Req.Context(), query)
|
||||
if err == nil {
|
||||
starredDashboards = append(starredDashboards, query.Result)
|
||||
}
|
||||
@@ -674,7 +674,7 @@ func (hs *HTTPServer) buildAdminNavLinks(c *models.ReqContext) []*dtos.NavLink {
|
||||
|
||||
func (hs *HTTPServer) editorInAnyFolder(c *models.ReqContext) bool {
|
||||
hasEditPermissionInFoldersQuery := models.HasEditPermissionInFoldersQuery{SignedInUser: c.SignedInUser}
|
||||
if err := hs.dashboardService.HasEditPermissionInFolders(c.Req.Context(), &hasEditPermissionInFoldersQuery); err != nil {
|
||||
if err := hs.DashboardService.HasEditPermissionInFolders(c.Req.Context(), &hasEditPermissionInFoldersQuery); err != nil {
|
||||
return false
|
||||
}
|
||||
return hasEditPermissionInFoldersQuery.Result
|
||||
|
||||
Reference in New Issue
Block a user