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'}