Dashboard: Only show Starred as parent breadcrumb for starred dashboards (#87145)

don't update pageNav to have folder if sectionNav is starred
This commit is contained in:
Ashley Harrison 2024-05-01 09:55:31 +01:00 committed by GitHub
parent 5cee521dc9
commit f15f21a13f
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -458,19 +458,6 @@ function updateStatePageNavFromProps(props: Props, state: State): State {
};
}
const { folderUid } = dashboard.meta;
if (folderUid && pageNav) {
const folderNavModel = getNavModel(navIndex, `folder-dashboards-${folderUid}`).main;
// If the folder hasn't loaded (maybe user doesn't have permission on it?) then
// don't show the "page not found" breadcrumb
if (folderNavModel.id !== 'not-found') {
pageNav = {
...pageNav,
parentItem: folderNavModel,
};
}
}
if (props.route.routeName === DashboardRoutes.Path) {
sectionNav = getRootContentNavModel();
const pageNav = getPageNavFromSlug(props.match.params.slug!);
@ -485,6 +472,19 @@ function updateStatePageNavFromProps(props: Props, state: State): State {
);
}
const { folderUid } = dashboard.meta;
if (folderUid && pageNav && sectionNav.main.id !== 'starred') {
const folderNavModel = getNavModel(navIndex, `folder-dashboards-${folderUid}`).main;
// If the folder hasn't loaded (maybe user doesn't have permission on it?) then
// don't show the "page not found" breadcrumb
if (folderNavModel.id !== 'not-found') {
pageNav = {
...pageNav,
parentItem: folderNavModel,
};
}
}
if (state.editPanel || state.viewPanel) {
pageNav = {
...pageNav,