This commit is contained in:
wenyann 2021-01-13 11:37:22 +08:00
commit a2ff38a10f
9 changed files with 59 additions and 60 deletions

View File

@ -5,6 +5,7 @@ import com.github.pagehelper.PageHelper;
import io.metersphere.api.dto.ApiCaseBatchRequest; import io.metersphere.api.dto.ApiCaseBatchRequest;
import io.metersphere.api.dto.definition.*; import io.metersphere.api.dto.definition.*;
import io.metersphere.api.service.ApiTestCaseService; import io.metersphere.api.service.ApiTestCaseService;
import io.metersphere.base.domain.ApiTestCase;
import io.metersphere.base.domain.ApiTestCaseWithBLOBs; import io.metersphere.base.domain.ApiTestCaseWithBLOBs;
import io.metersphere.commons.constants.RoleConstants; import io.metersphere.commons.constants.RoleConstants;
import io.metersphere.commons.utils.PageUtils; import io.metersphere.commons.utils.PageUtils;
@ -61,13 +62,13 @@ public class ApiTestCaseController {
} }
@PostMapping(value = "/create", consumes = {"multipart/form-data"}) @PostMapping(value = "/create", consumes = {"multipart/form-data"})
public void create(@RequestPart("request") SaveApiTestCaseRequest request, @RequestPart(value = "files") List<MultipartFile> bodyFiles) { public ApiTestCase create(@RequestPart("request") SaveApiTestCaseRequest request, @RequestPart(value = "files") List<MultipartFile> bodyFiles) {
apiTestCaseService.create(request, bodyFiles); return apiTestCaseService.create(request, bodyFiles);
} }
@PostMapping(value = "/update", consumes = {"multipart/form-data"}) @PostMapping(value = "/update", consumes = {"multipart/form-data"})
public void update(@RequestPart("request") SaveApiTestCaseRequest request, @RequestPart(value = "files") List<MultipartFile> bodyFiles) { public ApiTestCase update(@RequestPart("request") SaveApiTestCaseRequest request, @RequestPart(value = "files") List<MultipartFile> bodyFiles) {
apiTestCaseService.update(request, bodyFiles); return apiTestCaseService.update(request, bodyFiles);
} }
@GetMapping("/delete/{id}") @GetMapping("/delete/{id}")

View File

@ -116,10 +116,11 @@ public class ApiTestCaseService {
return apiTestCaseMapper.selectByPrimaryKey(id); return apiTestCaseMapper.selectByPrimaryKey(id);
} }
public void create(SaveApiTestCaseRequest request, List<MultipartFile> bodyFiles) { public ApiTestCase create(SaveApiTestCaseRequest request, List<MultipartFile> bodyFiles) {
List<String> bodyUploadIds = new ArrayList<>(request.getBodyUploadIds()); List<String> bodyUploadIds = new ArrayList<>(request.getBodyUploadIds());
ApiTestCase test = createTest(request); ApiTestCase test = createTest(request);
createBodyFiles(test, bodyUploadIds, bodyFiles); createBodyFiles(test, bodyUploadIds, bodyFiles);
return test;
} }
private void checkQuota() { private void checkQuota() {
@ -129,13 +130,13 @@ public class ApiTestCaseService {
} }
} }
public void update(SaveApiTestCaseRequest request, List<MultipartFile> bodyFiles) { public ApiTestCase update(SaveApiTestCaseRequest request, List<MultipartFile> bodyFiles) {
deleteFileByTestId(request.getId()); deleteFileByTestId(request.getId());
List<String> bodyUploadIds = new ArrayList<>(request.getBodyUploadIds()); List<String> bodyUploadIds = new ArrayList<>(request.getBodyUploadIds());
request.setBodyUploadIds(null); request.setBodyUploadIds(null);
ApiTestCase test = updateTest(request); ApiTestCase test = updateTest(request);
createBodyFiles(test, bodyUploadIds, bodyFiles); createBodyFiles(test, bodyUploadIds, bodyFiles);
return test;
} }
private void createBodyFiles(ApiTestCase test, List<String> bodyUploadIds, List<MultipartFile> bodyFiles) { private void createBodyFiles(ApiTestCase test, List<String> bodyUploadIds, List<MultipartFile> bodyFiles) {

View File

@ -665,7 +665,7 @@
let obj = JSON.parse(JSON.stringify(row)); let obj = JSON.parse(JSON.stringify(row));
obj.resourceId = getUUID(); obj.resourceId = getUUID();
if (obj.name) { if (obj.name) {
obj.name = obj.name + '_copy'; obj.name = obj.name + '_copy';
} }
hashTree.push(obj); hashTree.push(obj);
this.sort(); this.sort();
@ -817,21 +817,23 @@
} }
}) })
// csv // csv
this.currentScenario.variables.forEach(param => { if (this.currentScenario.variables) {
if (param.type === 'CSV' && param.files) { this.currentScenario.variables.forEach(param => {
param.files.forEach(item => { if (param.type === 'CSV' && param.files) {
if (item.file) { param.files.forEach(item => {
if (!item.id) { if (item.file) {
let fileId = getUUID().substring(0, 12); if (!item.id) {
item.name = item.file.name; let fileId = getUUID().substring(0, 12);
item.id = fileId; item.name = item.file.name;
item.id = fileId;
}
obj.bodyUploadIds.push(item.id);
bodyUploadFiles.push(item.file);
} }
obj.bodyUploadIds.push(item.id); })
bodyUploadFiles.push(item.file); }
} })
}) }
}
})
return bodyUploadFiles; return bodyUploadFiles;
}, },
editScenario(showMessage) { editScenario(showMessage) {

View File

@ -16,7 +16,7 @@
@click="active(apiCase)"/> @click="active(apiCase)"/>
<el-input v-if="!apiCase.id || isShowInput" size="small" v-model="apiCase.name" :name="index" :key="index" <el-input v-if="!apiCase.id || isShowInput" size="small" v-model="apiCase.name" :name="index" :key="index"
class="ms-api-header-select" style="width: 180px" class="ms-api-header-select" style="width: 180px"
@blur="saveTestCase(apiCase)" placeholder="请输入用例名称"/> @blur="saveTestCase(apiCase)" :placeholder="$t('commons.input_name')"/>
<span v-else> <span v-else>
{{ apiCase.id ? apiCase.name : '' }} {{ apiCase.id ? apiCase.name : '' }}
<i class="el-icon-edit" style="cursor:pointer" @click="showInput(apiCase)" v-tester/> <i class="el-icon-edit" style="cursor:pointer" @click="showInput(apiCase)" v-tester/>
@ -211,9 +211,12 @@ export default {
if (tmp.tags instanceof Array) { if (tmp.tags instanceof Array) {
tmp.tags = JSON.stringify(tmp.tags); tmp.tags = JSON.stringify(tmp.tags);
} }
this.$fileUpload(url, null, bodyFiles, tmp, () => { this.$fileUpload(url, null, bodyFiles, tmp, (response) => {
let data = response.data;
row.id = data.id;
row.createTime = data.createTime;
row.updateTime = data.updateTime;
this.$success(this.$t('commons.save_success')); this.$success(this.$t('commons.save_success'));
this.$emit('refresh');
}); });
}, },
showInput(row) { showInput(row) {

View File

@ -3,12 +3,20 @@
:modal="false" width="45%" :destroy-on-close="true"> :modal="false" width="45%" :destroy-on-close="true">
<span>{{ $t('api_test.automation.scenario_ref') }}</span> <span>{{ $t('api_test.automation.scenario_ref') }}</span>
<div class="refs" v-loading="scenarioLoading"> <div class="refs" v-loading="scenarioLoading">
<div v-for="(item, index) in scenarioRefs" :key="index" class="el-button--text">{{ item.name }}</div> <div v-for="(item, index) in scenarioRefs" :key="index" class="el-button--text">
<router-link :to="{name: 'ApiAutomation', params: { dataSelectRange: 'edit:' + item.id }}">
{{ item.name }}
</router-link>
</div>
</div> </div>
<span>{{ $t('api_test.automation.plan_ref') }}</span> <span>{{ $t('api_test.automation.plan_ref') }}</span>
<div class="refs"> <div class="refs">
<div v-for="(item, index) in planRefs" :key="index" class="el-button--text">{{ item.name }}</div> <div v-for="(item, index) in planRefs" :key="index" class="el-button--text">
<router-link :to="'/track/plan/view/' + item.id">
{{ item.name }}
</router-link>
</div>
</div> </div>
<template v-slot:footer> <template v-slot:footer>

View File

@ -3,17 +3,17 @@
<el-header height="0"> <el-header height="0">
<div style="float: right"> <div style="float: right">
<div v-if="tipsType==='1'"> <div v-if="tipsType==='1'">
🤔天凉了保温杯买了吗 🤔 天凉了保温杯买了吗
</div> </div>
<div v-else-if="tipsType==='2'"> <div v-else-if="tipsType==='2'">
😔觉得MeterSphere不好用就来 😔 觉得MeterSphere不好用就来
<el-link href="https://github.com/metersphere/metersphere/issues" target="_blank" style="color: black" <el-link href="https://github.com/metersphere/metersphere/issues" target="_blank" style="color: black"
type="primary">https://github.com/metersphere/metersphere/issues type="primary">https://github.com/metersphere/metersphere/issues
</el-link> </el-link>
吐个槽吧 吐个槽吧
</div> </div>
<div v-else-if="tipsType==='3'"> <div v-else-if="tipsType==='3'">
😄觉得MeterSphere好用就来 😄 觉得MeterSphere好用就来
<el-link href="https://github.com/metersphere/metersphere" target="_blank" style="color: black" <el-link href="https://github.com/metersphere/metersphere" target="_blank" style="color: black"
type="primary">https://github.com/metersphere/metersphere type="primary">https://github.com/metersphere/metersphere
</el-link> </el-link>

View File

@ -13,7 +13,7 @@
.drag-bar { .drag-bar {
height: 1px; height: 1px;
width: 100%; width: 100%;
z-index: 9999; z-index: 1000;
cursor: row-resize; cursor: row-resize;
position: fixed; position: fixed;
background-color: #E6E6E6; background-color: #E6E6E6;

View File

@ -79,11 +79,11 @@
], ],
loadTestCases: [ loadTestCases: [
{ {
caseName: 'testCase4', caseName: 'testCase5',
projectName: 'P3', projectName: '测试项目',
userName: '/module1/module2', userName: 'Tom',
createTime: new Date(), createTime: new Date(),
status: 'error', caseStatus: 'error',
} }
] ]
} }

View File

@ -33,43 +33,27 @@
</template> </template>
</el-table-column> </el-table-column>
<el-table-column <el-table-column
prop="status" prop="caseStatus"
column-key="status" :label="$t('test_track.plan.load_case.execution_status')">
:filters="statusFilters"
:label="$t('commons.status')">
<template v-slot:default="{row}"> <template v-slot:default="{row}">
<ms-performance-test-status :row="row"/> <el-tag size="mini" type="danger" v-if="row.caseStatus === 'error'">
{{ row.caseStatus }}
</el-tag>
<el-tag size="mini" type="success" v-else-if="row.caseStatus === 'success'">
{{ row.caseStatus }}
</el-tag>
<span v-else>-</span>
</template> </template>
</el-table-column> </el-table-column>
<!-- <el-table-column-->
<!-- prop="caseStatus"-->
<!-- :label="$t('test_track.plan.load_case.execution_status')">-->
<!-- <template v-slot:default="{row}">-->
<!-- <el-tag size="mini" type="danger" v-if="row.caseStatus === 'error'">-->
<!-- {{ row.caseStatus }}-->
<!-- </el-tag>-->
<!-- <el-tag size="mini" type="success" v-else-if="row.caseStatus === 'success'">-->
<!-- {{ row.caseStatus }}-->
<!-- </el-tag>-->
<!-- <span v-else>-</span>-->
<!-- </template>-->
<!-- </el-table-column>-->
</el-table> </el-table>
</div> </div>
</template> </template>
<script> <script>
import MsTag from "@/business/components/common/components/MsTag";
import PriorityTableItem from "@/business/components/track/common/tableItems/planview/PriorityTableItem";
import TypeTableItem from "@/business/components/track/common/tableItems/planview/TypeTableItem";
import MethodTableItem from "@/business/components/track/common/tableItems/planview/MethodTableItem";
import StatusTableItem from "@/business/components/track/common/tableItems/planview/StatusTableItem";
import MsPerformanceTestStatus from "@/business/components/performance/test/PerformanceTestStatus";
export default { export default {
name: "LoadFailureCasesList", name: "LoadFailureCasesList",
components: {MsTag, PriorityTableItem, TypeTableItem, MethodTableItem, StatusTableItem, MsPerformanceTestStatus},
props: ['loadTestCases'], props: ['loadTestCases'],
data() { data() {
return { return {