Merge branch 'master' of https://github.com/metersphere/metersphere
This commit is contained in:
commit
e14ac46e01
|
@ -6,6 +6,7 @@ import io.metersphere.base.domain.ApiTest;
|
|||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
public interface ExtApiTestMapper {
|
||||
List<APITestResult> list(@Param("request") QueryAPITestRequest request);
|
||||
|
@ -13,4 +14,7 @@ public interface ExtApiTestMapper {
|
|||
List<ApiTest> getApiTestByProjectId(String projectId);
|
||||
|
||||
List<ApiTest> listByIds(@Param("ids") List<String> ids);
|
||||
|
||||
int checkApiTestOwner(@Param("testId") String testId, @Param("workspaceIds") Set<String> workspaceIds);
|
||||
|
||||
}
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
|
||||
<mapper namespace="io.metersphere.base.mapper.ext.ExtApiTestMapper">
|
||||
|
||||
<resultMap id="BaseResultMap" type="io.metersphere.api.dto.APITestResult"
|
||||
extends="io.metersphere.base.mapper.ApiTestMapper.BaseResultMap">
|
||||
<result column="project_name" property="projectName"/>
|
||||
|
@ -11,25 +10,25 @@
|
|||
<sql id="condition">
|
||||
<choose>
|
||||
<when test='${object}.operator == "like"'>
|
||||
like CONCAT('%', #{${object}.value},'%')
|
||||
LIKE CONCAT('%', #{${object}.value},'%')
|
||||
</when>
|
||||
<when test='${object}.operator == "not like"'>
|
||||
not like CONCAT('%', #{${object}.value},'%')
|
||||
NOT LIKE CONCAT('%', #{${object}.value},'%')
|
||||
</when>
|
||||
<when test='${object}.operator == "in"'>
|
||||
in
|
||||
IN
|
||||
<foreach collection="${object}.value" item="v" separator="," open="(" close=")">
|
||||
#{v}
|
||||
</foreach>
|
||||
</when>
|
||||
<when test='${object}.operator == "not in"'>
|
||||
not in
|
||||
NOT IN
|
||||
<foreach collection="${object}.value" item="v" separator="," open="(" close=")">
|
||||
#{v}
|
||||
</foreach>
|
||||
</when>
|
||||
<when test='${object}.operator == "between"'>
|
||||
between #{${object}.value[0]} and #{${object}.value[1]}
|
||||
BETWEEN #{${object}.value[0]} AND #{${object}.value[1]}
|
||||
</when>
|
||||
<when test='${object}.operator == "gt"'>
|
||||
> #{${object}.value}
|
||||
|
@ -54,37 +53,37 @@
|
|||
|
||||
<sql id="combine">
|
||||
<if test='${condition}.name != null and (${name} == null or ${name} == "")'>
|
||||
and api_test.name
|
||||
AND api_test.name
|
||||
<include refid="condition">
|
||||
<property name="object" value="${condition}.name"/>
|
||||
</include>
|
||||
</if>
|
||||
<if test="${condition}.updateTime != null">
|
||||
and api_test.update_time
|
||||
AND api_test.update_time
|
||||
<include refid="condition">
|
||||
<property name="object" value="${condition}.updateTime"/>
|
||||
</include>
|
||||
</if>
|
||||
<if test="${condition}.projectName != null">
|
||||
and project.name
|
||||
AND project.name
|
||||
<include refid="condition">
|
||||
<property name="object" value="${condition}.projectName"/>
|
||||
</include>
|
||||
</if>
|
||||
<if test="${condition}.createTime != null">
|
||||
and api_test.create_time
|
||||
AND api_test.create_time
|
||||
<include refid="condition">
|
||||
<property name="object" value="${condition}.createTime"/>
|
||||
</include>
|
||||
</if>
|
||||
<if test="${condition}.status != null">
|
||||
and api_test.status
|
||||
AND api_test.status
|
||||
<include refid="condition">
|
||||
<property name="object" value="${condition}.status"/>
|
||||
</include>
|
||||
</if>
|
||||
<if test="${condition}.creator != null">
|
||||
and api_test.user_id
|
||||
AND api_test.user_id
|
||||
<include refid="condition">
|
||||
<property name="object" value="${condition}.creator"/>
|
||||
</include>
|
||||
|
@ -92,11 +91,11 @@
|
|||
</sql>
|
||||
|
||||
<select id="list" resultMap="BaseResultMap">
|
||||
select api_test.id, api_test.project_id, api_test.name, api_test.description,
|
||||
api_test.status, api_test.user_id, api_test.create_time, api_test.update_time, project.name as project_name, user.name as user_name
|
||||
from api_test
|
||||
left join project on api_test.project_id = project.id
|
||||
left join user on api_test.user_id = user.id
|
||||
SELECT api_test.id, api_test.project_id, api_test.name, api_test.description,
|
||||
api_test.status, api_test.user_id, api_test.create_time, api_test.update_time, project.name AS project_name, user.name AS user_name
|
||||
FROM api_test
|
||||
LEFT JOIN project ON api_test.project_id = project.id
|
||||
LEFT JOIN user ON api_test.user_id = user.id
|
||||
<where>
|
||||
<if test="request.combine != null">
|
||||
<include refid="combine">
|
||||
|
@ -109,7 +108,7 @@
|
|||
and api_test.id != #{request.excludeId}
|
||||
</if>
|
||||
<if test="request.name != null">
|
||||
and api_test.name like CONCAT('%', #{request.name},'%')
|
||||
AND api_test.name LIKE CONCAT('%', #{request.name},'%')
|
||||
</if>
|
||||
<if test="request.workspaceId != null">
|
||||
AND project.workspace_id = #{request.workspaceId}
|
||||
|
@ -125,36 +124,34 @@
|
|||
</if>
|
||||
<if test="request.filters != null and request.filters.size() > 0">
|
||||
<foreach collection="request.filters.entrySet()" index="key" item="values">
|
||||
|
||||
<if test="values != null and values.size() > 0">
|
||||
and api_test.status in
|
||||
AND api_test.status IN
|
||||
<foreach collection="values" item="value" separator="," open="(" close=")">
|
||||
#{value}
|
||||
</foreach>
|
||||
</if>
|
||||
|
||||
</foreach>
|
||||
</if>
|
||||
</where>
|
||||
<if test="request.orders != null and request.orders.size() > 0">
|
||||
order by
|
||||
ORDER BY
|
||||
<foreach collection="request.orders" separator="," item="order">
|
||||
api_test.${order.name} ${order.type}
|
||||
</foreach>
|
||||
</if>
|
||||
</select>
|
||||
<select id="getApiTestByProjectId" resultType="io.metersphere.base.domain.ApiTest">
|
||||
select id,name,status
|
||||
from api_test
|
||||
where project_id = #{projectId}
|
||||
SELECT id,name,status
|
||||
FROM api_test
|
||||
WHERE project_id = #{projectId}
|
||||
</select>
|
||||
|
||||
<select id="listByIds" resultType="io.metersphere.base.domain.ApiTest">
|
||||
select *
|
||||
from api_test
|
||||
SELECT *
|
||||
FROM api_test
|
||||
<where>
|
||||
<if test="ids != null and ids.size() > 0">
|
||||
id in
|
||||
id IN
|
||||
<foreach collection="ids" item="id" separator="," open="(" close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
|
@ -162,4 +159,20 @@
|
|||
</where>
|
||||
</select>
|
||||
|
||||
<select id="checkApiTestOwner" resultType="int">
|
||||
SELECT COUNT(1)
|
||||
FROM api_test
|
||||
LEFT JOIN project ON api_test.project_id = project.id
|
||||
<where>
|
||||
<if test="testId != null">
|
||||
and api_test.id = #{testId}
|
||||
</if>
|
||||
<if test="workspaceIds != null and workspaceIds.size() > 0">
|
||||
AND workspace_id IN
|
||||
<foreach collection="workspaceIds" item="id" separator="," open="(" close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
</if>
|
||||
</where>
|
||||
</select>
|
||||
</mapper>
|
|
@ -1,14 +1,17 @@
|
|||
package io.metersphere.base.mapper.ext;
|
||||
|
||||
import io.metersphere.base.domain.LoadTest;
|
||||
import io.metersphere.track.request.testplan.QueryTestPlanRequest;
|
||||
import io.metersphere.dto.LoadTestDTO;
|
||||
import io.metersphere.track.request.testplan.QueryTestPlanRequest;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
public interface ExtLoadTestMapper {
|
||||
List<LoadTestDTO> list(@Param("request") QueryTestPlanRequest params);
|
||||
|
||||
List<LoadTest> getLoadTestByProjectId(String projectId);
|
||||
|
||||
int checkLoadTestOwner(@Param("testId") String testId, @Param("workspaceIds") Set<String> workspaceIds);
|
||||
}
|
||||
|
|
|
@ -98,9 +98,25 @@
|
|||
</if>
|
||||
</select>
|
||||
<select id="getLoadTestByProjectId" resultType="io.metersphere.base.domain.LoadTest">
|
||||
select id,name
|
||||
from load_test
|
||||
where project_id = #{projectId}
|
||||
SELECT id,name
|
||||
FROM load_test
|
||||
WHERE project_id = #{projectId}
|
||||
</select>
|
||||
|
||||
<select id="checkLoadTestOwner" resultType="int">
|
||||
SELECT COUNT(1)
|
||||
FROM load_test
|
||||
LEFT JOIN project ON api_test.project_id = project.id
|
||||
<where>
|
||||
<if test="testId != null">
|
||||
and load_test.id = #{testId}
|
||||
</if>
|
||||
<if test="workspaceIds != null and workspaceIds.size() > 0">
|
||||
AND workspace_id IN
|
||||
<foreach collection="workspaceIds" item="id" separator="," open="(" close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
</if>
|
||||
</where>
|
||||
</select>
|
||||
</mapper>
|
|
@ -71,9 +71,7 @@
|
|||
from load_test_report ltr
|
||||
join load_test lt on ltr.test_id = lt.id
|
||||
join user on ltr.user_id = user.id
|
||||
<if test="reportRequest.workspaceId != null">
|
||||
JOIN project on project.id = lt.project_id
|
||||
</if>
|
||||
join project on project.id = lt.project_id
|
||||
<where>
|
||||
<if test="reportRequest.combine != null">
|
||||
<include refid="combine">
|
||||
|
@ -90,6 +88,9 @@
|
|||
<if test="reportRequest.workspaceId != null">
|
||||
AND workspace_id = #{reportRequest.workspaceId,jdbcType=VARCHAR}
|
||||
</if>
|
||||
<if test="reportRequest.projectId != null">
|
||||
AND project.id = #{reportRequest.projectId,jdbcType=VARCHAR}
|
||||
</if>
|
||||
<if test="reportRequest.filters != null and reportRequest.filters.size() > 0">
|
||||
<foreach collection="reportRequest.filters.entrySet()" index="key" item="values">
|
||||
<if test="values != null and values.size() > 0">
|
||||
|
|
|
@ -1,12 +1,13 @@
|
|||
package io.metersphere.base.mapper.ext;
|
||||
|
||||
import io.metersphere.base.domain.TestCase;
|
||||
import io.metersphere.track.request.testcase.QueryTestCaseRequest;
|
||||
import io.metersphere.track.dto.TestCaseDTO;
|
||||
import io.metersphere.track.request.testcase.QueryTestCaseRequest;
|
||||
import io.metersphere.track.request.testcase.TestCaseBatchRequest;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
public interface ExtTestCaseMapper {
|
||||
|
||||
|
@ -22,6 +23,7 @@ public interface ExtTestCaseMapper {
|
|||
|
||||
/**
|
||||
* 获取不在测试计划中的用例
|
||||
*
|
||||
* @param request
|
||||
* @return
|
||||
*/
|
||||
|
@ -29,6 +31,7 @@ public interface ExtTestCaseMapper {
|
|||
|
||||
/**
|
||||
* 获取不在评审范围中的用例
|
||||
*
|
||||
* @param request
|
||||
* @return
|
||||
*/
|
||||
|
@ -38,9 +41,9 @@ public interface ExtTestCaseMapper {
|
|||
* 检查某工作空间下是否有某用例
|
||||
*
|
||||
* @param caseId
|
||||
* @param workspaceId
|
||||
* @param workspaceIds
|
||||
* @return TestCase ID
|
||||
*/
|
||||
List<String> checkIsHave(@Param("caseId") String caseId, @Param("workspaceId") String workspaceId);
|
||||
int checkIsHave(@Param("caseId") String caseId, @Param("workspaceIds") Set<String> workspaceIds);
|
||||
|
||||
}
|
||||
|
|
|
@ -357,13 +357,19 @@
|
|||
</select>
|
||||
|
||||
<select id="getMaxNumByProjectId" resultType="io.metersphere.base.domain.TestCase">
|
||||
select * from test_case where test_case.project_id = #{projectId} order by num desc limit 1;
|
||||
SELECT * FROM test_case WHERE test_case.project_id = #{projectId} ORDER BY num DESC LIMIT 1;
|
||||
</select>
|
||||
<select id="checkIsHave" resultType="java.lang.String">
|
||||
select distinct test_case.id
|
||||
from test_case, project
|
||||
where test_case.project_id = project.id
|
||||
and project.workspace_id = #{workspaceId}
|
||||
and test_case.id = #{caseId}
|
||||
|
||||
<select id="checkIsHave" resultType="int">
|
||||
SELECT COUNT(1)
|
||||
FROM test_case, project
|
||||
WHERE test_case.project_id = project.id
|
||||
<if test="workspaceIds != null and workspaceIds.size() > 0">
|
||||
AND project.workspace_id IN
|
||||
<foreach collection="workspaceIds" item="id" separator="," open="(" close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
</if>
|
||||
AND test_case.id = #{caseId}
|
||||
</select>
|
||||
</mapper>
|
|
@ -7,6 +7,7 @@ import io.metersphere.track.request.testreview.QueryTestReviewRequest;
|
|||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
public interface ExtTestCaseReviewMapper {
|
||||
|
||||
|
@ -20,8 +21,8 @@ public interface ExtTestCaseReviewMapper {
|
|||
* 检查某工作空间下是否有某测试评审
|
||||
*
|
||||
* @param reviewId
|
||||
* @param workspaceId
|
||||
* @param workspaceIds
|
||||
* @return Review ID
|
||||
*/
|
||||
List<String> checkIsHave(@Param("reviewId") String reviewId, @Param("workspaceId") String workspaceId);
|
||||
int checkIsHave(@Param("reviewId") String reviewId, @Param("workspaceIds") Set<String> workspaceIds);
|
||||
}
|
||||
|
|
|
@ -74,11 +74,16 @@
|
|||
|
||||
order by test_case_review.update_time desc
|
||||
</select>
|
||||
<select id="checkIsHave" resultType="java.lang.String">
|
||||
select distinct review_id
|
||||
from project, test_case_review_project
|
||||
where project.id = test_case_review_project.project_id
|
||||
and project.workspace_id = #{workspaceId}
|
||||
and test_case_review_project.review_id = #{reviewId}
|
||||
<select id="checkIsHave" resultType="int">
|
||||
SELECT COUNT(1)
|
||||
FROM project, test_case_review_project
|
||||
WHERE project.id = test_case_review_project.project_id
|
||||
<if test="workspaceIds != null and workspaceIds.size() > 0">
|
||||
AND project.workspace_id IN
|
||||
<foreach collection="workspaceIds" item="id" separator="," open="(" close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
</if>
|
||||
AND test_case_review_project.review_id = #{reviewId}
|
||||
</select>
|
||||
</mapper>
|
|
@ -6,6 +6,7 @@ import io.metersphere.track.request.testcase.QueryTestPlanRequest;
|
|||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
public interface ExtTestPlanMapper {
|
||||
List<TestPlanDTOWithMetric> list(@Param("request") QueryTestPlanRequest params);
|
||||
|
@ -20,4 +21,5 @@ public interface ExtTestPlanMapper {
|
|||
|
||||
List<TestPlanDTO> selectReference(@Param("request") QueryTestPlanRequest params);
|
||||
|
||||
int checkIsHave(@Param("planId") String planId, @Param("workspaceIds") Set<String> workspaceIds);
|
||||
}
|
||||
|
|
|
@ -215,4 +215,16 @@
|
|||
</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<select id="checkIsHave" resultType="int">
|
||||
SELECT COUNT(1)
|
||||
FROM test_plan_project, project
|
||||
WHERE project_id = project.id AND test_plan_id = #{planId}
|
||||
<if test="workspaceIds != null and workspaceIds.size() > 0">
|
||||
AND project.workspace_id IN
|
||||
<foreach collection="workspaceIds" item="id" separator="," open="(" close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
</if>
|
||||
</select>
|
||||
</mapper>
|
|
@ -16,4 +16,5 @@ public class ReportRequest {
|
|||
private List<OrderRequest> orders;
|
||||
private Map<String, List<String>> filters;
|
||||
private Map<String, Object> combine;
|
||||
private String projectId;
|
||||
}
|
||||
|
|
|
@ -79,6 +79,7 @@ public class PerformanceTestService {
|
|||
|
||||
public List<LoadTestDTO> list(QueryTestPlanRequest request) {
|
||||
request.setOrders(ServiceUtils.getDefaultOrder(request.getOrders()));
|
||||
request.setProjectId(SessionUtils.getCurrentProjectId());
|
||||
return extLoadTestMapper.list(request);
|
||||
}
|
||||
|
||||
|
@ -320,6 +321,7 @@ public class PerformanceTestService {
|
|||
orderRequest.setType("desc");
|
||||
orders.add(orderRequest);
|
||||
request.setOrders(orders);
|
||||
request.setProjectId(SessionUtils.getCurrentProjectId());
|
||||
return extLoadTestMapper.list(request);
|
||||
}
|
||||
|
||||
|
@ -462,7 +464,11 @@ public class PerformanceTestService {
|
|||
.collect(Collectors.toList());
|
||||
if (!resourceIds.isEmpty()) {
|
||||
LoadTestExample example = new LoadTestExample();
|
||||
example.createCriteria().andIdIn(resourceIds);
|
||||
LoadTestExample.Criteria criteria = example.createCriteria();
|
||||
if (StringUtils.isNotBlank(SessionUtils.getCurrentProjectId())) {
|
||||
criteria.andProjectIdEqualTo(SessionUtils.getCurrentProjectId());
|
||||
}
|
||||
criteria.andIdIn(resourceIds);
|
||||
List<LoadTest> loadTests = loadTestMapper.selectByExample(example);
|
||||
Map<String, String> loadTestMap = loadTests.stream().collect(Collectors.toMap(LoadTest::getId, LoadTest::getName));
|
||||
scheduleService.build(loadTestMap, schedules);
|
||||
|
|
|
@ -10,6 +10,7 @@ import io.metersphere.commons.constants.ReportKeys;
|
|||
import io.metersphere.commons.exception.MSException;
|
||||
import io.metersphere.commons.utils.LogUtil;
|
||||
import io.metersphere.commons.utils.ServiceUtils;
|
||||
import io.metersphere.commons.utils.SessionUtils;
|
||||
import io.metersphere.controller.request.OrderRequest;
|
||||
import io.metersphere.dto.LogDetailDTO;
|
||||
import io.metersphere.dto.ReportDTO;
|
||||
|
@ -59,11 +60,13 @@ public class ReportService {
|
|||
orderRequest.setType("desc");
|
||||
orders.add(orderRequest);
|
||||
request.setOrders(orders);
|
||||
request.setProjectId(SessionUtils.getCurrentProjectId());
|
||||
return extLoadTestReportMapper.getReportList(request);
|
||||
}
|
||||
|
||||
public List<ReportDTO> getReportList(ReportRequest request) {
|
||||
request.setOrders(ServiceUtils.getDefaultOrder(request.getOrders()));
|
||||
request.setProjectId(SessionUtils.getCurrentProjectId());
|
||||
return extLoadTestReportMapper.getReportList(request);
|
||||
}
|
||||
|
||||
|
|
|
@ -1,22 +1,21 @@
|
|||
package io.metersphere.service;
|
||||
|
||||
import io.metersphere.api.dto.APITestResult;
|
||||
import io.metersphere.api.dto.QueryAPITestRequest;
|
||||
import io.metersphere.base.domain.Project;
|
||||
import io.metersphere.base.domain.UserRole;
|
||||
import io.metersphere.base.mapper.ProjectMapper;
|
||||
import io.metersphere.base.mapper.ext.*;
|
||||
import io.metersphere.commons.constants.RoleConstants;
|
||||
import io.metersphere.commons.utils.SessionUtils;
|
||||
import io.metersphere.dto.LoadTestDTO;
|
||||
import io.metersphere.i18n.Translator;
|
||||
import io.metersphere.track.dto.TestPlanDTOWithMetric;
|
||||
import io.metersphere.track.request.testplan.QueryTestPlanRequest;
|
||||
import org.apache.commons.collections.CollectionUtils;
|
||||
import org.apache.commons.collections4.CollectionUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.shiro.authz.UnauthorizedException;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
import java.util.Set;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@Service
|
||||
public class CheckOwnerService {
|
||||
|
@ -34,28 +33,40 @@ public class CheckOwnerService {
|
|||
private ExtTestCaseReviewMapper extTestCaseReviewMapper;
|
||||
|
||||
public void checkProjectOwner(String projectId) {
|
||||
String workspaceId = SessionUtils.getCurrentWorkspaceId();
|
||||
Set<String> workspaceIds = getUserRelatedWorkspaceIds();
|
||||
Project project = projectMapper.selectByPrimaryKey(projectId);
|
||||
if (project == null) {
|
||||
return;
|
||||
}
|
||||
if (!StringUtils.equals(workspaceId, project.getWorkspaceId())) {
|
||||
if (CollectionUtils.isEmpty(workspaceIds)) {
|
||||
return;
|
||||
}
|
||||
if (!workspaceIds.contains(project.getWorkspaceId())) {
|
||||
throw new UnauthorizedException(Translator.get("check_owner_project"));
|
||||
}
|
||||
}
|
||||
|
||||
private Set<String> getUserRelatedWorkspaceIds() {
|
||||
return Objects.requireNonNull(SessionUtils.getUser()).getUserRoles().stream()
|
||||
.filter(ur ->
|
||||
StringUtils.equalsAny(ur.getRoleId(), RoleConstants.TEST_MANAGER, RoleConstants.TEST_USER, RoleConstants.TEST_VIEWER))
|
||||
.map(UserRole::getSourceId)
|
||||
.collect(Collectors.toSet());
|
||||
}
|
||||
|
||||
public void checkApiTestOwner(String testId) {
|
||||
// 关联为其他时
|
||||
if (StringUtils.equals("other", testId)) {
|
||||
return;
|
||||
}
|
||||
String workspaceId = SessionUtils.getCurrentWorkspaceId();
|
||||
QueryAPITestRequest request = new QueryAPITestRequest();
|
||||
request.setWorkspaceId(workspaceId);
|
||||
request.setId(testId);
|
||||
List<APITestResult> apiTestResults = extApiTestMapper.list(request);
|
||||
Set<String> workspaceIds = getUserRelatedWorkspaceIds();
|
||||
if (CollectionUtils.isEmpty(workspaceIds)) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (CollectionUtils.size(apiTestResults) != 1) {
|
||||
int result = extApiTestMapper.checkApiTestOwner(testId, workspaceIds);
|
||||
|
||||
if (result == 0) {
|
||||
throw new UnauthorizedException(Translator.get("check_owner_test"));
|
||||
}
|
||||
}
|
||||
|
@ -65,40 +76,47 @@ public class CheckOwnerService {
|
|||
if (StringUtils.equals("other", testId)) {
|
||||
return;
|
||||
}
|
||||
String workspaceId = SessionUtils.getCurrentWorkspaceId();
|
||||
QueryTestPlanRequest request = new QueryTestPlanRequest();
|
||||
request.setWorkspaceId(workspaceId);
|
||||
request.setId(testId);
|
||||
List<LoadTestDTO> loadTestDTOS = extLoadTestMapper.list(request);
|
||||
Set<String> workspaceIds = getUserRelatedWorkspaceIds();
|
||||
if (CollectionUtils.isEmpty(workspaceIds)) {
|
||||
return;
|
||||
}
|
||||
int result = extLoadTestMapper.checkLoadTestOwner(testId, workspaceIds);
|
||||
|
||||
if (CollectionUtils.size(loadTestDTOS) != 1) {
|
||||
if (result == 0) {
|
||||
throw new UnauthorizedException(Translator.get("check_owner_test"));
|
||||
}
|
||||
}
|
||||
|
||||
public void checkTestCaseOwner(String caseId) {
|
||||
String workspaceId = SessionUtils.getCurrentWorkspaceId();
|
||||
List<String> list = extTestCaseMapper.checkIsHave(caseId, workspaceId);
|
||||
if (CollectionUtils.size(list) != 1) {
|
||||
Set<String> workspaceIds = getUserRelatedWorkspaceIds();
|
||||
if (CollectionUtils.isEmpty(workspaceIds)) {
|
||||
return;
|
||||
}
|
||||
|
||||
int result = extTestCaseMapper.checkIsHave(caseId, workspaceIds);
|
||||
if (result == 0) {
|
||||
throw new UnauthorizedException(Translator.get("check_owner_case"));
|
||||
}
|
||||
}
|
||||
|
||||
public void checkTestPlanOwner(String planId) {
|
||||
String workspaceId = SessionUtils.getCurrentWorkspaceId();
|
||||
io.metersphere.track.request.testcase.QueryTestPlanRequest request = new io.metersphere.track.request.testcase.QueryTestPlanRequest();
|
||||
request.setWorkspaceId(workspaceId);
|
||||
request.setId(planId);
|
||||
List<TestPlanDTOWithMetric> list = extTestPlanMapper.list(request);
|
||||
if (CollectionUtils.size(list) != 1) {
|
||||
Set<String> workspaceIds = getUserRelatedWorkspaceIds();
|
||||
if (CollectionUtils.isEmpty(workspaceIds)) {
|
||||
return;
|
||||
}
|
||||
int result = extTestPlanMapper.checkIsHave(planId, workspaceIds);
|
||||
if (result == 0) {
|
||||
throw new UnauthorizedException(Translator.get("check_owner_plan"));
|
||||
}
|
||||
}
|
||||
|
||||
public void checkTestReviewOwner(String reviewId) {
|
||||
String workspaceId = SessionUtils.getCurrentWorkspaceId();
|
||||
List<String> list = extTestCaseReviewMapper.checkIsHave(reviewId, workspaceId);
|
||||
if (CollectionUtils.size(list) != 1) {
|
||||
Set<String> workspaceIds = getUserRelatedWorkspaceIds();
|
||||
if (CollectionUtils.isEmpty(workspaceIds)) {
|
||||
return;
|
||||
}
|
||||
int result = extTestCaseReviewMapper.checkIsHave(reviewId, workspaceIds);
|
||||
if (result == 0) {
|
||||
throw new UnauthorizedException(Translator.get("check_owner_review"));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1 +1 @@
|
|||
Subproject commit bb494fc68a2367359c9048fa7250c7618de4afb6
|
||||
Subproject commit 905ca8af61ce966d26109e9c5c8c0aee3ca1324e
|
|
@ -26,7 +26,8 @@
|
|||
<i class="icon el-icon-arrow-right" :class="{'is-active': request.active}"
|
||||
@click="active(request)" v-if="request.referenced!=undefined && request.referenced!='Deleted' && request.referenced!='REF'"/>
|
||||
<el-switch v-model="request.enable" style="margin-left: 10px"/>
|
||||
<el-button size="mini" icon="el-icon-delete" circle @click="remove" style="margin-left: 10px"/>
|
||||
<el-button size="mini" icon="el-icon-copy-document" circle @click="copyRow" style="margin-left: 10px"/>
|
||||
<el-button size="mini" icon="el-icon-delete" type="danger" circle @click="remove" style="margin-left: 10px"/>
|
||||
</div>
|
||||
</el-row>
|
||||
<!-- 请求参数-->
|
||||
|
@ -101,6 +102,9 @@
|
|||
remove() {
|
||||
this.$emit('remove', this.request, this.node);
|
||||
},
|
||||
copyRow() {
|
||||
this.$emit('copyRow', this.request, this.node);
|
||||
},
|
||||
active(item) {
|
||||
item.active = !item.active;
|
||||
this.reload();
|
||||
|
|
|
@ -11,7 +11,8 @@
|
|||
<el-tag size="mini" style="margin-left: 20px" v-if="scenario.referenced==='REF'">{{ $t('api_test.scenario.reference') }}</el-tag>
|
||||
<div style="margin-right: 20px; float: right">
|
||||
<el-switch v-model="scenario.enable" style="margin-left: 10px"/>
|
||||
<el-button size="mini" icon="el-icon-delete" circle @click="remove" style="margin-left: 10px"/>
|
||||
<el-button size="mini" icon="el-icon-copy-document" circle @click="copyRow" style="margin-left: 10px"/>
|
||||
<el-button size="mini" icon="el-icon-delete" type="danger" circle @click="remove" style="margin-left: 10px"/>
|
||||
</div>
|
||||
</el-row>
|
||||
</el-card>
|
||||
|
@ -55,6 +56,9 @@
|
|||
item.active = !item.active;
|
||||
this.reload();
|
||||
},
|
||||
copyRow() {
|
||||
this.$emit('copyRow', this.scenario, this.node);
|
||||
},
|
||||
reload() {
|
||||
this.loading = true
|
||||
this.$nextTick(() => {
|
||||
|
|
|
@ -10,7 +10,8 @@
|
|||
ms
|
||||
<div style="margin-right: 20px; float: right">
|
||||
<el-switch v-model="timer.enable" style="margin-left: 10px"/>
|
||||
<el-button size="mini" icon="el-icon-delete" circle @click="remove" style="margin-left: 10px;"/>
|
||||
<el-button size="mini" icon="el-icon-copy-document" circle @click="copyRow" style="margin-left: 10px"/>
|
||||
<el-button size="mini" icon="el-icon-delete" type="danger" circle @click="remove" style="margin-left: 10px"/>
|
||||
</div>
|
||||
</el-row>
|
||||
</el-card>
|
||||
|
@ -30,7 +31,10 @@
|
|||
methods: {
|
||||
remove() {
|
||||
this.$emit('remove', this.timer, this.node);
|
||||
}
|
||||
},
|
||||
copyRow() {
|
||||
this.$emit('copyRow', this.timer, this.node);
|
||||
},
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
|
|
@ -79,8 +79,7 @@
|
|||
<el-row>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="Tag" prop="tagId">
|
||||
<el-select v-model="currentScenario.tagId" size="small" class="ms-scenario-input" placeholder="Tag"
|
||||
@change="tagChange" :multiple="true">
|
||||
<el-select v-model="currentScenario.tagId" size="small" class="ms-scenario-input" placeholder="Tag" :multiple="true">
|
||||
<el-option
|
||||
v-for="item in tags"
|
||||
:key="item.id"
|
||||
|
@ -168,26 +167,26 @@
|
|||
<span class="custom-tree-node father" slot-scope="{ node, data}" style="width: 96%">
|
||||
<template>
|
||||
<!-- 场景 -->
|
||||
<ms-api-scenario-component v-if="data.type==='scenario'" :scenario="data" :node="node" @remove="remove"/>
|
||||
<ms-api-scenario-component v-if="data.type==='scenario'" :scenario="data" :node="node" @remove="remove" @copyRow="copyRow"/>
|
||||
<!--条件控制器-->
|
||||
<ms-if-controller :controller="data" :node="node" v-if="data.type==='IfController'" @remove="remove"/>
|
||||
<ms-if-controller :controller="data" :node="node" v-if="data.type==='IfController'" @remove="remove" @copyRow="copyRow"/>
|
||||
<!--等待控制器-->
|
||||
<ms-constant-timer :timer="data" :node="node" v-if="data.type==='ConstantTimer'" @remove="remove"/>
|
||||
<ms-constant-timer :timer="data" :node="node" v-if="data.type==='ConstantTimer'" @remove="remove" @copyRow="copyRow"/>
|
||||
<!--自定义脚本-->
|
||||
<ms-jsr233-processor v-if="data.type==='JSR223Processor'" @remove="remove" :title="$t('api_test.automation.customize_script')"
|
||||
<ms-jsr233-processor v-if="data.type==='JSR223Processor'" @remove="remove" @copyRow="copyRow" :title="$t('api_test.automation.customize_script')"
|
||||
style-type="color: #7B4D12;background-color: #F1EEE9" :jsr223-processor="data" :node="node"/>
|
||||
<!--前置脚本-->
|
||||
<ms-jsr233-processor v-if="data.type==='JSR223PreProcessor'" @remove="remove" :title="$t('api_test.definition.request.pre_script')"
|
||||
<ms-jsr233-processor v-if="data.type==='JSR223PreProcessor'" @remove="remove" @copyRow="copyRow" :title="$t('api_test.definition.request.pre_script')"
|
||||
style-type="color: #B8741A;background-color: #F9F1EA" :jsr223-processor="data" :node="node"/>
|
||||
<!--后置脚本-->
|
||||
<ms-jsr233-processor v-if="data.type==='JSR223PostProcessor'" @remove="remove" :title="$t('api_test.definition.request.post_script')"
|
||||
<ms-jsr233-processor v-if="data.type==='JSR223PostProcessor'" @remove="remove" @copyRow="copyRow" :title="$t('api_test.definition.request.post_script')"
|
||||
style-type="color: #783887;background-color: #F2ECF3" :jsr223-processor="data" :node="node"/>
|
||||
<!--断言规则-->
|
||||
<ms-api-assertions v-if="data.type==='Assertions'" @remove="remove" customizeStyle="margin-top: 0px" :assertions="data" :node="node"/>
|
||||
<ms-api-assertions v-if="data.type==='Assertions'" @remove="remove" @copyRow="copyRow" customizeStyle="margin-top: 0px" :assertions="data" :node="node"/>
|
||||
<!--提取规则-->
|
||||
<ms-api-extract @remove="remove" v-if="data.type==='Extract'" customizeStyle="margin-top: 0px" :extract="data" :node="node"/>
|
||||
<ms-api-extract @remove="remove" @copyRow="copyRow" v-if="data.type==='Extract'" customizeStyle="margin-top: 0px" :extract="data" :node="node"/>
|
||||
<!--API 导入 -->
|
||||
<ms-api-component :request="data" @remove="remove" v-if="data.type==='HTTPSamplerProxy'||data.type==='DubboSampler'||data.type==='JDBCSampler'||data.type==='TCPSampler'" :node="node"/>
|
||||
<ms-api-component :request="data" @remove="remove" @copyRow="copyRow" v-if="data.type==='HTTPSamplerProxy'||data.type==='DubboSampler'||data.type==='JDBCSampler'||data.type==='TCPSampler'" :node="node"/>
|
||||
</template>
|
||||
</span>
|
||||
</el-tree>
|
||||
|
@ -513,9 +512,6 @@
|
|||
this.$post('/user/ws/member/tester/list', {workspaceId: workspaceId}, response => {
|
||||
this.maintainerOptions = response.data;
|
||||
});
|
||||
},
|
||||
tagChange() {
|
||||
|
||||
},
|
||||
openTagConfig() {
|
||||
if (!this.projectId) {
|
||||
|
@ -546,6 +542,16 @@
|
|||
this.sort();
|
||||
this.reload();
|
||||
},
|
||||
copyRow(row, node) {
|
||||
const parent = node.parent
|
||||
const hashTree = parent.data.hashTree || parent.data;
|
||||
let obj = {};
|
||||
Object.assign(obj, row);
|
||||
obj.resourceId = getUUID();
|
||||
hashTree.push(obj);
|
||||
this.sort();
|
||||
this.reload();
|
||||
},
|
||||
reload() {
|
||||
this.isReloadData = true
|
||||
this.$nextTick(() => {
|
||||
|
|
|
@ -16,7 +16,8 @@
|
|||
<el-input size="small" v-model="controller.value" :placeholder="$t('api_test.value')" v-if="!hasEmptyOperator" style="width: 20%;margin-left: 20px"/>
|
||||
<div style="margin-right: 20px; float: right">
|
||||
<el-switch v-model="controller.enable" style="margin-left: 10px"/>
|
||||
<el-button size="mini" icon="el-icon-delete" circle @click="remove" style="margin-left: 10px;"/>
|
||||
<el-button size="mini" icon="el-icon-copy-document" circle @click="copyRow" style="margin-left: 10px"/>
|
||||
<el-button size="mini" icon="el-icon-delete" type="danger" circle @click="remove" style="margin-left: 10px"/>
|
||||
</div>
|
||||
</el-row>
|
||||
</el-card>
|
||||
|
@ -72,6 +73,9 @@
|
|||
remove() {
|
||||
this.$emit('remove', this.controller, this.node);
|
||||
},
|
||||
copyRow() {
|
||||
this.$emit('copyRow', this.controller, this.node);
|
||||
},
|
||||
change(value) {
|
||||
if (value.indexOf("empty") > 0 && !!this.controller.value) {
|
||||
this.controller.value = "";
|
||||
|
|
|
@ -10,7 +10,8 @@
|
|||
<div style="margin-right: 20px; float: right">
|
||||
<i class="icon el-icon-arrow-right" :class="{'is-active': this.jsr223ProcessorData.active}" @click="changeActive" style="margin-left: 20px"/>
|
||||
<el-switch v-model="jsr223ProcessorData.enable" style="margin-left: 10px"/>
|
||||
<el-button size="mini" icon="el-icon-delete" circle @click="remove" style="margin-left: 10px;"/>
|
||||
<el-button size="mini" icon="el-icon-copy-document" circle @click="copyRow" style="margin-left: 10px"/>
|
||||
<el-button size="mini" icon="el-icon-delete" type="danger" circle @click="remove" style="margin-left: 10px"/>
|
||||
</div>
|
||||
</div>
|
||||
</el-row>
|
||||
|
@ -142,6 +143,9 @@
|
|||
remove() {
|
||||
this.$emit('remove', this.jsr223ProcessorData, this.node);
|
||||
},
|
||||
copyRow() {
|
||||
this.$emit('copyRow', this.jsr223ProcessorData, this.node);
|
||||
},
|
||||
reload() {
|
||||
this.isCodeEditAlive = false;
|
||||
this.$nextTick(() => (this.isCodeEditAlive = true));
|
||||
|
|
|
@ -357,16 +357,18 @@
|
|||
this.apiCaseList.unshift(obj);
|
||||
},
|
||||
addCase() {
|
||||
// 初始化对象
|
||||
let request = {};
|
||||
if (this.api.request instanceof Object) {
|
||||
request = this.api.request;
|
||||
} else {
|
||||
request = JSON.parse(this.api.request);
|
||||
if (this.api.request) {
|
||||
// 初始化对象
|
||||
let request = {};
|
||||
if (this.api.request instanceof Object) {
|
||||
request = this.api.request;
|
||||
} else {
|
||||
request = JSON.parse(this.api.request);
|
||||
}
|
||||
let obj = {apiDefinitionId: this.api.id, name: '', priority: 'P0', type: 'create', active: false};
|
||||
obj.request = request;
|
||||
this.apiCaseList.unshift(obj);
|
||||
}
|
||||
let obj = {apiDefinitionId: this.api.id, name: '', priority: 'P0', type: 'create', active: false};
|
||||
obj.request = request;
|
||||
this.apiCaseList.unshift(obj);
|
||||
},
|
||||
|
||||
active(item) {
|
||||
|
|
|
@ -11,7 +11,8 @@
|
|||
<div style="margin-right: 20px; float: right">
|
||||
<i class="icon el-icon-arrow-right" :class="{'is-active': assertions.active}" @click="active(assertions)" style="margin-left: 20px"/>
|
||||
<el-switch v-model="assertions.enable" style="margin-left: 10px"/>
|
||||
<el-button size="mini" icon="el-icon-delete" circle @click="remove" style="margin-left: 10px;"/>
|
||||
<el-button size="mini" icon="el-icon-copy-document" circle @click="copyRow" style="margin-left: 10px"/>
|
||||
<el-button size="mini" icon="el-icon-delete" type="danger" circle @click="remove" style="margin-left: 10px"/>
|
||||
</div>
|
||||
</div>
|
||||
<!-- 请求参数-->
|
||||
|
@ -109,6 +110,9 @@
|
|||
this.reloadData = getUUID().substring(0, 8);
|
||||
this.reload();
|
||||
},
|
||||
copyRow() {
|
||||
this.$emit('copyRow', this.assertions, this.node);
|
||||
},
|
||||
suggestJsonOpen() {
|
||||
if (!this.request.debugRequestResult) {
|
||||
this.$message(this.$t('api_test.request.assertions.debug_first'));
|
||||
|
|
|
@ -9,7 +9,8 @@
|
|||
<div style="margin-right: 20px; float: right">
|
||||
<i class="icon el-icon-arrow-right" :class="{'is-active': extract.active}" @click="active(extract)" style="margin-left: 20px"/>
|
||||
<el-switch v-model="extract.enable" style="margin-left: 10px"/>
|
||||
<el-button size="mini" icon="el-icon-delete" circle @click="remove" style="margin-left: 10px;"/>
|
||||
<el-button size="mini" icon="el-icon-copy-document" circle @click="copyRow" style="margin-left: 10px"/>
|
||||
<el-button size="mini" icon="el-icon-delete" type="danger" circle @click="remove" style="margin-left: 10px"/>
|
||||
</div>
|
||||
<!-- 请求参数-->
|
||||
<el-collapse-transition>
|
||||
|
@ -87,6 +88,9 @@
|
|||
remove() {
|
||||
this.$emit('remove', this.extract, this.node);
|
||||
},
|
||||
copyRow() {
|
||||
this.$emit('copyRow', this.extract, this.node);
|
||||
},
|
||||
reload() {
|
||||
this.loading = true
|
||||
this.$nextTick(() => {
|
||||
|
|
|
@ -9,7 +9,8 @@
|
|||
<div style="margin-right: 20px; float: right">
|
||||
<i class="icon el-icon-arrow-right" :class="{'is-active': active}" @click="changeActive"/>
|
||||
<el-switch v-model="jsr223ProcessorData.enable" style="margin-left: 10px"/>
|
||||
<el-button size="mini" icon="el-icon-delete" circle @click="remove" style="margin-left: 10px;"/>
|
||||
<el-button size="mini" icon="el-icon-copy-document" circle @click="copyRow" style="margin-left: 10px"/>
|
||||
<el-button size="mini" icon="el-icon-delete" type="danger" circle @click="remove" style="margin-left: 10px"/>
|
||||
</div>
|
||||
</div>
|
||||
</el-row>
|
||||
|
@ -147,6 +148,9 @@
|
|||
remove() {
|
||||
this.$emit('remove', this.jsr223ProcessorData);
|
||||
},
|
||||
copyRow() {
|
||||
this.$emit('copyRow', this.jsr223ProcessorData);
|
||||
},
|
||||
reload() {
|
||||
this.isCodeEditAlive = false;
|
||||
this.$nextTick(() => (this.isCodeEditAlive = true));
|
||||
|
|
|
@ -65,15 +65,15 @@
|
|||
</div>
|
||||
<div v-for="row in request.hashTree" :key="row.id" v-loading="isReloadData" style="margin-left: 20px;width: 100%">
|
||||
<!-- 前置脚本 -->
|
||||
<ms-jsr233-processor v-if="row.label ==='JSR223 PreProcessor'" @remove="remove" :is-read-only="false" :title="$t('api_test.definition.request.pre_script')" style-type="color: #B8741A;background-color: #F9F1EA"
|
||||
<ms-jsr233-processor v-if="row.label ==='JSR223 PreProcessor'" @copyRow="copyRow" @remove="remove" :is-read-only="false" :title="$t('api_test.definition.request.pre_script')" style-type="color: #B8741A;background-color: #F9F1EA"
|
||||
:jsr223-processor="row"/>
|
||||
<!--后置脚本-->
|
||||
<ms-jsr233-processor v-if="row.label ==='JSR223 PostProcessor'" @remove="remove" :is-read-only="false" :title="$t('api_test.definition.request.post_script')" style-type="color: #783887;background-color: #F2ECF3"
|
||||
<ms-jsr233-processor v-if="row.label ==='JSR223 PostProcessor'" @copyRow="copyRow" @remove="remove" :is-read-only="false" :title="$t('api_test.definition.request.post_script')" style-type="color: #783887;background-color: #F2ECF3"
|
||||
:jsr223-processor="row"/>
|
||||
<!--断言规则-->
|
||||
<ms-api-assertions v-if="row.type==='Assertions'" @remove="remove" :is-read-only="isReadOnly" :assertions="row"/>
|
||||
<ms-api-assertions v-if="row.type==='Assertions'" @copyRow="copyRow" @remove="remove" :is-read-only="isReadOnly" :assertions="row"/>
|
||||
<!--提取规则-->
|
||||
<ms-api-extract :is-read-only="isReadOnly" @remove="remove" v-if="row.type==='Extract'" :extract="row"/>
|
||||
<ms-api-extract :is-read-only="isReadOnly" @copyRow="copyRow" @remove="remove" v-if="row.type==='Extract'" :extract="row"/>
|
||||
|
||||
</div>
|
||||
</el-col>
|
||||
|
@ -107,6 +107,7 @@
|
|||
import {parseEnvironment} from "../../../model/EnvironmentModel";
|
||||
import ApiEnvironmentConfig from "../../environment/ApiEnvironmentConfig";
|
||||
import {getCurrentProjectID} from "@/common/js/utils";
|
||||
import {getUUID} from "@/common/js/utils";
|
||||
|
||||
export default {
|
||||
name: "MsDatabaseConfig",
|
||||
|
@ -165,6 +166,13 @@
|
|||
this.request.hashTree.splice(index, 1);
|
||||
this.reload();
|
||||
},
|
||||
copyRow(row) {
|
||||
let obj = {};
|
||||
Object.assign(obj, row);
|
||||
obj.id = getUUID();
|
||||
this.request.hashTree.push(obj);
|
||||
this.reload();
|
||||
},
|
||||
reload() {
|
||||
this.isReloadData = true
|
||||
this.$nextTick(() => {
|
||||
|
|
|
@ -44,15 +44,15 @@
|
|||
|
||||
<div v-for="row in request.hashTree" :key="row.id" v-loading="isReloadData" style="margin-left: 20px;width: 100%">
|
||||
<!-- 前置脚本 -->
|
||||
<ms-jsr233-processor v-if="row.label ==='JSR223 PreProcessor'" @remove="remove" :is-read-only="false" :title="$t('api_test.definition.request.pre_script')" style-type="color: #B8741A;background-color: #F9F1EA"
|
||||
<ms-jsr233-processor v-if="row.label ==='JSR223 PreProcessor'" @copyRow="copyRow" @remove="remove" :is-read-only="false" :title="$t('api_test.definition.request.pre_script')" style-type="color: #B8741A;background-color: #F9F1EA"
|
||||
:jsr223-processor="row"/>
|
||||
<!--后置脚本-->
|
||||
<ms-jsr233-processor v-if="row.label ==='JSR223 PostProcessor'" @remove="remove" :is-read-only="false" :title="$t('api_test.definition.request.post_script')" style-type="color: #783887;background-color: #F2ECF3"
|
||||
<ms-jsr233-processor v-if="row.label ==='JSR223 PostProcessor'" @copyRow="copyRow" @remove="remove" :is-read-only="false" :title="$t('api_test.definition.request.post_script')" style-type="color: #783887;background-color: #F2ECF3"
|
||||
:jsr223-processor="row"/>
|
||||
<!--断言规则-->
|
||||
<ms-api-assertions v-if="row.type==='Assertions'" @remove="remove" :is-read-only="isReadOnly" :assertions="row"/>
|
||||
<ms-api-assertions v-if="row.type==='Assertions'" @copyRow="copyRow" @remove="remove" :is-read-only="isReadOnly" :assertions="row"/>
|
||||
<!--提取规则-->
|
||||
<ms-api-extract :is-read-only="isReadOnly" @remove="remove" v-if="row.type==='Extract'" :extract="row"/>
|
||||
<ms-api-extract :is-read-only="isReadOnly" @copyRow="copyRow" @remove="remove" v-if="row.type==='Extract'" :extract="row"/>
|
||||
|
||||
</div>
|
||||
</el-col>
|
||||
|
@ -81,11 +81,11 @@
|
|||
import MsApiScenarioVariables from "../../ApiScenarioVariables";
|
||||
import {createComponent} from "../../jmeter/components";
|
||||
import {Assertions, Extract, DubboRequest} from "../../../model/ApiTestModel";
|
||||
import {parseEnvironment} from "../../../model/EnvironmentModel";
|
||||
import MsDubboInterface from "../../request/dubbo/Interface";
|
||||
import MsDubboRegistryCenter from "../../request/dubbo/RegistryCenter";
|
||||
import MsDubboConfigCenter from "../../request/dubbo/ConfigCenter";
|
||||
import MsDubboConsumerService from "../../request/dubbo/ConsumerAndService";
|
||||
import {getUUID} from "@/common/js/utils";
|
||||
|
||||
export default {
|
||||
name: "MsDatabaseConfig",
|
||||
|
@ -140,6 +140,13 @@
|
|||
this.request.hashTree.splice(index, 1);
|
||||
this.reload();
|
||||
},
|
||||
copyRow(row) {
|
||||
let obj = {};
|
||||
Object.assign(obj, row);
|
||||
obj.id = getUUID();
|
||||
this.request.hashTree.push(obj);
|
||||
this.reload();
|
||||
},
|
||||
reload() {
|
||||
this.isReloadData = true
|
||||
this.$nextTick(() => {
|
||||
|
|
|
@ -30,7 +30,7 @@
|
|||
</el-tab-pane>
|
||||
|
||||
<!--REST 参数-->
|
||||
<el-tab-pane :label="$t('api_test.definition.request.rest_param')" name="rest" >
|
||||
<el-tab-pane :label="$t('api_test.definition.request.rest_param')" name="rest">
|
||||
<el-tooltip class="item-tabs" effect="dark" :content="$t('api_test.definition.request.rest_info')" placement="top-start" slot="label">
|
||||
<span>
|
||||
{{$t('api_test.definition.request.rest_param')}}
|
||||
|
@ -61,15 +61,15 @@
|
|||
|
||||
<div v-for="row in request.hashTree" :key="row.id" v-loading="isReloadData">
|
||||
<!-- 前置脚本 -->
|
||||
<ms-jsr233-processor v-if="row.label ==='JSR223 PreProcessor'" @remove="remove" :is-read-only="false" :title="$t('api_test.definition.request.pre_script')" style-type="color: #B8741A;background-color: #F9F1EA"
|
||||
<ms-jsr233-processor v-if="row.label ==='JSR223 PreProcessor'" @copyRow="copyRow" @remove="remove" :is-read-only="false" :title="$t('api_test.definition.request.pre_script')" style-type="color: #B8741A;background-color: #F9F1EA"
|
||||
:jsr223-processor="row"/>
|
||||
<!--后置脚本-->
|
||||
<ms-jsr233-processor v-if="row.label ==='JSR223 PostProcessor'" @remove="remove" :is-read-only="false" :title="$t('api_test.definition.request.post_script')" style-type="color: #783887;background-color: #F2ECF3"
|
||||
<ms-jsr233-processor v-if="row.label ==='JSR223 PostProcessor'" @copyRow="copyRow" @remove="remove" :is-read-only="false" :title="$t('api_test.definition.request.post_script')" style-type="color: #783887;background-color: #F2ECF3"
|
||||
:jsr223-processor="row"/>
|
||||
<!--断言规则-->
|
||||
<ms-api-assertions v-if="row.type==='Assertions'" @remove="remove" :is-read-only="isReadOnly" :assertions="row"/>
|
||||
<ms-api-assertions v-if="row.type==='Assertions'" @copyRow="copyRow" @remove="remove" :is-read-only="isReadOnly" :assertions="row"/>
|
||||
<!--提取规则-->
|
||||
<ms-api-extract :is-read-only="isReadOnly" @remove="remove" v-if="row.type==='Extract'" :extract="row"/>
|
||||
<ms-api-extract :is-read-only="isReadOnly" @copyRow="copyRow" @remove="remove" v-if="row.type==='Extract'" :extract="row"/>
|
||||
|
||||
</div>
|
||||
</el-col>
|
||||
|
@ -99,6 +99,7 @@
|
|||
import MsApiAssertions from "../../assertion/ApiAssertions";
|
||||
import MsApiExtract from "../../extract/ApiExtract";
|
||||
import {Assertions, Body, Extract} from "../../../model/ApiTestModel";
|
||||
import {getUUID} from "@/common/js/utils";
|
||||
|
||||
export default {
|
||||
name: "MsApiHttpRequestForm",
|
||||
|
@ -180,6 +181,13 @@
|
|||
this.request.hashTree.splice(index, 1);
|
||||
this.reload();
|
||||
},
|
||||
copyRow(row) {
|
||||
let obj = {};
|
||||
Object.assign(obj, row);
|
||||
row.id = getUUID();
|
||||
this.request.hashTree.push(obj);
|
||||
this.reload();
|
||||
},
|
||||
reload() {
|
||||
this.isReloadData = true
|
||||
this.$nextTick(() => {
|
||||
|
|
|
@ -92,15 +92,15 @@
|
|||
</div>
|
||||
<div v-for="row in request.hashTree" :key="row.id" v-loading="isReloadData" style="margin-left: 20px;width: 100%">
|
||||
<!-- 前置脚本 -->
|
||||
<ms-jsr233-processor v-if="row.label ==='JSR223 PreProcessor'" @remove="remove" :is-read-only="false" :title="$t('api_test.definition.request.pre_script')" style-type="color: #B8741A;background-color: #F9F1EA"
|
||||
<ms-jsr233-processor v-if="row.label ==='JSR223 PreProcessor'" @copyRow="copyRow" @remove="remove" :is-read-only="false" :title="$t('api_test.definition.request.pre_script')" style-type="color: #B8741A;background-color: #F9F1EA"
|
||||
:jsr223-processor="row"/>
|
||||
<!--后置脚本-->
|
||||
<ms-jsr233-processor v-if="row.label ==='JSR223 PostProcessor'" @remove="remove" :is-read-only="false" :title="$t('api_test.definition.request.post_script')" style-type="color: #783887;background-color: #F2ECF3"
|
||||
<ms-jsr233-processor v-if="row.label ==='JSR223 PostProcessor'" @copyRow="copyRow" @remove="remove" :is-read-only="false" :title="$t('api_test.definition.request.post_script')" style-type="color: #783887;background-color: #F2ECF3"
|
||||
:jsr223-processor="row"/>
|
||||
<!--断言规则-->
|
||||
<ms-api-assertions v-if="row.type==='Assertions'" @remove="remove" :is-read-only="isReadOnly" :assertions="row"/>
|
||||
<ms-api-assertions v-if="row.type==='Assertions'" @copyRow="copyRow" @remove="remove" :is-read-only="isReadOnly" :assertions="row"/>
|
||||
<!--提取规则-->
|
||||
<ms-api-extract :is-read-only="isReadOnly" @remove="remove" v-if="row.type==='Extract'" :extract="row"/>
|
||||
<ms-api-extract :is-read-only="isReadOnly" @copyRow="copyRow" @remove="remove" v-if="row.type==='Extract'" :extract="row"/>
|
||||
|
||||
</div>
|
||||
</el-col>
|
||||
|
@ -132,7 +132,7 @@
|
|||
import ApiEnvironmentConfig from "../../environment/ApiEnvironmentConfig";
|
||||
import {API_STATUS} from "../../../model/JsonData";
|
||||
import TCPSampler from "../../jmeter/components/sampler/tcp-sampler";
|
||||
import {getCurrentProjectID} from "@/common/js/utils";
|
||||
import {getCurrentProjectID, getUUID} from "@/common/js/utils";
|
||||
|
||||
export default {
|
||||
name: "MsDatabaseConfig",
|
||||
|
@ -194,6 +194,13 @@
|
|||
this.request.hashTree.splice(index, 1);
|
||||
this.reload();
|
||||
},
|
||||
copyRow(row) {
|
||||
let obj = {};
|
||||
Object.assign(obj, row);
|
||||
obj.id = getUUID();
|
||||
this.request.hashTree.push(obj);
|
||||
this.reload();
|
||||
},
|
||||
reload() {
|
||||
this.isReloadData = true
|
||||
this.$nextTick(() => {
|
||||
|
|
|
@ -32,12 +32,8 @@ export default {
|
|||
options: Object
|
||||
},
|
||||
mounted() {
|
||||
console.log('mounted')
|
||||
this.init();
|
||||
},
|
||||
beforeDestroy() {
|
||||
console.log('beforeDestroy')
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
result: {},
|
||||
|
@ -55,21 +51,6 @@ export default {
|
|||
}
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
// getIndex: function () {
|
||||
// return function (item) {
|
||||
// return this.options.index(item);
|
||||
// }
|
||||
// },
|
||||
// getRouter: function () {
|
||||
// return function (item) {
|
||||
// if (this.options.router) {
|
||||
// return this.options.router(item);
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
},
|
||||
|
||||
methods: {
|
||||
init: function () {
|
||||
if (hasRoles(ROLE_TEST_VIEWER, ROLE_TEST_USER, ROLE_TEST_MANAGER)) {
|
||||
|
|
|
@ -1 +1 @@
|
|||
Subproject commit a22a3005d9bd254793fcf634d72539cbdf31be3a
|
||||
Subproject commit 29a8fc09602fde5708af06582ac972d98eb69836
|
Loading…
Reference in New Issue