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

feat: insights out of beta and expose 2 widgets to pro (#7177)

1. Remove beta badge
2. Remove exposure from oss
3. Expose 2 widgets to pro and rest to enterprise
This commit is contained in:
Jaanus Sellin 2024-05-29 11:55:01 +03:00 committed by GitHub
parent 8d898c2ac9
commit ef9f09b58c
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
6 changed files with 110 additions and 89 deletions

View File

@ -22,6 +22,7 @@ import type {
import type { GroupedDataByProject } from './hooks/useGroupedProjectTrends'; import type { GroupedDataByProject } from './hooks/useGroupedProjectTrends';
import { allOption } from 'component/common/ProjectSelect/ProjectSelect'; import { allOption } from 'component/common/ProjectSelect/ProjectSelect';
import { chartInfo } from './chart-info'; import { chartInfo } from './chart-info';
import useUiConfig from 'hooks/api/getters/useUiConfig/useUiConfig';
interface IChartsProps { interface IChartsProps {
flags: InstanceInsightsSchema['flags']; flags: InstanceInsightsSchema['flags'];
@ -83,6 +84,7 @@ export const InsightsCharts: VFC<IChartsProps> = ({
allMetricsDatapoints, allMetricsDatapoints,
loading, loading,
}) => { }) => {
const { isEnterprise } = useUiConfig();
const showAllProjects = projects[0] === allOption.id; const showAllProjects = projects[0] === allOption.id;
const isOneProjectSelected = projects.length === 1; const isOneProjectSelected = projects.length === 1;
@ -143,11 +145,21 @@ export const InsightsCharts: VFC<IChartsProps> = ({
</ChartWidget> </ChartWidget>
} }
/> />
<ConditionallyRender
condition={isEnterprise()}
show={
<>
<Widget {...chartInfo.totalFlags}> <Widget {...chartInfo.totalFlags}>
<FlagStats <FlagStats
count={showAllProjects ? flags.total : summary.total} count={
showAllProjects
? flags.total
: summary.total
}
flagsPerUser={ flagsPerUser={
showAllProjects ? getFlagsPerUser(flags, users) : '' showAllProjects
? getFlagsPerUser(flags, users)
: ''
} }
isLoading={loading} isLoading={loading}
/> />
@ -165,7 +177,9 @@ export const InsightsCharts: VFC<IChartsProps> = ({
elseShow={ elseShow={
<ChartWidget {...chartInfo.flagsPerProject}> <ChartWidget {...chartInfo.flagsPerProject}>
<FlagsProjectChart <FlagsProjectChart
projectFlagTrends={groupedProjectsData} projectFlagTrends={
groupedProjectsData
}
isLoading={loading} isLoading={loading}
/> />
</ChartWidget> </ChartWidget>
@ -192,7 +206,9 @@ export const InsightsCharts: VFC<IChartsProps> = ({
</ChartWidget> </ChartWidget>
<Widget {...chartInfo.medianTimeToProduction}> <Widget {...chartInfo.medianTimeToProduction}>
<TimeToProduction <TimeToProduction
daysToProduction={summary.medianTimeToProduction} daysToProduction={
summary.medianTimeToProduction
}
/> />
</Widget> </Widget>
<ChartWidget <ChartWidget
@ -206,7 +222,14 @@ export const InsightsCharts: VFC<IChartsProps> = ({
isLoading={loading} isLoading={loading}
/> />
</ChartWidget> </ChartWidget>
</>
}
/>
</StyledGrid> </StyledGrid>
<ConditionallyRender
condition={isEnterprise()}
show={
<>
<Widget <Widget
{...(showAllProjects {...(showAllProjects
? chartInfo.metrics ? chartInfo.metrics
@ -229,5 +252,8 @@ export const InsightsCharts: VFC<IChartsProps> = ({
/> />
</Widget> </Widget>
</> </>
}
/>
</>
); );
}; };

View File

@ -10,7 +10,6 @@ import {
useTheme, useTheme,
} from '@mui/material'; } from '@mui/material';
import { PageHeader } from 'component/common/PageHeader/PageHeader'; import { PageHeader } from 'component/common/PageHeader/PageHeader';
import { Badge } from 'component/common/Badge/Badge';
import { ShareLink } from './ShareLink/ShareLink'; import { ShareLink } from './ShareLink/ShareLink';
import { ConditionallyRender } from 'component/common/ConditionallyRender/ConditionallyRender'; import { ConditionallyRender } from 'component/common/ConditionallyRender/ConditionallyRender';
@ -82,7 +81,6 @@ export const InsightsHeader: VFC<DashboardHeaderProps> = ({ actions }) => {
})} })}
> >
<span>Insights</span>{' '} <span>Insights</span>{' '}
<Badge color='success'>Beta</Badge>
</Typography> </Typography>
} }
actions={ actions={

View File

@ -242,12 +242,9 @@ const OldHeader: VFC = () => {
<StyledLink to={'/search'}>Search</StyledLink> <StyledLink to={'/search'}>Search</StyledLink>
<StyledLink to='/playground'>Playground</StyledLink> <StyledLink to='/playground'>Playground</StyledLink>
<ConditionallyRender <ConditionallyRender
condition={!killInsightsDashboard} condition={!killInsightsDashboard && !isOss()}
show={ show={
<StyledLinkWithBetaBadge <StyledLink to='/insights'>Insights</StyledLink>
to={'/insights'}
title={'Insights'}
/>
} }
/> />
<StyledAdvancedNavButton <StyledAdvancedNavButton

View File

@ -126,7 +126,7 @@ exports[`returns all baseRoutes 1`] = `
}, },
{ {
"component": [Function], "component": [Function],
"enterprise": false, "enterprise": true,
"menu": { "menu": {
"mobile": true, "mobile": true,
}, },

View File

@ -153,7 +153,7 @@ export const routes: IRoute[] = [
type: 'protected', type: 'protected',
menu: { mobile: true }, menu: { mobile: true },
notFlag: 'killInsightsUI', notFlag: 'killInsightsUI',
enterprise: false, enterprise: true,
}, },
// Applications // Applications

View File

@ -257,7 +257,7 @@ describe('Playground API E2E', () => {
if (features.length !== body.features.length) { if (features.length !== body.features.length) {
ctx.log( ctx.log(
`I expected the number of mapped toggles (${body.features.length}) to be the same as the number of created toggles (${features.length}), but that was not the case.`, `I expected the number of mapped flags (${body.features.length}) to be the same as the number of created toggles (${features.length}), but that was not the case.`,
); );
return false; return false;
} }