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 {
|
public interface ExtWorkspaceMapper {
|
||||||
|
|
||||||
List<WorkspaceDTO> getWorkspaceWithOrg(@Param("request") WorkspaceRequest request);
|
List<WorkspaceDTO> getWorkspaceWithOrg(@Param("request") WorkspaceRequest request);
|
||||||
|
|
||||||
List<String> getWorkspaceIdsByOrgId(@Param("orgId") String orgId);
|
List<String> getWorkspaceIdsByOrgId(@Param("orgId") String orgId);
|
||||||
|
|
||||||
|
List<WorkspaceDTO> getWorkspaceIdsOrgId(@Param("orgId") String orgId);
|
||||||
|
|
||||||
String getOrganizationIdById(String resourceID);
|
String getOrganizationIdById(String resourceID);
|
||||||
|
|
||||||
List<WorkspaceDTO> findIdAndNameByOrganizationId(@Param("organizationId") String organizationId);
|
List<WorkspaceDTO> findIdAndNameByOrganizationId(@Param("organizationId") String organizationId);
|
||||||
|
|
|
@ -10,11 +10,17 @@
|
||||||
AND w.name LIKE #{request.name,jdbcType=VARCHAR}
|
AND w.name LIKE #{request.name,jdbcType=VARCHAR}
|
||||||
</if>
|
</if>
|
||||||
</where>
|
</where>
|
||||||
order by w.update_time desc
|
order by w.update_time desc
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<select id="getWorkspaceIdsByOrgId" resultType="java.lang.String">
|
<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}
|
where organization_id = #{orgId}
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
|
|
@ -100,6 +100,11 @@ public class WorkspaceController {
|
||||||
return workspaceService.getWorkspaceListByOrgIdAndUserId(currentOrganizationId);
|
return workspaceService.getWorkspaceListByOrgIdAndUserId(currentOrganizationId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@GetMapping("/list/orgworkspace/{orgId}")
|
||||||
|
public List<WorkspaceDTO> getWorkspaceListByOrgId(@PathVariable String orgId) {
|
||||||
|
return workspaceService.getWorkspaceIdsByOrgId(orgId);
|
||||||
|
}
|
||||||
|
|
||||||
@PostMapping("/member/update")
|
@PostMapping("/member/update")
|
||||||
@MsAuditLog(module = "workspace_member", type = OperLogConstants.UPDATE, beforeEvent = "#msClass.getLogDetails(#memberDTO)", content = "#msClass.getLogDetails(#memberDTO)", msClass = WorkspaceService.class)
|
@MsAuditLog(module = "workspace_member", type = OperLogConstants.UPDATE, beforeEvent = "#msClass.getLogDetails(#memberDTO)", content = "#msClass.getLogDetails(#memberDTO)", msClass = WorkspaceService.class)
|
||||||
public void updateOrgMember(@RequestBody WorkspaceMemberDTO memberDTO) {
|
public void updateOrgMember(@RequestBody WorkspaceMemberDTO memberDTO) {
|
||||||
|
|
|
@ -221,6 +221,10 @@ public class WorkspaceService {
|
||||||
return extWorkspaceMapper.getWorkspaceIdsByOrgId(orgId);
|
return extWorkspaceMapper.getWorkspaceIdsByOrgId(orgId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public List<WorkspaceDTO> getWorkspaceIdsByOrgId(String orgId) {
|
||||||
|
return extWorkspaceMapper.getWorkspaceIdsOrgId(orgId);
|
||||||
|
}
|
||||||
|
|
||||||
public void updateWorkspaceMember(WorkspaceMemberDTO memberDTO) {
|
public void updateWorkspaceMember(WorkspaceMemberDTO memberDTO) {
|
||||||
String workspaceId = memberDTO.getWorkspaceId();
|
String workspaceId = memberDTO.getWorkspaceId();
|
||||||
String userId = memberDTO.getId();
|
String userId = memberDTO.getId();
|
||||||
|
|
|
@ -1,17 +1,18 @@
|
||||||
package io.metersphere.track.controller;
|
package io.metersphere.track.controller;
|
||||||
|
|
||||||
|
import com.alibaba.fastjson.JSONObject;
|
||||||
import com.github.pagehelper.Page;
|
import com.github.pagehelper.Page;
|
||||||
import com.github.pagehelper.PageHelper;
|
import com.github.pagehelper.PageHelper;
|
||||||
import io.metersphere.base.domain.Project;
|
import io.metersphere.base.domain.Project;
|
||||||
import io.metersphere.base.domain.TestPlan;
|
import io.metersphere.base.domain.TestPlan;
|
||||||
import io.metersphere.commons.constants.OperLogConstants;
|
import io.metersphere.commons.constants.OperLogConstants;
|
||||||
import io.metersphere.commons.constants.PermissionConstants;
|
import io.metersphere.commons.constants.PermissionConstants;
|
||||||
import io.metersphere.commons.constants.RoleConstants;
|
|
||||||
import io.metersphere.commons.utils.PageUtils;
|
import io.metersphere.commons.utils.PageUtils;
|
||||||
import io.metersphere.commons.utils.Pager;
|
import io.metersphere.commons.utils.Pager;
|
||||||
import io.metersphere.commons.utils.SessionUtils;
|
import io.metersphere.commons.utils.SessionUtils;
|
||||||
import io.metersphere.log.annotation.MsAuditLog;
|
import io.metersphere.log.annotation.MsAuditLog;
|
||||||
import io.metersphere.service.CheckPermissionService;
|
import io.metersphere.service.CheckPermissionService;
|
||||||
|
import io.metersphere.track.dto.ApiRunConfigDTO;
|
||||||
import io.metersphere.track.dto.TestCaseReportMetricDTO;
|
import io.metersphere.track.dto.TestCaseReportMetricDTO;
|
||||||
import io.metersphere.track.dto.TestPlanDTO;
|
import io.metersphere.track.dto.TestPlanDTO;
|
||||||
import io.metersphere.track.dto.TestPlanDTOWithMetric;
|
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.request.testplancase.TestCaseRelevanceRequest;
|
||||||
import io.metersphere.track.service.TestPlanProjectService;
|
import io.metersphere.track.service.TestPlanProjectService;
|
||||||
import io.metersphere.track.service.TestPlanService;
|
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.RequiresPermissions;
|
||||||
import org.apache.shiro.authz.annotation.RequiresRoles;
|
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
|
@ -156,7 +155,11 @@ public class TestPlanController {
|
||||||
return PageUtils.setPageInfo(page, testPlanProjectService.getProjectByPlanId(request));
|
return PageUtils.setPageInfo(page, testPlanProjectService.getProjectByPlanId(request));
|
||||||
}
|
}
|
||||||
@PostMapping("/testplan/jenkins")
|
@PostMapping("/testplan/jenkins")
|
||||||
public void runJenkins(@RequestBody TestplanRunRequest testplanRunRequest){
|
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 projectID;
|
||||||
private String userId;
|
private String userId;
|
||||||
private String triggerMode;
|
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> apiTestCaseIdMap;
|
||||||
Map<String, String> performanceIdMap;
|
Map<String, String> performanceIdMap;
|
||||||
if (StringUtils.isEmpty(apiRunConfig)) {
|
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<>();
|
planScenarioIdMap = new LinkedHashMap<>();
|
||||||
apiTestCaseIdMap = new LinkedHashMap<>();
|
apiTestCaseIdMap = new LinkedHashMap<>();
|
||||||
|
|
|
@ -80,7 +80,7 @@
|
||||||
this.selectPageFontColor.color = "gray";
|
this.selectPageFontColor.color = "gray";
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
this.selectAllSimpleStyle.color = "gray";
|
this.selectAllFontColor.color = "gray";
|
||||||
this.selectPageFontColor.color = "gray";
|
this.selectPageFontColor.color = "gray";
|
||||||
}
|
}
|
||||||
this.$emit(even);
|
this.$emit(even);
|
||||||
|
|
Loading…
Reference in New Issue