# Conflicts:
#	frontend/src/business/components/api/automation/scenario/EditApiScenario.vue
This commit is contained in:
fit2-zhao 2021-01-08 17:53:45 +08:00
commit fe74a26fd2
19 changed files with 425 additions and 289 deletions

View File

@ -116,4 +116,8 @@ public class ApiTestCaseController {
public String jenkinsRun(@RequestBody RunCaseRequest request) {
return apiTestCaseService.run(request);
}
@GetMapping(value = "/jenkins/exec/result/{id}")
public String getExecResult(@PathVariable String id) {
return apiTestCaseService.getExecResult(id);
}
}

View File

@ -0,0 +1,5 @@
package io.metersphere.api.dto.definition.request.variable;
public enum ScenarioVariableType {
CONSTANT, LIST, CSV, COUNTER, RANDOM,
}

View File

@ -220,17 +220,21 @@ public class Swagger2Parser extends SwaggerAbstractParser {
//模型数组
ArrayModel arrayModel = (ArrayModel) schema;
Property items = arrayModel.getItems();
JSONArray propertyList = new JSONArray();
if (items instanceof RefProperty) {
RefProperty refProperty = (RefProperty) items;
String simpleRef = refProperty.getSimpleRef();
HashSet<String> refSet = new HashSet<>();
refSet.add(simpleRef);
Model model = definitions.get(simpleRef);
JSONArray propertyList = new JSONArray();
if (model != null) {
propertyList.add(getBodyParameters(model.getProperties(), refSet));
return propertyList.toString();
} else {
propertyList.add(new JSONObject());
}
}
return propertyList.toString();
}
return "";
}

View File

@ -16,6 +16,7 @@ import io.metersphere.api.dto.definition.request.sampler.MsHTTPSamplerProxy;
import io.metersphere.api.dto.scenario.request.RequestType;
import io.metersphere.api.jmeter.JMeterService;
import io.metersphere.base.domain.*;
import io.metersphere.base.mapper.ApiDefinitionExecResultMapper;
import io.metersphere.base.mapper.ApiDefinitionMapper;
import io.metersphere.base.mapper.ApiTestCaseMapper;
import io.metersphere.base.mapper.ApiTestFileMapper;
@ -71,6 +72,8 @@ public class ApiTestCaseService {
private ApiDefinitionMapper apiDefinitionMapper;
@Resource
private JMeterService jMeterService;
@Resource
private ApiDefinitionExecResultMapper apiDefinitionExecResultMapper;
private static final String BODY_FILE_DIR = "/opt/metersphere/data/body";
@ -438,6 +441,7 @@ public class ApiTestCaseService {
mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
MsTestElement element = mapper.readValue(testCaseWithBLOBs.getRequest(), new TypeReference<MsTestElement>() {
});
element.setName(request.getCaseId());
// 测试计划
MsTestPlan testPlan = new MsTestPlan();
testPlan.setHashTree(new LinkedList<>());
@ -466,4 +470,11 @@ public class ApiTestCaseService {
return request.getReportId();
}
public String getExecResult(String id){
ApiDefinitionExecResultExample apidefinitionexecresultexample = new ApiDefinitionExecResultExample();
ApiDefinitionExecResultExample.Criteria criteria = apidefinitionexecresultexample.createCriteria();
criteria.andResourceIdEqualTo(id);
String status=apiDefinitionExecResultMapper.selectByExample(apidefinitionexecresultexample).get(0).getStatus();
return status;
}
}

View File

@ -252,6 +252,18 @@
#{value}
</foreach>
</when>
<when test="key=='method'">
and api_definition.method in
<foreach collection="values" item="value" separator="," open="(" close=")">
#{value}
</foreach>
</when>
<when test="key=='user_id'">
and api_definition.user_id in
<foreach collection="values" item="value" separator="," open="(" close=")">
#{value}
</foreach>
</when>
</choose>
</if>
</foreach>
@ -270,7 +282,12 @@
<if test="request.orders != null and request.orders.size() > 0">
order by
<foreach collection="request.orders" separator="," item="order">
<if test="order.name == 'user_name'">
user_name ${order.type}
</if>
<if test="order.name != 'user_name'">
api_definition.${order.name} ${order.type}
</if>
</foreach>
</if>
</select>
@ -351,10 +368,30 @@
</foreach>
</if>
<if test="request.filters != null and request.filters.size() > 0">
<foreach collection="request.filters.entrySet()" index="key" item="values">
<if test="values != null and values.size() > 0">
<choose>
<when test="key=='status'">
and api_definition.status in
<foreach collection="request.filters" item="value" separator="," open="(" close=")">
<foreach collection="values" item="value" separator="," open="(" close=")">
#{value}
</foreach>
</when>
<when test="key=='method'">
and api_definition.method in
<foreach collection="values" item="value" separator="," open="(" close=")">
#{value}
</foreach>
</when>
<when test="key=='user_id'">
and api_definition.user_id in
<foreach collection="values" item="value" separator="," open="(" close=")">
#{value}
</foreach>
</when>
</choose>
</if>
</foreach>
</if>
and exists (
select id

View File

@ -196,12 +196,6 @@
AND atc.api_definition_id = #{request.apiDefinitionId}
</if>
</where>
<if test="request.orders != null and request.orders.size() > 0">
order by
<foreach collection="request.orders" separator="," item="order">
atc.${order.name} ${order.type}
</foreach>
</if>
</select>
<select id="listSimple" resultType="io.metersphere.api.dto.definition.ApiTestCaseDTO">

View File

@ -320,21 +320,28 @@
</if>
</select>
<select id="listByMethod" resultType="io.metersphere.track.dto.TestCaseDTO">
SELECT id,name,status,project_id,"api" as type from api_test
SELECT id,name,project_id,"api" as type from api_test
<where>
<if test="request.projectId!=null">
and project_id=#{request.projectId}
</if>
</where>
UNION ALL
select id,name,status,project_id,"perform" as type from load_test
select id,name,project_id,"perform" as type from load_test
<where>
<if test="request.projectId!=null">
and project_id= #{request.projectId}
</if>
</where>
UNION ALL
select id,name,status,project_id,"scenario" as type from api_scenario
select id,name,project_id,"scenario" as type from api_scenario
<where>
<if test="request.projectId!=null">
and project_id= #{request.projectId}
</if>
</where>
UNION ALL
select id,name,project_id,"definition" as type from api_test_case
<where>
<if test="request.projectId!=null">
and project_id= #{request.projectId}

View File

@ -72,6 +72,12 @@
#{value}
</foreach>
</when>
<when test="key == 'user_id'">
and c.create_user_id in
<foreach collection="values" item="value" separator="," open="(" close=")">
#{value}
</foreach>
</when>
</choose>
</if>
</foreach>
@ -83,6 +89,9 @@
<when test="order.name == 'update_time'">
t.${order.name} ${order.type}
</when>
<when test="order.name == 'create_user'">
create_user_id ${order.type}
</when>
<otherwise>
${order.name} ${order.type}
</otherwise>

View File

@ -320,31 +320,46 @@
</select>
<select id="get" resultType="io.metersphere.track.dto.TestPlanCaseDTO">
select test_case.remark, test_plan_test_case.id as id, test_plan_test_case.*,test_case.*,test_case_node.name as model, project.name as projectName
select test_case.remark,
test_plan_test_case.id as id,
test_plan_test_case.*,
test_case.*,
test_case_node.name as model,
project.name as projectName
from test_plan_test_case
inner join test_case on test_plan_test_case.case_id = test_case.id
left join test_case_node on test_case_node.id=test_case.node_id
left join test_case_node on test_case_node.id = test_case.node_id
inner join project on project.id = test_case.project_id
where test_plan_test_case.id = #{testPlanTestCaseId}
</select>
<select id="getExecResultByPlanId" resultType="java.lang.String">
select status
from
test_plan_test_case
from test_plan_test_case
where plan_id = #{planId}
</select>
<select id="listByPlanId" resultType="io.metersphere.track.dto.TestPlanCaseDTO">
SELECT test_plan_api_case.api_case_id as id,"definition" as type,api_test_case.name,test_plan_api_case.status
from test_plan_api_case left join api_test_case on test_plan_api_case.api_case_id=api_test_case.id
inner join
api_definition a
on
api_test_case.api_definition_id = a.id
and a.status != 'Trash'
<where>
<if test="request.planId != null">
and test_plan_api_case.test_plan_id = #{request.planId}
</if>
</where>
UNION ALL
SELECT test_plan_api_scenario.api_scenario_id as id,"scenario" as type,api_scenario.name,test_plan_api_scenario.status
from test_plan_api_scenario left join api_scenario on test_plan_api_scenario.api_scenario_id=api_scenario.id
SELECT test_plan_api_scenario.api_scenario_id as id,"scenario" as
type,api_scenario.name,test_plan_api_scenario.status
from test_plan_api_scenario
left join
api_scenario
on
test_plan_api_scenario.api_scenario_id=api_scenario.id
and api_scenario.status != 'Trash'
<where>
<if test="request.planId != null">
and test_plan_api_scenario.test_plan_id = #{request.planId}
@ -377,6 +392,8 @@
</update>
<delete id="deleteByTestCaseID" parameterType="java.lang.String">
delete from test_plan_api_case where api_case_id = #{id,jdbcType=VARCHAR}
delete
from test_plan_api_case
where api_case_id = #{id,jdbcType=VARCHAR}
</delete>
</mapper>

View File

@ -52,4 +52,9 @@ public class TestPlanLoadCaseController {
public Boolean isExistReport(@RequestBody LoadCaseReportRequest request) {
return testPlanLoadCaseService.isExistReport(request);
}
@PostMapping("/batch/delete")
public void batchDelete(@RequestBody List<String> ids) {
testPlanLoadCaseService.batchDelete(ids);
}
}

View File

@ -113,4 +113,13 @@ public class TestPlanLoadCaseService {
}
testPlanLoadCaseMapper.deleteByExample(testPlanLoadCaseExample);
}
public void batchDelete(List<String> ids) {
if (CollectionUtils.isEmpty(ids)) {
return;
}
TestPlanLoadCaseExample example = new TestPlanLoadCaseExample();
example.createCriteria().andIdIn(ids);
testPlanLoadCaseMapper.deleteByExample(example);
}
}

View File

@ -383,8 +383,9 @@ public class TestPlanService {
return testPlans;
}
public List<TestPlanDTO> listTestPlanByProject(QueryTestPlanRequest request) {
return extTestPlanMapper.planList(request);
public List<TestPlanDTOWithMetric> listTestPlanByProject(QueryTestPlanRequest request) {
List<TestPlanDTOWithMetric> testPlans=extTestPlanMapper.list(request);
return testPlans;
}
public void testPlanRelevance(PlanCaseRelevanceRequest request) {

View File

@ -6,28 +6,23 @@
:show-create="false"/>
</template>
<el-table ref="scenarioTable" border :data="tableData" class="adjust-table" @select-all="select" @select="select"
<el-table ref="scenarioTable" border :data="tableData" class="adjust-table ms-select-all" @select-all="select" @select="select"
v-loading="loading">
<el-table-column type="selection" width="38"/>
<el-table-column v-if="!referenced" width="40" :resizable="false" align="center">
<el-dropdown slot="header" style="width: 14px">
<span class="el-dropdown-link" style="width: 14px">
<i class="el-icon-arrow-down el-icon--right" style="margin-left: 0px"></i>
</span>
<el-dropdown-menu slot="dropdown">
<el-dropdown-item @click.native.stop="isSelectDataAll(true)">
{{ $t('api_test.batch_menus.select_all_data', [total]) }}
</el-dropdown-item>
<el-dropdown-item @click.native.stop="isSelectDataAll(false)">
{{ $t('api_test.batch_menus.select_show_data', [tableData.length]) }}
</el-dropdown-item>
</el-dropdown-menu>
</el-dropdown>
<template v-slot:default="{row}">
<show-more-btn :is-show="isSelect(row)" :buttons="buttons" :size="selectDataCounts"/>
<el-table-column type="selection" width="50"/>
<ms-table-select-all v-if="!referenced"
:page-size="pageSize"
:total="total"
@selectPageAll="isSelectDataAll(false)"
@selectAll="isSelectDataAll(true)"/>
<el-table-column v-if="!referenced" width="30" :resizable="false" align="center">
<template v-slot:default="scope">
<show-more-btn :is-show="isSelect(scope.row)" :buttons="buttons" :size="selectDataCounts"/>
</template>
</el-table-column>
<el-table-column prop="num" label="ID"
show-overflow-tooltip/>
<el-table-column prop="name" :label="$t('api_test.automation.scenario_name')"
@ -111,10 +106,12 @@ import MsApiReportDetail from "../report/ApiReportDetail";
import MsTableMoreBtn from "./TableMoreBtn";
import MsScenarioExtendButtons from "@/business/components/api/automation/scenario/ScenarioExtendBtns";
import MsTestPlanList from "./testplan/TestPlanList";
import MsTableSelectAll from "../../../common/components/table/MsTableSelectAll";
export default {
name: "MsApiScenarioList",
components: {
MsTableSelectAll,
MsTablePagination,
MsTableMoreBtn,
ShowMoreBtn,

View File

@ -2,14 +2,12 @@
<el-card>
<div class="card-content">
<div class="ms-main-div" @click="showAll">
<el-row>
<el-col>
<!--操作按钮-->
<div class="ms-opt-btn">
<el-button type="primary" size="small" @click="editScenario(true)">{{$t('commons.save')}}</el-button>
<el-button type="primary" size="small" @click="editScenario">{{$t('commons.save')}}</el-button>
</div>
</el-col>
</el-row>
<div class="tip">{{$t('test_track.plan_view.base_info')}}</div>
<el-form :model="currentScenario" label-position="right" label-width="80px" size="small" :rules="rules" ref="currentScenario" style="margin-right: 20px">
<!-- 基础信息 -->
@ -109,7 +107,7 @@
</el-col>
<el-col :span="3" class="ms-col-one ms-font">
<el-link class="head" @click="showScenarioParameters">{{$t('api_test.automation.scenario_total')}}</el-link>
{{this.currentScenario.variables!=undefined?this.currentScenario.variables.length: 0}}
{{this.currentScenario.variables!=undefined?this.currentScenario.variables.length-1: 0}}
</el-col>
<el-col :span="3" class="ms-col-one ms-font">
<el-checkbox v-model="enableCookieShare">共享cookie</el-checkbox>

View File

@ -36,7 +36,7 @@
show-overflow-tooltip>
<template v-slot:default="scope" class="request-method">
<el-tag size="mini" :style="{'background-color': getColor(scope.row.method), border: getColor(true, scope.row.method)}" class="api-el-tag">
{{ scope.row.method}}
{{ scope.row.method }}
</el-tag>
</template>
</el-table-column>
@ -74,23 +74,22 @@
<script>
import MsTableOperator from "../../../../common/components/MsTableOperator";
import MsTableOperatorButton from "../../../../common/components/MsTableOperatorButton";
import {LIST_CHANGE, TrackEvent} from "@/business/components/common/head/ListEvent";
import MsTablePagination from "../../../../common/pagination/TablePagination";
import MsTag from "../../../../common/components/MsTag";
import MsBottomContainer from "../../../definition/components/BottomContainer";
import ShowMoreBtn from "../../../../track/case/components/ShowMoreBtn";
import MsBatchEdit from "../../../definition/components/basis/BatchEdit";
import {API_METHOD_COLOUR, CASE_PRIORITY} from "../../../definition/model/JsonData";
import {getCurrentProjectID} from "@/common/js/utils";
import ApiListContainer from "../../../definition/components/list/ApiListContainer";
import PriorityTableItem from "../../../../track/common/tableItems/planview/PriorityTableItem";
import {_filter, _sort} from "../../../../../../common/js/utils";
import {_handleSelect, _handleSelectAll} from "../../../../../../common/js/tableUtils";
import MsEnvironmentSelect from "../../../definition/components/case/MsEnvironmentSelect";
import MsTableOperator from "../../../../common/components/MsTableOperator";
import MsTableOperatorButton from "../../../../common/components/MsTableOperatorButton";
import MsTablePagination from "../../../../common/pagination/TablePagination";
import MsTag from "../../../../common/components/MsTag";
import MsBottomContainer from "../../../definition/components/BottomContainer";
import ShowMoreBtn from "../../../../track/case/components/ShowMoreBtn";
import MsBatchEdit from "../../../definition/components/basis/BatchEdit";
import {API_METHOD_COLOUR, CASE_PRIORITY} from "../../../definition/model/JsonData";
import {getCurrentProjectID} from "@/common/js/utils";
import ApiListContainer from "../../../definition/components/list/ApiListContainer";
import PriorityTableItem from "../../../../track/common/tableItems/planview/PriorityTableItem";
import {_filter, _sort} from "../../../../../../common/js/utils";
import {_handleSelect, _handleSelectAll} from "../../../../../../common/js/tableUtils";
import MsEnvironmentSelect from "../../../definition/components/case/MsEnvironmentSelect";
export default {
export default {
name: "RelevanceApiList",
components: {
MsEnvironmentSelect,
@ -176,10 +175,10 @@
},
initTable() {
this.selectRows = new Set();
this.condition.filters = ["Prepare", "Underway", "Completed"];
this.condition.filters = {status: ["Prepare", "Underway", "Completed"]};
this.condition.moduleIds = this.selectNodeIds;
if (this.trashEnable) {
this.condition.filters = ["Trash"];
this.condition.filters = {status: ["Trash"]};
this.condition.moduleIds = [];
}
if (this.projectId != null) {
@ -234,29 +233,29 @@
this.environmentId = data.id;
}
},
}
}
</script>
<style scoped>
.operate-button > div {
.operate-button > div {
display: inline-block;
margin-left: 10px;
}
}
.request-method {
.request-method {
padding: 0 5px;
color: #1E90FF;
}
}
.api-el-tag {
.api-el-tag {
color: white;
}
}
.search-input {
.search-input {
float: right;
width: 30%;
margin-bottom: 20px;
margin-right: 20px;
}
}
</style>

View File

@ -10,28 +10,23 @@
<el-table v-loading="result.loading"
ref="caseTable"
border
:data="tableData" row-key="id" class="test-content adjust-table"
:data="tableData" row-key="id" class="test-content adjust-table ms-select-all"
@select-all="handleSelectAll"
@filter-change="filter"
@sort-change="sort"
@select="handleSelect" :height="screenHeight">
<el-table-column type="selection"/>
<el-table-column width="40" :resizable="false" align="center">
<el-dropdown slot="header" style="width: 14px">
<span class="el-dropdown-link" style="width: 14px">
<i class="el-icon-arrow-down el-icon--right" style="margin-left: 0px"></i>
</span>
<el-dropdown-menu slot="dropdown">
<el-dropdown-item @click.native.stop="isSelectDataAll(true)">
{{ $t('api_test.batch_menus.select_all_data', [total]) }}
</el-dropdown-item>
<el-dropdown-item @click.native.stop="isSelectDataAll(false)">
{{ $t('api_test.batch_menus.select_show_data', [tableData.length]) }}
</el-dropdown-item>
</el-dropdown-menu>
</el-dropdown>
<el-table-column type="selection" width="50"/>
<ms-table-select-all
:page-size="pageSize"
:total="total"
@selectPageAll="isSelectDataAll(false)"
@selectAll="isSelectDataAll(true)"/>
<el-table-column width="30" :resizable="false" align="center">
<template v-slot:default="scope">
<show-more-btn :is-show="scope.row.showMore && !isReadOnly" :buttons="buttons" :size="selectDataCounts"/>
<show-more-btn :is-show="scope.row.showMore" :buttons="buttons" :size="selectDataCounts"/>
</template>
</el-table-column>
@ -117,8 +112,6 @@ import ApiListContainer from "./ApiListContainer";
import PriorityTableItem from "../../../../track/common/tableItems/planview/PriorityTableItem";
import ApiCaseList from "../case/ApiCaseList";
import {_filter, _sort} from "../../../../../../common/js/utils";
import TestPlanCaseListHeader from "../../../../track/plan/view/comonents/api/TestPlanCaseListHeader";
import MsEnvironmentSelect from "../case/MsEnvironmentSelect";
import {_handleSelect, _handleSelectAll} from "../../../../../../common/js/tableUtils";
import MsApiCaseTableExtendBtns from "../reference/ApiCaseTableExtendBtns";
import MsReferenceView from "../reference/ReferenceView";
@ -126,10 +119,12 @@ import MsSetEnvironment from "@/business/components/api/definition/components/ba
import TestPlan from "@/business/components/api/definition/components/jmeter/components/test-plan";
import ThreadGroup from "@/business/components/api/definition/components/jmeter/components/thread-group";
import {parseEnvironment} from "@/business/components/api/test/model/EnvironmentModel";
import MsTableSelectAll from "../../../../common/components/table/MsTableSelectAll";
export default {
name: "ApiCaseSimpleList",
components: {
MsTableSelectAll,
MsSetEnvironment,
ApiCaseList,
PriorityTableItem,
@ -569,4 +564,12 @@ export default {
margin-right: 20px;
}
.ms-select-all >>> th:first-child {
margin-top: 20px;
}
.ms-select-all >>> th:nth-child(2) .el-icon-arrow-down {
top: -2px;
}
</style>

View File

@ -49,6 +49,9 @@
<el-table-column
prop="method"
sortable="custom"
column-key="method"
:filters="methodFilters"
:label="$t('api_test.definition.api_type')"
show-overflow-tooltip>
<template v-slot:default="scope" class="request-method">
@ -66,6 +69,9 @@
<el-table-column
prop="userName"
sortable="custom"
:filters="userFilters"
column-key="user_id"
:label="$t('api_test.definition.api_principal')"
show-overflow-tooltip/>
@ -77,7 +83,11 @@
</template>
</el-table-column>
<el-table-column width="160" :label="$t('api_test.definition.api_last_time')" prop="updateTime">
<el-table-column
width="160"
:label="$t('api_test.definition.api_last_time')"
sortable="custom"
prop="updateTime">
<template v-slot:default="scope">
<span>{{ scope.row.updateTime | timestampFormatDate }}</span>
</template>
@ -180,6 +190,21 @@ export default {
{text: this.$t('test_track.plan.plan_status_completed'), value: 'Completed'},
{text: this.$t('test_track.plan.plan_status_trash'), value: 'Trash'},
],
methodFilters: [
{text: 'GET', value: 'GET'},
{text: 'POST', value: 'POST'},
{text: 'PUT', value: 'PUT'},
{text: 'PATCH', value: 'PATCH'},
{text: 'DELETE', value: 'DELETE'},
{text: 'OPTIONS', value: 'OPTIONS'},
{text: 'HEAD', value: 'HEAD'},
{text: 'CONNECT', value: 'CONNECT'},
{text: 'DUBBO', value: 'DUBBO'},
{text: 'dubbo://', value: 'dubbo://'},
{text: 'SQL', value: 'SQL'},
{text: 'TCP', value: 'TCP'},
],
userFilters: [],
valueArr: {
status: API_STATUS,
method: REQ_METHOD,
@ -292,6 +317,9 @@ export default {
let workspaceId = localStorage.getItem(WORKSPACE_ID);
this.$post('/user/ws/member/tester/list', {workspaceId: workspaceId}, response => {
this.valueArr.userId = response.data;
this.userFilters = response.data.map(u => {
return {text: u.name, value: u.id}
});
});
},
handleSelect(selection, row) {
@ -541,37 +569,16 @@ export default {
margin-right: 20px;
}
.api-list >>> th:first-child {
/*border: 1px solid #DCDFE6;*/
/*border-right: 0px;*/
/*border-top-left-radius:5px;*/
/*border-bottom-left-radius:5px;*/
/*width: 20px;*/
}
.api-list >>> th:nth-child(2) {
/*border: 1px solid #DCDFE6;*/
/*border-left: 0px;*/
/*border-top-right-radius:5px;*/
/*border-bottom-right-radius:5px;*/
}
.api-list >>> th:first-child > .cell {
padding: 5px;
width: 30px;
}
.api-list >>> th:nth-child(2) > .cell {
/*background-color: black;*/
}
.api-list >>> .el-dropdown {
float: left;
}
.el-tag {
margin-left: 10px;
}
.ms-select-all >>> th:first-child {
margin-top: 20px;
}
.ms-select-all >>> th:nth-child(2) .el-icon-arrow-down {
top: -2px;
}
</style>

View File

@ -26,12 +26,13 @@
</template>
</el-table-column>
<el-table-column prop="num" label="ID" show-overflow-tooltip/>
<el-table-column prop="name" :label="$t('api_test.definition.api_name')" show-overflow-tooltip/>
<el-table-column prop="num" sortable="custom" label="ID" show-overflow-tooltip/>
<el-table-column prop="name" sortable="custom" :label="$t('api_test.definition.api_name')" show-overflow-tooltip/>
<el-table-column
prop="priority"
:filters="priorityFilters"
sortable="custom"
column-key="priority"
:label="$t('test_track.case.priority')"
show-overflow-tooltip>
@ -47,6 +48,9 @@
<el-table-column
prop="createUser"
column-key="user_id"
sortable="custom"
:filters="userFilters"
:label="'创建人'"
show-overflow-tooltip/>
@ -134,6 +138,7 @@ import MsRun from "../../../../../api/definition/components/Run";
import TestPlanApiCaseResult from "./TestPlanApiCaseResult";
import TestPlan from "../../../../../api/definition/components/jmeter/components/test-plan";
import ThreadGroup from "../../../../../api/definition/components/jmeter/components/thread-group";
import {WORKSPACE_ID} from "@/common/js/constants";
export default {
name: "TestPlanApiCaseList",
@ -177,6 +182,7 @@ export default {
],
valueArr: {
priority: CASE_PRIORITY,
userId: [],
},
methodColorMap: new Map(API_METHOD_COLOUR),
tableData: [],
@ -189,7 +195,8 @@ export default {
runData: [],
reportId: "",
response: {},
rowLoading: ""
rowLoading: "",
userFilters: []
}
},
props: {
@ -220,6 +227,7 @@ export default {
planId: String
},
created: function () {
this.getMaintainerOptions();
this.initTable();
},
watch: {
@ -248,6 +256,15 @@ export default {
},
},
methods: {
getMaintainerOptions() {
let workspaceId = localStorage.getItem(WORKSPACE_ID);
this.$post('/user/ws/member/tester/list', {workspaceId: workspaceId}, response => {
this.valueArr.userId = response.data;
this.userFilters = response.data.map(u => {
return {text: u.name, value: u.id}
});
});
},
isApiListEnableChange(data) {
this.$emit('isApiListEnableChange', data);
},

View File

@ -205,7 +205,19 @@ export default {
//
// },
handleDeleteBatch() {
this.$alert(this.$t('test_track.plan_view.confirm_cancel_relevance') + "", '', {
confirmButtonText: this.$t('commons.confirm'),
callback: (action) => {
if (action === 'confirm') {
let ids = Array.from(this.selectRows).map(row => row.id);
this.result = this.$post('/test/plan/load/case/batch/delete', ids, () => {
this.selectRows.clear();
this.initTable();
this.$success(this.$t('test_track.cancel_relevance_success'));
});
}
}
})
},
handleRunBatch() {
@ -221,7 +233,7 @@ export default {
})
},
handleDelete(loadCase) {
this.$get('/test/plan/load/case/delete/' + loadCase.id, () => {
this.result = this.$get('/test/plan/load/case/delete/' + loadCase.id, () => {
this.$success(this.$t('test_track.cancel_relevance_success'));
this.$emit('refresh');
this.initTable();