fix: jenkins选择资源池运行 (#3635)
* fix: jenkins选择资源池运行 * fix: 格式修改 Co-authored-by: wenyann <wenyan.yang@fit2cloud.com>
This commit is contained in:
parent
207729e698
commit
8829a8caaf
|
@ -9,8 +9,11 @@ import java.util.List;
|
|||
public interface ExtWorkspaceMapper {
|
||||
|
||||
List<WorkspaceDTO> getWorkspaceWithOrg(@Param("request") WorkspaceRequest request);
|
||||
|
||||
List<String> getWorkspaceIdsByOrgId(@Param("orgId") String orgId);
|
||||
|
||||
List<WorkspaceDTO> getWorkspaceIdsOrgId(@Param("orgId") String orgId);
|
||||
|
||||
String getOrganizationIdById(String resourceID);
|
||||
|
||||
List<WorkspaceDTO> findIdAndNameByOrganizationId(@Param("organizationId") String organizationId);
|
||||
|
|
|
@ -14,7 +14,13 @@
|
|||
</select>
|
||||
|
||||
<select id="getWorkspaceIdsByOrgId" resultType="java.lang.String">
|
||||
select id from workspace
|
||||
select id
|
||||
from workspace
|
||||
where organization_id = #{orgId}
|
||||
</select>
|
||||
<select id="getWorkspaceIdsOrgId" resultType="io.metersphere.dto.WorkspaceDTO">
|
||||
select *
|
||||
from workspace
|
||||
where organization_id = #{orgId}
|
||||
</select>
|
||||
|
||||
|
|
|
@ -100,6 +100,11 @@ public class WorkspaceController {
|
|||
return workspaceService.getWorkspaceListByOrgIdAndUserId(currentOrganizationId);
|
||||
}
|
||||
|
||||
@GetMapping("/list/orgworkspace/{orgId}")
|
||||
public List<WorkspaceDTO> getWorkspaceListByOrgId(@PathVariable String orgId) {
|
||||
return workspaceService.getWorkspaceIdsByOrgId(orgId);
|
||||
}
|
||||
|
||||
@PostMapping("/member/update")
|
||||
@MsAuditLog(module = "workspace_member", type = OperLogConstants.UPDATE, beforeEvent = "#msClass.getLogDetails(#memberDTO)", content = "#msClass.getLogDetails(#memberDTO)", msClass = WorkspaceService.class)
|
||||
public void updateOrgMember(@RequestBody WorkspaceMemberDTO memberDTO) {
|
||||
|
|
|
@ -221,6 +221,10 @@ public class WorkspaceService {
|
|||
return extWorkspaceMapper.getWorkspaceIdsByOrgId(orgId);
|
||||
}
|
||||
|
||||
public List<WorkspaceDTO> getWorkspaceIdsByOrgId(String orgId) {
|
||||
return extWorkspaceMapper.getWorkspaceIdsOrgId(orgId);
|
||||
}
|
||||
|
||||
public void updateWorkspaceMember(WorkspaceMemberDTO memberDTO) {
|
||||
String workspaceId = memberDTO.getWorkspaceId();
|
||||
String userId = memberDTO.getId();
|
||||
|
|
|
@ -1,17 +1,18 @@
|
|||
package io.metersphere.track.controller;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.github.pagehelper.Page;
|
||||
import com.github.pagehelper.PageHelper;
|
||||
import io.metersphere.base.domain.Project;
|
||||
import io.metersphere.base.domain.TestPlan;
|
||||
import io.metersphere.commons.constants.OperLogConstants;
|
||||
import io.metersphere.commons.constants.PermissionConstants;
|
||||
import io.metersphere.commons.constants.RoleConstants;
|
||||
import io.metersphere.commons.utils.PageUtils;
|
||||
import io.metersphere.commons.utils.Pager;
|
||||
import io.metersphere.commons.utils.SessionUtils;
|
||||
import io.metersphere.log.annotation.MsAuditLog;
|
||||
import io.metersphere.service.CheckPermissionService;
|
||||
import io.metersphere.track.dto.ApiRunConfigDTO;
|
||||
import io.metersphere.track.dto.TestCaseReportMetricDTO;
|
||||
import io.metersphere.track.dto.TestPlanDTO;
|
||||
import io.metersphere.track.dto.TestPlanDTOWithMetric;
|
||||
|
@ -22,9 +23,7 @@ import io.metersphere.track.request.testplan.TestplanRunRequest;
|
|||
import io.metersphere.track.request.testplancase.TestCaseRelevanceRequest;
|
||||
import io.metersphere.track.service.TestPlanProjectService;
|
||||
import io.metersphere.track.service.TestPlanService;
|
||||
import org.apache.shiro.authz.annotation.Logical;
|
||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||
import org.apache.shiro.authz.annotation.RequiresRoles;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
@ -157,6 +156,10 @@ public class TestPlanController {
|
|||
}
|
||||
@PostMapping("/testplan/jenkins")
|
||||
public void runJenkins(@RequestBody TestplanRunRequest testplanRunRequest) {
|
||||
testPlanService.run(testplanRunRequest.getTestPlanID(),testplanRunRequest.getProjectID(),testplanRunRequest.getUserId(),testplanRunRequest.getTriggerMode(),null);
|
||||
ApiRunConfigDTO api = new ApiRunConfigDTO();
|
||||
api.setMode(testplanRunRequest.getMode());
|
||||
api.setResourcePoolId(testplanRunRequest.getResourcePoolId());
|
||||
String apiRunConfig = JSONObject.toJSONString(api);
|
||||
testPlanService.run(testplanRunRequest.getTestPlanID(), testplanRunRequest.getProjectID(), testplanRunRequest.getUserId(), testplanRunRequest.getTriggerMode(), apiRunConfig);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,12 @@
|
|||
package io.metersphere.track.dto;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class ApiRunConfigDTO {
|
||||
private String mode;
|
||||
private String reportType;
|
||||
private String onSampleError;
|
||||
private String runWithinResourcePool;
|
||||
private String resourcePoolId;
|
||||
}
|
|
@ -11,5 +11,10 @@ public class TestplanRunRequest {
|
|||
private String projectID;
|
||||
private String userId;
|
||||
private String triggerMode;
|
||||
private String mode;
|
||||
private String reportType;
|
||||
private String onSampleError;
|
||||
private String runWithinResourcePool;
|
||||
private String resourcePoolId;
|
||||
}
|
||||
|
||||
|
|
|
@ -1004,7 +1004,12 @@ public class TestPlanService {
|
|||
Map<String, String> apiTestCaseIdMap;
|
||||
Map<String, String> performanceIdMap;
|
||||
if (StringUtils.isEmpty(apiRunConfig)) {
|
||||
apiRunConfig = "{\"mode\":\"parallel\",\"reportType\":\"iddReport\",\"onSampleError\":true,\"runWithinResourcePool\":true,\"resourcePoolId\":\"29773f4f-55e4-4bce-ad3d-b531b4eb59c2\"}";
|
||||
apiRunConfig =
|
||||
"{\"mode\":\"parallel\"," +
|
||||
"\"reportType\":\"iddReport\"," +
|
||||
"\"onSampleError\":true," +
|
||||
"\"runWithinResourcePool\":true," +
|
||||
"\"resourcePoolId\":\"29773f4f-55e4-4bce-ad3d-b531b4eb59c2\"}";
|
||||
}
|
||||
planScenarioIdMap = new LinkedHashMap<>();
|
||||
apiTestCaseIdMap = new LinkedHashMap<>();
|
||||
|
|
|
@ -80,7 +80,7 @@
|
|||
this.selectPageFontColor.color = "gray";
|
||||
|
||||
} else {
|
||||
this.selectAllSimpleStyle.color = "gray";
|
||||
this.selectAllFontColor.color = "gray";
|
||||
this.selectPageFontColor.color = "gray";
|
||||
}
|
||||
this.$emit(even);
|
||||
|
|
Loading…
Reference in New Issue