From cd1fffe054cf754d399b06431aa3eac804ea38a0 Mon Sep 17 00:00:00 2001 From: Ashley Harrison Date: Wed, 17 May 2023 10:29:58 +0100 Subject: [PATCH] =?UTF-8?q?NestedFolders:=20make=20sure=20DashboardPage=20?= =?UTF-8?q?code=20is=20feature=20toggled=20correc=E2=80=A6=20(#68606)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit NestedFolders: make sure DashboardPage code is feature toggled correctly (#68602) make sure DashboardPage code is feature toggled correctly (cherry picked from commit bbb679575728427efa199f9526f7eb13bc2921ff) --- .../dashboard/containers/DashboardPage.tsx | 20 ++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/public/app/features/dashboard/containers/DashboardPage.tsx b/public/app/features/dashboard/containers/DashboardPage.tsx index 0fa779d8b07..2445fff3b35 100644 --- a/public/app/features/dashboard/containers/DashboardPage.tsx +++ b/public/app/features/dashboard/containers/DashboardPage.tsx @@ -545,12 +545,22 @@ function updateStatePageNavFromProps(props: Props, state: State): State { // Check if folder changed const { folderTitle, folderUid } = dashboard.meta; - const folderNavModel = folderUid ? getNavModel(navIndex, `folder-dashboards-${folderUid}`).main : undefined; if (folderTitle && folderUid && pageNav && pageNav.parentItem?.text !== folderTitle) { - pageNav = { - ...pageNav, - parentItem: folderNavModel, - }; + if (config.featureToggles.nestedFolders) { + const folderNavModel = folderUid ? getNavModel(navIndex, `folder-dashboards-${folderUid}`).main : undefined; + pageNav = { + ...pageNav, + parentItem: folderNavModel, + }; + } else { + pageNav = { + ...pageNav, + parentItem: { + text: folderTitle, + url: `/dashboards/f/${dashboard.meta.folderUid}`, + }, + }; + } } if (props.route.routeName === DashboardRoutes.Path) {