From c9e7bec6904cbacc062be1b47e7c9e0696b1a534 Mon Sep 17 00:00:00 2001 From: Christopher Kolstad Date: Wed, 28 Feb 2024 14:06:46 +0100 Subject: [PATCH] task: upgrade edge banner now toggleable by flag (#6363) So, since our assumption about client instances ended up being wrong (or, less than stable). This PR moves the EdgeUpgradeBanner to be displayed if the featureflag displayEdgeBanner is enabled. That way, if customers comes back and says they have upgraded but still get the banner, we can remove them from the segment. --- src/lib/__snapshots__/create-config.test.ts.snap | 1 + src/lib/routes/admin-api/config.ts | 6 ++++-- src/lib/types/experimental.ts | 9 +++++++-- 3 files changed, 12 insertions(+), 4 deletions(-) diff --git a/src/lib/__snapshots__/create-config.test.ts.snap b/src/lib/__snapshots__/create-config.test.ts.snap index 0ba0809c25..ff3e1d4c10 100644 --- a/src/lib/__snapshots__/create-config.test.ts.snap +++ b/src/lib/__snapshots__/create-config.test.ts.snap @@ -86,6 +86,7 @@ exports[`should create default config 1`] = ` "disableNotifications": false, "disablePublishUnannouncedEvents": false, "disableUpdateMaxRevisionId": false, + "displayEdgeBanner": false, "edgeBulkMetrics": false, "embedProxy": true, "embedProxyFrontend": true, diff --git a/src/lib/routes/admin-api/config.ts b/src/lib/routes/admin-api/config.ts index b166f7948c..3da2e79e36 100644 --- a/src/lib/routes/admin-api/config.ts +++ b/src/lib/routes/admin-api/config.ts @@ -7,8 +7,8 @@ import Controller from '../controller'; import VersionService from '../../services/version-service'; import SettingService from '../../services/setting-service'; import { - simpleAuthSettingsKey, SimpleAuthSettings, + simpleAuthSettingsKey, } from '../../types/settings/simple-auth-settings'; import { ADMIN, NONE } from '../../types/permissions'; import { createResponseSchema } from '../../openapi/util/create-response-schema'; @@ -153,7 +153,9 @@ class ConfigController extends Controller { const flags = { ...this.config.ui.flags, ...expFlags, - displayUpgradeEdgeBanner: usesOldEdge, + displayUpgradeEdgeBanner: + usesOldEdge || + this.config.flagResolver.isEnabled('displayEdgeBanner'), }; const response: UiConfigSchema = { diff --git a/src/lib/types/experimental.ts b/src/lib/types/experimental.ts index aeb3977000..cbaee15667 100644 --- a/src/lib/types/experimental.ts +++ b/src/lib/types/experimental.ts @@ -1,4 +1,4 @@ -import { Variant, PayloadType } from 'unleash-client'; +import { PayloadType, Variant } from 'unleash-client'; import { parseEnvVarBoolean } from '../util'; import { getDefaultVariant } from 'unleash-client/lib/variant'; @@ -51,7 +51,8 @@ export type IFlagKey = | 'disableUpdateMaxRevisionId' | 'disablePublishUnannouncedEvents' | 'sdkReporting' - | 'scimApi'; + | 'scimApi' + | 'displayEdgeBanner'; export type IFlags = Partial<{ [key in IFlagKey]: boolean | Variant }>; @@ -252,6 +253,10 @@ const flags: IFlags = { process.env.UNLEASH_EXPERIMENTAL_SCIM_API, false, ), + displayEdgeBanner: parseEnvVarBoolean( + process.env.UNLEASH_EXPERIMENTAL_DISPLAY_EDGE_BANNER, + false, + ), }; export const defaultExperimentalOptions: IExperimentalOptions = {