1
0
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:
Mateusz Kwasniewski 2024-11-19 10:51:37 +01:00 committed by GitHub
parent cd0a65a279
commit 04a7b05ac3
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 11 additions and 34 deletions

View File

@ -4,10 +4,8 @@ import useProjects from 'hooks/api/getters/useProjects/useProjects';
import { useLastViewedProject } from 'hooks/useLastViewedProject'; import { useLastViewedProject } from 'hooks/useLastViewedProject';
import Loader from './common/Loader/Loader'; import Loader from './common/Loader/Loader';
import { getSessionStorageItem, setSessionStorageItem } from 'utils/storage'; import { getSessionStorageItem, setSessionStorageItem } from 'utils/storage';
import { useUiFlag } from 'hooks/useUiFlag';
export const InitialRedirect = () => { export const InitialRedirect = () => {
const personalDashboardUiEnabled = useUiFlag('personalDashboardUI');
const { lastViewed } = useLastViewedProject(); const { lastViewed } = useLastViewedProject();
const { projects, loading } = useProjects(); const { projects, loading } = useProjects();
const navigate = useNavigate(); const navigate = useNavigate();
@ -19,16 +17,8 @@ export const InitialRedirect = () => {
return `/projects/${lastViewed}`; return `/projects/${lastViewed}`;
} }
if (personalDashboardUiEnabled) { return '/personal';
return '/personal'; }, [lastViewed, projects]);
}
if (projects && !lastViewed && projects.length === 1) {
return `/projects/${projects[0].id}`;
}
return '/projects';
}, [lastViewed, projects, personalDashboardUiEnabled]);
const redirect = () => { const redirect = () => {
navigate(sessionRedirect ?? getRedirect(), { replace: true }); navigate(sessionRedirect ?? getRedirect(), { replace: true });

View File

@ -24,7 +24,6 @@ import FlagIcon from '@mui/icons-material/OutlinedFlag';
import { ConditionallyRender } from 'component/common/ConditionallyRender/ConditionallyRender'; import { ConditionallyRender } from 'component/common/ConditionallyRender/ConditionallyRender';
import useProjectOverview from 'hooks/api/getters/useProjectOverview/useProjectOverview'; import useProjectOverview from 'hooks/api/getters/useProjectOverview/useProjectOverview';
import { ProjectIcon } from 'component/common/ProjectIcon/ProjectIcon'; import { ProjectIcon } from 'component/common/ProjectIcon/ProjectIcon';
import { useUiFlag } from 'hooks/useUiFlag';
const StyledBadgeContainer = styled('div')(({ theme }) => ({ const StyledBadgeContainer = styled('div')(({ theme }) => ({
paddingLeft: theme.spacing(2), paddingLeft: theme.spacing(2),
@ -157,21 +156,18 @@ export const PrimaryNavigationList: FC<{
activeItem?: string; activeItem?: string;
}> = ({ mode, onClick, activeItem }) => { }> = ({ mode, onClick, activeItem }) => {
const DynamicListItem = mode === 'mini' ? MiniListItem : FullListItem; const DynamicListItem = mode === 'mini' ? MiniListItem : FullListItem;
const personalDashboardUIEnabled = useUiFlag('personalDashboardUI');
const { isOss } = useUiConfig(); const { isOss } = useUiConfig();
return ( return (
<List> <List>
{personalDashboardUIEnabled ? ( <DynamicListItem
<DynamicListItem href='/personal'
href='/personal' text='Dashboard'
text='Dashboard' onClick={() => onClick('/personal')}
onClick={() => onClick('/personal')} selected={activeItem === '/personal'}
selected={activeItem === '/personal'} >
> <PersonalDashboardIcon />
<PersonalDashboardIcon /> </DynamicListItem>
</DynamicListItem>
) : null}
<DynamicListItem <DynamicListItem
href='/projects' href='/projects'

View File

@ -77,7 +77,7 @@ test('select active item', async () => {
const links = screen.getAllByRole('link'); const links = screen.getAllByRole('link');
expect(links[1]).toHaveClass(classes.selected); expect(links[2]).toHaveClass(classes.selected);
}); });
test('print recent projects and flags', async () => { test('print recent projects and flags', async () => {
@ -114,10 +114,6 @@ test('print recent projects and flags', async () => {
}); });
describe('order of items in navigation', () => { describe('order of items in navigation', () => {
const flags = {
personalDashboardUI: true,
};
const getLinks = async () => { const getLinks = async () => {
const configureButton = await screen.findByRole('button', { const configureButton = await screen.findByRole('button', {
name: /configure/i, name: /configure/i,
@ -142,9 +138,6 @@ describe('order of items in navigation', () => {
}; };
test('menu for open-source', async () => { test('menu for open-source', async () => {
testServerRoute(server, '/api/admin/ui-config', {
flags,
});
render(<NavigationSidebar />); render(<NavigationSidebar />);
expect(await getLinks()).toMatchSnapshot(); expect(await getLinks()).toMatchSnapshot();
@ -152,7 +145,6 @@ describe('order of items in navigation', () => {
test('menu for pro plan', async () => { test('menu for pro plan', async () => {
testServerRoute(server, '/api/admin/ui-config', { testServerRoute(server, '/api/admin/ui-config', {
flags,
versionInfo: { versionInfo: {
current: { enterprise: 'version' }, current: { enterprise: 'version' },
}, },
@ -166,7 +158,6 @@ describe('order of items in navigation', () => {
test('menu for enterprise plan', async () => { test('menu for enterprise plan', async () => {
testServerRoute(server, '/api/admin/ui-config', { testServerRoute(server, '/api/admin/ui-config', {
flags,
versionInfo: { versionInfo: {
current: { enterprise: 'version' }, current: { enterprise: 'version' },
}, },