+
{name && {name}}
{email && (
diff --git a/web/src/components/features/sidebars/SidebarSettings.tsx b/web/src/components/features/sidebars/SidebarSettings.tsx
index 67a514825..35f525743 100644
--- a/web/src/components/features/sidebars/SidebarSettings.tsx
+++ b/web/src/components/features/sidebars/SidebarSettings.tsx
@@ -63,7 +63,7 @@ const permissionAndSecurityItems: ISidebarGroup = {
export const SidebarSettings: React.FC<{}> = React.memo(({}) => {
const isAdmin = useUserConfigContextSelector((x) => x.isAdmin);
- const currentRoute = useAppLayoutContextSelector((x) => x.currentRoute);
+ const currentParentRoute = useAppLayoutContextSelector((x) => x.currentParentRoute);
const content = useMemo(() => {
const items = [accountItems];
@@ -78,7 +78,7 @@ export const SidebarSettings: React.FC<{}> = React.memo(({}) => {
}
- activeItem={currentRoute}
+ activeItem={currentParentRoute}
footer={}
/>
);
diff --git a/web/src/context/BusterAppLayout/AppLayoutProvider.tsx b/web/src/context/BusterAppLayout/AppLayoutProvider.tsx
index e3e8e8a04..2486432aa 100644
--- a/web/src/context/BusterAppLayout/AppLayoutProvider.tsx
+++ b/web/src/context/BusterAppLayout/AppLayoutProvider.tsx
@@ -1,9 +1,9 @@
'use client';
import { BusterRoutesWithArgsRoute, createBusterRoute } from '@/routes/busterRoutes';
-import { pathNameToRoute } from '@/routes/helpers';
-import { useMemoizedFn, usePrevious } from '@/hooks';
-import { useRouter, usePathname, useSelectedLayoutSegment, useParams } from 'next/navigation';
+import { pathNameToParentRoute, pathNameToRoute } from '@/routes/helpers';
+import { useMemoizedFn } from '@/hooks';
+import { useRouter, usePathname, useParams } from 'next/navigation';
import React, { PropsWithChildren } from 'react';
import { createContext, useContextSelector } from 'use-context-selector';
@@ -12,6 +12,7 @@ export const useAppLayout = () => {
const pathname = usePathname();
const params = useParams();
const currentRoute = pathNameToRoute(pathname, params);
+ const currentParentRoute = pathNameToParentRoute(pathname, params);
const [openInviteModal, setOpenInviteModal] = React.useState(false);
const onToggleInviteModal = useMemoizedFn((v?: boolean) => {
@@ -57,7 +58,8 @@ export const useAppLayout = () => {
currentRoute,
onToggleInviteModal,
openInviteModal,
- onChangePage
+ onChangePage,
+ currentParentRoute
};
};
diff --git a/web/src/controllers/CollectionIndividualController/CollectionsIndividualPopup.tsx b/web/src/controllers/CollectionIndividualController/CollectionsIndividualPopup.tsx
index dd5feb135..40291b251 100644
--- a/web/src/controllers/CollectionIndividualController/CollectionsIndividualPopup.tsx
+++ b/web/src/controllers/CollectionIndividualController/CollectionsIndividualPopup.tsx
@@ -39,7 +39,6 @@ const CollectionDeleteButton: React.FC<{
const onRemoveFromCollection = useMemoizedFn(async () => {
if (collection) {
- console.log(selectedRowKeys, collection);
await removeAssetFromCollection({
id: collectionId,
assets: (collection.assets || [])?.reduce<{ type: 'metric' | 'dashboard'; id: string }[]>(
diff --git a/web/src/controllers/DatasetPermissionUser/PermissionUsersSelectedPopup.tsx b/web/src/controllers/DatasetPermissionUser/PermissionUsersSelectedPopup.tsx
index a7bbb7795..45c778cbb 100644
--- a/web/src/controllers/DatasetPermissionUser/PermissionUsersSelectedPopup.tsx
+++ b/web/src/controllers/DatasetPermissionUser/PermissionUsersSelectedPopup.tsx
@@ -38,8 +38,6 @@ const options = PERMISSION_USERS_OPTIONS.map((v) => ({
icon: v.value === 'included' ? :
}));
-console.log(options);
-
const PermissionUsersAssignButton: React.FC<{
selectedRowKeys: string[];
onSelectChange: (selectedRowKeys: string[]) => void;
diff --git a/web/src/routes/helpers.tsx b/web/src/routes/helpers.tsx
index 3ea2d9d58..11a231f98 100644
--- a/web/src/routes/helpers.tsx
+++ b/web/src/routes/helpers.tsx
@@ -21,9 +21,53 @@ export const pathNameToRoute = (pathName: string, params: any): BusterRoutes =>
[BusterRoutes.APP_DATASETS_ID_PERMISSIONS_OVERVIEW]: BusterRoutes.APP_DATASETS,
[BusterRoutes.APP_DATASETS_ID_OVERVIEW]: BusterRoutes.APP_DATASETS,
[BusterRoutes.APP_DATASETS_ID_EDITOR]: BusterRoutes.APP_DATASETS,
- [BusterRoutes.APP_TERMS_ID]: BusterRoutes.APP_TERMS,
- [BusterRoutes.SETTINGS_USERS_ID]: BusterRoutes.SETTINGS_USERS
+ [BusterRoutes.APP_TERMS_ID]: BusterRoutes.APP_TERMS
};
+
+ if (route && paramRoutesToParent[route as string]) {
+ return paramRoutesToParent[route as string];
+ }
+
+ return route || BusterRoutes.ROOT;
+};
+
+export const pathNameToParentRoute = (pathName: string, params: any): BusterRoutes => {
+ const route = Object.values(BusterRoutes).find((r) => {
+ return r === pathName || createBusterRoute({ route: r, ...params }) === pathName;
+ });
+
+ const paramRoutesToParent: Record = {
+ [BusterRoutes.APP_CHAT_ID]: BusterRoutes.APP_CHAT,
+ [BusterRoutes.APP_CHAT_ID_DASHBOARD_ID]: BusterRoutes.APP_CHAT,
+ [BusterRoutes.APP_CHAT_ID_METRIC_ID]: BusterRoutes.APP_CHAT,
+ [BusterRoutes.APP_CHAT_ID_COLLECTION_ID]: BusterRoutes.APP_CHAT,
+ [BusterRoutes.APP_CHAT_ID_REASONING_ID]: BusterRoutes.APP_CHAT,
+ [BusterRoutes.APP_CHAT_ID_TERM_ID]: BusterRoutes.APP_CHAT,
+ [BusterRoutes.APP_CHAT_ID_VALUE_ID]: BusterRoutes.APP_CHAT,
+ [BusterRoutes.APP_METRIC_ID]: BusterRoutes.APP_METRIC,
+ [BusterRoutes.APP_DASHBOARD_METRICS_ID]: BusterRoutes.APP_DASHBOARDS,
+ [BusterRoutes.APP_DASHBOARD_ID]: BusterRoutes.APP_DASHBOARDS,
+ [BusterRoutes.APP_COLLECTIONS_ID]: BusterRoutes.APP_COLLECTIONS,
+ [BusterRoutes.APP_DATASETS_ID]: BusterRoutes.APP_DATASETS,
+ [BusterRoutes.APP_DATASETS_ID_PERMISSIONS_OVERVIEW]: BusterRoutes.APP_DATASETS,
+ [BusterRoutes.APP_DATASETS_ID_OVERVIEW]: BusterRoutes.APP_DATASETS,
+ [BusterRoutes.APP_DATASETS_ID_EDITOR]: BusterRoutes.APP_DATASETS,
+ [BusterRoutes.APP_TERMS_ID]: BusterRoutes.APP_TERMS,
+ [BusterRoutes.SETTINGS_USERS_ID]: BusterRoutes.SETTINGS_USERS,
+ [BusterRoutes.SETTINGS_USERS_ID_DATASETS]: BusterRoutes.SETTINGS_USERS,
+ [BusterRoutes.SETTINGS_USERS_ID_PERMISSION_GROUPS]: BusterRoutes.SETTINGS_USERS,
+ [BusterRoutes.SETTINGS_USERS_ID_TEAMS]: BusterRoutes.SETTINGS_USERS,
+ [BusterRoutes.SETTINGS_USERS_ID_DATASET_GROUPS]: BusterRoutes.SETTINGS_USERS,
+ [BusterRoutes.SETTINGS_DATASET_GROUPS_ID_PERMISSION_GROUPS]:
+ BusterRoutes.SETTINGS_DATASET_GROUPS,
+ [BusterRoutes.SETTINGS_DATASET_GROUPS_ID_DATASETS]: BusterRoutes.SETTINGS_DATASET_GROUPS,
+ [BusterRoutes.SETTINGS_DATASET_GROUPS_ID_USERS]: BusterRoutes.SETTINGS_DATASET_GROUPS,
+ [BusterRoutes.SETTINGS_PERMISSION_GROUPS_ID_USERS]: BusterRoutes.SETTINGS_PERMISSION_GROUPS,
+ [BusterRoutes.SETTINGS_PERMISSION_GROUPS_ID_DATASET_GROUPS]:
+ BusterRoutes.SETTINGS_PERMISSION_GROUPS,
+ [BusterRoutes.SETTINGS_PERMISSION_GROUPS_ID_DATASETS]: BusterRoutes.SETTINGS_PERMISSION_GROUPS
+ };
+
if (route && paramRoutesToParent[route as string]) {
return paramRoutesToParent[route as string];
}