From e8865119ce0835b734df97b6979ea848e7183997 Mon Sep 17 00:00:00 2001 From: yazhou Date: Tue, 24 Sep 2024 17:24:55 +0800 Subject: [PATCH 1/2] feat: Add KUBESPHERE_EDITION constants to globals config Signed-off-by: yazhou --- packages/core/src/run.tsx | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/packages/core/src/run.tsx b/packages/core/src/run.tsx index 9564882edcf..ec7e92c1cf0 100644 --- a/packages/core/src/run.tsx +++ b/packages/core/src/run.tsx @@ -17,10 +17,12 @@ import i18n from './utils/i18n'; import emitter from './utils/emitter'; import App from './App'; -import { isEmpty } from 'lodash'; +import { isEmpty, set } from 'lodash'; -globals.context = new Context(); +set(globals, 'config.isKsEdition', process.env.KUBESPHERE_EDITION === 'ks'); +set(globals, 'config.isKseEdition', process.env.KUBESPHERE_EDITION === 'kse'); +globals.context = new Context(); if (!isEmpty(globals?.ksConfig?.enabledExtensionModulesStatus)) { Object.entries(globals.ksConfig.enabledExtensionModulesStatus).forEach(([key, value]) => { if ((value as Record).annotations) { From 9872d66b7fa280b52f93616c7328bcc93c0fc066 Mon Sep 17 00:00:00 2001 From: yazhou Date: Tue, 24 Sep 2024 17:50:11 +0800 Subject: [PATCH 2/2] refactor: Update KUBESPHERE_EDITION constants to globals config Signed-off-by: yazhou --- packages/core/src/run.tsx | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/core/src/run.tsx b/packages/core/src/run.tsx index ec7e92c1cf0..502d8b734a2 100644 --- a/packages/core/src/run.tsx +++ b/packages/core/src/run.tsx @@ -8,7 +8,7 @@ import React, { Suspense } from 'react'; import ReactDOM from 'react-dom'; import { Loading } from '@kubed/components'; -import { CacheStoreProvider } from '@ks-console/shared'; +import { CacheStoreProvider, ENV } from '@ks-console/shared'; import Context from './utils/Context'; import { registerInternalExtensions } from './utils/extensions.internal'; import { registerLocalExtensions } from './utils/extensions.local'; @@ -19,8 +19,8 @@ import emitter from './utils/emitter'; import App from './App'; import { isEmpty, set } from 'lodash'; -set(globals, 'config.isKsEdition', process.env.KUBESPHERE_EDITION === 'ks'); -set(globals, 'config.isKseEdition', process.env.KUBESPHERE_EDITION === 'kse'); +set(globals, 'config.isKsEdition', ENV.isKsEdition); +set(globals, 'config.isKseEdition', ENV.isKseEdition); globals.context = new Context(); if (!isEmpty(globals?.ksConfig?.enabledExtensionModulesStatus)) {