From 198a977f57411482d3ef62ba47d251eae2c23946 Mon Sep 17 00:00:00 2001 From: Cornelius Suermann Date: Wed, 16 Aug 2023 10:05:03 +0200 Subject: [PATCH] feat(core): Show a banner when running a non-prod license (no-changelog) (#6849) * add feat:showNonProdBanner * fix linting * fix linting --- packages/cli/src/Server.ts | 5 +++++ packages/cli/src/constants.ts | 1 + packages/cli/src/controllers/e2e.controller.ts | 1 + .../editor-ui/src/__tests__/server/endpoints/settings.ts | 2 ++ packages/workflow/src/Interfaces.ts | 1 + 5 files changed, 10 insertions(+) diff --git a/packages/cli/src/Server.ts b/packages/cli/src/Server.ts index 8104b2ea32353..2a2a532944e86 100644 --- a/packages/cli/src/Server.ts +++ b/packages/cli/src/Server.ts @@ -66,6 +66,7 @@ import { GENERATED_STATIC_DIR, inDevelopment, inE2ETests, + LICENSE_FEATURES, N8N_VERSION, RESPONSE_ERROR_MESSAGES, TEMPLATES_DIR, @@ -311,6 +312,7 @@ export class Server extends AbstractServer { variables: false, sourceControl: false, auditLogs: false, + showNonProdBanner: false, debugInEditor: false, }, hideUsagePage: config.getEnv('hideUsagePage'), @@ -441,6 +443,9 @@ export class Server extends AbstractServer { advancedExecutionFilters: isAdvancedExecutionFiltersEnabled(), variables: isVariablesEnabled(), sourceControl: isSourceControlLicensed(), + showNonProdBanner: Container.get(License).isFeatureEnabled( + LICENSE_FEATURES.SHOW_NON_PROD_BANNER, + ), debugInEditor: isDebugInEditorLicensed(), }); diff --git a/packages/cli/src/constants.ts b/packages/cli/src/constants.ts index 037afc6bbbb1b..12f08845575dd 100644 --- a/packages/cli/src/constants.ts +++ b/packages/cli/src/constants.ts @@ -75,6 +75,7 @@ export const LICENSE_FEATURES = { VARIABLES: 'feat:variables', SOURCE_CONTROL: 'feat:sourceControl', API_DISABLED: 'feat:apiDisabled', + SHOW_NON_PROD_BANNER: 'feat:showNonProdBanner', WORKFLOW_HISTORY: 'feat:workflowHistory', DEBUG_IN_EDITOR: 'feat:debugInEditor', } as const; diff --git a/packages/cli/src/controllers/e2e.controller.ts b/packages/cli/src/controllers/e2e.controller.ts index 7d1118769275f..d2497eddca24f 100644 --- a/packages/cli/src/controllers/e2e.controller.ts +++ b/packages/cli/src/controllers/e2e.controller.ts @@ -61,6 +61,7 @@ export class E2EController { [LICENSE_FEATURES.SOURCE_CONTROL]: false, [LICENSE_FEATURES.VARIABLES]: false, [LICENSE_FEATURES.API_DISABLED]: false, + [LICENSE_FEATURES.SHOW_NON_PROD_BANNER]: false, [LICENSE_FEATURES.WORKFLOW_HISTORY]: false, [LICENSE_FEATURES.DEBUG_IN_EDITOR]: false, }; diff --git a/packages/editor-ui/src/__tests__/server/endpoints/settings.ts b/packages/editor-ui/src/__tests__/server/endpoints/settings.ts index c8e17f65c0eae..97534dac3a456 100644 --- a/packages/editor-ui/src/__tests__/server/endpoints/settings.ts +++ b/packages/editor-ui/src/__tests__/server/endpoints/settings.ts @@ -18,6 +18,8 @@ const defaultSettings: IN8nUISettings = { variables: true, sourceControl: false, auditLogs: false, + versionControl: false, + showNonProdBanner: false, }, executionMode: 'regular', executionTimeout: 0, diff --git a/packages/workflow/src/Interfaces.ts b/packages/workflow/src/Interfaces.ts index c5cec473a257d..d215a2df6bff2 100644 --- a/packages/workflow/src/Interfaces.ts +++ b/packages/workflow/src/Interfaces.ts @@ -2185,6 +2185,7 @@ export interface IN8nUISettings { variables: boolean; sourceControl: boolean; auditLogs: boolean; + showNonProdBanner: boolean; debugInEditor: boolean; }; hideUsagePage: boolean;