Merge remote-tracking branch 'origin/master'
This commit is contained in:
commit
3880b876e3
|
@ -85,6 +85,7 @@ public class HistoricalDataUpgradeService {
|
|||
ifController.setType("IfController");
|
||||
ifController.setName("IfController");
|
||||
ifController.setIndex(index + "");
|
||||
ifController.setHashTree(new LinkedList<>());
|
||||
ifController.setResourceId(UUID.randomUUID().toString());
|
||||
}
|
||||
// 等待控制器
|
||||
|
@ -93,6 +94,7 @@ public class HistoricalDataUpgradeService {
|
|||
BeanUtils.copyBean(constantTimer, request.getTimer());
|
||||
constantTimer.setType("ConstantTimer");
|
||||
constantTimer.setIndex(index + "");
|
||||
constantTimer.setHashTree(new LinkedList<>());
|
||||
constantTimer.setResourceId(UUID.randomUUID().toString());
|
||||
testElements.add(constantTimer);
|
||||
}
|
||||
|
@ -119,7 +121,6 @@ public class HistoricalDataUpgradeService {
|
|||
if (StringUtils.isEmpty(element.getName())) {
|
||||
element.setName(request1.getPath());
|
||||
}
|
||||
|
||||
element.setType("HTTPSamplerProxy");
|
||||
}
|
||||
if (request instanceof DubboRequest) {
|
||||
|
@ -147,6 +148,7 @@ public class HistoricalDataUpgradeService {
|
|||
}
|
||||
element.setIndex(index + "");
|
||||
element.setResourceId(UUID.randomUUID().toString());
|
||||
element.setHashTree(new LinkedList<>());
|
||||
LinkedList<MsTestElement> msTestElements = new LinkedList<>();
|
||||
// 断言规则
|
||||
if (request.getAssertions() != null && ((request.getAssertions().getDuration() != null && request.getAssertions().getDuration().getValue() > 0) ||
|
||||
|
@ -157,6 +159,7 @@ public class HistoricalDataUpgradeService {
|
|||
msAssertions.setType("Assertions");
|
||||
msAssertions.setIndex(index + "");
|
||||
msAssertions.setResourceId(UUID.randomUUID().toString());
|
||||
msAssertions.setHashTree(new LinkedList<>());
|
||||
msTestElements.add(msAssertions);
|
||||
}
|
||||
// 提取规则
|
||||
|
@ -166,6 +169,7 @@ public class HistoricalDataUpgradeService {
|
|||
MsExtract extract = JSON.parseObject(extractJson, MsExtract.class);
|
||||
extract.setType("Extract");
|
||||
extract.setIndex(index + "");
|
||||
extract.setHashTree(new LinkedList<>());
|
||||
extract.setResourceId(UUID.randomUUID().toString());
|
||||
msTestElements.add(extract);
|
||||
}
|
||||
|
@ -175,6 +179,7 @@ public class HistoricalDataUpgradeService {
|
|||
MsJSR223PreProcessor preProcessor = JSON.parseObject(preJson, MsJSR223PreProcessor.class);
|
||||
preProcessor.setType("JSR223PreProcessor");
|
||||
preProcessor.setIndex(index + "");
|
||||
preProcessor.setHashTree(new LinkedList<>());
|
||||
preProcessor.setResourceId(UUID.randomUUID().toString());
|
||||
msTestElements.add(preProcessor);
|
||||
}
|
||||
|
@ -184,6 +189,7 @@ public class HistoricalDataUpgradeService {
|
|||
MsJSR223PostProcessor preProcessor = JSON.parseObject(preJson, MsJSR223PostProcessor.class);
|
||||
preProcessor.setType("JSR223PostProcessor");
|
||||
preProcessor.setIndex(index + "");
|
||||
preProcessor.setHashTree(new LinkedList<>());
|
||||
preProcessor.setResourceId(UUID.randomUUID().toString());
|
||||
msTestElements.add(preProcessor);
|
||||
}
|
||||
|
|
|
@ -156,11 +156,11 @@
|
|||
<!--等待控制器-->
|
||||
<ms-constant-timer :timer="data" :node="node" v-if="data.type==='ConstantTimer'" @remove="remove" @copyRow="copyRow"/>
|
||||
<!--自定义脚本-->
|
||||
<ms-jsr233-processor v-if="data.type==='JSR223Processor'" @remove="remove" @copyRow="copyRow" :title="$t('api_test.automation.customize_script')" :jsr223-processor="data" :node="node"/>
|
||||
<ms-jsr233-processor :draggable="true" v-if="data.type==='JSR223Processor'" @remove="remove" @copyRow="copyRow" :title="$t('api_test.automation.customize_script')" :jsr223-processor="data" :node="node"/>
|
||||
<!--前置脚本-->
|
||||
<ms-jsr233-processor v-if="data.type==='JSR223PreProcessor'" @remove="remove" @copyRow="copyRow" :title="$t('api_test.definition.request.pre_script')" :jsr223-processor="data" :node="node"/>
|
||||
<ms-jsr233-processor :draggable="true" v-if="data.type==='JSR223PreProcessor'" @remove="remove" @copyRow="copyRow" :title="$t('api_test.definition.request.pre_script')" :jsr223-processor="data" :node="node"/>
|
||||
<!--后置脚本-->
|
||||
<ms-jsr233-processor v-if="data.type==='JSR223PostProcessor'" @remove="remove" @copyRow="copyRow" :title="$t('api_test.definition.request.post_script')" :jsr223-processor="data" :node="node"/>
|
||||
<ms-jsr233-processor :draggable="true" v-if="data.type==='JSR223PostProcessor'" @remove="remove" @copyRow="copyRow" :title="$t('api_test.definition.request.post_script')" :jsr223-processor="data" :node="node"/>
|
||||
<!--断言规则-->
|
||||
<ms-api-assertions :draggable="true" @suggestClick="suggestClick(node)" :response="response" v-if="data.type==='Assertions'" @remove="remove" @copyRow="copyRow" :assertions="data" :node="node"/>
|
||||
<!--提取规则-->
|
||||
|
|
|
@ -29,63 +29,63 @@
|
|||
</div>
|
||||
|
||||
<el-collapse-transition>
|
||||
<div v-if="data.active && showCollapse" draggable>
|
||||
<div v-if="data.active && showCollapse" :draggable="draggable">
|
||||
<el-divider></el-divider>
|
||||
<slot></slot>
|
||||
<slot></slot>
|
||||
</div>
|
||||
</el-collapse-transition>
|
||||
</el-card>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
name: "ApiBaseComponent",
|
||||
data() {
|
||||
return {
|
||||
isShowInput: false
|
||||
export default {
|
||||
name: "ApiBaseComponent",
|
||||
data() {
|
||||
return {
|
||||
isShowInput: false
|
||||
}
|
||||
},
|
||||
props: {
|
||||
draggable: Boolean,
|
||||
data: {
|
||||
type: Object,
|
||||
default() {
|
||||
return {}
|
||||
},
|
||||
},
|
||||
color: {
|
||||
type: String,
|
||||
default() {
|
||||
return "#B8741A"
|
||||
}
|
||||
},
|
||||
props: {
|
||||
draggable: Boolean,
|
||||
data: {
|
||||
type: Object,
|
||||
default() {
|
||||
return {}
|
||||
},
|
||||
},
|
||||
color: {
|
||||
type: String,
|
||||
default() {
|
||||
return "#B8741A"
|
||||
}
|
||||
},
|
||||
backgroundColor: {
|
||||
type: String,
|
||||
default() {
|
||||
return "#F9F1EA"
|
||||
}
|
||||
},
|
||||
showCollapse: {
|
||||
type: Boolean,
|
||||
default() {
|
||||
return true
|
||||
}
|
||||
},
|
||||
title: String
|
||||
},
|
||||
methods: {
|
||||
active() {
|
||||
this.$set(this.data, 'active', !this.data.active);
|
||||
this.$emit('active');
|
||||
},
|
||||
copyRow() {
|
||||
this.$emit('copy');
|
||||
},
|
||||
remove() {
|
||||
this.$emit('remove');
|
||||
backgroundColor: {
|
||||
type: String,
|
||||
default() {
|
||||
return "#F9F1EA"
|
||||
}
|
||||
},
|
||||
showCollapse: {
|
||||
type: Boolean,
|
||||
default() {
|
||||
return true
|
||||
}
|
||||
},
|
||||
title: String
|
||||
},
|
||||
methods: {
|
||||
active() {
|
||||
this.$set(this.data, 'active', !this.data.active);
|
||||
this.$emit('active');
|
||||
},
|
||||
copyRow() {
|
||||
this.$emit('copy');
|
||||
},
|
||||
remove() {
|
||||
this.$emit('remove');
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
@copy="copyRow"
|
||||
@remove="remove"
|
||||
:data="extract"
|
||||
:draggable="draggable"
|
||||
color="#015478"
|
||||
background-color="#E6EEF2"
|
||||
:title="$t('api_test.definition.request.extract_param')">
|
||||
|
@ -46,6 +47,7 @@
|
|||
import MsApiJsonpathSuggest from "../assertion/ApiJsonpathSuggest";
|
||||
import {ExtractJSONPath} from "../../../test/model/ScenarioModel";
|
||||
import ApiBaseComponent from "../../../automation/scenario/common/ApiBaseComponent";
|
||||
|
||||
export default {
|
||||
name: "MsApiExtract",
|
||||
components: {
|
||||
|
@ -66,6 +68,10 @@
|
|||
isReadOnly: {
|
||||
type: Boolean,
|
||||
default: false
|
||||
},
|
||||
draggable: {
|
||||
type: Boolean,
|
||||
default: false,
|
||||
}
|
||||
},
|
||||
data() {
|
||||
|
@ -139,15 +145,18 @@
|
|||
font-size: 13px;
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
|
||||
.extract-item {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.extract-add {
|
||||
padding: 10px;
|
||||
border: #DCDFE6 solid 1px;
|
||||
margin: 5px 0;
|
||||
border-radius: 5px;
|
||||
}
|
||||
|
||||
/deep/ .el-card__body {
|
||||
padding: 15px;
|
||||
}
|
||||
|
|
|
@ -7,13 +7,24 @@
|
|||
:destroy-on-close="true"
|
||||
show-close
|
||||
@closed="handleClose" v-loading="loading">
|
||||
<el-form :model="ruleForm" label-position="right" label-width="80px" size="small" :rules="rule">
|
||||
<el-form-item :label="$t('test_track.module.module')" prop="apiScenarioModuleId">
|
||||
<el-select size="small" style="width: 80%" v-model="apiScenarioModuleId">
|
||||
<el-option v-for="item in moduleOptions" :key="item.id" :label="item.path" :value="item.id"/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
|
||||
<ms-node-tree
|
||||
v-loading="result.loading"
|
||||
:tree-nodes="data"
|
||||
@add="add"
|
||||
:type="'edit'"
|
||||
@edit="edit"
|
||||
@drag="drag"
|
||||
@remove="remove"
|
||||
@nodeSelectEvent="nodeChange"
|
||||
ref="nodeTree">
|
||||
|
||||
<template v-slot:header>
|
||||
<el-input :placeholder="$t('test_track.module.search')" v-model="condition.filterText" size="small">
|
||||
</el-input>
|
||||
</template>
|
||||
|
||||
</ms-node-tree>
|
||||
<span slot="footer" class="dialog-footer">
|
||||
<ms-dialog-footer
|
||||
@cancel="oneClickOperationVisible = false"
|
||||
|
@ -28,31 +39,32 @@
|
|||
import MsApiReportStatus from "../report/ApiReportStatus";
|
||||
import MsApiReportDialog from "./ApiReportDialog";
|
||||
import {getUUID, getCurrentProjectID} from "@/common/js/utils";
|
||||
import SelectMenu from "../../track/common/SelectMenu";
|
||||
import MsNodeTree from "../../track/common/NodeTree";
|
||||
import {buildNodePath} from "../definition/model/NodeTree";
|
||||
|
||||
|
||||
export default {
|
||||
name: "MsUpgrade",
|
||||
components: {
|
||||
MsApiReportDialog, MsApiReportStatus, MsApiScenarioConfig, MsDialogFooter
|
||||
MsApiReportDialog, MsApiReportStatus, MsApiScenarioConfig,
|
||||
MsDialogFooter,
|
||||
MsNodeTree,
|
||||
SelectMenu,
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
oneClickOperationVisible: false,
|
||||
apiScenarioModuleId: "",
|
||||
moduleOptions: [],
|
||||
ruleForm: {},
|
||||
loading: false,
|
||||
rule: {
|
||||
apiScenarioModuleId: [
|
||||
{required: true, message: this.$t('test_track.module.module'), trigger: 'blur'},
|
||||
],
|
||||
}
|
||||
result: {},
|
||||
data: [],
|
||||
condition: {
|
||||
filterText: "",
|
||||
trashEnable: false
|
||||
},
|
||||
currentModule: undefined,
|
||||
};
|
||||
},
|
||||
created() {
|
||||
this.initModule();
|
||||
},
|
||||
props: {
|
||||
selectIds: {
|
||||
type: Set
|
||||
|
@ -64,8 +76,14 @@
|
|||
type: Set
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
'condition.filterText'(val) {
|
||||
this.$refs.nodeTree.filter(val);
|
||||
},
|
||||
},
|
||||
methods: {
|
||||
openOneClickOperation() {
|
||||
this.initModule();
|
||||
this.oneClickOperationVisible = true;
|
||||
},
|
||||
getPath(id) {
|
||||
|
@ -75,9 +93,13 @@
|
|||
return path[0].path;
|
||||
},
|
||||
confirm() {
|
||||
if (!this.currentModule) {
|
||||
this.$warning("请选择一个模块");
|
||||
return;
|
||||
}
|
||||
this.loading = true;
|
||||
let arr = Array.from(this.selectIds);
|
||||
let obj = {testIds: arr, projectId: getCurrentProjectID(), modulePath: this.getPath(this.apiScenarioModuleId), moduleId: this.apiScenarioModuleId};
|
||||
let obj = {testIds: arr, projectId: getCurrentProjectID(), modulePath: this.getPath(this.currentModule.id), moduleId: this.currentModule.id};
|
||||
this.$post("/api/historicalDataUpgrade", obj, response => {
|
||||
this.loading = false;
|
||||
this.$success(this.$t('organization.integration.successful_operation'));
|
||||
|
@ -100,6 +122,69 @@
|
|||
handleClose() {
|
||||
this.ruleForm = {}
|
||||
},
|
||||
edit(param) {
|
||||
param.projectId = getCurrentProjectID();
|
||||
param.protocol = this.condition.protocol;
|
||||
this.$post("/api/automation/module/edit", param, () => {
|
||||
this.$success(this.$t('commons.save_success'));
|
||||
this.initModule();
|
||||
this.refresh();
|
||||
}, (error) => {
|
||||
this.initModule();
|
||||
});
|
||||
},
|
||||
add(param) {
|
||||
param.projectId = getCurrentProjectID();
|
||||
param.protocol = this.condition.protocol;
|
||||
this.$post("/api/automation/module/add", param, () => {
|
||||
this.$success(this.$t('commons.save_success'));
|
||||
this.initModule();
|
||||
}, (error) => {
|
||||
this.initModule();
|
||||
});
|
||||
},
|
||||
remove(nodeIds) {
|
||||
this.$post("/api/automation/module/delete", nodeIds, () => {
|
||||
this.initModule();
|
||||
this.refresh();
|
||||
}, (error) => {
|
||||
this.initModule();
|
||||
});
|
||||
},
|
||||
drag(param, list) {
|
||||
this.$post("/api/automation/module/drag", param, () => {
|
||||
this.$post("/api/automation/module/pos", list, () => {
|
||||
this.initModule();
|
||||
});
|
||||
}, (error) => {
|
||||
this.initModule();
|
||||
});
|
||||
},
|
||||
nodeChange(node, nodeIds, pNodes) {
|
||||
this.currentModule = node.data;
|
||||
this.condition.trashEnable = false;
|
||||
if (node.data.id === 'root') {
|
||||
this.$emit("nodeSelectEvent", node, [], pNodes);
|
||||
} else {
|
||||
this.$emit("nodeSelectEvent", node, nodeIds, pNodes);
|
||||
}
|
||||
},
|
||||
saveAsEdit(data) {
|
||||
this.$emit('saveAsEdit', data);
|
||||
},
|
||||
refresh() {
|
||||
this.$emit("refreshTable");
|
||||
},
|
||||
addScenario() {
|
||||
if (!getCurrentProjectID()) {
|
||||
this.$warning(this.$t('commons.check_project_tip'));
|
||||
return;
|
||||
}
|
||||
this.$refs.basisScenario.open(this.currentModule);
|
||||
},
|
||||
enableTrash() {
|
||||
this.condition.trashEnable = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
|
Loading…
Reference in New Issue