mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
Dashboards: Fix Dashboards not loading when user doesn't have permission on the parent folder (#76028)
This commit is contained in:
parent
46c1c03183
commit
c5914d92d4
@ -539,7 +539,9 @@ export class BackendSrv implements BackendService {
|
|||||||
queryParams.set('accesscontrol', 'true');
|
queryParams.set('accesscontrol', 'true');
|
||||||
}
|
}
|
||||||
|
|
||||||
return this.get<FolderDTO>(`/api/folders/${uid}?${queryParams.toString()}`);
|
return this.get<FolderDTO>(`/api/folders/${uid}?${queryParams.toString()}`, undefined, undefined, {
|
||||||
|
showErrorAlert: false,
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -449,10 +449,14 @@ function updateStatePageNavFromProps(props: Props, state: State): State {
|
|||||||
if (folderUid && pageNav) {
|
if (folderUid && pageNav) {
|
||||||
if (newBrowseDashboardsEnabled()) {
|
if (newBrowseDashboardsEnabled()) {
|
||||||
const folderNavModel = getNavModel(navIndex, `folder-dashboards-${folderUid}`).main;
|
const folderNavModel = getNavModel(navIndex, `folder-dashboards-${folderUid}`).main;
|
||||||
pageNav = {
|
// If the folder hasn't loaded (maybe user doesn't have permission on it?) then
|
||||||
...pageNav,
|
// don't show the "page not found" breadcrumb
|
||||||
parentItem: folderNavModel,
|
if (folderNavModel.id !== 'not-found') {
|
||||||
};
|
pageNav = {
|
||||||
|
...pageNav,
|
||||||
|
parentItem: folderNavModel,
|
||||||
|
};
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
// Check if folder changed
|
// Check if folder changed
|
||||||
if (folderTitle && pageNav.parentItem?.text !== folderTitle) {
|
if (folderTitle && pageNav.parentItem?.text !== folderTitle) {
|
||||||
|
@ -93,8 +93,13 @@ async function fetchDashboard(
|
|||||||
// get parent folder (if it exists) and put it in the store
|
// get parent folder (if it exists) and put it in the store
|
||||||
// this will be used to populate the full breadcrumb trail
|
// this will be used to populate the full breadcrumb trail
|
||||||
if (newBrowseDashboardsEnabled() && dashDTO.meta.folderUid) {
|
if (newBrowseDashboardsEnabled() && dashDTO.meta.folderUid) {
|
||||||
await dispatch(getFolderByUid(dashDTO.meta.folderUid));
|
try {
|
||||||
|
await dispatch(getFolderByUid(dashDTO.meta.folderUid));
|
||||||
|
} catch (err) {
|
||||||
|
console.warn('Error fetching parent folder', dashDTO.meta.folderUid, 'for dashboard', err);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (args.fixUrl && dashDTO.meta.url && !playlistSrv.isPlaying) {
|
if (args.fixUrl && dashDTO.meta.url && !playlistSrv.isPlaying) {
|
||||||
// check if the current url is correct (might be old slug)
|
// check if the current url is correct (might be old slug)
|
||||||
const dashboardUrl = locationUtil.stripBaseFromUrl(dashDTO.meta.url);
|
const dashboardUrl = locationUtil.stripBaseFromUrl(dashDTO.meta.url);
|
||||||
|
Loading…
Reference in New Issue
Block a user