Merge remote-tracking branch 'origin/master'
This commit is contained in:
commit
8c768895d4
|
@ -80,8 +80,8 @@ public class ApiAutomationController {
|
||||||
}
|
}
|
||||||
|
|
||||||
@PostMapping("/reduction")
|
@PostMapping("/reduction")
|
||||||
public void reduction(@RequestBody List<SaveApiScenarioRequest> requests) {
|
public void reduction(@RequestBody List<String> ids) {
|
||||||
apiAutomationService.reduction(requests);
|
apiAutomationService.reduction(ids);
|
||||||
}
|
}
|
||||||
|
|
||||||
@GetMapping("/getApiScenario/{id}")
|
@GetMapping("/getApiScenario/{id}")
|
||||||
|
|
|
@ -128,8 +128,8 @@ public class ApiDefinitionController {
|
||||||
}
|
}
|
||||||
|
|
||||||
@PostMapping("/reduction")
|
@PostMapping("/reduction")
|
||||||
public void reduction(@RequestBody List<SaveApiDefinitionRequest> requests) {
|
public void reduction(@RequestBody ApiBatchRequest request) {
|
||||||
apiDefinitionService.reduction(requests);
|
apiDefinitionService.reduction(request);
|
||||||
}
|
}
|
||||||
|
|
||||||
@GetMapping("/get/{id}")
|
@GetMapping("/get/{id}")
|
||||||
|
|
|
@ -316,13 +316,8 @@ public class ApiAutomationService {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void reduction(List<SaveApiScenarioRequest> requests) {
|
public void reduction(List<String> ids) {
|
||||||
List<String> apiIds = new ArrayList<>();
|
extApiScenarioMapper.reduction(ids);
|
||||||
requests.forEach(item -> {
|
|
||||||
checkNameExist(item);
|
|
||||||
apiIds.add(item.getId());
|
|
||||||
});
|
|
||||||
extApiScenarioMapper.reduction(apiIds);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void checkNameExist(SaveApiScenarioRequest request) {
|
private void checkNameExist(SaveApiScenarioRequest request) {
|
||||||
|
|
|
@ -136,10 +136,11 @@ public class ApiDefinitionService {
|
||||||
public ApiDefinitionWithBLOBs getBLOBs(String id) {
|
public ApiDefinitionWithBLOBs getBLOBs(String id) {
|
||||||
return apiDefinitionMapper.selectByPrimaryKey(id);
|
return apiDefinitionMapper.selectByPrimaryKey(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<ApiDefinitionWithBLOBs> getBLOBs(List<String> idList) {
|
public List<ApiDefinitionWithBLOBs> getBLOBs(List<String> idList) {
|
||||||
if(idList == null || idList.isEmpty()){
|
if (idList == null || idList.isEmpty()) {
|
||||||
return new ArrayList<>(0);
|
return new ArrayList<>(0);
|
||||||
}else{
|
} else {
|
||||||
ApiDefinitionExample example = new ApiDefinitionExample();
|
ApiDefinitionExample example = new ApiDefinitionExample();
|
||||||
example.createCriteria().andIdIn(idList);
|
example.createCriteria().andIdIn(idList);
|
||||||
example.setOrderByClause("create_time DESC ");
|
example.setOrderByClause("create_time DESC ");
|
||||||
|
@ -189,13 +190,8 @@ public class ApiDefinitionService {
|
||||||
extApiDefinitionMapper.removeToGc(apiIds);
|
extApiDefinitionMapper.removeToGc(apiIds);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void reduction(List<SaveApiDefinitionRequest> requests) {
|
public void reduction(ApiBatchRequest request) {
|
||||||
List<String> apiIds = new ArrayList<>();
|
extApiDefinitionMapper.reduction(request.getIds());
|
||||||
requests.forEach(item -> {
|
|
||||||
checkNameExist(item);
|
|
||||||
apiIds.add(item.getId());
|
|
||||||
});
|
|
||||||
extApiDefinitionMapper.reduction(apiIds);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void deleteBodyFiles(String apiId) {
|
public void deleteBodyFiles(String apiId) {
|
||||||
|
@ -243,7 +239,7 @@ public class ApiDefinitionService {
|
||||||
|
|
||||||
private ApiDefinition updateTest(SaveApiDefinitionRequest request) {
|
private ApiDefinition updateTest(SaveApiDefinitionRequest request) {
|
||||||
checkNameExist(request);
|
checkNameExist(request);
|
||||||
if(StringUtils.equals(request.getMethod(),"ESB")){
|
if (StringUtils.equals(request.getMethod(), "ESB")) {
|
||||||
//ESB的接口类型数据,采用TCP方式去发送。并将方法类型改为TCP。 并修改发送数据
|
//ESB的接口类型数据,采用TCP方式去发送。并将方法类型改为TCP。 并修改发送数据
|
||||||
request = esbApiParamService.handleEsbRequest(request);
|
request = esbApiParamService.handleEsbRequest(request);
|
||||||
}
|
}
|
||||||
|
@ -272,7 +268,7 @@ public class ApiDefinitionService {
|
||||||
|
|
||||||
private ApiDefinition createTest(SaveApiDefinitionRequest request) {
|
private ApiDefinition createTest(SaveApiDefinitionRequest request) {
|
||||||
checkNameExist(request);
|
checkNameExist(request);
|
||||||
if(StringUtils.equals(request.getMethod(),"ESB")){
|
if (StringUtils.equals(request.getMethod(), "ESB")) {
|
||||||
//ESB的接口类型数据,采用TCP方式去发送。并将方法类型改为TCP。 并修改发送数据
|
//ESB的接口类型数据,采用TCP方式去发送。并将方法类型改为TCP。 并修改发送数据
|
||||||
request = esbApiParamService.handleEsbRequest(request);
|
request = esbApiParamService.handleEsbRequest(request);
|
||||||
}
|
}
|
||||||
|
@ -709,6 +705,7 @@ public class ApiDefinitionService {
|
||||||
calculateResult(resList);
|
calculateResult(resList);
|
||||||
return resList;
|
return resList;
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<ApiDefinitionResult> listRelevanceReview(ApiDefinitionRequest request) {
|
public List<ApiDefinitionResult> listRelevanceReview(ApiDefinitionRequest request) {
|
||||||
request.setOrders(ServiceUtils.getDefaultOrder(request.getOrders()));
|
request.setOrders(ServiceUtils.getDefaultOrder(request.getOrders()));
|
||||||
List<ApiDefinitionResult> resList = extApiDefinitionMapper.listRelevanceReview(request);
|
List<ApiDefinitionResult> resList = extApiDefinitionMapper.listRelevanceReview(request);
|
||||||
|
@ -740,7 +737,7 @@ public class ApiDefinitionService {
|
||||||
res.setCaseStatus("-");
|
res.setCaseStatus("-");
|
||||||
}
|
}
|
||||||
|
|
||||||
if(StringUtils.equals("ESB",res.getMethod())){
|
if (StringUtils.equals("ESB", res.getMethod())) {
|
||||||
esbApiParamService.handleApiEsbParams(res);
|
esbApiParamService.handleApiEsbParams(res);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -827,8 +824,7 @@ public class ApiDefinitionService {
|
||||||
((MsApiExportResult) apiExportResult).setProtocol(request.getProtocol());
|
((MsApiExportResult) apiExportResult).setProtocol(request.getProtocol());
|
||||||
((MsApiExportResult) apiExportResult).setProjectId(request.getProjectId());
|
((MsApiExportResult) apiExportResult).setProjectId(request.getProjectId());
|
||||||
((MsApiExportResult) apiExportResult).setVersion(System.getenv("MS_VERSION"));
|
((MsApiExportResult) apiExportResult).setVersion(System.getenv("MS_VERSION"));
|
||||||
}
|
} else { // 导出为 Swagger 格式
|
||||||
else { // 导出为 Swagger 格式
|
|
||||||
Swagger3Parser swagger3Parser = new Swagger3Parser();
|
Swagger3Parser swagger3Parser = new Swagger3Parser();
|
||||||
System.out.println(apiDefinitionMapper.selectByExampleWithBLOBs(example));
|
System.out.println(apiDefinitionMapper.selectByExampleWithBLOBs(example));
|
||||||
apiExportResult = swagger3Parser.swagger3Export(apiDefinitionMapper.selectByExampleWithBLOBs(example));
|
apiExportResult = swagger3Parser.swagger3Export(apiDefinitionMapper.selectByExampleWithBLOBs(example));
|
||||||
|
|
|
@ -24,7 +24,7 @@
|
||||||
|
|
||||||
<el-table-column v-if="!referenced" width="30" min-width="30" :resizable="false" align="center">
|
<el-table-column v-if="!referenced" width="30" min-width="30" :resizable="false" align="center">
|
||||||
<template v-slot:default="scope">
|
<template v-slot:default="scope">
|
||||||
<show-more-btn :is-show="scope.row.showMore" :buttons="buttons" :size="selectDataCounts" v-tester/>
|
<show-more-btn :is-show="scope.row.showMore" :buttons="trashEnable ? trashButtons: buttons" :size="selectDataCounts" v-tester/>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<template v-for="(item, index) in tableLabel">
|
<template v-for="(item, index) in tableLabel">
|
||||||
|
@ -286,6 +286,12 @@
|
||||||
{name: this.$t('api_test.definition.request.batch_delete'), handleClick: this.handleDeleteBatch},
|
{name: this.$t('api_test.definition.request.batch_delete'), handleClick: this.handleDeleteBatch},
|
||||||
|
|
||||||
],
|
],
|
||||||
|
trashButtons: [
|
||||||
|
{name: this.$t('api_test.definition.request.batch_delete'), handleClick: this.handleDeleteBatch},
|
||||||
|
{
|
||||||
|
name: "批量恢复", handleClick: this.handleBatchRestore
|
||||||
|
},
|
||||||
|
],
|
||||||
isSelectAllDate: false,
|
isSelectAllDate: false,
|
||||||
selectRows: new Set(),
|
selectRows: new Set(),
|
||||||
selectDataCounts: 0,
|
selectDataCounts: 0,
|
||||||
|
@ -592,10 +598,14 @@
|
||||||
this.$emit('edit', data);
|
this.$emit('edit', data);
|
||||||
},
|
},
|
||||||
reductionApi(row) {
|
reductionApi(row) {
|
||||||
row.scenarioDefinition = null;
|
this.$post("/api/automation/reduction", [row.id], response => {
|
||||||
row.tags = null;
|
this.$success(this.$t('commons.save_success'));
|
||||||
let rows = [row];
|
this.search();
|
||||||
this.$post("/api/automation/reduction", rows, response => {
|
})
|
||||||
|
},
|
||||||
|
handleBatchRestore() {
|
||||||
|
let ids = Array.from(this.selectRows).map(row => row.id);
|
||||||
|
this.$post("/api/automation/reduction", ids, response => {
|
||||||
this.$success(this.$t('commons.save_success'));
|
this.$success(this.$t('commons.save_success'));
|
||||||
this.search();
|
this.search();
|
||||||
})
|
})
|
||||||
|
|
|
@ -135,7 +135,6 @@
|
||||||
}
|
}
|
||||||
// 加载引用对象数据
|
// 加载引用对象数据
|
||||||
this.getApiInfo();
|
this.getApiInfo();
|
||||||
console.log(JSON.stringify(this.request));
|
|
||||||
if (this.request.protocol === 'HTTP') {
|
if (this.request.protocol === 'HTTP') {
|
||||||
this.setUrl(this.request.url);
|
this.setUrl(this.request.url);
|
||||||
this.setUrl(this.request.path);
|
this.setUrl(this.request.path);
|
||||||
|
|
|
@ -230,7 +230,8 @@
|
||||||
}
|
}
|
||||||
data.message = true;
|
data.message = true;
|
||||||
data.request.useEnvironment = this.environment;
|
data.request.useEnvironment = this.environment;
|
||||||
this.saveTestCase(data);
|
//this.saveTestCase(data);
|
||||||
|
|
||||||
this.$emit('singleRun', data);
|
this.$emit('singleRun', data);
|
||||||
},
|
},
|
||||||
copyCase(data) {
|
copyCase(data) {
|
||||||
|
|
|
@ -222,7 +222,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
this.result = this.$post("/api/testcase/list", this.condition, response => {
|
this.result = this.$post("/api/testcase/list", this.condition, response => {
|
||||||
if(response.data){
|
if (response.data) {
|
||||||
this.apiCaseList = response.data;
|
this.apiCaseList = response.data;
|
||||||
}
|
}
|
||||||
this.apiCaseList.forEach(apiCase => {
|
this.apiCaseList.forEach(apiCase => {
|
||||||
|
@ -260,7 +260,7 @@
|
||||||
if (!request.hashTree) {
|
if (!request.hashTree) {
|
||||||
request.hashTree = [];
|
request.hashTree = [];
|
||||||
}
|
}
|
||||||
if(request.backScript != null){
|
if (request.backScript != null) {
|
||||||
request.hashTree.push(request.backScript);
|
request.hashTree.push(request.backScript);
|
||||||
}
|
}
|
||||||
let uuid = getUUID();
|
let uuid = getUUID();
|
||||||
|
@ -290,14 +290,11 @@
|
||||||
this.singleLoading = true;
|
this.singleLoading = true;
|
||||||
this.singleRunId = row.id;
|
this.singleRunId = row.id;
|
||||||
row.request.name = row.id;
|
row.request.name = row.id;
|
||||||
this.$get('/api/definition/get/' + row.request.id, response => {
|
row.request.useEnvironment = this.environment;
|
||||||
row.request.path = response.data.path; // 取的path是对应接口的path,因此查库以获得
|
row.request.projectId = getCurrentProjectID();
|
||||||
row.request.useEnvironment = this.environment;
|
this.runData.push(row.request);
|
||||||
row.request.projectId = getCurrentProjectID();
|
/*触发执行操作*/
|
||||||
this.runData.push(row.request);
|
this.reportId = getUUID().substring(0, 8);
|
||||||
/*触发执行操作*/
|
|
||||||
this.reportId = getUUID().substring(0, 8);
|
|
||||||
});
|
|
||||||
},
|
},
|
||||||
|
|
||||||
batchRun() {
|
batchRun() {
|
||||||
|
|
|
@ -28,7 +28,7 @@
|
||||||
<el-table-column width="30" :resizable="false" align="center">
|
<el-table-column width="30" :resizable="false" align="center">
|
||||||
<template v-slot:default="scope">
|
<template v-slot:default="scope">
|
||||||
<!-- 选中记录后浮现的按钮,提供对记录的批量操作 -->
|
<!-- 选中记录后浮现的按钮,提供对记录的批量操作 -->
|
||||||
<show-more-btn :is-show="scope.row.showMore" :buttons="buttons" :size="selectDataCounts" v-tester/>
|
<show-more-btn :is-show="scope.row.showMore" :buttons="trashEnable ? trashButtons : buttons" :size="selectDataCounts" v-tester/>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<template v-for="(item, index) in tableLabel">
|
<template v-for="(item, index) in tableLabel">
|
||||||
|
@ -289,6 +289,12 @@
|
||||||
name: this.$t('api_test.definition.request.batch_move'), handleClick: this.handleBatchMove
|
name: this.$t('api_test.definition.request.batch_move'), handleClick: this.handleBatchMove
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
|
trashButtons: [
|
||||||
|
{name: this.$t('api_test.definition.request.batch_delete'), handleClick: this.handleDeleteBatch},
|
||||||
|
{
|
||||||
|
name: "批量恢复", handleClick: this.handleBatchRestore
|
||||||
|
},
|
||||||
|
],
|
||||||
typeArr: [
|
typeArr: [
|
||||||
{id: 'status', name: this.$t('api_test.definition.api_status')},
|
{id: 'status', name: this.$t('api_test.definition.api_status')},
|
||||||
{id: 'method', name: this.$t('api_test.definition.api_type')},
|
{id: 'method', name: this.$t('api_test.definition.api_type')},
|
||||||
|
@ -564,17 +570,18 @@
|
||||||
},
|
},
|
||||||
reductionApi(row) {
|
reductionApi(row) {
|
||||||
let tmp = JSON.parse(JSON.stringify(row));
|
let tmp = JSON.parse(JSON.stringify(row));
|
||||||
tmp.request = null;
|
let rows = {ids: [tmp.id]};
|
||||||
tmp.response = null;
|
|
||||||
if (tmp.tags instanceof Array) {
|
|
||||||
tmp.tags = JSON.stringify(tmp.tags);
|
|
||||||
}
|
|
||||||
let rows = [tmp];
|
|
||||||
this.$post('/api/definition/reduction/', rows, () => {
|
this.$post('/api/definition/reduction/', rows, () => {
|
||||||
this.$success(this.$t('commons.save_success'));
|
this.$success(this.$t('commons.save_success'));
|
||||||
this.search();
|
this.search();
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
handleBatchRestore() {
|
||||||
|
this.$post('/api/definition/reduction/', buildBatchParam(this), () => {
|
||||||
|
this.$success(this.$t('commons.save_success'));
|
||||||
|
this.search();
|
||||||
|
});
|
||||||
|
},
|
||||||
handleDeleteBatch() {
|
handleDeleteBatch() {
|
||||||
if (this.trashEnable) {
|
if (this.trashEnable) {
|
||||||
this.$alert(this.$t('api_test.definition.request.delete_confirm') + "?", '', {
|
this.$alert(this.$t('api_test.definition.request.delete_confirm') + "?", '', {
|
||||||
|
|
|
@ -26,6 +26,11 @@
|
||||||
row: Object,
|
row: Object,
|
||||||
size: Number
|
size: Number
|
||||||
},
|
},
|
||||||
|
created() {
|
||||||
|
if (this.trashEnable) {
|
||||||
|
this.buttons.splice(1, 1);
|
||||||
|
}
|
||||||
|
},
|
||||||
methods: {
|
methods: {
|
||||||
click(btn) {
|
click(btn) {
|
||||||
if (btn.handleClick instanceof Function) {
|
if (btn.handleClick instanceof Function) {
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
Subproject commit 3571feccf7c2bc68e4b619f6c367ac47d37c6723
|
Subproject commit f63ebb68ebad78de42fd711f17e2671e34577a86
|
Loading…
Reference in New Issue