From ef9f09b58ceecb4a1eb8c6423c7e215100436eec Mon Sep 17 00:00:00 2001 From: Jaanus Sellin Date: Wed, 29 May 2024 11:55:01 +0300 Subject: [PATCH] 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 --- .../src/component/insights/InsightsCharts.tsx | 184 ++++++++++-------- .../InsightsHeader/InsightsHeader.tsx | 2 - .../src/component/menu/Header/OldHeader.tsx | 7 +- .../__snapshots__/routes.test.tsx.snap | 2 +- frontend/src/component/menu/routes.ts | 2 +- src/test/e2e/api/admin/playground.e2e.test.ts | 2 +- 6 files changed, 110 insertions(+), 89 deletions(-) diff --git a/frontend/src/component/insights/InsightsCharts.tsx b/frontend/src/component/insights/InsightsCharts.tsx index 637bde06d4..8bcea8cc40 100644 --- a/frontend/src/component/insights/InsightsCharts.tsx +++ b/frontend/src/component/insights/InsightsCharts.tsx @@ -22,6 +22,7 @@ import type { import type { GroupedDataByProject } from './hooks/useGroupedProjectTrends'; import { allOption } from 'component/common/ProjectSelect/ProjectSelect'; import { chartInfo } from './chart-info'; +import useUiConfig from 'hooks/api/getters/useUiConfig/useUiConfig'; interface IChartsProps { flags: InstanceInsightsSchema['flags']; @@ -83,6 +84,7 @@ export const InsightsCharts: VFC = ({ allMetricsDatapoints, loading, }) => { + const { isEnterprise } = useUiConfig(); const showAllProjects = projects[0] === allOption.id; const isOneProjectSelected = projects.length === 1; @@ -143,91 +145,115 @@ export const InsightsCharts: VFC = ({ } /> - - - - + + + + + + + } + elseShow={ + + + + } /> - - } - elseShow={ - - - + + + + + + + + + + + + + } /> - - - - - - - - - - - - - - - - theme.spacing(2) }} - > - - + + + + + theme.spacing(2) }} + > + + + + } + /> ); }; diff --git a/frontend/src/component/insights/components/InsightsHeader/InsightsHeader.tsx b/frontend/src/component/insights/components/InsightsHeader/InsightsHeader.tsx index 75fc56a9c3..cfb1210556 100644 --- a/frontend/src/component/insights/components/InsightsHeader/InsightsHeader.tsx +++ b/frontend/src/component/insights/components/InsightsHeader/InsightsHeader.tsx @@ -10,7 +10,6 @@ import { useTheme, } from '@mui/material'; import { PageHeader } from 'component/common/PageHeader/PageHeader'; -import { Badge } from 'component/common/Badge/Badge'; import { ShareLink } from './ShareLink/ShareLink'; import { ConditionallyRender } from 'component/common/ConditionallyRender/ConditionallyRender'; @@ -82,7 +81,6 @@ export const InsightsHeader: VFC = ({ actions }) => { })} > Insights{' '} - Beta } actions={ diff --git a/frontend/src/component/menu/Header/OldHeader.tsx b/frontend/src/component/menu/Header/OldHeader.tsx index f85b0b010e..f8dd1d57ed 100644 --- a/frontend/src/component/menu/Header/OldHeader.tsx +++ b/frontend/src/component/menu/Header/OldHeader.tsx @@ -242,12 +242,9 @@ const OldHeader: VFC = () => { Search Playground + Insights } /> { if (features.length !== body.features.length) { 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; }