From 04a7b05ac34ee0f427f443f76bc877f0cb9314d0 Mon Sep 17 00:00:00 2001 From: Mateusz Kwasniewski Date: Tue, 19 Nov 2024 10:51:37 +0100 Subject: [PATCH] chore: stop using personal dashboard UI flag (#8793) --- frontend/src/component/InitialRedirect.tsx | 14 ++----------- .../NavigationSidebar/NavigationList.tsx | 20 ++++++++----------- .../NavigationSidebar.test.tsx | 11 +--------- 3 files changed, 11 insertions(+), 34 deletions(-) diff --git a/frontend/src/component/InitialRedirect.tsx b/frontend/src/component/InitialRedirect.tsx index f65ba0e7186f..2ac97d278def 100644 --- a/frontend/src/component/InitialRedirect.tsx +++ b/frontend/src/component/InitialRedirect.tsx @@ -4,10 +4,8 @@ import useProjects from 'hooks/api/getters/useProjects/useProjects'; import { useLastViewedProject } from 'hooks/useLastViewedProject'; import Loader from './common/Loader/Loader'; import { getSessionStorageItem, setSessionStorageItem } from 'utils/storage'; -import { useUiFlag } from 'hooks/useUiFlag'; export const InitialRedirect = () => { - const personalDashboardUiEnabled = useUiFlag('personalDashboardUI'); const { lastViewed } = useLastViewedProject(); const { projects, loading } = useProjects(); const navigate = useNavigate(); @@ -19,16 +17,8 @@ export const InitialRedirect = () => { return `/projects/${lastViewed}`; } - if (personalDashboardUiEnabled) { - return '/personal'; - } - - if (projects && !lastViewed && projects.length === 1) { - return `/projects/${projects[0].id}`; - } - - return '/projects'; - }, [lastViewed, projects, personalDashboardUiEnabled]); + return '/personal'; + }, [lastViewed, projects]); const redirect = () => { navigate(sessionRedirect ?? getRedirect(), { replace: true }); diff --git a/frontend/src/component/layout/MainLayout/NavigationSidebar/NavigationList.tsx b/frontend/src/component/layout/MainLayout/NavigationSidebar/NavigationList.tsx index c1dc541ed549..5a96d4c81e74 100644 --- a/frontend/src/component/layout/MainLayout/NavigationSidebar/NavigationList.tsx +++ b/frontend/src/component/layout/MainLayout/NavigationSidebar/NavigationList.tsx @@ -24,7 +24,6 @@ import FlagIcon from '@mui/icons-material/OutlinedFlag'; import { ConditionallyRender } from 'component/common/ConditionallyRender/ConditionallyRender'; import useProjectOverview from 'hooks/api/getters/useProjectOverview/useProjectOverview'; import { ProjectIcon } from 'component/common/ProjectIcon/ProjectIcon'; -import { useUiFlag } from 'hooks/useUiFlag'; const StyledBadgeContainer = styled('div')(({ theme }) => ({ paddingLeft: theme.spacing(2), @@ -157,21 +156,18 @@ export const PrimaryNavigationList: FC<{ activeItem?: string; }> = ({ mode, onClick, activeItem }) => { const DynamicListItem = mode === 'mini' ? MiniListItem : FullListItem; - const personalDashboardUIEnabled = useUiFlag('personalDashboardUI'); const { isOss } = useUiConfig(); return ( - {personalDashboardUIEnabled ? ( - onClick('/personal')} - selected={activeItem === '/personal'} - > - - - ) : null} + onClick('/personal')} + selected={activeItem === '/personal'} + > + + { const links = screen.getAllByRole('link'); - expect(links[1]).toHaveClass(classes.selected); + expect(links[2]).toHaveClass(classes.selected); }); test('print recent projects and flags', async () => { @@ -114,10 +114,6 @@ test('print recent projects and flags', async () => { }); describe('order of items in navigation', () => { - const flags = { - personalDashboardUI: true, - }; - const getLinks = async () => { const configureButton = await screen.findByRole('button', { name: /configure/i, @@ -142,9 +138,6 @@ describe('order of items in navigation', () => { }; test('menu for open-source', async () => { - testServerRoute(server, '/api/admin/ui-config', { - flags, - }); render(); expect(await getLinks()).toMatchSnapshot(); @@ -152,7 +145,6 @@ describe('order of items in navigation', () => { test('menu for pro plan', async () => { testServerRoute(server, '/api/admin/ui-config', { - flags, versionInfo: { current: { enterprise: 'version' }, }, @@ -166,7 +158,6 @@ describe('order of items in navigation', () => { test('menu for enterprise plan', async () => { testServerRoute(server, '/api/admin/ui-config', { - flags, versionInfo: { current: { enterprise: 'version' }, },