Skip to content

Commit

Permalink
chore: stop using personal dashboard UI flag (#8793)
Browse files Browse the repository at this point in the history
  • Loading branch information
kwasniew authored Nov 19, 2024
1 parent cd0a65a commit 04a7b05
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 34 deletions.
14 changes: 2 additions & 12 deletions frontend/src/component/InitialRedirect.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand All @@ -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 });
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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),
Expand Down Expand Up @@ -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 (
<List>
{personalDashboardUIEnabled ? (
<DynamicListItem
href='/personal'
text='Dashboard'
onClick={() => onClick('/personal')}
selected={activeItem === '/personal'}
>
<PersonalDashboardIcon />
</DynamicListItem>
) : null}
<DynamicListItem
href='/personal'
text='Dashboard'
onClick={() => onClick('/personal')}
selected={activeItem === '/personal'}
>
<PersonalDashboardIcon />
</DynamicListItem>

<DynamicListItem
href='/projects'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ test('select active item', async () => {

const links = screen.getAllByRole('link');

expect(links[1]).toHaveClass(classes.selected);
expect(links[2]).toHaveClass(classes.selected);
});

test('print recent projects and flags', async () => {
Expand Down Expand Up @@ -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,
Expand All @@ -142,17 +138,13 @@ describe('order of items in navigation', () => {
};

test('menu for open-source', async () => {
testServerRoute(server, '/api/admin/ui-config', {
flags,
});
render(<NavigationSidebar />);

expect(await getLinks()).toMatchSnapshot();
});

test('menu for pro plan', async () => {
testServerRoute(server, '/api/admin/ui-config', {
flags,
versionInfo: {
current: { enterprise: 'version' },
},
Expand All @@ -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' },
},
Expand Down

0 comments on commit 04a7b05

Please sign in to comment.