去掉场景名称和请求名称输入字符限制,只设长度限制。

This commit is contained in:
q4speed 2020-05-29 17:03:06 +08:00
parent 8611d153f9
commit 082dd21cd3
3 changed files with 6 additions and 13 deletions

View File

@ -1,7 +1,7 @@
<template> <template>
<el-form :model="request" :rules="rules" ref="request" label-width="100px"> <el-form :model="request" :rules="rules" ref="request" label-width="100px">
<el-form-item :label="$t('api_test.request.name')" prop="name"> <el-form-item :label="$t('api_test.request.name')" prop="name">
<el-input v-model="request.name" maxlength="100" @input="valid"/> <el-input v-model="request.name" maxlength="100" show-word-limit/>
</el-form-item> </el-form-item>
<el-form-item :label="$t('api_test.request.url')" prop="url"> <el-form-item :label="$t('api_test.request.url')" prop="url">
@ -108,10 +108,6 @@
} }
} }
return url; return url;
},
valid(value) {
value = value.replace(/[`~!@#$%^&*()_\-+=<>?:"{}|,./;'\\[\]·!¥…()—\-《》?:“”【】、;‘’,。]/g, '').replace(/\s/g, "");
this.request.name = value;
} }
}, },

View File

@ -1,7 +1,7 @@
<template> <template>
<el-form :model="scenario" :rules="rules" ref="scenario" label-width="100px"> <el-form :model="scenario" :rules="rules" ref="scenario" label-width="100px">
<el-form-item :label="$t('api_test.scenario.name')" prop="name"> <el-form-item :label="$t('api_test.scenario.name')" prop="name">
<el-input v-model="scenario.name" maxlength="100" @input="valid"/> <el-input v-model="scenario.name" maxlength="100" show-word-limit/>
</el-form-item> </el-form-item>
<!-- <el-form-item :label="$t('api_test.scenario.base_url')" prop="url">--> <!-- <el-form-item :label="$t('api_test.scenario.base_url')" prop="url">-->
@ -43,13 +43,6 @@
] ]
} }
} }
},
methods: {
valid(value) {
value = value.replace(/[`~!@#$%^&*()\-+=<>?:"{}|,./;'\\[\]·!¥…()—\-《》?:“”【】、;‘’,。]/g, '').replace(/\s/g, "");
this.scenario.name = value;
}
} }
} }
</script> </script>

View File

@ -395,6 +395,8 @@ class JMXGenerator {
addScenarios(testPlan, scenarios) { addScenarios(testPlan, scenarios) {
scenarios.forEach(scenario => { scenarios.forEach(scenario => {
scenario.name = this.replace(scenario.name);
let threadGroup = new ThreadGroup(scenario.name || ""); let threadGroup = new ThreadGroup(scenario.name || "");
this.addScenarioVariables(threadGroup, scenario); this.addScenarioVariables(threadGroup, scenario);
@ -404,6 +406,8 @@ class JMXGenerator {
scenario.requests.forEach(request => { scenario.requests.forEach(request => {
if (!request.isValid()) return; if (!request.isValid()) return;
request.name = this.replace(request.name);
let httpSamplerProxy = new HTTPSamplerProxy(request.name || "", new JMXRequest(request)); let httpSamplerProxy = new HTTPSamplerProxy(request.name || "", new JMXRequest(request));
this.addRequestHeader(httpSamplerProxy, request); this.addRequestHeader(httpSamplerProxy, request);