Merge remote-tracking branch 'origin/master'
This commit is contained in:
commit
b2daeb76c2
|
@ -43,10 +43,13 @@ public class MsIfController extends MsTestElement {
|
|||
private IfController ifController() {
|
||||
IfController ifController = new IfController();
|
||||
ifController.setEnabled(this.isEnable());
|
||||
ifController.setName(StringUtils.isEmpty(this.getName()) ? "IfController" : this.getName());
|
||||
if (StringUtils.isEmpty(this.getName())) {
|
||||
this.setName(getLabelName());
|
||||
}
|
||||
ifController.setName(this.getName());
|
||||
ifController.setProperty(TestElement.TEST_CLASS, IfController.class.getName());
|
||||
ifController.setProperty(TestElement.GUI_CLASS, SaveService.aliasToClass("IfControllerPanel"));
|
||||
ifController.setCondition(this.getCondition());
|
||||
ifController.setCondition("true");
|
||||
ifController.setEvaluateAll(false);
|
||||
ifController.setUseExpression(true);
|
||||
return ifController;
|
||||
|
@ -61,13 +64,13 @@ public class MsIfController extends MsTestElement {
|
|||
|
||||
public String getLabelName() {
|
||||
if (isValid()) {
|
||||
String label = variable + " " + operator;
|
||||
String label = "条件控制器:" + variable + " " + operator;
|
||||
if (StringUtils.isNotBlank(value)) {
|
||||
label += " " + this.value;
|
||||
}
|
||||
return label;
|
||||
}
|
||||
return "";
|
||||
return "IfController";
|
||||
}
|
||||
|
||||
public String getCondition() {
|
||||
|
|
|
@ -387,7 +387,8 @@
|
|||
union all
|
||||
select tpac.id as s
|
||||
from test_plan_api_case tpac join api_test_case on tpac.api_case_id = api_test_case.id
|
||||
where tpac.test_plan_id = #{planId}
|
||||
join api_definition on api_test_case.api_definition_id = api_definition.id
|
||||
where tpac.test_plan_id = #{planId} and api_definition.status != 'Trash'
|
||||
union all
|
||||
select tplc.id as s
|
||||
from test_plan_load_case tplc join load_test on tplc.load_case_id = load_test.id
|
||||
|
|
|
@ -70,7 +70,6 @@
|
|||
import {getUUID, downloadFile, checkoutTestManagerOrTestUser} from "@/common/js/utils";
|
||||
import MsApiScenarioModule from "@/business/components/api/automation/scenario/ApiScenarioModule";
|
||||
import MsEditApiScenario from "./scenario/EditApiScenario";
|
||||
import {getCurrentProjectID} from "../../../../common/js/utils";
|
||||
|
||||
export default {
|
||||
name: "ApiAutomation",
|
||||
|
@ -96,7 +95,10 @@
|
|||
},
|
||||
isReadOnly() {
|
||||
return !checkoutTestManagerOrTestUser();
|
||||
}
|
||||
},
|
||||
projectId() {
|
||||
return this.$store.state.projectId
|
||||
},
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
|
@ -145,7 +147,7 @@
|
|||
let selectParamArr = redirectParam.split("edit:");
|
||||
if (selectParamArr.length == 2) {
|
||||
let scenarioId = selectParamArr[1];
|
||||
let projectId = getCurrentProjectID();
|
||||
let projectId = this.projectId;
|
||||
//查找单条数据,跳转修改页面
|
||||
let url = "/api/automation/list/" + 1 + "/" + 1;
|
||||
this.$post(url, {id: scenarioId, projectId: projectId}, response => {
|
||||
|
@ -176,7 +178,7 @@
|
|||
}
|
||||
},
|
||||
addTab(tab) {
|
||||
if (!getCurrentProjectID()) {
|
||||
if (!this.projectId) {
|
||||
this.$warning(this.$t('commons.check_project_tip'));
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -45,7 +45,7 @@
|
|||
import MsApiReportExport from "./ApiReportExport";
|
||||
import MsApiReportViewHeader from "./ApiReportViewHeader";
|
||||
import {RequestFactory} from "../../definition/model/ApiTestModel";
|
||||
import {windowPrint, getCurrentProjectID} from "@/common/js/utils";
|
||||
import {windowPrint} from "@/common/js/utils";
|
||||
|
||||
export default {
|
||||
name: "MsApiReport",
|
||||
|
@ -211,7 +211,7 @@
|
|||
return;
|
||||
}
|
||||
this.loading = true;
|
||||
this.report.projectId = getCurrentProjectID();
|
||||
this.report.projectId = this.projectId;
|
||||
let url = "/api/scenario/report/update";
|
||||
this.result = this.$post(url, this.report, response => {
|
||||
this.$success(this.$t('commons.save_success'));
|
||||
|
@ -236,7 +236,10 @@
|
|||
},
|
||||
isNotRunning() {
|
||||
return "Running" !== this.report.status;
|
||||
}
|
||||
},
|
||||
projectId() {
|
||||
return this.$store.state.projectId
|
||||
},
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
|
|
@ -58,7 +58,7 @@
|
|||
|
||||
<script>
|
||||
import {WORKSPACE_ID} from '@/common/js/constants';
|
||||
import {getCurrentUser, getUUID, getCurrentProjectID} from "@/common/js/utils";
|
||||
import {getCurrentUser, getUUID} from "@/common/js/utils";
|
||||
import MsDialogFooter from "@/business/components/common/components/MsDialogFooter";
|
||||
|
||||
export default {
|
||||
|
@ -84,6 +84,11 @@
|
|||
},
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
projectId() {
|
||||
return this.$store.state.projectId
|
||||
},
|
||||
},
|
||||
methods: {
|
||||
saveScenario(saveAs) {
|
||||
this.$refs['scenarioForm'].validate((valid) => {
|
||||
|
@ -105,7 +110,7 @@
|
|||
})
|
||||
},
|
||||
setParameter() {
|
||||
this.scenarioForm.projectId = getCurrentProjectID();
|
||||
this.scenarioForm.projectId = this.projectId;
|
||||
this.scenarioForm.id = getUUID().substring(0, 8);
|
||||
this.scenarioForm.protocol = this.currentProtocol;
|
||||
|
||||
|
|
|
@ -164,7 +164,7 @@
|
|||
import MsTablePagination from "@/business/components/common/pagination/TablePagination";
|
||||
import ShowMoreBtn from "@/business/components/track/case/components/ShowMoreBtn";
|
||||
import MsTag from "../../../common/components/MsTag";
|
||||
import {downloadFile, getCurrentProjectID, getCurrentUser, getUUID, strMapToObj} from "@/common/js/utils";
|
||||
import {downloadFile, getUUID, strMapToObj} from "@/common/js/utils";
|
||||
import MsApiReportDetail from "../report/ApiReportDetail";
|
||||
import MsTableMoreBtn from "./TableMoreBtn";
|
||||
import MsScenarioExtendButtons from "@/business/components/api/automation/scenario/ScenarioExtendBtns";
|
||||
|
@ -264,7 +264,6 @@
|
|||
infoDb: false,
|
||||
runVisible: false,
|
||||
planVisible: false,
|
||||
projectId: "",
|
||||
runData: [],
|
||||
report: {},
|
||||
selectDataSize: 0,
|
||||
|
@ -338,7 +337,6 @@
|
|||
},
|
||||
created() {
|
||||
this.condition.filters = {status: ["Prepare", "Underway", "Completed"]};
|
||||
this.projectId = getCurrentProjectID();
|
||||
this.search();
|
||||
this.getPrincipalOptions([]);
|
||||
},
|
||||
|
@ -363,7 +361,10 @@
|
|||
computed: {
|
||||
isNotRunning() {
|
||||
return "Running" !== this.report.status;
|
||||
}
|
||||
},
|
||||
projectId() {
|
||||
return this.$store.state.projectId
|
||||
},
|
||||
},
|
||||
methods: {
|
||||
customHeader() {
|
||||
|
@ -559,7 +560,7 @@
|
|||
},
|
||||
buildBatchParam(param) {
|
||||
param.ids = Array.from(this.selectRows).map(row => row.id);
|
||||
param.projectId = getCurrentProjectID();
|
||||
param.projectId = this.projectId;
|
||||
param.condition = this.condition;
|
||||
},
|
||||
handleBatchExecute() {
|
||||
|
@ -640,7 +641,7 @@
|
|||
let scenarioIds = [];
|
||||
scenarioIds.push(row.id);
|
||||
run.id = getUUID();
|
||||
run.projectId = getCurrentProjectID();
|
||||
run.projectId = this.projectId;
|
||||
run.ids = scenarioIds;
|
||||
this.$post(url, run, response => {
|
||||
let data = response.data;
|
||||
|
|
|
@ -59,7 +59,6 @@
|
|||
<script>
|
||||
import SelectMenu from "../../../track/common/SelectMenu";
|
||||
import MsAddBasisScenario from "@/business/components/api/automation/scenario/AddBasisScenario";
|
||||
import {getCurrentProjectID} from "@/common/js/utils";
|
||||
import MsNodeTree from "../../../track/common/NodeTree";
|
||||
import {buildNodePath} from "../../definition/model/NodeTree";
|
||||
import ModuleTrashButton from "../../definition/components/module/ModuleTrashButton";
|
||||
|
@ -90,7 +89,10 @@
|
|||
},
|
||||
isRelevanceModel() {
|
||||
return this.relevanceProjectId ? true : false;
|
||||
}
|
||||
},
|
||||
projectId() {
|
||||
return this.$store.state.projectId
|
||||
},
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
|
@ -99,14 +101,12 @@
|
|||
filterText: "",
|
||||
trashEnable: false
|
||||
},
|
||||
projectId: "",
|
||||
data: [],
|
||||
currentModule: undefined,
|
||||
moduleOptions: [],
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
this.projectId = getCurrentProjectID();
|
||||
this.list();
|
||||
},
|
||||
watch: {
|
||||
|
@ -130,7 +130,7 @@
|
|||
this.addScenario();
|
||||
break;
|
||||
case "import":
|
||||
this.result = this.$get("/api/automation/module/list/" + getCurrentProjectID(), response => {
|
||||
this.result = this.$get("/api/automation/module/list/" + this.projectId, response => {
|
||||
if (response.data != undefined && response.data != null) {
|
||||
this.data = response.data;
|
||||
let moduleOptions = [];
|
||||
|
@ -238,7 +238,7 @@
|
|||
this.$emit("refreshTable");
|
||||
},
|
||||
addScenario() {
|
||||
if (!getCurrentProjectID()) {
|
||||
if (!this.projectId) {
|
||||
this.$warning(this.$t('commons.check_project_tip'));
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -164,7 +164,7 @@
|
|||
</div>
|
||||
|
||||
<!--接口列表-->
|
||||
<scenario-api-relevance @save="pushApiOrCase" ref="scenarioApiRelevance" v-if="type!=='detail'"/>
|
||||
<scenario-api-relevance @save="pushApiOrCase" @close="setHideBtn" ref="scenarioApiRelevance" v-if="type!=='detail'"/>
|
||||
|
||||
<!--自定义接口-->
|
||||
<el-drawer v-if="type!=='detail'" :visible.sync="customizeVisible" :destroy-on-close="true" direction="ltr"
|
||||
|
@ -173,7 +173,7 @@
|
|||
<ms-api-customize :request="customizeRequest" @addCustomizeApi="addCustomizeApi"/>
|
||||
</el-drawer>
|
||||
<!--场景导入 -->
|
||||
<scenario-relevance v-if="type!=='detail'" @save="addScenario" ref="scenarioRelevance"/>
|
||||
<scenario-relevance v-if="type!=='detail'" @save="addScenario" @close="setHideBtn" ref="scenarioRelevance"/>
|
||||
|
||||
<!-- 环境 -->
|
||||
<api-environment-config v-if="type!=='detail'" ref="environmentConfig" @close="environmentConfigClose"/>
|
||||
|
@ -222,7 +222,7 @@
|
|||
import {parseEnvironment} from "../../definition/model/EnvironmentModel";
|
||||
import {ELEMENT_TYPE, ELEMENTS} from "./Setting";
|
||||
import MsApiCustomize from "./ApiCustomize";
|
||||
import {getCurrentProjectID, getUUID, objToStrMap, strMapToObj, handleCtrlSEvent} from "@/common/js/utils";
|
||||
import {getUUID, objToStrMap, strMapToObj, handleCtrlSEvent} from "@/common/js/utils";
|
||||
import ApiEnvironmentConfig from "../../definition/components/environment/ApiEnvironmentConfig";
|
||||
import MsInputTag from "./MsInputTag";
|
||||
import MsRun from "./DebugRun";
|
||||
|
@ -288,7 +288,7 @@
|
|||
loading: false,
|
||||
apiListVisible: false,
|
||||
customizeVisible: false,
|
||||
scenarioVisible: false,
|
||||
isBtnHide: false,
|
||||
debugVisible: false,
|
||||
customizeRequest: {protocol: "HTTP", type: "API", hashTree: [], referenced: 'Created', active: false},
|
||||
operatingElements: [],
|
||||
|
@ -300,7 +300,6 @@
|
|||
path: "/api/automation/create",
|
||||
debugData: {},
|
||||
reportId: "",
|
||||
projectId: "",
|
||||
enableCookieShare: false,
|
||||
globalOptions: {
|
||||
spacing: 30
|
||||
|
@ -317,7 +316,6 @@
|
|||
if (!this.currentScenario.apiScenarioModuleId) {
|
||||
this.currentScenario.apiScenarioModuleId = "";
|
||||
}
|
||||
this.projectId = getCurrentProjectID();
|
||||
this.operatingElements = ELEMENTS.get("ALL");
|
||||
this.getWsProjects();
|
||||
this.getMaintainerOptions();
|
||||
|
@ -438,9 +436,15 @@
|
|||
}
|
||||
];
|
||||
return buttons.filter(btn => btn.show);
|
||||
}
|
||||
},
|
||||
projectId() {
|
||||
return this.$store.state.projectId
|
||||
},
|
||||
},
|
||||
methods: {
|
||||
setHideBtn() {
|
||||
this.isBtnHide = false;
|
||||
},
|
||||
// 打开引用的场景
|
||||
openScenario(data) {
|
||||
this.$emit('openScenario', data);
|
||||
|
@ -532,6 +536,7 @@
|
|||
this.scenarioDefinition.push(new LoopController());
|
||||
break;
|
||||
case ELEMENT_TYPE.scenario:
|
||||
this.isBtnHide = true;
|
||||
this.$refs.scenarioRelevance.open();
|
||||
break;
|
||||
default:
|
||||
|
@ -559,12 +564,14 @@
|
|||
}
|
||||
},
|
||||
showAll() {
|
||||
if (!this.customizeVisible) {
|
||||
// 控制当有弹出页面操作时禁止刷新按钮列表
|
||||
if (!this.customizeVisible && !this.isBtnHide) {
|
||||
this.operatingElements = ELEMENTS.get("ALL");
|
||||
this.selectedTreeNode = undefined;
|
||||
}
|
||||
},
|
||||
apiListImport() {
|
||||
this.isBtnHide = true;
|
||||
this.$refs.scenarioApiRelevance.open();
|
||||
},
|
||||
recursiveSorting(arr) {
|
||||
|
@ -574,7 +581,7 @@
|
|||
arr[i].countController.proceed = true;
|
||||
}
|
||||
if (!arr[i].projectId) {
|
||||
arr[i].projectId = getCurrentProjectID();
|
||||
arr[i].projectId = this.projectId;
|
||||
}
|
||||
if (arr[i].hashTree != undefined && arr[i].hashTree.length > 0) {
|
||||
this.recursiveSorting(arr[i].hashTree);
|
||||
|
@ -596,7 +603,7 @@
|
|||
}
|
||||
// 设置项目ID
|
||||
if (!this.scenarioDefinition[i].projectId) {
|
||||
this.scenarioDefinition[i].projectId = getCurrentProjectID();
|
||||
this.scenarioDefinition[i].projectId = this.projectId;
|
||||
}
|
||||
if (this.scenarioDefinition[i].hashTree != undefined && this.scenarioDefinition[i].hashTree.length > 0) {
|
||||
this.recursiveSorting(this.scenarioDefinition[i].hashTree);
|
||||
|
@ -631,13 +638,17 @@
|
|||
item.hashTree = [];
|
||||
}
|
||||
item.enable === undefined ? item.enable = true : item.enable;
|
||||
this.scenarioDefinition.push(item);
|
||||
if (this.selectedTreeNode != undefined) {
|
||||
this.selectedTreeNode.hashTree.push(item);
|
||||
} else {
|
||||
this.scenarioDefinition.push(item);
|
||||
}
|
||||
})
|
||||
}
|
||||
this.isBtnHide = false;
|
||||
this.sort();
|
||||
this.reload();
|
||||
this.initProjectIds();
|
||||
this.scenarioVisible = false;
|
||||
},
|
||||
setApiParameter(item, refType, referenced) {
|
||||
let request = {};
|
||||
|
@ -676,6 +687,7 @@
|
|||
data.forEach(item => {
|
||||
this.setApiParameter(item, refType, referenced);
|
||||
});
|
||||
this.isBtnHide = false;
|
||||
this.sort();
|
||||
this.reload();
|
||||
this.initProjectIds();
|
||||
|
@ -957,7 +969,7 @@
|
|||
this.projectEnvMap = objToStrMap(obj.environmentMap);
|
||||
} else {
|
||||
// 兼容历史数据
|
||||
this.projectEnvMap.set(getCurrentProjectID(), obj.environmentId);
|
||||
this.projectEnvMap.set(this.projectId, obj.environmentId);
|
||||
}
|
||||
this.currentScenario.variables = [];
|
||||
let index = 1;
|
||||
|
@ -994,7 +1006,7 @@
|
|||
},
|
||||
setParameter() {
|
||||
this.currentScenario.stepTotal = this.scenarioDefinition.length;
|
||||
this.currentScenario.projectId = getCurrentProjectID();
|
||||
this.currentScenario.projectId = this.projectId;
|
||||
this.currentScenario.modulePath = this.getPath(this.currentScenario.apiScenarioModuleId);
|
||||
// 构建一个场景对象 方便引用处理
|
||||
let scenario = {
|
||||
|
|
|
@ -128,6 +128,7 @@ export default {
|
|||
}
|
||||
},
|
||||
close() {
|
||||
this.$emit('close');
|
||||
this.refresh();
|
||||
this.$refs.relevanceDialog.close();
|
||||
},
|
||||
|
|
|
@ -90,8 +90,10 @@
|
|||
response.data.forEach(item => {
|
||||
let scenarioDefinition = JSON.parse(item.scenarioDefinition);
|
||||
if (scenarioDefinition && scenarioDefinition.hashTree) {
|
||||
let obj = {id: item.id, name: item.name, type: "scenario", headers: scenarioDefinition.headers, variables: scenarioDefinition.variables, environmentMap: scenarioDefinition.environmentMap,
|
||||
referenced: 'Copy', resourceId: getUUID(), hashTree: scenarioDefinition.hashTree, projectId: item.projectId};
|
||||
let obj = {
|
||||
id: item.id, name: item.name, type: "scenario", headers: scenarioDefinition.headers, variables: scenarioDefinition.variables, environmentMap: scenarioDefinition.environmentMap,
|
||||
referenced: 'Copy', resourceId: getUUID(), hashTree: scenarioDefinition.hashTree, projectId: item.projectId
|
||||
};
|
||||
scenarios.push(obj);
|
||||
}
|
||||
});
|
||||
|
@ -101,6 +103,7 @@
|
|||
})
|
||||
},
|
||||
close() {
|
||||
this.$emit('close');
|
||||
this.refresh();
|
||||
this.$refs.relevanceDialog.close();
|
||||
},
|
||||
|
|
|
@ -69,8 +69,7 @@
|
|||
|
||||
<script>
|
||||
import MsDialogFooter from "../../../../common/components/MsDialogFooter";
|
||||
import {listenGoBack, removeGoBackListener, getCurrentProjectID} from "@/common/js/utils";
|
||||
import {buildNodePath} from "@/business/components/api/definition/model/NodeTree";
|
||||
import {listenGoBack, removeGoBackListener} from "@/common/js/utils";
|
||||
|
||||
export default {
|
||||
name: "ScenarioImport",
|
||||
|
@ -161,6 +160,9 @@
|
|||
isHar() {
|
||||
return this.selectedPlatformValue === 'Har';
|
||||
},
|
||||
projectId() {
|
||||
return this.$store.state.projectId
|
||||
},
|
||||
},
|
||||
methods: {
|
||||
scheduleEdit() {
|
||||
|
@ -241,7 +243,7 @@
|
|||
})
|
||||
param.modeId = this.formData.modeId
|
||||
}
|
||||
param.projectId = getCurrentProjectID();
|
||||
param.projectId = this.projectId;
|
||||
if (!this.swaggerUrlEable) {
|
||||
param.swaggerUrl = undefined;
|
||||
}
|
||||
|
|
|
@ -90,6 +90,7 @@
|
|||
import ApiResponseComponent from "./ApiResponseComponent";
|
||||
import MsRun from "../DebugRun";
|
||||
import {getUUID} from "@/common/js/utils";
|
||||
import {ELEMENT_TYPE, ELEMENTS} from "../Setting";
|
||||
|
||||
export default {
|
||||
name: "MsLoopController",
|
||||
|
@ -186,7 +187,37 @@
|
|||
this.controller.countController.proceed = true;
|
||||
return;
|
||||
}
|
||||
// 递归遍历所有请求数量
|
||||
if (this.controller.hashTree && this.controller.hashTree.length === 1
|
||||
&& this.controller.hashTree[0].hashTree && this.controller.hashTree[0].hashTree.length > 0) {
|
||||
let count = 0;
|
||||
this.controller.hashTree[0].hashTree.forEach(item => {
|
||||
if (ELEMENTS.get("AllSamplerProxy").indexOf(item.type) != -1) {
|
||||
count++;
|
||||
}
|
||||
if (item.hashTree && item.hashTree.length > 0) {
|
||||
this.recursive(item.hashTree, count);
|
||||
}
|
||||
})
|
||||
|
||||
if (count > 1) {
|
||||
this.$warning("当前循环下超过一个请求,不能关闭状态")
|
||||
this.controller.countController.proceed = true;
|
||||
return;
|
||||
}
|
||||
}
|
||||
},
|
||||
recursive(arr, count) {
|
||||
for (let i in arr) {
|
||||
if (ELEMENTS.get("AllSamplerProxy").indexOf(arr[i].type) != -1) {
|
||||
count++;
|
||||
}
|
||||
if (arr[i].hashTree && arr[i].hashTree.length > 0) {
|
||||
this.recursive(arr[i].hashTree, count);
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
runDebug() {
|
||||
if (!this.controller.hashTree || this.controller.hashTree.length < 1) {
|
||||
this.$warning("当前循环下没有请求,不能执行")
|
||||
|
|
|
@ -135,7 +135,7 @@
|
|||
import {parseEnvironment} from "../../../definition/model/EnvironmentModel";
|
||||
import {ELEMENT_TYPE, ELEMENTS} from "../Setting";
|
||||
import MsApiCustomize from "../ApiCustomize";
|
||||
import {getCurrentProjectID, getUUID, objToStrMap, strMapToObj} from "@/common/js/utils";
|
||||
import {getUUID, strMapToObj} from "@/common/js/utils";
|
||||
import ApiEnvironmentConfig from "../../../definition/components/environment/ApiEnvironmentConfig";
|
||||
import MsInputTag from "../MsInputTag";
|
||||
import MsRun from "../DebugRun";
|
||||
|
@ -215,7 +215,6 @@
|
|||
path: "/api/automation/create",
|
||||
debugData: {},
|
||||
reportId: "",
|
||||
projectId: "",
|
||||
enableCookieShare: false,
|
||||
globalOptions: {
|
||||
spacing: 30
|
||||
|
@ -231,7 +230,6 @@
|
|||
if (!this.currentScenario.apiScenarioModuleId) {
|
||||
this.currentScenario.apiScenarioModuleId = "";
|
||||
}
|
||||
this.projectId = getCurrentProjectID();
|
||||
this.operatingElements = ELEMENTS.get("ALL");
|
||||
this.projectEnvMap = this.envMap;
|
||||
},
|
||||
|
@ -354,7 +352,10 @@
|
|||
}
|
||||
];
|
||||
return buttons.filter(btn => btn.show);
|
||||
}
|
||||
},
|
||||
projectId() {
|
||||
return this.$store.state.projectId
|
||||
},
|
||||
},
|
||||
methods: {
|
||||
// 打开引用的场景
|
||||
|
@ -496,7 +497,7 @@
|
|||
arr[i].countController.proceed = true;
|
||||
}
|
||||
if (!arr[i].projectId) {
|
||||
arr[i].projectId = getCurrentProjectID();
|
||||
arr[i].projectId = this.projectId;
|
||||
}
|
||||
if (arr[i].hashTree != undefined && arr[i].hashTree.length > 0) {
|
||||
this.recursiveSorting(arr[i].hashTree);
|
||||
|
@ -518,7 +519,7 @@
|
|||
}
|
||||
// 设置项目ID
|
||||
if (!this.scenarioDefinition[i].projectId) {
|
||||
this.scenarioDefinition[i].projectId = getCurrentProjectID();
|
||||
this.scenarioDefinition[i].projectId = this.projectId;
|
||||
}
|
||||
if (this.scenarioDefinition[i].hashTree != undefined && this.scenarioDefinition[i].hashTree.length > 0) {
|
||||
this.recursiveSorting(this.scenarioDefinition[i].hashTree);
|
||||
|
@ -858,7 +859,7 @@
|
|||
|
||||
setParameter() {
|
||||
this.currentScenario.stepTotal = this.scenarioDefinition.length;
|
||||
this.currentScenario.projectId = getCurrentProjectID();
|
||||
this.currentScenario.projectId = this.projectId;
|
||||
this.currentScenario.modulePath = this.getPath(this.currentScenario.apiScenarioModuleId);
|
||||
// 构建一个场景对象 方便引用处理
|
||||
let scenario = {
|
||||
|
|
|
@ -191,6 +191,7 @@ export default {
|
|||
req.id = getUUID();
|
||||
data.request = JSON.stringify(req);
|
||||
data.method = this.api.method;
|
||||
data.path = this.api.path;
|
||||
data.url = this.api.url;
|
||||
data.status = this.api.status;
|
||||
data.userId = this.api.userId;
|
||||
|
|
|
@ -1,16 +1,25 @@
|
|||
<template>
|
||||
<div v-loading="result.loading" class="pressure-config-container">
|
||||
<el-row>
|
||||
<el-col>
|
||||
<ms-chart class="chart-container" ref="chart1" :options="options" :autoresize="true"></ms-chart>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-row>
|
||||
<el-collapse v-model="activeNames">
|
||||
<el-collapse-item :title="threadGroup.attributes.testname" :name="index"
|
||||
v-for="(threadGroup, index) in threadGroups.filter(th=>th.enabled === 'true' && th.deleted=='false')"
|
||||
:key="index">
|
||||
<el-col :span="10">
|
||||
<el-col :span="10">
|
||||
|
||||
<el-collapse v-model="activeNames" accordion>
|
||||
<el-collapse-item :name="index"
|
||||
v-for="(threadGroup, index) in threadGroups.filter(th=>th.enabled === 'true' && th.deleted=='false')"
|
||||
:key="index">
|
||||
<template slot="title">
|
||||
<div style="padding-right: 10px">
|
||||
{{ threadGroup.attributes.testname }}
|
||||
</div>
|
||||
<el-tag type="primary" size="mini" v-if="threadGroup.threadType === 'DURATION'">
|
||||
{{ $t('load_test.thread_num') }}{{ threadGroup.threadNumber }},
|
||||
{{ $t('load_test.duration') }}: {{ threadGroup.duration }} {{ getUnitLabel(threadGroup) }}
|
||||
</el-tag>
|
||||
<el-tag type="primary" size="mini" v-if="threadGroup.threadType === 'ITERATION'">
|
||||
{{ $t('load_test.thread_num') }} {{ threadGroup.threadNumber }},
|
||||
{{ $t('load_test.iterate_num') }} {{ threadGroup.iterateNum }}
|
||||
</el-tag>
|
||||
</template>
|
||||
<el-form :inline="true">
|
||||
<el-form-item :label="$t('load_test.thread_num')">
|
||||
<el-input-number
|
||||
|
@ -34,7 +43,7 @@
|
|||
:disabled="true"
|
||||
v-model="threadGroup.duration"
|
||||
:min="1"
|
||||
@change="calculateChart(threadGroup)"
|
||||
@change="calculateTotalChart(threadGroup)"
|
||||
size="mini"/>
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
|
@ -51,7 +60,7 @@
|
|||
<el-input-number
|
||||
:disabled="true"
|
||||
v-model="threadGroup.rpsLimit"
|
||||
@change="calculateChart(threadGroup)"
|
||||
@change="calculateTotalChart(threadGroup)"
|
||||
:min="1"
|
||||
size="mini"/>
|
||||
</el-form-item>
|
||||
|
@ -63,7 +72,7 @@
|
|||
:min="1"
|
||||
:max="threadGroup.duration"
|
||||
v-model="threadGroup.rampUpTime"
|
||||
@change="calculateChart(threadGroup)"
|
||||
@change="calculateTotalChart(threadGroup)"
|
||||
size="mini"/>
|
||||
</el-form-item>
|
||||
<el-form-item :label="$t('load_test.ramp_up_time_minutes', [getUnitLabel(threadGroup)])">
|
||||
|
@ -72,7 +81,7 @@
|
|||
:min="1"
|
||||
:max="Math.min(threadGroup.threadNumber, threadGroup.rampUpTime)"
|
||||
v-model="threadGroup.step"
|
||||
@change="calculateChart(threadGroup)"
|
||||
@change="calculateTotalChart(threadGroup)"
|
||||
size="mini"/>
|
||||
</el-form-item>
|
||||
<el-form-item :label="$t('load_test.ramp_up_time_times')"/>
|
||||
|
@ -96,7 +105,7 @@
|
|||
:disabled="true"
|
||||
v-model="threadGroup.iterateNum"
|
||||
:min="1"
|
||||
@change="calculateChart(threadGroup)"
|
||||
@change="calculateTotalChart(threadGroup)"
|
||||
size="mini"/>
|
||||
</el-form-item>
|
||||
<br>
|
||||
|
@ -106,7 +115,7 @@
|
|||
<el-input-number
|
||||
:disabled="true || !threadGroup.rpsLimitEnable"
|
||||
v-model="threadGroup.rpsLimit"
|
||||
@change="calculateChart(threadGroup)"
|
||||
@change="calculateTotalChart(threadGroup)"
|
||||
:min="1"
|
||||
size="mini"/>
|
||||
</el-form-item>
|
||||
|
@ -116,19 +125,18 @@
|
|||
:disabled="true"
|
||||
:min="1"
|
||||
v-model="threadGroup.iterateRampUp"
|
||||
@change="calculateChart(threadGroup)"
|
||||
@change="calculateTotalChart(threadGroup)"
|
||||
size="mini"/>
|
||||
</el-form-item>
|
||||
<el-form-item :label="$t('load_test.ramp_up_time_seconds', [getUnitLabel(threadGroup)])"/>
|
||||
</div>
|
||||
</el-form>
|
||||
</el-col>
|
||||
<el-col :span="14">
|
||||
<div class="title">{{ $t('load_test.pressure_prediction_chart') }}</div>
|
||||
<ms-chart class="chart-container" :options="threadGroup.options" :autoresize="true"></ms-chart>
|
||||
</el-col>
|
||||
</el-collapse-item>
|
||||
</el-collapse>
|
||||
</el-collapse-item>
|
||||
</el-collapse>
|
||||
</el-col>
|
||||
<el-col :span="14">
|
||||
<ms-chart class="chart-container" ref="chart1" :options="options" :autoresize="true"></ms-chart>
|
||||
</el-col>
|
||||
</el-row>
|
||||
</div>
|
||||
</template>
|
||||
|
@ -240,8 +248,7 @@ export default {
|
|||
break;
|
||||
}
|
||||
});
|
||||
this.calculateChart(this.threadGroups[i]);
|
||||
|
||||
this.calculateTotalChart(this.threadGroups[i]);
|
||||
}
|
||||
},
|
||||
getLoadConfig() {
|
||||
|
|
|
@ -14,21 +14,33 @@
|
|||
</el-select>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<ms-chart class="chart-container" ref="chart1" :options="options" :autoresize="true"></ms-chart>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-row>
|
||||
<el-collapse v-model="activeNames">
|
||||
<el-collapse-item :title="threadGroup.attributes.testname" :name="index"
|
||||
v-for="(threadGroup, index) in threadGroups.filter(th=>th.enabled === 'true' && th.deleted=='false')"
|
||||
:key="index">
|
||||
<el-col :span="10">
|
||||
<el-col :span="12">
|
||||
<el-collapse v-model="activeNames" accordion>
|
||||
<el-collapse-item :name="index"
|
||||
v-for="(threadGroup, index) in threadGroups.filter(th=>th.enabled === 'true' && th.deleted=='false')"
|
||||
:key="index">
|
||||
<template slot="title">
|
||||
<div style="padding-right: 20px; font-size: 16px;">
|
||||
{{ threadGroup.attributes.testname }}
|
||||
</div>
|
||||
<el-tag type="primary" size="mini" v-if="threadGroup.threadType === 'DURATION'">
|
||||
{{ $t('load_test.thread_num') }}{{ threadGroup.threadNumber }},
|
||||
{{ $t('load_test.duration') }}: {{ threadGroup.duration }} {{ getUnitLabel(threadGroup) }}
|
||||
</el-tag>
|
||||
<el-tag type="primary" size="mini" v-if="threadGroup.threadType === 'ITERATION'">
|
||||
{{ $t('load_test.thread_num') }} {{ threadGroup.threadNumber }},
|
||||
{{$t('load_test.iterate_num')}} {{threadGroup.iterateNum}}
|
||||
</el-tag>
|
||||
</template>
|
||||
<el-form :inline="true">
|
||||
<el-form-item :label="$t('load_test.thread_num')">
|
||||
<el-input-number
|
||||
:disabled="isReadOnly"
|
||||
v-model="threadGroup.threadNumber"
|
||||
@change="calculateChart(threadGroup)"
|
||||
@change="calculateTotalChart(threadGroup)"
|
||||
:min="resourcePoolResourceLength"
|
||||
size="mini"/>
|
||||
</el-form-item>
|
||||
|
@ -47,7 +59,7 @@
|
|||
v-model="threadGroup.duration"
|
||||
:min="1"
|
||||
:max="9999"
|
||||
@change="calculateChart(threadGroup)"
|
||||
@change="calculateTotalChart(threadGroup)"
|
||||
size="mini"/>
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
|
@ -64,7 +76,7 @@
|
|||
<el-input-number
|
||||
:disabled="isReadOnly || !threadGroup.rpsLimitEnable"
|
||||
v-model="threadGroup.rpsLimit"
|
||||
@change="calculateChart(threadGroup)"
|
||||
@change="calculateTotalChart(threadGroup)"
|
||||
:min="1"
|
||||
:max="99999"
|
||||
size="mini"/>
|
||||
|
@ -77,7 +89,7 @@
|
|||
:min="1"
|
||||
:max="threadGroup.duration"
|
||||
v-model="threadGroup.rampUpTime"
|
||||
@change="calculateChart(threadGroup)"
|
||||
@change="calculateTotalChart(threadGroup)"
|
||||
size="mini"/>
|
||||
</el-form-item>
|
||||
<el-form-item :label="$t('load_test.ramp_up_time_minutes', [getUnitLabel(threadGroup)])">
|
||||
|
@ -86,7 +98,7 @@
|
|||
:min="1"
|
||||
:max="Math.min(threadGroup.threadNumber, threadGroup.rampUpTime)"
|
||||
v-model="threadGroup.step"
|
||||
@change="calculateChart(threadGroup)"
|
||||
@change="calculateTotalChart(threadGroup)"
|
||||
size="mini"/>
|
||||
</el-form-item>
|
||||
<el-form-item :label="$t('load_test.ramp_up_time_times')"/>
|
||||
|
@ -98,7 +110,7 @@
|
|||
:disabled="isReadOnly"
|
||||
:min="1"
|
||||
v-model="threadGroup.rampUpTime"
|
||||
@change="calculateChart(threadGroup)"
|
||||
@change="calculateTotalChart(threadGroup)"
|
||||
size="mini"/>
|
||||
</el-form-item>
|
||||
<el-form-item :label="$t('load_test.ramp_up_time_seconds', [getUnitLabel(threadGroup)])"/>
|
||||
|
@ -112,7 +124,7 @@
|
|||
v-model="threadGroup.iterateNum"
|
||||
:min="1"
|
||||
:max="9999999"
|
||||
@change="calculateChart(threadGroup)"
|
||||
@change="calculateTotalChart(threadGroup)"
|
||||
size="mini"/>
|
||||
</el-form-item>
|
||||
<br>
|
||||
|
@ -137,13 +149,13 @@
|
|||
<el-form-item :label="$t('load_test.ramp_up_time_seconds', [getUnitLabel(threadGroup)])"/>
|
||||
</div>
|
||||
</el-form>
|
||||
</el-col>
|
||||
<el-col :span="14">
|
||||
<div class="title">{{ $t('load_test.pressure_prediction_chart') }}</div>
|
||||
<ms-chart class="chart-container" :options="threadGroup.options" :autoresize="true"></ms-chart>
|
||||
</el-col>
|
||||
</el-collapse-item>
|
||||
</el-collapse>
|
||||
</el-collapse-item>
|
||||
</el-collapse>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<div class="title">{{ $t('load_test.pressure_prediction_chart') }}</div>
|
||||
<ms-chart class="chart-container" ref="chart1" :options="options" :autoresize="true"></ms-chart>
|
||||
</el-col>
|
||||
</el-row>
|
||||
</div>
|
||||
</template>
|
||||
|
@ -303,8 +315,6 @@ export default {
|
|||
this.$set(this.threadGroups[i], "enabled", this.threadGroups[i].enabled || 'true');
|
||||
this.$set(this.threadGroups[i], "deleted", this.threadGroups[i].deleted || 'false');
|
||||
})
|
||||
this.calculateChart(this.threadGroups[i]);
|
||||
|
||||
}
|
||||
this.calculateTotalChart();
|
||||
}
|
||||
|
@ -639,18 +649,33 @@ export default {
|
|||
border-bottom: 1px solid #DCDFE6;
|
||||
}
|
||||
|
||||
/deep/ .el-collapse-item__content{
|
||||
padding-left: 10px;
|
||||
padding-bottom: 5px;
|
||||
border-left-width: 8px;
|
||||
border-left-style: solid;
|
||||
border-left-color: #F5F7FA;
|
||||
border-top-left-radius: 3px;
|
||||
border-bottom-left-radius: 3px;
|
||||
}
|
||||
|
||||
.chart-container {
|
||||
width: 100%;
|
||||
height: 300px;
|
||||
}
|
||||
|
||||
.el-form-item {
|
||||
margin-top: 5px;
|
||||
margin-bottom: 5px;
|
||||
}
|
||||
|
||||
.el-col .el-form {
|
||||
margin-top: 15px;
|
||||
margin-top: 5px;
|
||||
text-align: left;
|
||||
}
|
||||
|
||||
.el-col {
|
||||
margin-top: 15px;
|
||||
margin-top: 5px;
|
||||
text-align: left;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue