Merge branch 'master' of https://github.com/metersphere/metersphere
This commit is contained in:
commit
6751fa0b39
|
@ -32,6 +32,15 @@ public class MsJSR223PreProcessor extends MsTestElement {
|
|||
if (!this.isEnable()) {
|
||||
return;
|
||||
}
|
||||
final HashTree jsr223PreTree = tree.add(getJSR223PreProcessor());
|
||||
if (CollectionUtils.isNotEmpty(hashTree)) {
|
||||
hashTree.forEach(el -> {
|
||||
el.toHashTree(jsr223PreTree, el.getHashTree(), config);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
public JSR223PreProcessor getJSR223PreProcessor() {
|
||||
JSR223PreProcessor processor = new JSR223PreProcessor();
|
||||
processor.setEnabled(true);
|
||||
if (StringUtils.isNotEmpty(this.getName())) {
|
||||
|
@ -44,13 +53,7 @@ public class MsJSR223PreProcessor extends MsTestElement {
|
|||
processor.setProperty("cacheKey", "true");
|
||||
processor.setProperty("scriptLanguage", this.getScriptLanguage());
|
||||
processor.setProperty("script", this.getScript());
|
||||
|
||||
final HashTree jsr223PreTree = tree.add(processor);
|
||||
if (CollectionUtils.isNotEmpty(hashTree)) {
|
||||
hashTree.forEach(el -> {
|
||||
el.toHashTree(jsr223PreTree, el.getHashTree(), config);
|
||||
});
|
||||
}
|
||||
return processor;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -4,6 +4,7 @@ import com.alibaba.fastjson.annotation.JSONField;
|
|||
import com.alibaba.fastjson.annotation.JSONType;
|
||||
import io.metersphere.api.dto.definition.request.MsTestElement;
|
||||
import io.metersphere.api.dto.definition.request.ParameterConfig;
|
||||
import io.metersphere.api.dto.definition.request.processors.pre.MsJSR223PreProcessor;
|
||||
import io.metersphere.api.dto.scenario.KeyValue;
|
||||
import io.metersphere.api.dto.scenario.environment.EnvironmentConfig;
|
||||
import lombok.Data;
|
||||
|
@ -11,14 +12,18 @@ import lombok.EqualsAndHashCode;
|
|||
import org.apache.commons.collections.CollectionUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.jmeter.config.ConfigTestElement;
|
||||
import org.apache.jmeter.modifiers.UserParameters;
|
||||
import org.apache.jmeter.protocol.tcp.sampler.TCPSampler;
|
||||
import org.apache.jmeter.save.SaveService;
|
||||
import org.apache.jmeter.testelement.TestElement;
|
||||
import org.apache.jmeter.testelement.property.CollectionProperty;
|
||||
import org.apache.jmeter.testelement.property.StringProperty;
|
||||
import org.apache.jorphan.collections.HashTree;
|
||||
import org.apache.jorphan.collections.ListedHashTree;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.Random;
|
||||
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
|
@ -58,6 +63,8 @@ public class MsTCPSampler extends MsTestElement {
|
|||
private List<KeyValue> parameters;
|
||||
@JSONField(ordinal = 36)
|
||||
private String useEnvironment;
|
||||
@JSONField(ordinal = 37)
|
||||
private MsJSR223PreProcessor tcpPreProcessor;
|
||||
|
||||
@Override
|
||||
public void toHashTree(HashTree tree, List<MsTestElement> hashTree, ParameterConfig config) {
|
||||
|
@ -67,12 +74,13 @@ public class MsTCPSampler extends MsTestElement {
|
|||
if (this.getReferenced() != null && this.getReferenced().equals("REF")) {
|
||||
this.getRefElement(this);
|
||||
}
|
||||
parseParameters();
|
||||
config.setConfig(getEnvironmentConfig(useEnvironment));
|
||||
parseEnvironment(config.getConfig());
|
||||
final HashTree samplerHashTree = new ListedHashTree();
|
||||
samplerHashTree.add(tcpConfig());
|
||||
tree.set(tcpSampler(config), samplerHashTree);
|
||||
setUserParameters(samplerHashTree);
|
||||
samplerHashTree.add(tcpPreProcessor.getJSR223PreProcessor());
|
||||
if (CollectionUtils.isNotEmpty(hashTree)) {
|
||||
hashTree.forEach(el -> {
|
||||
el.toHashTree(samplerHashTree, el.getHashTree(), config);
|
||||
|
@ -108,18 +116,27 @@ public class MsTCPSampler extends MsTestElement {
|
|||
tcpSampler.setRequestData(this.getRequest());
|
||||
tcpSampler.setProperty(ConfigTestElement.USERNAME, this.getUsername());
|
||||
tcpSampler.setProperty(ConfigTestElement.PASSWORD, this.getPassword());
|
||||
|
||||
return tcpSampler;
|
||||
}
|
||||
|
||||
private void parseParameters() {
|
||||
if (CollectionUtils.isNotEmpty(parameters)) {
|
||||
parameters.forEach(item -> {
|
||||
if (item.isEnable() && StringUtils.isNotBlank(item.getValue())) {
|
||||
request = request.replaceAll("\\$\\{" + item.getName() + "\\}", Matcher.quoteReplacement(item.getValue()));
|
||||
}
|
||||
});
|
||||
}
|
||||
private void setUserParameters(HashTree tree) {
|
||||
UserParameters userParameters = new UserParameters();
|
||||
userParameters.setEnabled(true);
|
||||
userParameters.setName(this.getName() + "UserParameters");
|
||||
userParameters.setPerIteration(false);
|
||||
userParameters.setProperty(TestElement.TEST_CLASS, UserParameters.class.getName());
|
||||
userParameters.setProperty(TestElement.GUI_CLASS, SaveService.aliasToClass("UserParametersGui"));
|
||||
List<StringProperty> names = new ArrayList<>();
|
||||
List<StringProperty> threadValues = new ArrayList<>();
|
||||
this.parameters.forEach(item -> {
|
||||
names.add(new StringProperty(new Integer(new Random().nextInt(1000000)).toString(), item.getName()));
|
||||
threadValues.add(new StringProperty(new Integer(new Random().nextInt(1000000)).toString(), item.getValue()));
|
||||
});
|
||||
userParameters.setNames(new CollectionProperty(UserParameters.NAMES, names));
|
||||
List<CollectionProperty> collectionPropertyList = new ArrayList<>();
|
||||
collectionPropertyList.add(new CollectionProperty(new Integer(new Random().nextInt(1000000)).toString(), threadValues));
|
||||
userParameters.setThreadLists(new CollectionProperty(UserParameters.THREAD_VALUES, collectionPropertyList));
|
||||
tree.add(userParameters);
|
||||
}
|
||||
|
||||
private ConfigTestElement tcpConfig() {
|
||||
|
|
|
@ -0,0 +1,20 @@
|
|||
package io.metersphere.commons.utils;
|
||||
|
||||
import java.net.URL;
|
||||
import java.net.URLConnection;
|
||||
|
||||
public class UrlTestUtils {
|
||||
|
||||
public static boolean testUrlWithTimeOut(String urlString, int timeOutMillSeconds) {
|
||||
try {
|
||||
URL url = new URL(urlString);
|
||||
URLConnection co = url.openConnection();
|
||||
co.setConnectTimeout(timeOutMillSeconds);
|
||||
co.connect();
|
||||
return true;
|
||||
} catch (Exception e) {
|
||||
LogUtil.error(e);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -6,6 +6,7 @@ import io.metersphere.base.domain.TestResource;
|
|||
import io.metersphere.commons.constants.ResourceStatusEnum;
|
||||
import io.metersphere.commons.exception.MSException;
|
||||
import io.metersphere.commons.utils.CommonBeanFactory;
|
||||
import io.metersphere.commons.utils.UrlTestUtils;
|
||||
import io.metersphere.config.JmeterProperties;
|
||||
import io.metersphere.config.KafkaProperties;
|
||||
import io.metersphere.controller.ResultHolder;
|
||||
|
@ -15,6 +16,7 @@ import io.metersphere.i18n.Translator;
|
|||
import io.metersphere.performance.engine.AbstractEngine;
|
||||
import io.metersphere.performance.engine.request.StartTestRequest;
|
||||
import io.metersphere.service.SystemParameterService;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.web.client.RestTemplate;
|
||||
|
||||
import java.util.HashMap;
|
||||
|
@ -77,6 +79,12 @@ public class DockerTestEngine extends AbstractEngine {
|
|||
metersphereUrl = baseInfo.getUrl();
|
||||
}
|
||||
|
||||
// docker 不能从 localhost 中下载文件
|
||||
if (StringUtils.contains(metersphereUrl, "http://localhost")
|
||||
|| !UrlTestUtils.testUrlWithTimeOut(metersphereUrl, 1000)) {
|
||||
MSException.throwException(Translator.get("run_load_test_file_init_error"));
|
||||
}
|
||||
|
||||
Map<String, String> env = new HashMap<>();
|
||||
env.put("RATIO", "" + ratio);
|
||||
env.put("RESOURCE_INDEX", "" + resourceIndex);
|
||||
|
@ -123,4 +131,5 @@ public class DockerTestEngine extends AbstractEngine {
|
|||
}
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -1 +1 @@
|
|||
Subproject commit 7f7808c6f0457dd2df6b19a1622558f3f8122646
|
||||
Subproject commit 132f406fac7fb4d841210343eb98c09f78317f18
|
|
@ -34,7 +34,7 @@ edit_load_test_not_found=Cannot edit test, test not found=
|
|||
run_load_test_not_found=Cannot run test, test not found=
|
||||
run_load_test_file_not_found=Unable to run test, unable to get test file meta information, test ID=
|
||||
run_load_test_file_content_not_found=Cannot run test, cannot get test file content, test ID=
|
||||
run_load_test_file_init_error=Failed to run test, failed to initialize run environment, test ID=
|
||||
run_load_test_file_init_error=Failed to run test, please check current end point configuration
|
||||
load_test_is_running=Load test is running, please wait.
|
||||
load_test_kafka_invalid=Kafka is not available, please check the configuration
|
||||
cannot_edit_load_test_running=Cannot modify the running test
|
||||
|
|
|
@ -34,7 +34,7 @@ edit_load_test_not_found=无法编辑测试,未找到测试:
|
|||
run_load_test_not_found=无法运行测试,未找到测试:
|
||||
run_load_test_file_not_found=无法运行测试,无法获取测试文件元信息,测试ID:
|
||||
run_load_test_file_content_not_found=无法运行测试,无法获取测试文件内容,测试ID:
|
||||
run_load_test_file_init_error=无法运行测试,初始化运行环境失败,测试ID:
|
||||
run_load_test_file_init_error=无法运行测试,请检查当前站点配置
|
||||
load_test_is_running=测试正在运行, 请等待
|
||||
load_test_kafka_invalid=Kafka 不可用,请检查配置
|
||||
cannot_edit_load_test_running=不能修改正在运行的测试
|
||||
|
|
|
@ -34,7 +34,7 @@ edit_load_test_not_found=無法編輯測試,未找到測試:
|
|||
run_load_test_not_found=無法運行測試,未找到測試:
|
||||
run_load_test_file_not_found=無法運行測試,無法獲取測試文件元信息,測試ID:
|
||||
run_load_test_file_content_not_found=無法運行測試,無法獲取測試文件內容,測試ID:
|
||||
run_load_test_file_init_error=無法運行測試,初始化運行環境失敗,測試ID:
|
||||
run_load_test_file_init_error=無法運行測試,請檢查當前站點配置
|
||||
load_test_is_running=測試正在運行, 請等待
|
||||
load_test_kafka_invalid=Kafka 不可用,請檢查配置
|
||||
cannot_edit_load_test_running=不能修改正在運行的測試
|
||||
|
|
|
@ -854,6 +854,7 @@
|
|||
this.result = this.$get("/api/automation/getApiScenario/" + this.currentScenario.id, response => {
|
||||
if (response.data) {
|
||||
this.path = "/api/automation/update";
|
||||
this.currentScenario.description = response.data.description;
|
||||
if (response.data.scenarioDefinition != null) {
|
||||
let obj = JSON.parse(response.data.scenarioDefinition);
|
||||
if (obj) {
|
||||
|
|
|
@ -0,0 +1,162 @@
|
|||
<template>
|
||||
<div>
|
||||
<el-row style="margin:0px 10px 10px">
|
||||
<el-col>
|
||||
<div class="document-url">
|
||||
<el-link href="https://jmeter.apache.org/usermanual/component_reference.html#BeanShell_PostProcessor"
|
||||
type="primary">{{$t('commons.reference_documentation')}}
|
||||
</el-link>
|
||||
</div>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-row>
|
||||
<el-col :span="20" class="script-content">
|
||||
<ms-code-edit v-if="isCodeEditAlive" :mode="codeEditModeMap[jsr223ProcessorData.scriptLanguage]"
|
||||
:read-only="isReadOnly"
|
||||
:data.sync="jsr223ProcessorData.script" theme="eclipse" :modes="['java','python']"
|
||||
ref="codeEdit"/>
|
||||
</el-col>
|
||||
<el-col :span="4" class="script-index">
|
||||
<ms-dropdown :default-command="jsr223ProcessorData.scriptLanguage" :commands="languages" @command="languageChange"/>
|
||||
<div class="template-title">{{$t('api_test.request.processor.code_template')}}</div>
|
||||
<div v-for="(template, index) in codeTemplates" :key="index" class="code-template">
|
||||
<el-link :disabled="template.disabled" @click="addTemplate(template)">{{template.title}}</el-link>
|
||||
</div>
|
||||
</el-col>
|
||||
</el-row>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import MsCodeEdit from "../../../definition/components/MsCodeEdit";
|
||||
import MsDropdown from "../../../../common/components/MsDropdown";
|
||||
export default {
|
||||
name: "Jsr233ProcessorContent",
|
||||
components: {MsDropdown, MsCodeEdit},
|
||||
data() {
|
||||
return {
|
||||
jsr223ProcessorData: {},
|
||||
codeTemplates: [
|
||||
{
|
||||
title: this.$t('api_test.request.processor.code_template_get_variable'),
|
||||
value: 'vars.get("variable_name")',
|
||||
},
|
||||
{
|
||||
title: this.$t('api_test.request.processor.code_template_set_variable'),
|
||||
value: 'vars.put("variable_name", "variable_value")',
|
||||
},
|
||||
{
|
||||
title: this.$t('api_test.request.processor.code_template_get_global_variable'),
|
||||
value: 'props.get("variable_name")',
|
||||
},
|
||||
{
|
||||
title: this.$t('api_test.request.processor.code_template_set_global_variable'),
|
||||
value: 'props.put("variable_name", "variable_value")',
|
||||
},
|
||||
{
|
||||
title: this.$t('api_test.request.processor.code_template_get_response_header'),
|
||||
value: 'prev.getResponseHeaders()',
|
||||
disabled: this.isPreProcessor
|
||||
},
|
||||
{
|
||||
title: this.$t('api_test.request.processor.code_template_get_response_code'),
|
||||
value: 'prev.getResponseCode()',
|
||||
disabled: this.isPreProcessor
|
||||
},
|
||||
{
|
||||
title: this.$t('api_test.request.processor.code_template_get_response_result'),
|
||||
value: 'prev.getResponseDataAsString()',
|
||||
disabled: this.isPreProcessor
|
||||
}
|
||||
],
|
||||
isCodeEditAlive: true,
|
||||
languages: [
|
||||
'beanshell', "python", "groovy", "javascript"
|
||||
],
|
||||
codeEditModeMap: {
|
||||
beanshell: 'java',
|
||||
python: 'python',
|
||||
groovy: 'java',
|
||||
javascript: 'javascript',
|
||||
}
|
||||
}
|
||||
},
|
||||
created() {
|
||||
this.jsr223ProcessorData = this.jsr223Processor;
|
||||
},
|
||||
props: {
|
||||
isReadOnly: {
|
||||
type: Boolean,
|
||||
default:
|
||||
false
|
||||
},
|
||||
jsr223Processor: {
|
||||
type: Object,
|
||||
},
|
||||
isPreProcessor: {
|
||||
type: Boolean,
|
||||
default:
|
||||
false
|
||||
},
|
||||
node: {},
|
||||
},
|
||||
watch: {
|
||||
jsr223Processor() {
|
||||
this.reload();
|
||||
}
|
||||
}
|
||||
,
|
||||
methods: {
|
||||
addTemplate(template) {
|
||||
if (!this.jsr223ProcessorData.script) {
|
||||
this.jsr223ProcessorData.script = "";
|
||||
}
|
||||
this.jsr223ProcessorData.script += template.value;
|
||||
if (this.jsr223ProcessorData.scriptLanguage === 'beanshell') {
|
||||
this.jsr223ProcessorData.script += ';';
|
||||
}
|
||||
this.reload();
|
||||
},
|
||||
reload() {
|
||||
this.isCodeEditAlive = false;
|
||||
this.$nextTick(() => (this.isCodeEditAlive = true));
|
||||
},
|
||||
languageChange(language) {
|
||||
this.jsr223ProcessorData.scriptLanguage = language;
|
||||
},
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.ace_editor {
|
||||
border-radius: 5px;
|
||||
}
|
||||
|
||||
.script-content {
|
||||
height: calc(100vh - 570px);
|
||||
}
|
||||
|
||||
.script-index {
|
||||
padding: 0 20px;
|
||||
}
|
||||
|
||||
.template-title {
|
||||
margin-bottom: 5px;
|
||||
font-weight: bold;
|
||||
font-size: 15px;
|
||||
}
|
||||
|
||||
.document-url {
|
||||
margin-top: 10px;
|
||||
}
|
||||
|
||||
.instructions-icon {
|
||||
margin-left: 5px;
|
||||
}
|
||||
|
||||
.ms-dropdown {
|
||||
margin-bottom: 20px;
|
||||
}
|
||||
|
||||
</style>
|
|
@ -2,35 +2,18 @@
|
|||
<api-base-component
|
||||
@copy="copyRow"
|
||||
@remove="remove"
|
||||
:data="jsr223ProcessorData"
|
||||
:data="jsr223Processor"
|
||||
:draggable="draggable"
|
||||
:color="color"
|
||||
:background-color="backgroundColor"
|
||||
:title="title">
|
||||
<el-row style="margin:0px 10px 10px">
|
||||
<el-col>
|
||||
<div class="document-url">
|
||||
<el-link href="https://jmeter.apache.org/usermanual/component_reference.html#BeanShell_PostProcessor"
|
||||
type="primary">{{$t('commons.reference_documentation')}}
|
||||
</el-link>
|
||||
</div>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-row>
|
||||
<el-col :span="20" class="script-content">
|
||||
<ms-code-edit v-if="isCodeEditAlive" :mode="codeEditModeMap[jsr223ProcessorData.scriptLanguage]"
|
||||
:read-only="isReadOnly"
|
||||
:data.sync="jsr223ProcessorData.script" theme="eclipse" :modes="['java','python']"
|
||||
ref="codeEdit"/>
|
||||
</el-col>
|
||||
<el-col :span="4" class="script-index">
|
||||
<ms-dropdown :default-command="jsr223ProcessorData.scriptLanguage" :commands="languages" @command="languageChange"/>
|
||||
<div class="template-title">{{$t('api_test.request.processor.code_template')}}</div>
|
||||
<div v-for="(template, index) in codeTemplates" :key="index" class="code-template">
|
||||
<el-link :disabled="template.disabled" @click="addTemplate(template)">{{template.title}}</el-link>
|
||||
</div>
|
||||
</el-col>
|
||||
</el-row>
|
||||
|
||||
<jsr233-processor-content
|
||||
:jsr223-processor="jsr223Processor"
|
||||
:is-pre-processor="isPreProcessor"
|
||||
:node="node"
|
||||
:is-read-only="isReadOnly"/>
|
||||
|
||||
</api-base-component>
|
||||
</template>
|
||||
|
||||
|
@ -39,61 +22,11 @@
|
|||
import MsInstructionsIcon from "../../../../common/components/MsInstructionsIcon";
|
||||
import MsDropdown from "../../../../common/components/MsDropdown";
|
||||
import ApiBaseComponent from "../common/ApiBaseComponent";
|
||||
import Jsr233ProcessorContent from "../common/Jsr233ProcessorContent";
|
||||
|
||||
export default {
|
||||
name: "MsJsr233Processor",
|
||||
components: {ApiBaseComponent, MsDropdown, MsInstructionsIcon, MsCodeEdit},
|
||||
data() {
|
||||
return {
|
||||
jsr223ProcessorData: {},
|
||||
codeTemplates: [
|
||||
{
|
||||
title: this.$t('api_test.request.processor.code_template_get_variable'),
|
||||
value: 'vars.get("variable_name")',
|
||||
},
|
||||
{
|
||||
title: this.$t('api_test.request.processor.code_template_set_variable'),
|
||||
value: 'vars.put("variable_name", "variable_value")',
|
||||
},
|
||||
{
|
||||
title: this.$t('api_test.request.processor.code_template_get_global_variable'),
|
||||
value: 'props.get("variable_name")',
|
||||
},
|
||||
{
|
||||
title: this.$t('api_test.request.processor.code_template_set_global_variable'),
|
||||
value: 'props.put("variable_name", "variable_value")',
|
||||
},
|
||||
{
|
||||
title: this.$t('api_test.request.processor.code_template_get_response_header'),
|
||||
value: 'prev.getResponseHeaders()',
|
||||
disabled: this.isPreProcessor
|
||||
},
|
||||
{
|
||||
title: this.$t('api_test.request.processor.code_template_get_response_code'),
|
||||
value: 'prev.getResponseCode()',
|
||||
disabled: this.isPreProcessor
|
||||
},
|
||||
{
|
||||
title: this.$t('api_test.request.processor.code_template_get_response_result'),
|
||||
value: 'prev.getResponseDataAsString()',
|
||||
disabled: this.isPreProcessor
|
||||
}
|
||||
],
|
||||
isCodeEditAlive: true,
|
||||
languages: [
|
||||
'beanshell', "python", "groovy", "javascript"
|
||||
],
|
||||
codeEditModeMap: {
|
||||
beanshell: 'java',
|
||||
python: 'python',
|
||||
groovy: 'java',
|
||||
javascript: 'javascript',
|
||||
}
|
||||
}
|
||||
},
|
||||
created() {
|
||||
this.jsr223ProcessorData = this.jsr223Processor;
|
||||
},
|
||||
components: {Jsr233ProcessorContent, ApiBaseComponent, MsDropdown, MsInstructionsIcon, MsCodeEdit},
|
||||
props: {
|
||||
draggable: {
|
||||
type: Boolean,
|
||||
|
@ -117,71 +50,18 @@
|
|||
backgroundColor: String,
|
||||
node: {},
|
||||
},
|
||||
watch: {
|
||||
jsr223Processor() {
|
||||
this.reload();
|
||||
}
|
||||
}
|
||||
,
|
||||
methods: {
|
||||
addTemplate(template) {
|
||||
if (!this.jsr223ProcessorData.script) {
|
||||
this.jsr223ProcessorData.script = "";
|
||||
}
|
||||
this.jsr223ProcessorData.script += template.value;
|
||||
if (this.jsr223ProcessorData.scriptLanguage === 'beanshell') {
|
||||
this.jsr223ProcessorData.script += ';';
|
||||
}
|
||||
this.reload();
|
||||
},
|
||||
remove() {
|
||||
this.$emit('remove', this.jsr223ProcessorData, this.node);
|
||||
},
|
||||
copyRow() {
|
||||
this.$emit('copyRow', this.jsr223ProcessorData, this.node);
|
||||
},
|
||||
reload() {
|
||||
this.isCodeEditAlive = false;
|
||||
this.$nextTick(() => (this.isCodeEditAlive = true));
|
||||
},
|
||||
languageChange(language) {
|
||||
this.jsr223ProcessorData.scriptLanguage = language;
|
||||
},
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.ace_editor {
|
||||
border-radius: 5px;
|
||||
}
|
||||
|
||||
.script-content {
|
||||
height: calc(100vh - 570px);
|
||||
}
|
||||
|
||||
.script-index {
|
||||
padding: 0 20px;
|
||||
}
|
||||
|
||||
.template-title {
|
||||
margin-bottom: 5px;
|
||||
font-weight: bold;
|
||||
font-size: 15px;
|
||||
}
|
||||
|
||||
.document-url {
|
||||
margin-top: 10px;
|
||||
}
|
||||
|
||||
.instructions-icon {
|
||||
margin-left: 5px;
|
||||
}
|
||||
|
||||
.ms-dropdown {
|
||||
margin-bottom: 20px;
|
||||
}
|
||||
|
||||
/deep/ .el-divider {
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
|
|
|
@ -23,6 +23,13 @@
|
|||
</div>
|
||||
</el-tab-pane>
|
||||
|
||||
<el-tab-pane :label="$t('api_test.definition.request.pre_script')" name="script">
|
||||
<jsr233-processor-content
|
||||
:jsr223-processor="request.tcpPreProcessor"
|
||||
:is-pre-processor="true"
|
||||
:is-read-only="isReadOnly"/>
|
||||
</el-tab-pane>
|
||||
|
||||
<el-tab-pane :label="$t('api_test.definition.request.other_config')" name="other" class="other-config">
|
||||
<el-row>
|
||||
<el-col :span="8">
|
||||
|
@ -138,11 +145,14 @@
|
|||
import {getCurrentProjectID, getUUID} from "@/common/js/utils";
|
||||
import MsApiVariable from "../../ApiVariable";
|
||||
import MsInstructionsIcon from "../../../../../common/components/MsInstructionsIcon";
|
||||
import Jsr233ProcessorContent from "../../../../automation/scenario/common/Jsr233ProcessorContent";
|
||||
import JSR223PreProcessor from "../../jmeter/components/pre-processors/jsr223-pre-processor";
|
||||
|
||||
|
||||
export default {
|
||||
name: "TcpBasisParameters",
|
||||
components: {
|
||||
Jsr233ProcessorContent,
|
||||
MsInstructionsIcon,
|
||||
MsApiVariable,
|
||||
MsApiScenarioVariables,
|
||||
|
@ -178,6 +188,9 @@
|
|||
this.$set(this.request, 'parameters', []);
|
||||
this.request.parameters = [];
|
||||
}
|
||||
if (!this.request.tcpPreProcessor) {
|
||||
this.$set(this.request, 'tcpPreProcessor', new JSR223PreProcessor())
|
||||
}
|
||||
this.getEnvironments();
|
||||
},
|
||||
methods: {
|
||||
|
|
|
@ -101,10 +101,10 @@
|
|||
this.mode = mode;
|
||||
},
|
||||
setBodyType() {
|
||||
if (!this.response.headers) {
|
||||
if (!this.response.responseResult.headers) {
|
||||
return;
|
||||
}
|
||||
if (this.response.headers.indexOf("Content-Type: application/json") > 0) {
|
||||
if (this.response.responseResult.headers.indexOf("Content-Type: application/json") > 0) {
|
||||
if (this.$refs.modeDropdown) {
|
||||
this.$refs.modeDropdown.handleCommand(BODY_FORMAT.JSON);
|
||||
this.msCodeReload();
|
||||
|
|
|
@ -9,16 +9,16 @@
|
|||
<el-form-item>
|
||||
<el-radio v-model='radioValue' :label="2">
|
||||
{{$t('schedule.cron.period')}} {{$t('schedule.cron.from')}}
|
||||
<el-input-number v-model='cycle01' :min="0" :max="60" /> -
|
||||
<el-input-number v-model='cycle02' :min="0" :max="60" /> 小时
|
||||
<el-input-number v-model='cycle01' :min="0" :max="24" /> -
|
||||
<el-input-number v-model='cycle02' :min="0" :max="24" /> 小时
|
||||
</el-radio>
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item>
|
||||
<el-radio v-model='radioValue' :label="3">
|
||||
{{$t('schedule.cron.from')}}
|
||||
<el-input-number v-model='average01' :min="0" :max="60" /> {{$t('schedule.cron.hours')}}{{$t('schedule.cron.start')}},{{$t('schedule.cron.every')}}
|
||||
<el-input-number v-model='average02' :min="0" :max="60" /> {{$t('schedule.cron.hours')}}{{$t('schedule.cron.execute_once')}}
|
||||
<el-input-number v-model='average01' :min="0" :max="24" /> {{$t('schedule.cron.hours')}}{{$t('schedule.cron.start')}},{{$t('schedule.cron.every')}}
|
||||
<el-input-number v-model='average02' :min="0" :max="24" /> {{$t('schedule.cron.hours')}}{{$t('schedule.cron.execute_once')}}
|
||||
</el-radio>
|
||||
</el-form-item>
|
||||
|
||||
|
@ -26,7 +26,7 @@
|
|||
<el-radio v-model='radioValue' :label="4">
|
||||
{{$t('schedule.cron.specify')}}
|
||||
<el-select clearable v-model="checkboxList" :placeholder="$t('schedule.cron.multi_select')" multiple style="width:100%">
|
||||
<el-option v-for="item in 60" :key="item" :value="item-1">{{item-1}}</el-option>
|
||||
<el-option v-for="item in 24" :key="item" :value="item-1">{{item-1}}</el-option>
|
||||
</el-select>
|
||||
</el-radio>
|
||||
</el-form-item>
|
||||
|
|
|
@ -271,7 +271,18 @@
|
|||
this.$refs.environmentConfig.open(project.id);
|
||||
},
|
||||
handleEvent(event) {
|
||||
if (event.keyCode === 13) {
|
||||
let enter = event.keyCode;
|
||||
let ctrl = event.ctrlKey;
|
||||
let shift = event.shiftKey;
|
||||
let alt = event.altKey;
|
||||
if(enter === 13 && ctrl && !shift && !alt) {
|
||||
//ctrl + enter
|
||||
this.form.description += '\n';
|
||||
}
|
||||
if(enter === 13 && !ctrl && shift && !alt) {
|
||||
//shift + enter
|
||||
}
|
||||
if(enter === 13 && !ctrl && !shift && !alt) {
|
||||
this.submit('form')
|
||||
}
|
||||
},
|
||||
|
|
|
@ -762,4 +762,8 @@ p {
|
|||
white-space: pre-line;
|
||||
line-height: 20px;
|
||||
}
|
||||
|
||||
.head-bar {
|
||||
z-index: 999;
|
||||
}
|
||||
</style>
|
||||
|
|
|
@ -7,7 +7,7 @@ export default {
|
|||
install(Vue) {
|
||||
|
||||
// 登入请求不重定向
|
||||
let unRedirectUrls = new Set(['signin','ldap/signin']);
|
||||
let unRedirectUrls = new Set(['signin','ldap/signin','/signin', '/ldap/signin']);
|
||||
|
||||
if (!axios) {
|
||||
window.console.error('You have to install axios');
|
||||
|
|
Loading…
Reference in New Issue