From af41e8340b209b9159b5db7cf3d99f2fab136eee Mon Sep 17 00:00:00 2001 From: jingyang <3161362058@qq.com> Date: Tue, 2 Apr 2024 11:56:54 +0800 Subject: [PATCH] fix:license add CUSTOM_BASE_PATH env Signed-off-by: jingyang <3161362058@qq.com> --- service/license/.env | 1 + service/license/.env.template | 1 + .../license/src/pages/cluster/components/Tutorial.tsx | 9 +++++++-- service/license/src/pages/cluster/index.tsx | 7 ++++--- 4 files changed, 13 insertions(+), 5 deletions(-) create mode 100644 service/license/.env diff --git a/service/license/.env b/service/license/.env new file mode 100644 index 00000000000..68806d590a9 --- /dev/null +++ b/service/license/.env @@ -0,0 +1 @@ +CUSTOM_BASE_PATH="https://raw.githubusercontent.com/labring/sealos/main/scripts/cloud/install.sh" diff --git a/service/license/.env.template b/service/license/.env.template index 231e10e3941..bf163e8374e 100644 --- a/service/license/.env.template +++ b/service/license/.env.template @@ -1,6 +1,7 @@ PUBLIC_URL=. NEXT_PUBLIC_SERVICE=/service/ SEALOS_CLOUD_DOMAIN="cloud.sealos.io" +CUSTOM_BASE_PATH="" # GITHUB_CLIENT_ID= # GITHUB_CLIENT_SECRET= diff --git a/service/license/src/pages/cluster/components/Tutorial.tsx b/service/license/src/pages/cluster/components/Tutorial.tsx index b40bde9e276..47e7b9502e8 100644 --- a/service/license/src/pages/cluster/components/Tutorial.tsx +++ b/service/license/src/pages/cluster/components/Tutorial.tsx @@ -47,7 +47,12 @@ import ConfigForm from './ConfigForm'; const TAB_QUERY_PARAM = 'tab'; const TAB_QUERY_ARR = ['tutorial', 'cluster', 'license']; -export default function Tutorial({ ossFileUrl }: { ossFileUrl: string }) { +export type TutorialProps = { + ossFileUrl: string; + customBasePatch: string; +}; + +export default function Tutorial({ ossFileUrl, customBasePatch }: TutorialProps) { const { t } = useTranslation(); const { clusterDetail } = useClusterDetail(); const { copyData } = useCopyData(); @@ -241,7 +246,7 @@ export default function Tutorial({ ossFileUrl }: { ossFileUrl: string }) { diff --git a/service/license/src/pages/cluster/index.tsx b/service/license/src/pages/cluster/index.tsx index 0bcdf4e830f..147991385ed 100644 --- a/service/license/src/pages/cluster/index.tsx +++ b/service/license/src/pages/cluster/index.tsx @@ -29,11 +29,11 @@ import { serverSideTranslations } from 'next-i18next/serverSideTranslations'; import { useRouter } from 'next/router'; import { useEffect, useState } from 'react'; import ClusterList from './components/List'; -import Tutorial from './components/Tutorial'; +import Tutorial, { TutorialProps } from './components/Tutorial'; // Activation field systemId // Cluster recharge callback clusterId -export default function MyCluster({ ossFileUrl }: { ossFileUrl: string }) { +export default function MyCluster({ ossFileUrl, customBasePatch }: TutorialProps) { const { t } = useTranslation(); const { clusterDetail, setClusterDetail, clearClusterDetail } = useClusterDetail(); const [isLargerThanLG] = useMediaQuery(['(min-width: 992px)', '(display-mode: browser)']); @@ -152,7 +152,7 @@ export default function MyCluster({ ossFileUrl }: { ossFileUrl: string }) { - + @@ -248,6 +248,7 @@ export async function getServerSideProps({ req, res, locales }: any) { return { props: { ossFileUrl: process.env.OSS_FILE_URL, + customBasePatch: process.env.CUSTOM_BASE_PATH, ...(await serverSideTranslations(local, undefined, null, locales || [])) } };