1
0
mirror of https://github.com/Unleash/unleash.git synced 2025-07-31 13:47:02 +02:00

feat: when insights are enabled hide those widgets in other pages (#6675)

This commit is contained in:
Mateusz Kwasniewski 2024-03-22 12:09:31 +01:00 committed by GitHub
parent e0994b088a
commit a471f7369c
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 43 additions and 23 deletions

View File

@ -93,6 +93,15 @@ export const Project = () => {
path: basePath, path: basePath,
name: 'overview', name: 'overview',
}, },
...(projectOverviewRefactor
? [
{
title: 'Insights',
path: `${basePath}/insights`,
name: 'insights',
},
]
: []),
{ {
title: 'Health', title: 'Health',
path: `${basePath}/health`, path: `${basePath}/health`,
@ -109,12 +118,16 @@ export const Project = () => {
name: 'change-request', name: 'change-request',
isEnterprise: true, isEnterprise: true,
}, },
{ ...(!projectOverviewRefactor
title: 'Metrics', ? [
path: `${basePath}/metrics`, {
name: 'dora', title: 'Metrics',
isEnterprise: true, path: `${basePath}/metrics`,
}, name: 'dora',
isEnterprise: true,
},
]
: []),
{ {
title: 'Applications', title: 'Applications',
path: `${basePath}/applications`, path: `${basePath}/applications`,
@ -133,14 +146,6 @@ export const Project = () => {
}, },
]; ];
if (projectOverviewRefactor) {
tabs.splice(1, 0, {
title: 'Insights',
path: `${basePath}/insights`,
name: 'insights',
});
}
const filteredTabs = tabs const filteredTabs = tabs
.filter((tab) => { .filter((tab) => {
if (tab.flag) { if (tab.flag) {
@ -335,7 +340,9 @@ export const Project = () => {
} }
/> />
<Route path='settings/*' element={<ProjectSettings />} /> <Route path='settings/*' element={<ProjectSettings />} />
<Route path='metrics' element={<ProjectDoraMetrics />} /> {Boolean(!projectOverviewRefactor) && (
<Route path='metrics' element={<ProjectDoraMetrics />} />
)}
<Route path='applications' element={<ProjectApplications />} /> <Route path='applications' element={<ProjectApplications />} />
<Route path='*' element={<ProjectOverview />} /> <Route path='*' element={<ProjectOverview />} />
</Routes> </Routes>

View File

@ -9,6 +9,8 @@ import useProjectOverview, {
} from 'hooks/api/getters/useProjectOverview/useProjectOverview'; } from 'hooks/api/getters/useProjectOverview/useProjectOverview';
import { usePageTitle } from 'hooks/usePageTitle'; import { usePageTitle } from 'hooks/usePageTitle';
import { useLastViewedProject } from 'hooks/useLastViewedProject'; import { useLastViewedProject } from 'hooks/useLastViewedProject';
import { useUiFlag } from 'hooks/useUiFlag';
import { ConditionallyRender } from 'component/common/ConditionallyRender/ConditionallyRender';
const refreshInterval = 15 * 1000; const refreshInterval = 15 * 1000;
@ -36,6 +38,7 @@ const StyledContentContainer = styled(Box)(({ theme }) => ({
const ProjectOverview: FC<{ const ProjectOverview: FC<{
storageKey?: string; storageKey?: string;
}> = ({ storageKey = 'project-overview-v2' }) => { }> = ({ storageKey = 'project-overview-v2' }) => {
const projectOverviewRefactor = useUiFlag('projectOverviewRefactor');
const projectId = useRequiredPathParam('projectId'); const projectId = useRequiredPathParam('projectId');
const projectName = useProjectOverviewNameOrId(projectId); const projectName = useProjectOverviewNameOrId(projectId);
const { project } = useProjectOverview(projectId, { const { project } = useProjectOverview(projectId, {
@ -58,16 +61,26 @@ const ProjectOverview: FC<{
return ( return (
<StyledContainer key={projectId}> <StyledContainer key={projectId}>
<ProjectInfo <ConditionallyRender
id={projectId} condition={!projectOverviewRefactor}
description={description} show={
memberCount={members} <ProjectInfo
health={health} id={projectId}
featureTypeCounts={featureTypeCounts} description={description}
stats={stats} memberCount={members}
health={health}
featureTypeCounts={featureTypeCounts}
stats={stats}
/>
}
/> />
<StyledContentContainer> <StyledContentContainer>
<ProjectStats stats={project.stats} /> <ConditionallyRender
condition={!projectOverviewRefactor}
show={<ProjectStats stats={project.stats} />}
/>
<StyledProjectToggles> <StyledProjectToggles>
<ProjectFeatureToggles <ProjectFeatureToggles
environments={environments} environments={environments}