fix: 修复定时任务点击跳转错误 (#1643)

* feat(测试跟踪): 测试用例下载模版增加标签列

* fix(接口定义): 扩大请求头键长度

* fix: schedule表对旧数据name字段兼容的补充

* fix: 修复定时任务点击跳转错误

* fix: 测试计划首页的定时任务只显示测试计划任务

Co-authored-by: jianxing <41557596+AgAngle@users.noreply.github.com>
This commit is contained in:
Coooder-X 2021-03-18 14:53:15 +08:00 committed by GitHub
parent eb163bbb65
commit 3fd2139607
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 27 additions and 17 deletions

View File

@ -26,6 +26,7 @@ import io.metersphere.dto.ScheduleDao;
import io.metersphere.performance.service.PerformanceTestService;
import io.metersphere.service.CheckPermissionService;
import io.metersphere.service.ScheduleService;
import org.apache.commons.lang3.StringUtils;
import org.apache.jorphan.collections.HashTree;
import org.apache.shiro.authz.annotation.Logical;
import org.apache.shiro.authz.annotation.RequiresRoles;
@ -342,12 +343,16 @@ public class APITestController {
return returnList;
}
@GetMapping("/runningTask/{projectID}")
public List<TaskInfoResult> runningTask(@PathVariable String projectID) {
List<String> typeFilter = Arrays.asList( // 首页显示的运行中定时任务只要这3种不需要 性能测试api_test(旧版)
ScheduleGroup.API_SCENARIO_TEST.name(),
ScheduleGroup.SWAGGER_IMPORT.name(),
ScheduleGroup.TEST_PLAN_TEST.name());
@GetMapping("/runningTask/{projectID}/{callFrom}")
public List<TaskInfoResult> runningTask(@PathVariable String projectID, @PathVariable String callFrom) {
List<String> typeFilter = new ArrayList<>();
if(StringUtils.equals(callFrom, "api_test")) { // 接口测试首页显示的运行中定时任务只要这3种不需要 性能测试api_test(旧版)
typeFilter.add(ScheduleGroup.API_SCENARIO_TEST.name());
typeFilter.add(ScheduleGroup.SWAGGER_IMPORT.name());
typeFilter.add(ScheduleGroup.TEST_PLAN_TEST.name());
} else if(StringUtils.equals(callFrom, "track_home")) { // 测试跟踪首页只显示测试计划的定时任务
typeFilter.add(ScheduleGroup.TEST_PLAN_TEST.name());
}
List<TaskInfoResult> resultList = scheduleService.findRunningTaskInfoByProjectID(projectID, typeFilter);
int dataIndex = 1;
for (TaskInfoResult taskInfo :

View File

@ -69,17 +69,18 @@
sch.id AS taskID,
sch.`value` AS rule,
sch.`enable` AS `taskStatus`,
u.name AS creator,
u.`name` AS creator,
sch.update_time AS updateTime,
sch.type AS taskType,
sch.group AS taskGroup
sch.`group` AS taskGroup,
sch.resource_id AS scenarioId
FROM (
schedule sch left join user u
ON sch.user_id = u.id
)
WHERE sch.`enable` = true
AND sch.project_id = #{projectId,jdbcType=VARCHAR}
and sch.group in
and sch.`group` in
<foreach collection="types" item="item" separator="," open="(" close=")">
#{item}
</foreach>

View File

@ -194,7 +194,6 @@ public class TestPlanService {
testPlan.setActualEndTime(System.currentTimeMillis());
}
}
extScheduleMapper.updateNameByResourceID(testPlan.getId(), testPlan.getName());// 同步更新该测试的定时任务的name
List<String> userIds = new ArrayList<>();
userIds.add(testPlan.getPrincipal());
@ -204,6 +203,7 @@ public class TestPlanService {
i = testPlanMapper.updateByPrimaryKeySelective(testPlan);
}
else { // 有修改字段的调用为保证将某些时间置null的情况使用updateByPrimaryKey
extScheduleMapper.updateNameByResourceID(testPlan.getId(), testPlan.getName());// 同步更新该测试的定时任务的name
i = testPlanMapper.updateByPrimaryKey(testPlan); // 更新
}
if (!StringUtils.isBlank(testPlan.getStatus())) {

View File

@ -46,7 +46,7 @@
<ms-failure-test-case-list @redirectPage="redirectPage"/>
</el-col>
<el-col :span="12">
<ms-running-task-list @redirectPage="redirectPage"/>
<ms-running-task-list :call-from="'api_test'" @redirectPage="redirectPage"/>
</el-col>
</el-row>

View File

@ -64,7 +64,9 @@ export default {
components: {
MsTag
},
props: {
callFrom: String,
},
data() {
return {
value: '100',
@ -84,7 +86,7 @@ export default {
methods: {
search() {
let projectID = getCurrentProjectID();
this.result = this.$get("/api/runningTask/"+projectID, response => {
this.result = this.$get("/api/runningTask/"+projectID+"/"+this.callFrom, response => {
this.tableData = response.data;
});
},
@ -109,9 +111,9 @@ export default {
});
},
redirect(param){
if(param.taskType === 'testPlan'){
if(param.taskGroup === 'TEST_PLAN_TEST'){
this.$emit('redirectPage','testPlanEdit','', param.scenarioId);
}else{
}else if(param.taskGroup === 'API_SCENARIO_TEST') {
this.$emit('redirectPage','scenario','scenario', 'edit:'+param.scenarioId);
}
}

View File

@ -58,7 +58,7 @@
<review-list class="track-card"/>
</el-col>
<el-col :span="12">
<ms-running-task-list class="track-card"/>
<ms-running-task-list :call-from="'track_home'" class="track-card" @redirectPage="redirectPage"/>
</el-col>
</el-row>
@ -73,7 +73,7 @@ import MsMainContainer from "@/business/components/common/components/MsMainConta
import MsContainer from "@/business/components/common/components/MsContainer";
import CaseCountCard from "@/business/components/track/home/components/CaseCountCard";
import RelevanceCaseCard from "@/business/components/track/home/components/RelevanceCaseCard";
import {getCurrentProjectID, getUUID} from "@/common/js/utils";
import {getCurrentProjectID,getUUID} from "@/common/js/utils";
import CaseMaintenance from "@/business/components/track/home/components/CaseMaintenance";
import {COUNT_NUMBER, COUNT_NUMBER_SHALLOW} from "@/common/js/constants";
import BugCountCard from "@/business/components/track/home/components/BugCountCard";
@ -187,6 +187,8 @@ export default {
this.caseOption = option;
},
redirectPage(page,dataType,selectType){
//test_plan
this.$router.push('/track/plan/view/'+selectType);
switch (page){
case "case":
this.$router.push({name:'testCase',params:{dataType:dataType,dataSelectRange:selectType, projectId: getCurrentProjectID()}});