Merge remote-tracking branch 'origin/master' into master
This commit is contained in:
commit
f1f7472758
|
@ -6,10 +6,7 @@ import io.metersphere.api.dto.APIReportResult;
|
|||
import io.metersphere.api.dto.ApiTestImportRequest;
|
||||
import io.metersphere.api.dto.automation.ApiScenarioRequest;
|
||||
import io.metersphere.api.dto.automation.ReferenceDTO;
|
||||
import io.metersphere.api.dto.definition.ApiDefinitionRequest;
|
||||
import io.metersphere.api.dto.definition.ApiDefinitionResult;
|
||||
import io.metersphere.api.dto.definition.RunDefinitionRequest;
|
||||
import io.metersphere.api.dto.definition.SaveApiDefinitionRequest;
|
||||
import io.metersphere.api.dto.definition.*;
|
||||
import io.metersphere.api.service.ApiDefinitionService;
|
||||
import io.metersphere.base.domain.ApiDefinition;
|
||||
import io.metersphere.commons.constants.RoleConstants;
|
||||
|
@ -105,4 +102,10 @@ public class ApiDefinitionController {
|
|||
return apiDefinitionService.getReference(request);
|
||||
}
|
||||
|
||||
@PostMapping("/batch/edit")
|
||||
@RequiresRoles(value = {RoleConstants.TEST_USER, RoleConstants.TEST_MANAGER}, logical = Logical.OR)
|
||||
public void editApiBath(@RequestBody ApiBatchRequest request) {
|
||||
apiDefinitionService.editApiBath(request);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -0,0 +1,16 @@
|
|||
package io.metersphere.api.dto.definition;
|
||||
|
||||
import io.metersphere.base.domain.ApiDefinitionWithBLOBs;
|
||||
import io.metersphere.controller.request.OrderRequest;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
public class ApiBatchRequest extends ApiDefinitionWithBLOBs {
|
||||
private List<String> ids;
|
||||
private List<OrderRequest> orders;
|
||||
private String projectId;
|
||||
}
|
|
@ -375,4 +375,15 @@ public class ApiDefinitionService {
|
|||
dto.setTestPlanList(extTestPlanMapper.selectReference(planRequest));
|
||||
return dto;
|
||||
}
|
||||
|
||||
public void editApiBath(ApiBatchRequest request) {
|
||||
ApiDefinitionExample definitionExample = new ApiDefinitionExample();
|
||||
definitionExample.createCriteria().andIdIn(request.getIds());
|
||||
|
||||
ApiDefinitionWithBLOBs definitionWithBLOBs = new ApiDefinitionWithBLOBs();
|
||||
BeanUtils.copyBean(definitionWithBLOBs, request);
|
||||
definitionWithBLOBs.setUpdateTime(System.currentTimeMillis());
|
||||
apiDefinitionMapper.updateByExampleSelective(definitionWithBLOBs, definitionExample);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -38,7 +38,6 @@
|
|||
:currentRow="currentRow"
|
||||
@editApi="editApi"
|
||||
@handleCase="handleCase"
|
||||
@handleEditBatch="handleEditBatch"
|
||||
@showExecResult="showExecResult"
|
||||
ref="apiList"/>
|
||||
|
||||
|
@ -209,11 +208,6 @@
|
|||
}
|
||||
this.handleTabsEdit(name, "ADD", row);
|
||||
},
|
||||
handleEditBatch(rows) {
|
||||
rows.forEach(row => {
|
||||
this.handleTabsEdit(this.$t('api_test.definition.request.edit_api') + "-" + row.name, "ADD", row);
|
||||
})
|
||||
},
|
||||
handleCase(api) {
|
||||
this.currentApi = api;
|
||||
this.showCasePage = false;
|
||||
|
|
|
@ -66,10 +66,10 @@
|
|||
</el-col>
|
||||
|
||||
<el-col :span="3">
|
||||
<el-link type="danger" @click="showExecResult(item)" v-if="item.execResult && item.execResult==='error'">{{getResult(item.execResult)}}</el-link>
|
||||
<div v-else>
|
||||
<div v-if="item.type!='create'">{{getResult(item.execResult)}}</div>
|
||||
</div>
|
||||
<el-link type="danger" v-if="item.execResult && item.execResult==='error'" @click="showExecResult(item)">{{getResult(item.execResult)}}</el-link>
|
||||
<el-link v-else-if="item.execResult && item.execResult==='success'" @click="showExecResult(item)">{{getResult(item.execResult)}}</el-link>
|
||||
<div v-else> {{getResult(item.execResult)}}</div>
|
||||
|
||||
<div v-if="item.type!='create'" style="color: #999999;font-size: 12px">
|
||||
<span> {{item.updateTime | timestampFormatDate }}</span>
|
||||
{{item.updateUser}}
|
||||
|
|
|
@ -82,6 +82,8 @@
|
|||
:total="total"/>
|
||||
</el-card>
|
||||
<ms-api-case-list @refresh="initApiTable" @showExecResult="showExecResult" :currentApi="selectApi" ref="caseList"/>
|
||||
<!--批量编辑-->
|
||||
<ms-batch-edit ref="batchEdit" @batchEdit="batchEdit" :typeArr="typeArr" :value-arr="valueArr"/>
|
||||
</div>
|
||||
|
||||
</template>
|
||||
|
@ -99,8 +101,10 @@
|
|||
import MsContainer from "../../../common/components/MsContainer";
|
||||
import MsBottomContainer from "./BottomContainer";
|
||||
import ShowMoreBtn from "../../../../components/track/case/components/ShowMoreBtn";
|
||||
import {API_METHOD_COLOUR} from "../model/JsonData";
|
||||
import MsBatchEdit from "./basis/BatchEdit";
|
||||
import {API_METHOD_COLOUR, REQ_METHOD, API_STATUS} from "../model/JsonData";
|
||||
import {getCurrentProjectID} from "@/common/js/utils";
|
||||
import {WORKSPACE_ID} from '../../../../../common/js/constants';
|
||||
|
||||
export default {
|
||||
name: "ApiList",
|
||||
|
@ -114,7 +118,8 @@
|
|||
MsApiCaseList,
|
||||
MsContainer,
|
||||
MsBottomContainer,
|
||||
ShowMoreBtn
|
||||
ShowMoreBtn,
|
||||
MsBatchEdit
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
|
@ -127,6 +132,16 @@
|
|||
{name: this.$t('api_test.definition.request.batch_delete'), handleClick: this.handleDeleteBatch},
|
||||
{name: this.$t('api_test.definition.request.batch_edit'), handleClick: this.handleEditBatch}
|
||||
],
|
||||
typeArr: [
|
||||
{id: 'status', name: this.$t('api_test.definition.api_case_status')},
|
||||
{id: 'method', name: this.$t('api_test.definition.api_type')},
|
||||
{id: 'userId', name: this.$t('api_test.definition.api_principal')},
|
||||
],
|
||||
valueArr: {
|
||||
status: API_STATUS,
|
||||
method: REQ_METHOD,
|
||||
userId: [],
|
||||
},
|
||||
methodColorMap: new Map(API_METHOD_COLOUR),
|
||||
tableData: [],
|
||||
currentPage: 1,
|
||||
|
@ -147,6 +162,7 @@
|
|||
created: function () {
|
||||
this.projectId = getCurrentProjectID();
|
||||
this.initApiTable();
|
||||
this.getMaintainerOptions();
|
||||
},
|
||||
watch: {
|
||||
currentModule() {
|
||||
|
@ -158,6 +174,7 @@
|
|||
},
|
||||
methods: {
|
||||
initApiTable() {
|
||||
this.selectRows = new Set();
|
||||
this.condition.filters = ["Prepare", "Underway", "Completed"];
|
||||
if (this.currentModule != null) {
|
||||
if (this.currentModule.id == "root") {
|
||||
|
@ -181,6 +198,12 @@
|
|||
this.tableData = response.data.listObject;
|
||||
});
|
||||
},
|
||||
getMaintainerOptions() {
|
||||
let workspaceId = localStorage.getItem(WORKSPACE_ID);
|
||||
this.$post('/user/ws/member/tester/list', {workspaceId: workspaceId}, response => {
|
||||
this.valueArr.userId = response.data;
|
||||
});
|
||||
},
|
||||
handleSelect(selection, row) {
|
||||
row.hashTree = [];
|
||||
if (this.selectRows.has(row)) {
|
||||
|
@ -268,7 +291,18 @@
|
|||
}
|
||||
},
|
||||
handleEditBatch() {
|
||||
this.$emit('handleEditBatch', this.selectRows);
|
||||
this.$refs.batchEdit.open();
|
||||
},
|
||||
batchEdit(form) {
|
||||
let arr = Array.from(this.selectRows);
|
||||
let ids = arr.map(row => row.id);
|
||||
let param = {};
|
||||
param[form.type] = form.value;
|
||||
param.ids = ids;
|
||||
this.$post('/api/definition/batch/edit', param, () => {
|
||||
this.$success(this.$t('commons.save_success'));
|
||||
this.initApiTable();
|
||||
});
|
||||
},
|
||||
handleTestCase(api) {
|
||||
this.selectApi = api;
|
||||
|
|
|
@ -103,11 +103,11 @@
|
|||
let threadGroup = new ThreadGroup();
|
||||
threadGroup.hashTree = [];
|
||||
testPlan.hashTree = [threadGroup];
|
||||
|
||||
this.runData.forEach(item => {
|
||||
threadGroup.hashTree.push(item);
|
||||
})
|
||||
let reqObj = {id: this.reportId, testElement: testPlan};
|
||||
|
||||
let bodyFiles = this.getBodyUploadFiles(reqObj);
|
||||
let url = "";
|
||||
if (this.debug) {
|
||||
|
|
|
@ -0,0 +1,100 @@
|
|||
<template>
|
||||
<div>
|
||||
<el-dialog
|
||||
:title="dialogTitle"
|
||||
:visible.sync="dialogVisible"
|
||||
width="25%"
|
||||
class="batch-edit-dialog"
|
||||
:destroy-on-close="true"
|
||||
@close="handleClose"
|
||||
>
|
||||
<el-form :model="form" label-position="right" label-width="150px" size="medium" ref="form" :rules="rules">
|
||||
<el-form-item :label="$t('test_track.case.batch_update', [size])" prop="type">
|
||||
<el-select v-model="form.type" style="width: 80%" @change="changeType">
|
||||
<el-option v-for="(type, index) in typeArr" :key="index" :value="type.id" :label="type.name"/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item :label="$t('test_track.case.updated_attr_value')" prop="value">
|
||||
<el-select v-model="form.value" style="width: 80%" :filterable="filterable">
|
||||
<el-option v-for="(option, index) in options" :key="index" :value="option.id" :label="option.label">
|
||||
<div v-if="option.email">
|
||||
<span>{{option.id}}({{option.name}})</span>
|
||||
</div>
|
||||
</el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<template v-slot:footer>
|
||||
<ms-dialog-footer
|
||||
@cancel="dialogVisible = false"
|
||||
@confirm="submit('form')"/>
|
||||
</template>
|
||||
</el-dialog>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import MsDialogFooter from "../../../../common/components/MsDialogFooter";
|
||||
import {listenGoBack, removeGoBackListener} from "@/common/js/utils";
|
||||
|
||||
export default {
|
||||
name: "BatchEdit",
|
||||
components: {
|
||||
MsDialogFooter
|
||||
},
|
||||
props: {
|
||||
typeArr: Array,
|
||||
valueArr: Object,
|
||||
dialogTitle: {
|
||||
type: String,
|
||||
default() {
|
||||
return this.$t('api_test.definition.request.batch_edit')
|
||||
}
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
dialogVisible: false,
|
||||
form: {},
|
||||
size: 0,
|
||||
rules: {
|
||||
type: {required: true, message: this.$t('test_track.case.please_select_attr'), trigger: ['blur', 'change']},
|
||||
value: {required: true, message: this.$t('test_track.case.please_select_attr_value'), trigger: ['blur', 'change']}
|
||||
},
|
||||
options: [],
|
||||
filterable: false,
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
submit(form) {
|
||||
this.$refs[form].validate((valid) => {
|
||||
if (valid) {
|
||||
this.$emit("batchEdit", this.form);
|
||||
this.dialogVisible = false;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
});
|
||||
},
|
||||
open() {
|
||||
this.dialogVisible = true;
|
||||
this.size = this.$parent.selectRows.size;
|
||||
listenGoBack(this.handleClose);
|
||||
},
|
||||
handleClose() {
|
||||
this.form = {};
|
||||
this.options = [];
|
||||
removeGoBackListener(this.handleClose);
|
||||
},
|
||||
changeType(val) {
|
||||
this.$set(this.form, "value", "");
|
||||
this.filterable = val === "maintainerOptions";
|
||||
this.options = this.valueArr[val];
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
|
||||
</style>
|
|
@ -236,7 +236,7 @@
|
|||
let hasEnvironment = false;
|
||||
for (let i in this.environments) {
|
||||
if (this.environments[i].id === this.api.environmentId) {
|
||||
this.api.environmentId = this.environments[i];
|
||||
this.api.environmentId = this.environments[i].id;
|
||||
hasEnvironment = true;
|
||||
break;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue