From 48ed9d89937af7ce409d5f6627b61b8a4864eed9 Mon Sep 17 00:00:00 2001 From: zhengkunwang <31820853+zhengkunwang223@users.noreply.github.com> Date: Thu, 7 Dec 2023 15:08:06 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E6=94=B9=E5=88=9B=E5=BB=BA?= =?UTF-8?q?=E6=9C=BA=E6=9E=84=E7=9A=84=E9=83=A8=E5=88=86=E6=A0=A1=E9=AA=8C?= =?UTF-8?q?=20(#3216)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- backend/app/service/runtime.go | 3 ++- backend/app/service/website_ssl.go | 2 +- backend/i18n/lang/en.yaml | 1 + backend/i18n/lang/zh-Hant.yaml | 1 + backend/i18n/lang/zh.yaml | 1 + frontend/src/global/form-rules.ts | 2 +- frontend/src/views/website/ssl/ca/create/index.vue | 4 ++-- frontend/src/views/website/ssl/ca/obtain/index.vue | 4 ++-- 8 files changed, 11 insertions(+), 7 deletions(-) diff --git a/backend/app/service/runtime.go b/backend/app/service/runtime.go index 248bbf4f4..ec6dcd89c 100644 --- a/backend/app/service/runtime.go +++ b/backend/app/service/runtime.go @@ -12,6 +12,7 @@ import ( "github.com/1Panel-dev/1Panel/backend/buserr" "github.com/1Panel-dev/1Panel/backend/constant" "github.com/1Panel-dev/1Panel/backend/global" + "github.com/1Panel-dev/1Panel/backend/i18n" cmd2 "github.com/1Panel-dev/1Panel/backend/utils/cmd" "github.com/1Panel-dev/1Panel/backend/utils/compose" "github.com/1Panel-dev/1Panel/backend/utils/docker" @@ -575,7 +576,7 @@ func (r *RuntimeService) SyncForRestart() error { for _, runtime := range runtimes { if runtime.Status == constant.RuntimeBuildIng || runtime.Status == constant.RuntimeReCreating || runtime.Status == constant.RuntimeStarting || runtime.Status == constant.RuntimeCreating { runtime.Status = constant.SystemRestart - runtime.Message = "System restart causing interrupt" + runtime.Message = i18n.GetMsgByKey("SystemRestart") _ = runtimeRepo.Save(&runtime) } } diff --git a/backend/app/service/website_ssl.go b/backend/app/service/website_ssl.go index 3d66d1d5b..e3d9b2ff0 100644 --- a/backend/app/service/website_ssl.go +++ b/backend/app/service/website_ssl.go @@ -498,7 +498,7 @@ func (w WebsiteSSLService) SyncForRestart() error { for _, ssl := range sslList { if ssl.Status == constant.SSLApply { ssl.Status = constant.SystemRestart - ssl.Message = "System restart causing interrupt" + ssl.Message = i18n.GetMsgByKey("SystemRestart") _ = websiteSSLRepo.Save(&ssl) } } diff --git a/backend/i18n/lang/en.yaml b/backend/i18n/lang/en.yaml index 0eb441561..b33dbcd92 100644 --- a/backend/i18n/lang/en.yaml +++ b/backend/i18n/lang/en.yaml @@ -22,6 +22,7 @@ ErrTypePort: 'Port {{ .name }} format error' ErrTypePortRange: 'Port range needs to be between 1-65535' Success: "Success" Failed: "Failed" +SystemRestart: "System restart causes task interruption" #app ErrPortInUsed: "{{ .detail }} port already in use" diff --git a/backend/i18n/lang/zh-Hant.yaml b/backend/i18n/lang/zh-Hant.yaml index 6b50167a5..412305d07 100644 --- a/backend/i18n/lang/zh-Hant.yaml +++ b/backend/i18n/lang/zh-Hant.yaml @@ -22,6 +22,7 @@ ErrTypePort: '埠 {{ .name }} 格式錯誤' ErrTypePortRange: '連接埠範圍需要在 1-65535 之間' Success: "成功" Failed: "失敗" +SystemRestart: "系統重啟導致任務中斷" #app ErrPortInUsed: "{{ .detail }} 端口已被佔用!" diff --git a/backend/i18n/lang/zh.yaml b/backend/i18n/lang/zh.yaml index ba9bdb4e2..47b6e6ab9 100644 --- a/backend/i18n/lang/zh.yaml +++ b/backend/i18n/lang/zh.yaml @@ -22,6 +22,7 @@ ErrTypePort: '端口 {{ .name }} 格式错误' ErrTypePortRange: '端口范围需要在 1-65535 之间' Success: "成功" Failed: "失败" +SystemRestart: "系统重启导致任务中断" #app ErrPortInUsed: "{{ .detail }} 端口已被占用!" diff --git a/frontend/src/global/form-rules.ts b/frontend/src/global/form-rules.ts index 175f546a3..07940006f 100644 --- a/frontend/src/global/form-rules.ts +++ b/frontend/src/global/form-rules.ts @@ -132,7 +132,7 @@ const checkName = (rule: any, value: any, callback: any) => { if (value === '' || typeof value === 'undefined' || value == null) { callback(new Error(i18n.global.t('commons.rule.commonName'))); } else { - const reg = /^[a-zA-Z0-9\u4e00-\u9fa5]{1}[a-zA-Z0-9_.\u4e00-\u9fa5-]{0,128}$/; + const reg = /^[a-zA-Z0-9\u4e00-\u9fa5]{1}[a-zA-Z0-9_.\u4e00-\u9fa5-]{0,127}$/; if (!reg.test(value) && value !== '') { callback(new Error(i18n.global.t('commons.rule.commonName'))); } else { diff --git a/frontend/src/views/website/ssl/ca/create/index.vue b/frontend/src/views/website/ssl/ca/create/index.vue index 91f742263..24c56e270 100644 --- a/frontend/src/views/website/ssl/ca/create/index.vue +++ b/frontend/src/views/website/ssl/ca/create/index.vue @@ -72,8 +72,8 @@ const rules = ref({ keyType: [Rules.requiredSelect], name: [Rules.requiredInput, Rules.name], country: [Rules.requiredSelect], - organization: [Rules.requiredInput], - commonName: [Rules.requiredInput], + organization: [Rules.requiredInput, Rules.name], + commonName: [Rules.requiredInput, Rules.name], }); const initData = () => ({ diff --git a/frontend/src/views/website/ssl/ca/obtain/index.vue b/frontend/src/views/website/ssl/ca/obtain/index.vue index 9380d9356..0c4b65325 100644 --- a/frontend/src/views/website/ssl/ca/obtain/index.vue +++ b/frontend/src/views/website/ssl/ca/obtain/index.vue @@ -87,8 +87,8 @@ const em = defineEmits(['close']); const rules = ref({ keyType: [Rules.requiredSelect], domains: [Rules.requiredInput], - time: [Rules.requiredInput, checkNumberRange(1, 1000)], dir: [Rules.requiredInput], + time: [Rules.integerNumber, checkNumberRange(1, 10000)], }); const initData = () => ({ @@ -116,7 +116,7 @@ const handleClose = () => { }; const resetForm = () => { - obtainForm.value.resetFields(); + obtainForm.value?.resetFields(); obtain.value = initData(); };