From 0bccd31714cf159c9169aa5763120d3b231d3e6c Mon Sep 17 00:00:00 2001 From: shiziyuan9527 Date: Tue, 29 Nov 2022 14:26:49 +0800 Subject: [PATCH] =?UTF-8?q?refactor(=E7=B3=BB=E7=BB=9F=E8=AE=BE=E7=BD=AE):?= =?UTF-8?q?=20=E4=BF=AE=E6=94=B9=E5=B7=A5=E4=BD=9C=E7=A9=BA=E9=97=B4?= =?UTF-8?q?=E5=90=8D=E7=A7=B0=E6=A0=A1=E9=AA=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --story=1010451 --user=李玉号 优化工作空间命名提示描述 https://www.tapd.cn/55049933/s/1307418 --- .../java/io/metersphere/service/WorkspaceService.java | 4 ++++ .../src/main/resources/i18n/messages_en_US.properties | 1 + .../src/main/resources/i18n/messages_zh_CN.properties | 1 + .../src/main/resources/i18n/messages_zh_TW.properties | 1 + .../frontend/src/business/system/SystemWorkspace.vue | 11 ++--------- 5 files changed, 9 insertions(+), 9 deletions(-) diff --git a/system-setting/backend/src/main/java/io/metersphere/service/WorkspaceService.java b/system-setting/backend/src/main/java/io/metersphere/service/WorkspaceService.java index bbd712d3dd..e71274b39e 100644 --- a/system-setting/backend/src/main/java/io/metersphere/service/WorkspaceService.java +++ b/system-setting/backend/src/main/java/io/metersphere/service/WorkspaceService.java @@ -218,6 +218,10 @@ public class WorkspaceService { MSException.throwException(Translator.get("workspace_name_is_null")); } + if (workspace.getName().length() > 100) { + MSException.throwException(Translator.get("workspace_name_exceeds_length_limit")); + } + WorkspaceExample example = new WorkspaceExample(); WorkspaceExample.Criteria criteria = example.createCriteria(); criteria.andNameEqualTo(workspace.getName()); diff --git a/system-setting/backend/src/main/resources/i18n/messages_en_US.properties b/system-setting/backend/src/main/resources/i18n/messages_en_US.properties index c510f978cb..5fbe8efd38 100644 --- a/system-setting/backend/src/main/resources/i18n/messages_en_US.properties +++ b/system-setting/backend/src/main/resources/i18n/messages_en_US.properties @@ -1,3 +1,4 @@ error_lang_invalid=Invalid language parameter, new read_permission_file_fail=Failed to read permission file! platform_plugin_not_exit=Platform docking function has been plug-in, please download the corresponding version of the plug-in: +workspace_name_exceeds_length_limit=Workspace name exceeds length limit \ No newline at end of file diff --git a/system-setting/backend/src/main/resources/i18n/messages_zh_CN.properties b/system-setting/backend/src/main/resources/i18n/messages_zh_CN.properties index 13d5fb8b57..f22d4f8993 100644 --- a/system-setting/backend/src/main/resources/i18n/messages_zh_CN.properties +++ b/system-setting/backend/src/main/resources/i18n/messages_zh_CN.properties @@ -1,3 +1,4 @@ error_lang_invalid=语言参数错误, 新 read_permission_file_fail=读取权限文件失败! platform_plugin_not_exit=平台对接功能已插件化,请下载对应版本的插件: +workspace_name_exceeds_length_limit=工作空间名称超出长度限制 \ No newline at end of file diff --git a/system-setting/backend/src/main/resources/i18n/messages_zh_TW.properties b/system-setting/backend/src/main/resources/i18n/messages_zh_TW.properties index d9c061a608..d22fe908c7 100644 --- a/system-setting/backend/src/main/resources/i18n/messages_zh_TW.properties +++ b/system-setting/backend/src/main/resources/i18n/messages_zh_TW.properties @@ -1,3 +1,4 @@ error_lang_invalid=語言參數錯誤,新 read_permission_file_fail=讀取權限文件失敗! platform_plugin_not_exit=平臺對接功能已插件化,請下載對應版本的插件: +workspace_name_exceeds_length_limit=工作空間名稱超出長度限制 \ No newline at end of file diff --git a/system-setting/frontend/src/business/system/SystemWorkspace.vue b/system-setting/frontend/src/business/system/SystemWorkspace.vue index 8f2ace32ff..7aad14ae60 100644 --- a/system-setting/frontend/src/business/system/SystemWorkspace.vue +++ b/system-setting/frontend/src/business/system/SystemWorkspace.vue @@ -49,7 +49,7 @@ width="30%" @close="close" v-loading="workspaceAddLoading"> - + @@ -245,14 +245,7 @@ export default { form: {}, rules: { name: [ - {required: true, message: this.$t('workspace.input_name'), trigger: 'blur'}, - {min: 2, max: 25, message: this.$t('commons.input_limit', [2, 25]), trigger: 'blur'}, - { - required: true, - pattern: /^(?!-)(?!.*?-$)[a-zA-Z0-9\u4e00-\u9fa5-]+$/, - message: this.$t('workspace.special_characters_are_not_supported'), - trigger: 'blur' - } + {required: true, message: this.$t('workspace.input_name'), trigger: 'blur'} ], description: [ {max: 50, message: this.$t('commons.input_limit', [0, 50]), trigger: 'blur'}