This commit is contained in:
fit2-zhao 2021-02-04 17:54:14 +08:00
commit bd12a36af5
5 changed files with 104 additions and 96 deletions

View File

@ -11,6 +11,7 @@
@edit="edit" @edit="edit"
@drag="drag" @drag="drag"
@remove="remove" @remove="remove"
@refresh="list"
@nodeSelectEvent="nodeChange" @nodeSelectEvent="nodeChange"
ref="nodeTree"> ref="nodeTree">
@ -34,24 +35,24 @@
</template> </template>
<script> <script>
import SelectMenu from "../../../track/common/SelectMenu"; import SelectMenu from "../../../track/common/SelectMenu";
import MsAddBasisScenario from "@/business/components/api/automation/scenario/AddBasisScenario"; import MsAddBasisScenario from "@/business/components/api/automation/scenario/AddBasisScenario";
import {getCurrentProjectID} from "@/common/js/utils"; import {getCurrentProjectID} from "@/common/js/utils";
import MsNodeTree from "../../../track/common/NodeTree"; import MsNodeTree from "../../../track/common/NodeTree";
import {buildNodePath} from "../../definition/model/NodeTree"; import {buildNodePath} from "../../definition/model/NodeTree";
import ModuleTrashButton from "../../definition/components/module/ModuleTrashButton"; import ModuleTrashButton from "../../definition/components/module/ModuleTrashButton";
export default { export default {
name: 'MsApiScenarioModule', name: 'MsApiScenarioModule',
components: { components: {
ModuleTrashButton, ModuleTrashButton,
MsNodeTree, MsNodeTree,
MsAddBasisScenario, MsAddBasisScenario,
SelectMenu, SelectMenu,
}, },
props: { props: {
isReadOnly: { isReadOnly: {
type: Boolean, type: Boolean,
default() { default() {
return false return false
} }

View File

@ -11,6 +11,7 @@
@edit="edit" @edit="edit"
@drag="drag" @drag="drag"
@remove="remove" @remove="remove"
@refresh="list"
@nodeSelectEvent="nodeChange" @nodeSelectEvent="nodeChange"
ref="nodeTree"> ref="nodeTree">
@ -33,26 +34,26 @@
</template> </template>
<script> <script>
import MsAddBasisApi from "../basis/AddBasisApi"; import MsAddBasisApi from "../basis/AddBasisApi";
import SelectMenu from "../../../../track/common/SelectMenu"; import SelectMenu from "../../../../track/common/SelectMenu";
import {OPTIONS} from "../../model/JsonData"; import {OPTIONS} from "../../model/JsonData";
import ApiImport from "../import/ApiImport"; import ApiImport from "../import/ApiImport";
import {getCurrentProjectID} from "@/common/js/utils"; import {getCurrentProjectID} from "@/common/js/utils";
import MsNodeTree from "../../../../track/common/NodeTree"; import MsNodeTree from "../../../../track/common/NodeTree";
import ApiModuleHeader from "./ApiModuleHeader"; import ApiModuleHeader from "./ApiModuleHeader";
import {buildNodePath} from "../../model/NodeTree"; import {buildNodePath} from "../../model/NodeTree";
export default { export default {
name: 'MsApiModule', name: 'MsApiModule',
components: { components: {
ApiModuleHeader, ApiModuleHeader,
MsNodeTree, MsNodeTree,
MsAddBasisApi, MsAddBasisApi,
SelectMenu, SelectMenu,
ApiImport ApiImport
}, },
data() { data() {
return { return {
result: {}, result: {},
condition: { condition: {
protocol: OPTIONS[0].value, protocol: OPTIONS[0].value,

View File

@ -14,11 +14,11 @@
<el-form :inline="true"> <el-form :inline="true">
<el-form-item :label="$t('load_test.thread_num')"> <el-form-item :label="$t('load_test.thread_num')">
<el-input-number <el-input-number
:disabled="true" :disabled="true"
:placeholder="$t('load_test.input_thread_num')" :placeholder="$t('load_test.input_thread_num')"
v-model="threadGroup.threadNumber" v-model="threadGroup.threadNumber"
:min="1" :min="1"
size="mini"/> size="mini"/>
</el-form-item> </el-form-item>
<br> <br>
<el-form-item> <el-form-item>
@ -31,72 +31,72 @@
<div v-if="threadGroup.threadType === 'DURATION'"> <div v-if="threadGroup.threadType === 'DURATION'">
<el-form-item :label="$t('load_test.duration')"> <el-form-item :label="$t('load_test.duration')">
<el-input-number <el-input-number
:disabled="true" :disabled="true"
v-model="threadGroup.duration" v-model="threadGroup.duration"
:min="1" :min="1"
@change="calculateChart(threadGroup)" @change="calculateChart(threadGroup)"
size="mini"/> size="mini"/>
</el-form-item> </el-form-item>
<br> <br>
<el-form-item :label="$t('load_test.rps_limit')"> <el-form-item :label="$t('load_test.rps_limit')">
<el-switch v-model="threadGroup.rpsLimitEnable" @change="calculateTotalChart()"/> <el-switch v-model="threadGroup.rpsLimitEnable" @change="calculateTotalChart()"/>
&nbsp; &nbsp;
<el-input-number <el-input-number
:disabled="true " :disabled="true "
v-model="threadGroup.rpsLimit" v-model="threadGroup.rpsLimit"
@change="calculateChart(threadGroup)" @change="calculateChart(threadGroup)"
:min="1" :min="1"
size="mini"/> size="mini"/>
</el-form-item> </el-form-item>
<br> <br>
<el-form-item :label="$t('load_test.ramp_up_time_within')"> <el-form-item :label="$t('load_test.ramp_up_time_within')">
<el-input-number <el-input-number
:disabled="true" :disabled="true"
:min="1" :min="1"
:max="threadGroup.duration" :max="threadGroup.duration"
v-model="threadGroup.rampUpTime" v-model="threadGroup.rampUpTime"
@change="calculateChart(threadGroup)" @change="calculateChart(threadGroup)"
size="mini"/> size="mini"/>
</el-form-item> </el-form-item>
<el-form-item :label="$t('load_test.ramp_up_time_minutes')"> <el-form-item :label="$t('load_test.ramp_up_time_minutes')">
<el-input-number <el-input-number
:disabled="true" :disabled="true"
:min="1" :min="1"
:max="Math.min(threadGroup.threadNumber, threadGroup.rampUpTime)" :max="Math.min(threadGroup.threadNumber, threadGroup.rampUpTime)"
v-model="threadGroup.step" v-model="threadGroup.step"
@change="calculateChart(threadGroup)" @change="calculateChart(threadGroup)"
size="mini"/> size="mini"/>
</el-form-item> </el-form-item>
<el-form-item :label="$t('load_test.ramp_up_time_times')"/> <el-form-item :label="$t('load_test.ramp_up_time_times')"/>
</div> </div>
<div v-if="threadGroup.threadType === 'ITERATION'"> <div v-if="threadGroup.threadType === 'ITERATION'">
<el-form-item :label="$t('load_test.iterate_num')"> <el-form-item :label="$t('load_test.iterate_num')">
<el-input-number <el-input-number
:disabled="true" :disabled="true"
v-model="threadGroup.iterateNum" v-model="threadGroup.iterateNum"
:min="1" :min="1"
@change="calculateChart(threadGroup)" @change="calculateChart(threadGroup)"
size="mini"/> size="mini"/>
</el-form-item> </el-form-item>
<br> <br>
<el-form-item :label="$t('load_test.rps_limit')"> <el-form-item :label="$t('load_test.rps_limit')">
<el-switch v-model="threadGroup.rpsLimitEnable" @change="calculateTotalChart()"/> <el-switch v-model="threadGroup.rpsLimitEnable" @change="calculateTotalChart()"/>
&nbsp; &nbsp;
<el-input-number <el-input-number
:disabled="true || !threadGroup.rpsLimitEnable" :disabled="true || !threadGroup.rpsLimitEnable"
v-model="threadGroup.rpsLimit" v-model="threadGroup.rpsLimit"
@change="calculateChart(threadGroup)" @change="calculateChart(threadGroup)"
:min="1" :min="1"
size="mini"/> size="mini"/>
</el-form-item> </el-form-item>
<br> <br>
<el-form-item :label="$t('load_test.ramp_up_time_within')"> <el-form-item :label="$t('load_test.ramp_up_time_within')">
<el-input-number <el-input-number
:disabled="true" :disabled="true"
:min="1" :min="1"
v-model="threadGroup.iterateRampUp" v-model="threadGroup.iterateRampUp"
@change="calculateChart(threadGroup)" @change="calculateChart(threadGroup)"
size="mini"/> size="mini"/>
</el-form-item> </el-form-item>
<el-form-item :label="$t('load_test.ramp_up_time_seconds')"/> <el-form-item :label="$t('load_test.ramp_up_time_seconds')"/>
</div> </div>
@ -129,11 +129,11 @@ const ITERATE_RAMP_UP = "iterateRampUpTime";
const hexToRgba = function (hex, opacity) { const hexToRgba = function (hex, opacity) {
return 'rgba(' + parseInt('0x' + hex.slice(1, 3)) + ',' + parseInt('0x' + hex.slice(3, 5)) + ',' return 'rgba(' + parseInt('0x' + hex.slice(1, 3)) + ',' + parseInt('0x' + hex.slice(3, 5)) + ','
+ parseInt('0x' + hex.slice(5, 7)) + ',' + opacity + ')'; + parseInt('0x' + hex.slice(5, 7)) + ',' + opacity + ')';
} }
const hexToRgb = function (hex) { const hexToRgb = function (hex) {
return 'rgb(' + parseInt('0x' + hex.slice(1, 3)) + ',' + parseInt('0x' + hex.slice(3, 5)) return 'rgb(' + parseInt('0x' + hex.slice(1, 3)) + ',' + parseInt('0x' + hex.slice(3, 5))
+ ',' + parseInt('0x' + hex.slice(5, 7)) + ')'; + ',' + parseInt('0x' + hex.slice(5, 7)) + ')';
} }
export default { export default {
@ -469,11 +469,12 @@ export default {
}, },
}, },
watch: { watch: {
'report.testId': { report: {
handler() { handler() {
this.getJmxContent(); this.getJmxContent();
}, },
} deep: true
},
} }
} }
</script> </script>

View File

@ -220,6 +220,10 @@ export default {
if (dropType === "none" || dropType === undefined) { if (dropType === "none" || dropType === undefined) {
return; return;
} }
if (dropNode.data.id === 'root' && dropType === 'before') {
this.$emit('refresh');
return false;
}
let param = this.buildParam(draggingNode, dropNode, dropType); let param = this.buildParam(draggingNode, dropNode, dropType);
let list = []; let list = [];
this.getNodeTree(this.treeNodes, draggingNode.data.id, list); this.getNodeTree(this.treeNodes, draggingNode.data.id, list);

View File

@ -8,25 +8,26 @@
@drag="drag" @drag="drag"
@remove="remove" @remove="remove"
@nodeSelectEvent="nodeChange" @nodeSelectEvent="nodeChange"
@refresh="list"
ref="nodeTree"/> ref="nodeTree"/>
</template> </template>
<script> <script>
import NodeEdit from "./NodeEdit"; import NodeEdit from "./NodeEdit";
import {getCurrentProjectID} from "../../../../common/js/utils"; import {getCurrentProjectID} from "../../../../common/js/utils";
import MsNodeTree from "./NodeTree"; import MsNodeTree from "./NodeTree";
export default { export default {
name: "TestCaseNodeTree", name: "TestCaseNodeTree",
components: {MsNodeTree, NodeEdit }, components: {MsNodeTree, NodeEdit},
data() { data() {
return { return {
defaultProps: { defaultProps: {
children: "children", children: "children",
label: "label" label: "label"
}, },
result: {}, result: {},
treeNodes: [], treeNodes: [],
projectId: "" projectId: ""
}; };
}, },