From 38df2e1831a74dfe9f32ce1fb7f5e1e563dddc3f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ivar=20Conradi=20=C3=98sthus?= Date: Tue, 30 Jan 2024 11:05:27 +0100 Subject: [PATCH] fix: add instanceName to license display (#6065) ## About the changes - Shows the instanceName from the license - add new feature flag `enableLicenseChecker` used to enforce a valid license. --- frontend/src/component/admin/license/License.tsx | 14 +++++++++++--- .../src/hooks/api/getters/useLicense/useLicense.ts | 1 + src/lib/__snapshots__/create-config.test.ts.snap | 1 + src/lib/types/experimental.ts | 2 ++ 4 files changed, 15 insertions(+), 3 deletions(-) diff --git a/frontend/src/component/admin/license/License.tsx b/frontend/src/component/admin/license/License.tsx index f795e6b3f5..40d4e2e2a3 100644 --- a/frontend/src/component/admin/license/License.tsx +++ b/frontend/src/component/admin/license/License.tsx @@ -80,19 +80,27 @@ export const License = () => { Customer - {license?.customer} + {license.customer} + + + + + Instance Name + + + {license.instanceName} Plan - {license?.plan} + {license.plan} Seats - {license?.seats} + {license.seats} diff --git a/frontend/src/hooks/api/getters/useLicense/useLicense.ts b/frontend/src/hooks/api/getters/useLicense/useLicense.ts index 9660aa3ccd..e740a1f01b 100644 --- a/frontend/src/hooks/api/getters/useLicense/useLicense.ts +++ b/frontend/src/hooks/api/getters/useLicense/useLicense.ts @@ -21,6 +21,7 @@ export interface License { license?: { token: string; customer: string; + instanceName: string; plan: string; seats: number; expireAt: Date; diff --git a/src/lib/__snapshots__/create-config.test.ts.snap b/src/lib/__snapshots__/create-config.test.ts.snap index 038467708b..7ea030febc 100644 --- a/src/lib/__snapshots__/create-config.test.ts.snap +++ b/src/lib/__snapshots__/create-config.test.ts.snap @@ -90,6 +90,7 @@ exports[`should create default config 1`] = ` "embedProxy": true, "embedProxyFrontend": true, "enableLicense": false, + "enableLicenseChecker": false, "encryptEmails": false, "executiveDashboard": false, "extendedUsageMetrics": false, diff --git a/src/lib/types/experimental.ts b/src/lib/types/experimental.ts index 4fd63ab5fd..d00990d142 100644 --- a/src/lib/types/experimental.ts +++ b/src/lib/types/experimental.ts @@ -7,6 +7,7 @@ export type IFlagKey = | 'anonymiseEventLog' | 'encryptEmails' | 'enableLicense' + | 'enableLicenseChecker' | 'embedProxy' | 'embedProxyFrontend' | 'responseTimeWithAppNameKillSwitch' @@ -55,6 +56,7 @@ export type IFlags = Partial<{ [key in IFlagKey]: boolean | Variant }>; const flags: IFlags = { anonymiseEventLog: false, enableLicense: false, + enableLicenseChecker: false, embedProxy: parseEnvVarBoolean( process.env.UNLEASH_EXPERIMENTAL_EMBED_PROXY, true,