mirror of
https://github.com/Unleash/unleash.git
synced 2025-02-14 00:19:16 +01:00
chore: stop using personal dashboard UI flag (#8793)
This commit is contained in:
parent
cd0a65a279
commit
04a7b05ac3
@ -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 });
|
||||
|
@ -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 (
|
||||
<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'
|
||||
|
@ -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 () => {
|
||||
@ -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(<NavigationSidebar />);
|
||||
|
||||
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' },
|
||||
},
|
||||
|
Loading…
Reference in New Issue
Block a user