From 92c28b3ed146044b045b823eec6b4eb12049e57e Mon Sep 17 00:00:00 2001 From: zhengkunwang <31820853+zhengkunwang223@users.noreply.github.com> Date: Sat, 7 Oct 2023 04:00:47 -0500 Subject: [PATCH] =?UTF-8?q?feat:=20=E8=BF=90=E8=A1=8C=E7=8E=AF=E5=A2=83?= =?UTF-8?q?=E6=94=AF=E6=8C=81=E9=80=89=E6=8B=A9=E9=95=9C=E5=83=8F=E6=BA=90?= =?UTF-8?q?=20(#2441)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- backend/app/service/runtime.go | 3 ++ backend/app/service/runtime_utils.go | 1 + frontend/src/lang/modules/en.ts | 3 ++ frontend/src/lang/modules/tw.ts | 3 ++ frontend/src/lang/modules/zh.ts | 3 ++ .../website/runtime/node/operate/index.vue | 40 ++++++++++++++++--- 6 files changed, 48 insertions(+), 5 deletions(-) diff --git a/backend/app/service/runtime.go b/backend/app/service/runtime.go index 00a6b419f..85628a79c 100644 --- a/backend/app/service/runtime.go +++ b/backend/app/service/runtime.go @@ -278,6 +278,9 @@ func (r *RuntimeService) Get(id uint) (*response.RuntimeDTO, error) { res.Params[k] = v } } + if v, ok := envs["CONTAINER_PACKAGE_URL"]; ok { + res.Source = v + } } return &res, nil diff --git a/backend/app/service/runtime_utils.go b/backend/app/service/runtime_utils.go index 95a2196f8..7c38517c8 100644 --- a/backend/app/service/runtime_utils.go +++ b/backend/app/service/runtime_utils.go @@ -310,6 +310,7 @@ func handleParams(create request.RuntimeCreate, projectDir string) (composeConte } else { create.Params["RUN_INSTALL"] = "0" } + create.Params["CONTAINER_PACKAGE_URL"] = create.Source } newMap := make(map[string]string) diff --git a/frontend/src/lang/modules/en.ts b/frontend/src/lang/modules/en.ts index 963a7405d..c3575f947 100644 --- a/frontend/src/lang/modules/en.ts +++ b/frontend/src/lang/modules/en.ts @@ -1774,6 +1774,9 @@ const message = { 'The {0} operation will be performed on the selected operating environment. Do you want to continue? ', statusHelper: 'Status description: Starting - the container has been started, but the application is starting; abnormal - the container has been started, but the application status is abnormal', + taobao: 'Taobao', + tencent: 'Tencent', + imageSource: 'Image source', }, process: { pid: 'Process ID', diff --git a/frontend/src/lang/modules/tw.ts b/frontend/src/lang/modules/tw.ts index 2bf1f67db..373de1320 100644 --- a/frontend/src/lang/modules/tw.ts +++ b/frontend/src/lang/modules/tw.ts @@ -1676,6 +1676,9 @@ const message = { close: '關閉', operatorHelper: '將對選取的執行環境進行 {0} 操作,是否繼續? ', statusHelper: '狀態說明:啟動中-容器已啟動,但應用正在啟動;異常-容器已啟動,但應用狀態異常', + taobao: 'Taobao', + tencent: 'Tencent', + imageSource: 'Image source', }, process: { pid: '進程ID', diff --git a/frontend/src/lang/modules/zh.ts b/frontend/src/lang/modules/zh.ts index aab8c0824..6949030f4 100644 --- a/frontend/src/lang/modules/zh.ts +++ b/frontend/src/lang/modules/zh.ts @@ -1675,6 +1675,9 @@ const message = { close: '关闭', operatorHelper: '将对选中的运行环境进行 {0} 操作,是否继续?', statusHelper: '状态说明:启动中-容器已启动,但应用正在启动;异常-容器已启动,但应用状态异常', + taobao: '淘宝', + tencent: '腾讯', + imageSource: '镜像源', }, process: { pid: '进程ID', diff --git a/frontend/src/views/website/runtime/node/operate/index.vue b/frontend/src/views/website/runtime/node/operate/index.vue index ca6e65de8..b416564a5 100644 --- a/frontend/src/views/website/runtime/node/operate/index.vue +++ b/frontend/src/views/website/runtime/node/operate/index.vue @@ -82,20 +82,20 @@ {{ $t('runtime.runScriptHelper') }} - + {{ $t('runtime.appPortHelper') }} - + {{ $t('runtime.externalPortHelper') }} - + @@ -110,6 +110,19 @@ + + + + + + {{ $t('runtime.phpsourceHelper') }} + + @@ -171,24 +184,41 @@ const initData = (type: string) => ({ rebuild: false, codeDir: '/', port: 3000, + source: 'https://registry.npmjs.org/', }); let runtime = reactive(initData('node')); const rules = ref({ - name: [Rules.appName], + name: [Rules.requiredInput, Rules.appName], appID: [Rules.requiredSelect], codeDir: [Rules.requiredInput], port: [Rules.requiredInput, Rules.port], + source: [Rules.requiredSelect], params: { NODE_APP_PORT: [Rules.requiredInput, Rules.port], PACKAGE_MANAGER: [Rules.requiredSelect], HOST_IP: [Rules.requiredSelect], EXEC_SCRIPT: [Rules.requiredSelect], - CONTAINER_NAME: [Rules.requiredInput], + CONTAINER_NAME: [Rules.requiredInput, Rules.containerName], }, }); const scripts = ref([]); const em = defineEmits(['close']); +const imageSources = [ + { + label: i18n.global.t('runtime.default'), + value: 'https://registry.npmjs.org/', + }, + { + label: i18n.global.t('runtime.taobao'), + value: 'https://registry.npmmirror.com', + }, + { + label: i18n.global.t('runtime.tencent'), + value: 'https://mirrors.cloud.tencent.com/npm/', + }, +]; + watch( () => runtime.params['NODE_APP_PORT'], (newVal) => {