fix(任务中心): 资源池下拉选项调整

--bug=1048305 --user=王旭 【任务中心】详情列表-资源池下拉k8s无节点选项 https://www.tapd.cn/55049933/s/1600825
This commit is contained in:
WangXu10 2024-10-29 17:06:38 +08:00 committed by Craftsman
parent 6beafce34a
commit 7331d2c85f
2 changed files with 27 additions and 25 deletions

View File

@ -1,5 +1,6 @@
package io.metersphere.system.dto.taskhub; package io.metersphere.system.dto.taskhub;
import com.fasterxml.jackson.annotation.JsonInclude;
import io.metersphere.system.dto.sdk.OptionDTO; import io.metersphere.system.dto.sdk.OptionDTO;
import io.swagger.v3.oas.annotations.media.Schema; import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data; import lombok.Data;
@ -13,6 +14,7 @@ import java.util.List;
*/ */
@Data @Data
@EqualsAndHashCode(callSuper = false) @EqualsAndHashCode(callSuper = false)
@JsonInclude(JsonInclude.Include.NON_EMPTY)
public class ResourcePoolOptionsDTO extends OptionDTO { public class ResourcePoolOptionsDTO extends OptionDTO {
@Schema(description = "资源池节点") @Schema(description = "资源池节点")

View File

@ -253,7 +253,7 @@ public class TestPlanExecuteService {
extTestPlanApiScenarioMapper.countByPlanIds(childPlanIds); extTestPlanApiScenarioMapper.countByPlanIds(childPlanIds);
} }
// 初始化任务 // 初始化任务
ExecTask execTask = initExecTask(executionQueue.getTaskId(), caseTotal, testPlan.getName(), project, executionQueue.getCreateUser(), executionQueue.getExecutionSource(), executionQueue.getPrepareReportId()); ExecTask execTask = initExecTask(executionQueue.getTaskId(), caseTotal, testPlan, project, executionQueue.getCreateUser(), executionQueue.getExecutionSource(), executionQueue.getPrepareReportId());
// 预生成计划组报告 // 预生成计划组报告
Map<String, String> reportMap = testPlanReportService.genReportByExecution(executionQueue.getPrepareReportId(), execTask.getId(), genReportRequest, executionQueue.getCreateUser()); Map<String, String> reportMap = testPlanReportService.genReportByExecution(executionQueue.getPrepareReportId(), execTask.getId(), genReportRequest, executionQueue.getCreateUser());
@ -309,7 +309,7 @@ public class TestPlanExecuteService {
Integer caseTotal = extTestPlanApiCaseMapper.countByPlanIds(List.of(testPlan.getId())) + Integer caseTotal = extTestPlanApiCaseMapper.countByPlanIds(List.of(testPlan.getId())) +
extTestPlanApiScenarioMapper.countByPlanIds(List.of(testPlan.getId())); extTestPlanApiScenarioMapper.countByPlanIds(List.of(testPlan.getId()));
// 初始化任务 // 初始化任务
ExecTask execTask = initExecTask(executionQueue.getTaskId(), caseTotal, testPlan.getName(), project, executionQueue.getCreateUser(), executionQueue.getExecutionSource(), executionQueue.getPrepareReportId()); ExecTask execTask = initExecTask(executionQueue.getTaskId(), caseTotal, testPlan, project, executionQueue.getCreateUser(), executionQueue.getExecutionSource(), executionQueue.getPrepareReportId());
Map<String, String> reportMap = testPlanReportService.genReportByExecution(executionQueue.getPrepareReportId(), execTask.getId(), genReportRequest, executionQueue.getCreateUser()); Map<String, String> reportMap = testPlanReportService.genReportByExecution(executionQueue.getPrepareReportId(), execTask.getId(), genReportRequest, executionQueue.getCreateUser());
executionQueue.setPrepareReportId(reportMap.get(executionQueue.getSourceID())); executionQueue.setPrepareReportId(reportMap.get(executionQueue.getSourceID()));
@ -319,14 +319,14 @@ public class TestPlanExecuteService {
} }
} }
private ExecTask initExecTask(String taskId, int caseSize, String name, Project project, String userId, String triggerMode, String reportId) { private ExecTask initExecTask(String taskId, int caseSize, TestPlan testPlan, Project project, String userId, String triggerMode, String reportId) {
ExecTask execTask = apiCommonService.newExecTask(project.getId(), userId); ExecTask execTask = apiCommonService.newExecTask(project.getId(), userId);
execTask.setId(taskId); execTask.setId(taskId);
execTask.setCaseCount(Long.valueOf(caseSize)); execTask.setCaseCount(Long.valueOf(caseSize));
execTask.setTaskName(name); execTask.setTaskName(testPlan.getName());
execTask.setOrganizationId(project.getOrganizationId()); execTask.setOrganizationId(project.getOrganizationId());
execTask.setTriggerMode(triggerMode); execTask.setTriggerMode(triggerMode);
execTask.setTaskType(ExecTaskType.TEST_PLAN.name()); execTask.setTaskType(StringUtils.equalsIgnoreCase(testPlan.getType(), TestPlanConstants.TEST_PLAN_TYPE_PLAN) ? ExecTaskType.TEST_PLAN.name() : ExecTaskType.TEST_PLAN_GROUP.name());
baseTaskHubService.insertExecTask(execTask); baseTaskHubService.insertExecTask(execTask);
// 创建报告和任务的关联关系 // 创建报告和任务的关联关系