From 84707e2bf3aa2241a60c92aa4fd40f5b6b6e34c2 Mon Sep 17 00:00:00 2001 From: andreas-unleash Date: Wed, 20 Mar 2024 17:21:46 +0200 Subject: [PATCH] chore: create new flag to hide insights ui (#6638) Creates a new flag to control the executive dashboard ui Closes # [1-2208](https://linear.app/unleash/issue/1-2208/create-separate-ui-flag-decoupled-from-the-backend-flag) --------- Signed-off-by: andreas-unleash --- frontend/src/component/menu/Header/Header.tsx | 2 +- .../menu/__tests__/__snapshots__/routes.test.tsx.snap | 2 +- frontend/src/component/menu/routes.ts | 2 +- frontend/src/interfaces/uiConfig.ts | 2 +- src/lib/__snapshots__/create-config.test.ts.snap | 1 + src/lib/types/experimental.ts | 5 +++++ src/server-dev.ts | 1 + 7 files changed, 11 insertions(+), 4 deletions(-) diff --git a/frontend/src/component/menu/Header/Header.tsx b/frontend/src/component/menu/Header/Header.tsx index b5e00b9bed0..5f8e8c0f688 100644 --- a/frontend/src/component/menu/Header/Header.tsx +++ b/frontend/src/component/menu/Header/Header.tsx @@ -176,7 +176,7 @@ const Header: VFC = () => { const increaseUnleashWidth = useUiFlag('increaseUnleashWidth'); const celebatoryUnleash = useUiFlag('celebrateUnleash'); - const insightsDashboard = useUiFlag('executiveDashboard'); + const insightsDashboard = useUiFlag('executiveDashboardUI'); const routes = getRoutes(); const adminRoutes = useAdminRoutes(); diff --git a/frontend/src/component/menu/__tests__/__snapshots__/routes.test.tsx.snap b/frontend/src/component/menu/__tests__/__snapshots__/routes.test.tsx.snap index 933ef8a36a6..7913e62e581 100644 --- a/frontend/src/component/menu/__tests__/__snapshots__/routes.test.tsx.snap +++ b/frontend/src/component/menu/__tests__/__snapshots__/routes.test.tsx.snap @@ -13,7 +13,7 @@ exports[`returns all baseRoutes 1`] = ` { "component": [Function], "enterprise": false, - "flag": "executiveDashboard", + "flag": "executiveDashboardUI", "menu": { "mobile": true, }, diff --git a/frontend/src/component/menu/routes.ts b/frontend/src/component/menu/routes.ts index ccc3fa42618..5e2e443f9ab 100644 --- a/frontend/src/component/menu/routes.ts +++ b/frontend/src/component/menu/routes.ts @@ -67,7 +67,7 @@ export const routes: IRoute[] = [ component: ExecutiveDashboard, type: 'protected', menu: { mobile: true }, - flag: 'executiveDashboard', + flag: 'executiveDashboardUI', enterprise: false, }, diff --git a/frontend/src/interfaces/uiConfig.ts b/frontend/src/interfaces/uiConfig.ts index aa7d20d756c..022dcf8e2b7 100644 --- a/frontend/src/interfaces/uiConfig.ts +++ b/frontend/src/interfaces/uiConfig.ts @@ -71,7 +71,7 @@ export type UiFlags = { newStrategyConfigurationFeedback?: boolean; extendedUsageMetricsUI?: boolean; adminTokenKillSwitch?: boolean; - executiveDashboard?: boolean; + executiveDashboardUI?: boolean; feedbackComments?: Variant; displayUpgradeEdgeBanner?: boolean; showInactiveUsers?: boolean; diff --git a/src/lib/__snapshots__/create-config.test.ts.snap b/src/lib/__snapshots__/create-config.test.ts.snap index df6078091ac..29342e86509 100644 --- a/src/lib/__snapshots__/create-config.test.ts.snap +++ b/src/lib/__snapshots__/create-config.test.ts.snap @@ -94,6 +94,7 @@ exports[`should create default config 1`] = ` "enableLicenseChecker": false, "encryptEmails": false, "executiveDashboard": false, + "executiveDashboardUI": false, "extendedUsageMetrics": false, "extendedUsageMetricsUI": false, "featureSearchFeedback": { diff --git a/src/lib/types/experimental.ts b/src/lib/types/experimental.ts index 4d936fd9f4e..e76256d5909 100644 --- a/src/lib/types/experimental.ts +++ b/src/lib/types/experimental.ts @@ -39,6 +39,7 @@ export type IFlagKey = | 'extendedUsageMetricsUI' | 'adminTokenKillSwitch' | 'executiveDashboard' + | 'executiveDashboardUI' | 'feedbackComments' | 'createdByUserIdDataMigration' | 'showInactiveUsers' @@ -196,6 +197,10 @@ const flags: IFlags = { process.env.UNLEASH_EXPERIMENTAL_EXECUTIVE_DASHBOARD, false, ), + executiveDashboardUI: parseEnvVarBoolean( + process.env.UNLEASH_EXPERIMENTAL_EXECUTIVE_DASHBOARD_UI, + false, + ), sdkReporting: parseEnvVarBoolean( process.env.UNLEASH_EXPERIMENTAL_SDK_REPORTING, false, diff --git a/src/server-dev.ts b/src/server-dev.ts index a76b25b4ef2..abbc9bfd137 100644 --- a/src/server-dev.ts +++ b/src/server-dev.ts @@ -48,6 +48,7 @@ process.nextTick(async () => { featureSearchFeedbackPosting: true, extendedUsageMetricsUI: true, executiveDashboard: true, + executiveDashboardUI: true, userAccessUIEnabled: true, sdkReporting: true, outdatedSdksBanner: true,