fix: 通知跳转

This commit is contained in:
Captain.B 2021-09-13 14:21:45 +08:00 committed by 刘瑞斌
parent 6492542bf1
commit 3e3014c7ff
9 changed files with 94 additions and 36 deletions

View File

@ -56,6 +56,12 @@ public class ApiAutomationController {
return apiAutomationService.list(request);
}
@GetMapping("/get/{id}")
@RequiresPermissions("PROJECT_API_SCENARIO:READ")
public ApiScenarioDTO getById(@PathVariable String id) {
return apiAutomationService.getDto(id);
}
@PostMapping("/list/all")
@RequiresPermissions("PROJECT_API_SCENARIO:READ")
public List<ApiScenarioWithBLOBs> listAll(@RequestBody ApiScenarioBatchRequest request) {

View File

@ -161,8 +161,9 @@ public class ApiDefinitionController {
}
@GetMapping("/get/{id}")
public ApiDefinition get(@PathVariable String id) {
return apiDefinitionService.get(id);
@RequiresPermissions("PROJECT_API_DEFINITION:READ")
public ApiDefinitionResult getApiDefinitionResult(@PathVariable String id) {
return apiDefinitionService.getById(id);
}
@PostMapping(value = "/run/debug", consumes = {"multipart/form-data"})
@ -179,7 +180,7 @@ public class ApiDefinitionController {
}
@GetMapping("/report/get/{testId}/{test}")
public APIReportResult get(@PathVariable String testId, @PathVariable String test) {
public APIReportResult getResult(@PathVariable String testId, @PathVariable String test) {
return apiDefinitionService.getResult(testId, test);
}

View File

@ -137,8 +137,14 @@ public class ApiAutomationService {
@Resource
private ExtTestPlanScenarioCaseMapper extTestPlanScenarioCaseMapper;
public ApiScenarioWithBLOBs getDto(String id) {
return apiScenarioMapper.selectByPrimaryKey(id);
public ApiScenarioDTO getDto(String id) {
ApiScenarioRequest request = new ApiScenarioRequest();
request.setId(id);
List<ApiScenarioDTO> list = extApiScenarioMapper.list(request);
if (CollectionUtils.isNotEmpty(list)) {
return list.get(0);
}
return null;
}
public ApiTestEnvironment get(String id) {

View File

@ -1379,4 +1379,14 @@ public class ApiDefinitionService {
extApiDefinitionMapper::getLastOrder,
apiDefinitionMapper::updateByPrimaryKeySelective);
}
public ApiDefinitionResult getById(String id) {
ApiDefinitionRequest request = new ApiDefinitionRequest();
request.setId(id);
List<ApiDefinitionResult> list = list(request);
if (CollectionUtils.isNotEmpty(list)) {
return list.get(0);
}
return null;
}
}

View File

@ -182,10 +182,14 @@
<template v-slot:opt-before="scope">
<ms-table-operator-button v-permission=" ['PROJECT_API_SCENARIO:READ+RUN']"
:tip="$t('api_test.automation.execute')" icon="el-icon-video-play" class="run-button"
@exec="execute(scope.row)" v-if="!scope.row.isStop && !trashEnable" style="margin-right: 10px;"/>
:tip="$t('api_test.automation.execute')" icon="el-icon-video-play"
class="run-button"
@exec="execute(scope.row)" v-if="!scope.row.isStop && !trashEnable"
style="margin-right: 10px;"/>
<el-tooltip :content="$t('report.stop_btn')" placement="top" :enterable="false" v-else>
<el-button v-if="!trashEnable" @click.once="stop(scope.row)" size="mini" style="color:white;padding: 0;width: 28px;height: 28px;margin-right: 10px;" class="stop-btn" circle>
<el-button v-if="!trashEnable" @click.once="stop(scope.row)" size="mini"
style="color:white;padding: 0;width: 28px;height: 28px;margin-right: 10px;" class="stop-btn"
circle>
<div style="transform: scale(0.72)">
<span style="margin-left: -3.5px;font-weight: bold">STOP</span>
</div>
@ -195,7 +199,8 @@
</template>
<template v-slot:opt-behind="scope">
<ms-scenario-extend-buttons v-if="!trashEnable" style="display: contents" @openScenario="openScenario" :row="scope.row"/>
<ms-scenario-extend-buttons v-if="!trashEnable" style="display: contents" @openScenario="openScenario"
:row="scope.row"/>
</template>
</ms-table>
@ -206,10 +211,12 @@
<!-- 执行结果 -->
<el-drawer :visible.sync="runVisible" :destroy-on-close="true" direction="ltr" :withHeader="true" :modal="false"
size="90%">
<sysn-api-report-detail @refresh="search" :debug="true" :scenario="currentScenario" :scenarioId="scenarioId" :infoDb="infoDb" :report-id="reportId" :currentProjectId="projectId"/>
<sysn-api-report-detail @refresh="search" :debug="true" :scenario="currentScenario" :scenarioId="scenarioId"
:infoDb="infoDb" :report-id="reportId" :currentProjectId="projectId"/>
</el-drawer>
<!-- 执行结果 -->
<el-drawer :visible.sync="showReportVisible" :destroy-on-close="true" direction="ltr" :withHeader="true" :modal="false"
<el-drawer :visible.sync="showReportVisible" :destroy-on-close="true" direction="ltr" :withHeader="true"
:modal="false"
size="90%">
<ms-api-report-detail @refresh="search" :infoDb="infoDb" :report-id="reportId" :currentProjectId="projectId"/>
</el-drawer>
@ -235,9 +242,7 @@ import {downloadFile, getCurrentProjectID, getUUID, strMapToObj} from "@/common/
import {API_SCENARIO_CONFIGS} from "@/business/components/common/components/search/search-components";
import {API_SCENARIO_LIST} from "../../../../../common/js/constants";
import {
getCustomTableHeader, getCustomTableWidth, getLastTableSortField, handleRowDrop, saveLastTableSortField
} from "@/common/js/tableUtils";
import {getCustomTableHeader, getCustomTableWidth, getLastTableSortField, handleRowDrop} from "@/common/js/tableUtils";
import {API_SCENARIO_FILTERS} from "@/common/js/table-constants";
import {scenario} from "@/business/components/track/plan/event-bus";
import MsTable from "@/business/components/common/components/table/MsTable";
@ -467,7 +472,7 @@ export default {
created() {
scenario.$on('hide', id => {
this.hideStopBtn(id);
})
});
this.projectId = getCurrentProjectID();
if (!this.projectName || this.projectName === "") {
this.getProjectName();
@ -490,15 +495,21 @@ export default {
}
if(this.trashEnable){
this.condition.orders = [{"name":"delete_time","type":"desc"}];
}else {
if (this.trashEnable) {
this.condition.orders = [{"name": "delete_time", "type": "desc"}];
} else {
this.condition.orders = getLastTableSortField(this.tableHeaderKey);
}
this.search();
this.getPrincipalOptions([]);
//
if (this.$route.query.resourceId) {
this.$get('/api/automation/get/' + this.$route.query.resourceId, (response) => {
this.edit(response.data);
});
}
},
beforeDestroy() {
scenario.$off("hide");
@ -804,19 +815,19 @@ export default {
this.search();
});
return;
}else {
} else {
let param = {};
this.buildBatchParam(param);
this.$post('/api/automation/checkBeforeDelete/', param, response => {
let checkResult = response.data;
let alertMsg = this.$t('load_test.delete_threadgroup_confirm') + " ";
if(!checkResult.deleteFlag){
if (!checkResult.deleteFlag) {
alertMsg = "";
checkResult.checkMsg.forEach(item => {
alertMsg+=item+";";
alertMsg += item + ";";
});
if(alertMsg === ""){
if (alertMsg === "") {
alertMsg = this.$t('load_test.delete_threadgroup_confirm') + " ";
} else {
alertMsg += this.$t('api_test.is_continue') + " ";
@ -885,20 +896,20 @@ export default {
this.search();
});
return;
}else {
} else {
let param = {};
this.buildBatchParam(param);
param.ids = [row.id];
this.$post('/api/automation/checkBeforeDelete/', param, response => {
let checkResult = response.data;
let alertMsg = this.$t('load_test.delete_threadgroup_confirm') +" ";
if(!checkResult.deleteFlag){
let alertMsg = this.$t('load_test.delete_threadgroup_confirm') + " ";
if (!checkResult.deleteFlag) {
alertMsg = "";
checkResult.checkMsg.forEach(item => {
alertMsg+=item+";";
alertMsg += item + ";";
});
if(alertMsg === ""){
alertMsg = this.$t('load_test.delete_threadgroup_confirm') +" ";
if (alertMsg === "") {
alertMsg = this.$t('load_test.delete_threadgroup_confirm') + " ";
} else {
alertMsg += this.$t('api_test.is_continue') + " ";
}
@ -1021,10 +1032,10 @@ export default {
this.buildBatchParam(param);
this.$post('/api/automation/batchCopy', param, response => {
let copyResult = response.data;
if(copyResult.result){
if (copyResult.result) {
this.$success(this.$t('api_test.definition.request.batch_copy_end'));
}else {
this.$error(this.$t('commons.already_exists')+":"+copyResult.errorMsg);
} else {
this.$error(this.$t('commons.already_exists') + ":" + copyResult.errorMsg);
}
this.search();

View File

@ -389,6 +389,13 @@ export default {
},
created() {
this.getEnv();
//
if (this.$route.query.caseId) {
this.activeDom = 'middle';
// this.$get('/api/testcase/findById/' + this.$route.query.caseId, (response) => {
// this.edit(response.data);
// });
}
},
methods: {
setEnvironment(data) {

View File

@ -388,6 +388,12 @@ export default {
}
this.initTable();
//
if (this.$route.query.caseId) {
this.$get('/api/testcase/findById/' + this.$route.query.caseId, (response) => {
this.handleTestCase(response.data);
});
}
},
watch: {
selectNodeIds() {

View File

@ -437,6 +437,13 @@ export default {
this.initTable();
this.getMaintainerOptions();
//
if (this.$route.query.resourceId) {
this.$get('/api/definition/get/' + this.$route.query.resourceId, (response) => {
this.editApi(response.data);
});
}
},
watch: {
selectNodeIds() {

View File

@ -118,10 +118,10 @@ export function getUrl(d) {
url += "/track/plan/all";
break;
case "TEST_PLAN_TASK" :
url += "/track/plan/all";
url += "/track/plan/view/" + d.resourceId;
break;
case "REVIEW_TASK" :
url += "/track/review/all";
url += "/track/review/view/" + d.resourceId;
break;
case "DEFECT_TASK" :
url += "/track/issue";
@ -130,10 +130,14 @@ export function getUrl(d) {
url += "/api/definition";
break;
case "API_AUTOMATION_TASK" :
url += "/api/automation";
url += "/api/automation?resourceId=" + d.resourceId;
break;
case "API_DEFINITION_TASK" :
url += "/api/definition";
if (d.operation.startsWith('CASE_')) {
url += "/api/definition?caseId=" + d.resourceId;
} else {
url += "/api/definition?resourceId=" + d.resourceId;
}
break;
case "API_HOME_TASK" :
url += "/api/home";
@ -145,7 +149,7 @@ export function getUrl(d) {
url += "/performance/report/all";
break;
case "PERFORMANCE_TEST_TASK" :
url += "/performance/test/all";
url += "/performance/test/edit/" + d.resourceId;
break;
case "TRACK_TEST_CASE_TASK" :
url += "/track/case/all";