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); 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") @PostMapping("/list/all")
@RequiresPermissions("PROJECT_API_SCENARIO:READ") @RequiresPermissions("PROJECT_API_SCENARIO:READ")
public List<ApiScenarioWithBLOBs> listAll(@RequestBody ApiScenarioBatchRequest request) { public List<ApiScenarioWithBLOBs> listAll(@RequestBody ApiScenarioBatchRequest request) {

View File

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

View File

@ -137,8 +137,14 @@ public class ApiAutomationService {
@Resource @Resource
private ExtTestPlanScenarioCaseMapper extTestPlanScenarioCaseMapper; private ExtTestPlanScenarioCaseMapper extTestPlanScenarioCaseMapper;
public ApiScenarioWithBLOBs getDto(String id) { public ApiScenarioDTO getDto(String id) {
return apiScenarioMapper.selectByPrimaryKey(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) { public ApiTestEnvironment get(String id) {

View File

@ -1379,4 +1379,14 @@ public class ApiDefinitionService {
extApiDefinitionMapper::getLastOrder, extApiDefinitionMapper::getLastOrder,
apiDefinitionMapper::updateByPrimaryKeySelective); 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"> <template v-slot:opt-before="scope">
<ms-table-operator-button v-permission=" ['PROJECT_API_SCENARIO:READ+RUN']" <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" :tip="$t('api_test.automation.execute')" icon="el-icon-video-play"
@exec="execute(scope.row)" v-if="!scope.row.isStop && !trashEnable" style="margin-right: 10px;"/> 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-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)"> <div style="transform: scale(0.72)">
<span style="margin-left: -3.5px;font-weight: bold">STOP</span> <span style="margin-left: -3.5px;font-weight: bold">STOP</span>
</div> </div>
@ -195,7 +199,8 @@
</template> </template>
<template v-slot:opt-behind="scope"> <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> </template>
</ms-table> </ms-table>
@ -206,10 +211,12 @@
<!-- 执行结果 --> <!-- 执行结果 -->
<el-drawer :visible.sync="runVisible" :destroy-on-close="true" direction="ltr" :withHeader="true" :modal="false" <el-drawer :visible.sync="runVisible" :destroy-on-close="true" direction="ltr" :withHeader="true" :modal="false"
size="90%"> 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>
<!-- 执行结果 --> <!-- 执行结果 -->
<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%"> size="90%">
<ms-api-report-detail @refresh="search" :infoDb="infoDb" :report-id="reportId" :currentProjectId="projectId"/> <ms-api-report-detail @refresh="search" :infoDb="infoDb" :report-id="reportId" :currentProjectId="projectId"/>
</el-drawer> </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_CONFIGS} from "@/business/components/common/components/search/search-components";
import {API_SCENARIO_LIST} from "../../../../../common/js/constants"; import {API_SCENARIO_LIST} from "../../../../../common/js/constants";
import { import {getCustomTableHeader, getCustomTableWidth, getLastTableSortField, handleRowDrop} from "@/common/js/tableUtils";
getCustomTableHeader, getCustomTableWidth, getLastTableSortField, handleRowDrop, saveLastTableSortField
} from "@/common/js/tableUtils";
import {API_SCENARIO_FILTERS} from "@/common/js/table-constants"; import {API_SCENARIO_FILTERS} from "@/common/js/table-constants";
import {scenario} from "@/business/components/track/plan/event-bus"; import {scenario} from "@/business/components/track/plan/event-bus";
import MsTable from "@/business/components/common/components/table/MsTable"; import MsTable from "@/business/components/common/components/table/MsTable";
@ -467,7 +472,7 @@ export default {
created() { created() {
scenario.$on('hide', id => { scenario.$on('hide', id => {
this.hideStopBtn(id); this.hideStopBtn(id);
}) });
this.projectId = getCurrentProjectID(); this.projectId = getCurrentProjectID();
if (!this.projectName || this.projectName === "") { if (!this.projectName || this.projectName === "") {
this.getProjectName(); this.getProjectName();
@ -490,15 +495,21 @@ export default {
} }
if(this.trashEnable){ if (this.trashEnable) {
this.condition.orders = [{"name":"delete_time","type":"desc"}]; this.condition.orders = [{"name": "delete_time", "type": "desc"}];
}else { } else {
this.condition.orders = getLastTableSortField(this.tableHeaderKey); this.condition.orders = getLastTableSortField(this.tableHeaderKey);
} }
this.search(); this.search();
this.getPrincipalOptions([]); this.getPrincipalOptions([]);
//
if (this.$route.query.resourceId) {
this.$get('/api/automation/get/' + this.$route.query.resourceId, (response) => {
this.edit(response.data);
});
}
}, },
beforeDestroy() { beforeDestroy() {
scenario.$off("hide"); scenario.$off("hide");
@ -804,19 +815,19 @@ export default {
this.search(); this.search();
}); });
return; return;
}else { } else {
let param = {}; let param = {};
this.buildBatchParam(param); this.buildBatchParam(param);
this.$post('/api/automation/checkBeforeDelete/', param, response => { this.$post('/api/automation/checkBeforeDelete/', param, response => {
let checkResult = response.data; let checkResult = response.data;
let alertMsg = this.$t('load_test.delete_threadgroup_confirm') + " "; let alertMsg = this.$t('load_test.delete_threadgroup_confirm') + " ";
if(!checkResult.deleteFlag){ if (!checkResult.deleteFlag) {
alertMsg = ""; alertMsg = "";
checkResult.checkMsg.forEach(item => { checkResult.checkMsg.forEach(item => {
alertMsg+=item+";"; alertMsg += item + ";";
}); });
if(alertMsg === ""){ if (alertMsg === "") {
alertMsg = this.$t('load_test.delete_threadgroup_confirm') + " "; alertMsg = this.$t('load_test.delete_threadgroup_confirm') + " ";
} else { } else {
alertMsg += this.$t('api_test.is_continue') + " "; alertMsg += this.$t('api_test.is_continue') + " ";
@ -885,20 +896,20 @@ export default {
this.search(); this.search();
}); });
return; return;
}else { } else {
let param = {}; let param = {};
this.buildBatchParam(param); this.buildBatchParam(param);
param.ids = [row.id]; param.ids = [row.id];
this.$post('/api/automation/checkBeforeDelete/', param, response => { this.$post('/api/automation/checkBeforeDelete/', param, response => {
let checkResult = response.data; let checkResult = response.data;
let alertMsg = this.$t('load_test.delete_threadgroup_confirm') +" "; let alertMsg = this.$t('load_test.delete_threadgroup_confirm') + " ";
if(!checkResult.deleteFlag){ if (!checkResult.deleteFlag) {
alertMsg = ""; alertMsg = "";
checkResult.checkMsg.forEach(item => { checkResult.checkMsg.forEach(item => {
alertMsg+=item+";"; alertMsg += item + ";";
}); });
if(alertMsg === ""){ if (alertMsg === "") {
alertMsg = this.$t('load_test.delete_threadgroup_confirm') +" "; alertMsg = this.$t('load_test.delete_threadgroup_confirm') + " ";
} else { } else {
alertMsg += this.$t('api_test.is_continue') + " "; alertMsg += this.$t('api_test.is_continue') + " ";
} }
@ -1021,10 +1032,10 @@ export default {
this.buildBatchParam(param); this.buildBatchParam(param);
this.$post('/api/automation/batchCopy', param, response => { this.$post('/api/automation/batchCopy', param, response => {
let copyResult = response.data; let copyResult = response.data;
if(copyResult.result){ if (copyResult.result) {
this.$success(this.$t('api_test.definition.request.batch_copy_end')); this.$success(this.$t('api_test.definition.request.batch_copy_end'));
}else { } else {
this.$error(this.$t('commons.already_exists')+":"+copyResult.errorMsg); this.$error(this.$t('commons.already_exists') + ":" + copyResult.errorMsg);
} }
this.search(); this.search();

View File

@ -389,6 +389,13 @@ export default {
}, },
created() { created() {
this.getEnv(); 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: { methods: {
setEnvironment(data) { setEnvironment(data) {

View File

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

View File

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

View File

@ -118,10 +118,10 @@ export function getUrl(d) {
url += "/track/plan/all"; url += "/track/plan/all";
break; break;
case "TEST_PLAN_TASK" : case "TEST_PLAN_TASK" :
url += "/track/plan/all"; url += "/track/plan/view/" + d.resourceId;
break; break;
case "REVIEW_TASK" : case "REVIEW_TASK" :
url += "/track/review/all"; url += "/track/review/view/" + d.resourceId;
break; break;
case "DEFECT_TASK" : case "DEFECT_TASK" :
url += "/track/issue"; url += "/track/issue";
@ -130,10 +130,14 @@ export function getUrl(d) {
url += "/api/definition"; url += "/api/definition";
break; break;
case "API_AUTOMATION_TASK" : case "API_AUTOMATION_TASK" :
url += "/api/automation"; url += "/api/automation?resourceId=" + d.resourceId;
break; break;
case "API_DEFINITION_TASK" : 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; break;
case "API_HOME_TASK" : case "API_HOME_TASK" :
url += "/api/home"; url += "/api/home";
@ -145,7 +149,7 @@ export function getUrl(d) {
url += "/performance/report/all"; url += "/performance/report/all";
break; break;
case "PERFORMANCE_TEST_TASK" : case "PERFORMANCE_TEST_TASK" :
url += "/performance/test/all"; url += "/performance/test/edit/" + d.resourceId;
break; break;
case "TRACK_TEST_CASE_TASK" : case "TRACK_TEST_CASE_TASK" :
url += "/track/case/all"; url += "/track/case/all";