性能测试名称校验

This commit is contained in:
shiziyuan9527 2020-06-02 11:35:39 +08:00
parent cb11ae8646
commit fbcd87f7ca
4 changed files with 10 additions and 3 deletions

View File

@ -210,9 +210,13 @@
this.$router.push({path: '/performance/test/all'}) this.$router.push({path: '/performance/test/all'})
}, },
validTestPlan() { validTestPlan() {
let reg = /^[\u4e00-\u9fa5_a-zA-Z0-9\s.·-]+$/;
if (!this.testPlan.name) { if (!this.testPlan.name) {
this.$error(this.$t('load_test.test_name_is_null')); this.$error(this.$t('load_test.test_name_is_null'));
return false; return false;
} else if (!reg.test(this.testPlan.name)) {
this.$error(this.$t('load_test.special_characters_are_not_supported'));
return false;
} }
if (!this.testPlan.projectId) { if (!this.testPlan.projectId) {

View File

@ -254,7 +254,8 @@ export default {
'select_resource_pool': 'Please Select Resource Pool', 'select_resource_pool': 'Please Select Resource Pool',
'resource_pool_is_null': 'Resource Pool is empty', 'resource_pool_is_null': 'Resource Pool is empty',
'download_log_file': 'Download', 'download_log_file': 'Download',
'user_name': 'Creator' 'user_name': 'Creator',
'special_characters_are_not_supported': 'Test name does not support special characters',
}, },
api_test: { api_test: {
creator: "Creator", creator: "Creator",

View File

@ -252,7 +252,8 @@ export default {
'resource_pool_is_null': '资源池为空', 'resource_pool_is_null': '资源池为空',
'download_log_file': '下载完整日志文件', 'download_log_file': '下载完整日志文件',
'pressure_prediction_chart': '压力预估图', 'pressure_prediction_chart': '压力预估图',
'user_name': '创建人' 'user_name': '创建人',
'special_characters_are_not_supported': '测试名称不支持特殊字符',
}, },
api_test: { api_test: {
creator: "创建人", creator: "创建人",

View File

@ -253,7 +253,8 @@ export default {
'resource_pool_is_null': '資源池為空', 'resource_pool_is_null': '資源池為空',
'download_log_file': '下載完整日誌文件', 'download_log_file': '下載完整日誌文件',
'pressure_prediction_chart': '壓力預估圖', 'pressure_prediction_chart': '壓力預估圖',
'user_name': '創建人' 'user_name': '創建人',
'special_characters_are_not_supported': '測試名稱不支持特殊字符',
}, },
api_test: { api_test: {
title: "測試", title: "測試",