Conflicts:
	backend/src/main/resources/db/migration/V78__v1.8_release.sql
This commit is contained in:
wenyann 2021-03-16 11:40:19 +08:00
commit 30d39b4338
86 changed files with 2787 additions and 532 deletions

View File

@ -541,6 +541,11 @@
<include name="*.html"/> <include name="*.html"/>
</fileset> </fileset>
</move> </move>
<copy todir="src/main/resources/static/css">
<fileset dir="../frontend/src/assets/theme">
<include name="index.css"/>
</fileset>
</copy>
</target> </target>
</configuration> </configuration>
<goals> <goals>

View File

@ -15,6 +15,7 @@ import io.metersphere.api.service.*;
import io.metersphere.base.domain.ApiTest; import io.metersphere.base.domain.ApiTest;
import io.metersphere.base.domain.Schedule; import io.metersphere.base.domain.Schedule;
import io.metersphere.commons.constants.RoleConstants; import io.metersphere.commons.constants.RoleConstants;
import io.metersphere.commons.constants.ScheduleGroup;
import io.metersphere.commons.utils.CronUtils; import io.metersphere.commons.utils.CronUtils;
import io.metersphere.commons.utils.PageUtils; import io.metersphere.commons.utils.PageUtils;
import io.metersphere.commons.utils.Pager; import io.metersphere.commons.utils.Pager;
@ -28,15 +29,13 @@ import io.metersphere.service.ScheduleService;
import org.apache.jorphan.collections.HashTree; import org.apache.jorphan.collections.HashTree;
import org.apache.shiro.authz.annotation.Logical; import org.apache.shiro.authz.annotation.Logical;
import org.apache.shiro.authz.annotation.RequiresRoles; import org.apache.shiro.authz.annotation.RequiresRoles;
import org.python.core.AstList;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile; import org.springframework.web.multipart.MultipartFile;
import javax.annotation.Resource; import javax.annotation.Resource;
import java.text.DecimalFormat; import java.text.DecimalFormat;
import java.util.ArrayList; import java.util.*;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import static io.metersphere.commons.utils.JsonPathUtils.getListJson; import static io.metersphere.commons.utils.JsonPathUtils.getListJson;
@ -345,8 +344,11 @@ public class APITestController {
@GetMapping("/runningTask/{projectID}") @GetMapping("/runningTask/{projectID}")
public List<TaskInfoResult> runningTask(@PathVariable String projectID) { public List<TaskInfoResult> runningTask(@PathVariable String projectID) {
List<String> typeFilter = Arrays.asList( // 首页显示的运行中定时任务只要这3种不需要 性能测试api_test(旧版)
List<TaskInfoResult> resultList = scheduleService.findRunningTaskInfoByProjectID(projectID); ScheduleGroup.API_SCENARIO_TEST.name(),
ScheduleGroup.SWAGGER_IMPORT.name(),
ScheduleGroup.TEST_PLAN_TEST.name());
List<TaskInfoResult> resultList = scheduleService.findRunningTaskInfoByProjectID(projectID, typeFilter);
int dataIndex = 1; int dataIndex = 1;
for (TaskInfoResult taskInfo : for (TaskInfoResult taskInfo :
resultList) { resultList) {

View File

@ -30,6 +30,7 @@ import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile; import org.springframework.web.multipart.MultipartFile;
import javax.annotation.Resource; import javax.annotation.Resource;
import java.net.MalformedURLException;
import java.util.Date; import java.util.Date;
import java.util.List; import java.util.List;
@ -163,7 +164,7 @@ public class ApiDefinitionController {
//定时任务创建 //定时任务创建
@PostMapping(value = "/schedule/create") @PostMapping(value = "/schedule/create")
public void createSchedule(@RequestBody ScheduleRequest request) { public void createSchedule(@RequestBody ScheduleRequest request) throws MalformedURLException {
apiDefinitionService.createSchedule(request); apiDefinitionService.createSchedule(request);
} }
@PostMapping(value = "/schedule/update") @PostMapping(value = "/schedule/update")

View File

@ -29,5 +29,7 @@ public class TaskInfoResult {
private Long updateTime; private Long updateTime;
//定时任务类型 情景定时任务/范围计划任务 //定时任务类型 情景定时任务/范围计划任务
private String taskType; private String taskType;
//定时任务组别 swagger/scenario/testPlan
private String taskGroup;
} }

View File

@ -339,6 +339,8 @@ public class APITestService {
schedule.setJob(ApiTestJob.class.getName()); schedule.setJob(ApiTestJob.class.getName());
schedule.setGroup(ScheduleGroup.API_TEST.name()); schedule.setGroup(ScheduleGroup.API_TEST.name());
schedule.setType(ScheduleType.CRON.name()); schedule.setType(ScheduleType.CRON.name());
schedule.setProjectId(request.getProjectId());
schedule.setName(request.getName());
return schedule; return schedule;
} }

View File

@ -25,10 +25,7 @@ import io.metersphere.base.mapper.ApiScenarioMapper;
import io.metersphere.base.mapper.ApiScenarioReportMapper; import io.metersphere.base.mapper.ApiScenarioReportMapper;
import io.metersphere.base.mapper.TestCaseReviewScenarioMapper; import io.metersphere.base.mapper.TestCaseReviewScenarioMapper;
import io.metersphere.base.mapper.TestPlanApiScenarioMapper; import io.metersphere.base.mapper.TestPlanApiScenarioMapper;
import io.metersphere.base.mapper.ext.ExtApiScenarioMapper; import io.metersphere.base.mapper.ext.*;
import io.metersphere.base.mapper.ext.ExtTestPlanApiCaseMapper;
import io.metersphere.base.mapper.ext.ExtTestPlanMapper;
import io.metersphere.base.mapper.ext.ExtTestPlanScenarioCaseMapper;
import io.metersphere.commons.constants.*; import io.metersphere.commons.constants.*;
import io.metersphere.commons.exception.MSException; import io.metersphere.commons.exception.MSException;
import io.metersphere.commons.utils.*; import io.metersphere.commons.utils.*;
@ -64,6 +61,8 @@ import java.util.stream.Collectors;
@Service @Service
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public class ApiAutomationService { public class ApiAutomationService {
@Resource
private ExtScheduleMapper extScheduleMapper;
@Resource @Resource
private ApiScenarioMapper apiScenarioMapper; private ApiScenarioMapper apiScenarioMapper;
@Resource @Resource
@ -204,6 +203,7 @@ public class ApiAutomationService {
final ApiScenarioWithBLOBs scenario = buildSaveScenario(request); final ApiScenarioWithBLOBs scenario = buildSaveScenario(request);
apiScenarioMapper.updateByPrimaryKeySelective(scenario); apiScenarioMapper.updateByPrimaryKeySelective(scenario);
extScheduleMapper.updateNameByResourceID(request.getId(), request.getName());// 修改场景name同步到修改首页定时任务
} }
public ApiScenarioWithBLOBs buildSaveScenario(SaveApiScenarioRequest request) { public ApiScenarioWithBLOBs buildSaveScenario(SaveApiScenarioRequest request) {
@ -753,6 +753,9 @@ public class ApiAutomationService {
public void createSchedule(ScheduleRequest request) { public void createSchedule(ScheduleRequest request) {
Schedule schedule = scheduleService.buildApiTestSchedule(request); Schedule schedule = scheduleService.buildApiTestSchedule(request);
ApiScenarioWithBLOBs apiScene = apiScenarioMapper.selectByPrimaryKey(request.getResourceId());
schedule.setName(apiScene.getName()); // add场景定时任务时设置新增的数据库表字段的值
schedule.setProjectId(apiScene.getProjectId());
schedule.setJob(ApiScenarioTestJob.class.getName()); schedule.setJob(ApiScenarioTestJob.class.getName());
schedule.setGroup(ScheduleGroup.API_SCENARIO_TEST.name()); schedule.setGroup(ScheduleGroup.API_SCENARIO_TEST.name());
schedule.setType(ScheduleType.CRON.name()); schedule.setType(ScheduleType.CRON.name());

View File

@ -49,6 +49,7 @@ import sun.security.util.Cache;
import javax.annotation.Resource; import javax.annotation.Resource;
import java.io.File; import java.io.File;
import java.net.MalformedURLException;
import java.util.*; import java.util.*;
import java.util.function.Function; import java.util.function.Function;
import java.util.stream.Collectors; import java.util.stream.Collectors;
@ -215,7 +216,6 @@ public class ApiDefinitionService {
ApiDefinitionExample example = new ApiDefinitionExample(); ApiDefinitionExample example = new ApiDefinitionExample();
if (request.getProtocol().equals(RequestType.HTTP)) { if (request.getProtocol().equals(RequestType.HTTP)) {
example.createCriteria().andMethodEqualTo(request.getMethod()).andStatusNotEqualTo("Trash") example.createCriteria().andMethodEqualTo(request.getMethod()).andStatusNotEqualTo("Trash")
.andProtocolEqualTo(request.getProtocol()).andPathEqualTo(request.getPath())
.andProjectIdEqualTo(request.getProjectId()).andIdNotEqualTo(request.getId()); .andProjectIdEqualTo(request.getProjectId()).andIdNotEqualTo(request.getId());
return apiDefinitionMapper.selectByExample(example); return apiDefinitionMapper.selectByExample(example);
} else { } else {
@ -713,7 +713,7 @@ public class ApiDefinitionService {
} }
/*swagger定时导入*/ /*swagger定时导入*/
public void createSchedule(ScheduleRequest request) { public void createSchedule(ScheduleRequest request) throws MalformedURLException {
/*保存swaggerUrl*/ /*保存swaggerUrl*/
SwaggerUrlProject swaggerUrlProject = new SwaggerUrlProject(); SwaggerUrlProject swaggerUrlProject = new SwaggerUrlProject();
swaggerUrlProject.setId(UUID.randomUUID().toString()); swaggerUrlProject.setId(UUID.randomUUID().toString());
@ -725,6 +725,9 @@ public class ApiDefinitionService {
scheduleService.addSwaggerUrlSchedule(swaggerUrlProject); scheduleService.addSwaggerUrlSchedule(swaggerUrlProject);
request.setResourceId(swaggerUrlProject.getId()); request.setResourceId(swaggerUrlProject.getId());
Schedule schedule = scheduleService.buildApiTestSchedule(request); Schedule schedule = scheduleService.buildApiTestSchedule(request);
schedule.setProjectId(swaggerUrlProject.getProjectId());
java.net.URL swaggerUrl = new java.net.URL(swaggerUrlProject.getSwaggerUrl());
schedule.setName(swaggerUrl.getHost()); // swagger 定时任务的 name 设置为 swaggerURL 的域名
schedule.setJob(SwaggerUrlImportJob.class.getName()); schedule.setJob(SwaggerUrlImportJob.class.getName());
schedule.setGroup(ScheduleGroup.SWAGGER_IMPORT.name()); schedule.setGroup(ScheduleGroup.SWAGGER_IMPORT.name());
schedule.setType(ScheduleType.CRON.name()); schedule.setType(ScheduleType.CRON.name());

View File

@ -1,8 +1,7 @@
package io.metersphere.base.domain; package io.metersphere.base.domain;
import lombok.Data;
import java.io.Serializable; import java.io.Serializable;
import lombok.Data;
@Data @Data
public class Schedule implements Serializable { public class Schedule implements Serializable {
@ -30,7 +29,9 @@ public class Schedule implements Serializable {
private Long updateTime; private Long updateTime;
private String customData; private String projectId;
private String name;
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
} }

View File

@ -913,6 +913,146 @@ public class ScheduleExample {
addCriterion("update_time not between", value1, value2, "updateTime"); addCriterion("update_time not between", value1, value2, "updateTime");
return (Criteria) this; return (Criteria) this;
} }
public Criteria andProjectIdIsNull() {
addCriterion("project_id is null");
return (Criteria) this;
}
public Criteria andProjectIdIsNotNull() {
addCriterion("project_id is not null");
return (Criteria) this;
}
public Criteria andProjectIdEqualTo(String value) {
addCriterion("project_id =", value, "projectId");
return (Criteria) this;
}
public Criteria andProjectIdNotEqualTo(String value) {
addCriterion("project_id <>", value, "projectId");
return (Criteria) this;
}
public Criteria andProjectIdGreaterThan(String value) {
addCriterion("project_id >", value, "projectId");
return (Criteria) this;
}
public Criteria andProjectIdGreaterThanOrEqualTo(String value) {
addCriterion("project_id >=", value, "projectId");
return (Criteria) this;
}
public Criteria andProjectIdLessThan(String value) {
addCriterion("project_id <", value, "projectId");
return (Criteria) this;
}
public Criteria andProjectIdLessThanOrEqualTo(String value) {
addCriterion("project_id <=", value, "projectId");
return (Criteria) this;
}
public Criteria andProjectIdLike(String value) {
addCriterion("project_id like", value, "projectId");
return (Criteria) this;
}
public Criteria andProjectIdNotLike(String value) {
addCriterion("project_id not like", value, "projectId");
return (Criteria) this;
}
public Criteria andProjectIdIn(List<String> values) {
addCriterion("project_id in", values, "projectId");
return (Criteria) this;
}
public Criteria andProjectIdNotIn(List<String> values) {
addCriterion("project_id not in", values, "projectId");
return (Criteria) this;
}
public Criteria andProjectIdBetween(String value1, String value2) {
addCriterion("project_id between", value1, value2, "projectId");
return (Criteria) this;
}
public Criteria andProjectIdNotBetween(String value1, String value2) {
addCriterion("project_id not between", value1, value2, "projectId");
return (Criteria) this;
}
public Criteria andNameIsNull() {
addCriterion("`name` is null");
return (Criteria) this;
}
public Criteria andNameIsNotNull() {
addCriterion("`name` is not null");
return (Criteria) this;
}
public Criteria andNameEqualTo(String value) {
addCriterion("`name` =", value, "name");
return (Criteria) this;
}
public Criteria andNameNotEqualTo(String value) {
addCriterion("`name` <>", value, "name");
return (Criteria) this;
}
public Criteria andNameGreaterThan(String value) {
addCriterion("`name` >", value, "name");
return (Criteria) this;
}
public Criteria andNameGreaterThanOrEqualTo(String value) {
addCriterion("`name` >=", value, "name");
return (Criteria) this;
}
public Criteria andNameLessThan(String value) {
addCriterion("`name` <", value, "name");
return (Criteria) this;
}
public Criteria andNameLessThanOrEqualTo(String value) {
addCriterion("`name` <=", value, "name");
return (Criteria) this;
}
public Criteria andNameLike(String value) {
addCriterion("`name` like", value, "name");
return (Criteria) this;
}
public Criteria andNameNotLike(String value) {
addCriterion("`name` not like", value, "name");
return (Criteria) this;
}
public Criteria andNameIn(List<String> values) {
addCriterion("`name` in", values, "name");
return (Criteria) this;
}
public Criteria andNameNotIn(List<String> values) {
addCriterion("`name` not in", values, "name");
return (Criteria) this;
}
public Criteria andNameBetween(String value1, String value2) {
addCriterion("`name` between", value1, value2, "name");
return (Criteria) this;
}
public Criteria andNameNotBetween(String value1, String value2) {
addCriterion("`name` not between", value1, value2, "name");
return (Criteria) this;
}
} }
public static class Criteria extends GeneratedCriteria { public static class Criteria extends GeneratedCriteria {

View File

@ -244,6 +244,76 @@ public class TestCaseExample {
return (Criteria) this; return (Criteria) this;
} }
public Criteria andTestIdIsNull() {
addCriterion("test_id is null");
return (Criteria) this;
}
public Criteria andTestIdIsNotNull() {
addCriterion("test_id is not null");
return (Criteria) this;
}
public Criteria andTestIdEqualTo(String value) {
addCriterion("test_id =", value, "testId");
return (Criteria) this;
}
public Criteria andTestIdNotEqualTo(String value) {
addCriterion("test_id <>", value, "testId");
return (Criteria) this;
}
public Criteria andTestIdGreaterThan(String value) {
addCriterion("test_id >", value, "testId");
return (Criteria) this;
}
public Criteria andTestIdGreaterThanOrEqualTo(String value) {
addCriterion("test_id >=", value, "testId");
return (Criteria) this;
}
public Criteria andTestIdLessThan(String value) {
addCriterion("test_id <", value, "testId");
return (Criteria) this;
}
public Criteria andTestIdLessThanOrEqualTo(String value) {
addCriterion("test_id <=", value, "testId");
return (Criteria) this;
}
public Criteria andTestIdLike(String value) {
addCriterion("test_id like", value, "testId");
return (Criteria) this;
}
public Criteria andTestIdNotLike(String value) {
addCriterion("test_id not like", value, "testId");
return (Criteria) this;
}
public Criteria andTestIdIn(List<String> values) {
addCriterion("test_id in", values, "testId");
return (Criteria) this;
}
public Criteria andTestIdNotIn(List<String> values) {
addCriterion("test_id not in", values, "testId");
return (Criteria) this;
}
public Criteria andTestIdBetween(String value1, String value2) {
addCriterion("test_id between", value1, value2, "testId");
return (Criteria) this;
}
public Criteria andTestIdNotBetween(String value1, String value2) {
addCriterion("test_id not between", value1, value2, "testId");
return (Criteria) this;
}
public Criteria andNodePathIsNull() { public Criteria andNodePathIsNull() {
addCriterion("node_path is null"); addCriterion("node_path is null");
return (Criteria) this; return (Criteria) this;
@ -924,76 +994,6 @@ public class TestCaseExample {
return (Criteria) this; return (Criteria) this;
} }
public Criteria andTestIdIsNull() {
addCriterion("test_id is null");
return (Criteria) this;
}
public Criteria andTestIdIsNotNull() {
addCriterion("test_id is not null");
return (Criteria) this;
}
public Criteria andTestIdEqualTo(String value) {
addCriterion("test_id =", value, "testId");
return (Criteria) this;
}
public Criteria andTestIdNotEqualTo(String value) {
addCriterion("test_id <>", value, "testId");
return (Criteria) this;
}
public Criteria andTestIdGreaterThan(String value) {
addCriterion("test_id >", value, "testId");
return (Criteria) this;
}
public Criteria andTestIdGreaterThanOrEqualTo(String value) {
addCriterion("test_id >=", value, "testId");
return (Criteria) this;
}
public Criteria andTestIdLessThan(String value) {
addCriterion("test_id <", value, "testId");
return (Criteria) this;
}
public Criteria andTestIdLessThanOrEqualTo(String value) {
addCriterion("test_id <=", value, "testId");
return (Criteria) this;
}
public Criteria andTestIdLike(String value) {
addCriterion("test_id like", value, "testId");
return (Criteria) this;
}
public Criteria andTestIdNotLike(String value) {
addCriterion("test_id not like", value, "testId");
return (Criteria) this;
}
public Criteria andTestIdIn(List<String> values) {
addCriterion("test_id in", values, "testId");
return (Criteria) this;
}
public Criteria andTestIdNotIn(List<String> values) {
addCriterion("test_id not in", values, "testId");
return (Criteria) this;
}
public Criteria andTestIdBetween(String value1, String value2) {
addCriterion("test_id between", value1, value2, "testId");
return (Criteria) this;
}
public Criteria andTestIdNotBetween(String value1, String value2) {
addCriterion("test_id not between", value1, value2, "testId");
return (Criteria) this;
}
public Criteria andSortIsNull() { public Criteria andSortIsNull() {
addCriterion("sort is null"); addCriterion("sort is null");
return (Criteria) this; return (Criteria) this;

View File

@ -16,21 +16,15 @@ public interface ScheduleMapper {
int insertSelective(Schedule record); int insertSelective(Schedule record);
List<Schedule> selectByExampleWithBLOBs(ScheduleExample example);
List<Schedule> selectByExample(ScheduleExample example); List<Schedule> selectByExample(ScheduleExample example);
Schedule selectByPrimaryKey(String id); Schedule selectByPrimaryKey(String id);
int updateByExampleSelective(@Param("record") Schedule record, @Param("example") ScheduleExample example); int updateByExampleSelective(@Param("record") Schedule record, @Param("example") ScheduleExample example);
int updateByExampleWithBLOBs(@Param("record") Schedule record, @Param("example") ScheduleExample example);
int updateByExample(@Param("record") Schedule record, @Param("example") ScheduleExample example); int updateByExample(@Param("record") Schedule record, @Param("example") ScheduleExample example);
int updateByPrimaryKeySelective(Schedule record); int updateByPrimaryKeySelective(Schedule record);
int updateByPrimaryKeyWithBLOBs(Schedule record);
int updateByPrimaryKey(Schedule record); int updateByPrimaryKey(Schedule record);
} }

View File

@ -14,9 +14,8 @@
<result column="workspace_id" jdbcType="VARCHAR" property="workspaceId" /> <result column="workspace_id" jdbcType="VARCHAR" property="workspaceId" />
<result column="create_time" jdbcType="BIGINT" property="createTime" /> <result column="create_time" jdbcType="BIGINT" property="createTime" />
<result column="update_time" jdbcType="BIGINT" property="updateTime" /> <result column="update_time" jdbcType="BIGINT" property="updateTime" />
</resultMap> <result column="project_id" jdbcType="VARCHAR" property="projectId" />
<resultMap extends="BaseResultMap" id="ResultMapWithBLOBs" type="io.metersphere.base.domain.Schedule"> <result column="name" jdbcType="VARCHAR" property="name" />
<result column="custom_data" jdbcType="LONGVARCHAR" property="customData" />
</resultMap> </resultMap>
<sql id="Example_Where_Clause"> <sql id="Example_Where_Clause">
<where> <where>
@ -78,27 +77,8 @@
</sql> </sql>
<sql id="Base_Column_List"> <sql id="Base_Column_List">
id, `key`, `type`, `value`, `group`, job, `enable`, resource_id, user_id, workspace_id, id, `key`, `type`, `value`, `group`, job, `enable`, resource_id, user_id, workspace_id,
create_time, update_time create_time, update_time, project_id, `name`
</sql> </sql>
<sql id="Blob_Column_List">
custom_data
</sql>
<select id="selectByExampleWithBLOBs" parameterType="io.metersphere.base.domain.ScheduleExample" resultMap="ResultMapWithBLOBs">
select
<if test="distinct">
distinct
</if>
<include refid="Base_Column_List" />
,
<include refid="Blob_Column_List" />
from schedule
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
</if>
<if test="orderByClause != null">
order by ${orderByClause}
</if>
</select>
<select id="selectByExample" parameterType="io.metersphere.base.domain.ScheduleExample" resultMap="BaseResultMap"> <select id="selectByExample" parameterType="io.metersphere.base.domain.ScheduleExample" resultMap="BaseResultMap">
select select
<if test="distinct"> <if test="distinct">
@ -113,11 +93,9 @@
order by ${orderByClause} order by ${orderByClause}
</if> </if>
</select> </select>
<select id="selectByPrimaryKey" parameterType="java.lang.String" resultMap="ResultMapWithBLOBs"> <select id="selectByPrimaryKey" parameterType="java.lang.String" resultMap="BaseResultMap">
select select
<include refid="Base_Column_List" /> <include refid="Base_Column_List" />
,
<include refid="Blob_Column_List" />
from schedule from schedule
where id = #{id,jdbcType=VARCHAR} where id = #{id,jdbcType=VARCHAR}
</select> </select>
@ -136,12 +114,12 @@
`value`, `group`, job, `value`, `group`, job,
`enable`, resource_id, user_id, `enable`, resource_id, user_id,
workspace_id, create_time, update_time, workspace_id, create_time, update_time,
custom_data) project_id, `name`)
values (#{id,jdbcType=VARCHAR}, #{key,jdbcType=VARCHAR}, #{type,jdbcType=VARCHAR}, values (#{id,jdbcType=VARCHAR}, #{key,jdbcType=VARCHAR}, #{type,jdbcType=VARCHAR},
#{value,jdbcType=VARCHAR}, #{group,jdbcType=VARCHAR}, #{job,jdbcType=VARCHAR}, #{value,jdbcType=VARCHAR}, #{group,jdbcType=VARCHAR}, #{job,jdbcType=VARCHAR},
#{enable,jdbcType=BIT}, #{resourceId,jdbcType=VARCHAR}, #{userId,jdbcType=VARCHAR}, #{enable,jdbcType=BIT}, #{resourceId,jdbcType=VARCHAR}, #{userId,jdbcType=VARCHAR},
#{workspaceId,jdbcType=VARCHAR}, #{createTime,jdbcType=BIGINT}, #{updateTime,jdbcType=BIGINT}, #{workspaceId,jdbcType=VARCHAR}, #{createTime,jdbcType=BIGINT}, #{updateTime,jdbcType=BIGINT},
#{customData,jdbcType=LONGVARCHAR}) #{projectId,jdbcType=VARCHAR}, #{name,jdbcType=VARCHAR})
</insert> </insert>
<insert id="insertSelective" parameterType="io.metersphere.base.domain.Schedule"> <insert id="insertSelective" parameterType="io.metersphere.base.domain.Schedule">
insert into schedule insert into schedule
@ -182,8 +160,11 @@
<if test="updateTime != null"> <if test="updateTime != null">
update_time, update_time,
</if> </if>
<if test="customData != null"> <if test="projectId != null">
custom_data, project_id,
</if>
<if test="name != null">
`name`,
</if> </if>
</trim> </trim>
<trim prefix="values (" suffix=")" suffixOverrides=","> <trim prefix="values (" suffix=")" suffixOverrides=",">
@ -223,8 +204,11 @@
<if test="updateTime != null"> <if test="updateTime != null">
#{updateTime,jdbcType=BIGINT}, #{updateTime,jdbcType=BIGINT},
</if> </if>
<if test="customData != null"> <if test="projectId != null">
#{customData,jdbcType=LONGVARCHAR}, #{projectId,jdbcType=VARCHAR},
</if>
<if test="name != null">
#{name,jdbcType=VARCHAR},
</if> </if>
</trim> </trim>
</insert> </insert>
@ -273,33 +257,17 @@
<if test="record.updateTime != null"> <if test="record.updateTime != null">
update_time = #{record.updateTime,jdbcType=BIGINT}, update_time = #{record.updateTime,jdbcType=BIGINT},
</if> </if>
<if test="record.customData != null"> <if test="record.projectId != null">
custom_data = #{record.customData,jdbcType=LONGVARCHAR}, project_id = #{record.projectId,jdbcType=VARCHAR},
</if>
<if test="record.name != null">
`name` = #{record.name,jdbcType=VARCHAR},
</if> </if>
</set> </set>
<if test="_parameter != null"> <if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" /> <include refid="Update_By_Example_Where_Clause" />
</if> </if>
</update> </update>
<update id="updateByExampleWithBLOBs" parameterType="map">
update schedule
set id = #{record.id,jdbcType=VARCHAR},
`key` = #{record.key,jdbcType=VARCHAR},
`type` = #{record.type,jdbcType=VARCHAR},
`value` = #{record.value,jdbcType=VARCHAR},
`group` = #{record.group,jdbcType=VARCHAR},
job = #{record.job,jdbcType=VARCHAR},
`enable` = #{record.enable,jdbcType=BIT},
resource_id = #{record.resourceId,jdbcType=VARCHAR},
user_id = #{record.userId,jdbcType=VARCHAR},
workspace_id = #{record.workspaceId,jdbcType=VARCHAR},
create_time = #{record.createTime,jdbcType=BIGINT},
update_time = #{record.updateTime,jdbcType=BIGINT},
custom_data = #{record.customData,jdbcType=LONGVARCHAR}
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
</if>
</update>
<update id="updateByExample" parameterType="map"> <update id="updateByExample" parameterType="map">
update schedule update schedule
set id = #{record.id,jdbcType=VARCHAR}, set id = #{record.id,jdbcType=VARCHAR},
@ -313,7 +281,9 @@
user_id = #{record.userId,jdbcType=VARCHAR}, user_id = #{record.userId,jdbcType=VARCHAR},
workspace_id = #{record.workspaceId,jdbcType=VARCHAR}, workspace_id = #{record.workspaceId,jdbcType=VARCHAR},
create_time = #{record.createTime,jdbcType=BIGINT}, create_time = #{record.createTime,jdbcType=BIGINT},
update_time = #{record.updateTime,jdbcType=BIGINT} update_time = #{record.updateTime,jdbcType=BIGINT},
project_id = #{record.projectId,jdbcType=VARCHAR},
`name` = #{record.name,jdbcType=VARCHAR}
<if test="_parameter != null"> <if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" /> <include refid="Update_By_Example_Where_Clause" />
</if> </if>
@ -354,28 +324,15 @@
<if test="updateTime != null"> <if test="updateTime != null">
update_time = #{updateTime,jdbcType=BIGINT}, update_time = #{updateTime,jdbcType=BIGINT},
</if> </if>
<if test="customData != null"> <if test="projectId != null">
custom_data = #{customData,jdbcType=LONGVARCHAR}, project_id = #{projectId,jdbcType=VARCHAR},
</if>
<if test="name != null">
`name` = #{name,jdbcType=VARCHAR},
</if> </if>
</set> </set>
where id = #{id,jdbcType=VARCHAR} where id = #{id,jdbcType=VARCHAR}
</update> </update>
<update id="updateByPrimaryKeyWithBLOBs" parameterType="io.metersphere.base.domain.Schedule">
update schedule
set `key` = #{key,jdbcType=VARCHAR},
`type` = #{type,jdbcType=VARCHAR},
`value` = #{value,jdbcType=VARCHAR},
`group` = #{group,jdbcType=VARCHAR},
job = #{job,jdbcType=VARCHAR},
`enable` = #{enable,jdbcType=BIT},
resource_id = #{resourceId,jdbcType=VARCHAR},
user_id = #{userId,jdbcType=VARCHAR},
workspace_id = #{workspaceId,jdbcType=VARCHAR},
create_time = #{createTime,jdbcType=BIGINT},
update_time = #{updateTime,jdbcType=BIGINT},
custom_data = #{customData,jdbcType=LONGVARCHAR}
where id = #{id,jdbcType=VARCHAR}
</update>
<update id="updateByPrimaryKey" parameterType="io.metersphere.base.domain.Schedule"> <update id="updateByPrimaryKey" parameterType="io.metersphere.base.domain.Schedule">
update schedule update schedule
set `key` = #{key,jdbcType=VARCHAR}, set `key` = #{key,jdbcType=VARCHAR},
@ -388,7 +345,9 @@
user_id = #{userId,jdbcType=VARCHAR}, user_id = #{userId,jdbcType=VARCHAR},
workspace_id = #{workspaceId,jdbcType=VARCHAR}, workspace_id = #{workspaceId,jdbcType=VARCHAR},
create_time = #{createTime,jdbcType=BIGINT}, create_time = #{createTime,jdbcType=BIGINT},
update_time = #{updateTime,jdbcType=BIGINT} update_time = #{updateTime,jdbcType=BIGINT},
project_id = #{projectId,jdbcType=VARCHAR},
`name` = #{name,jdbcType=VARCHAR}
where id = #{id,jdbcType=VARCHAR} where id = #{id,jdbcType=VARCHAR}
</update> </update>
</mapper> </mapper>

View File

@ -15,10 +15,12 @@ public interface ExtScheduleMapper {
long countTaskByProjectIdAndCreateTimeRange(@Param("projectId")String projectId, @Param("startTime") long startTime, @Param("endTime") long endTime); long countTaskByProjectIdAndCreateTimeRange(@Param("projectId")String projectId, @Param("startTime") long startTime, @Param("endTime") long endTime);
List<TaskInfoResult> findRunningTaskInfoByProjectID(String workspaceID); List<TaskInfoResult> findRunningTaskInfoByProjectID(@Param("projectId") String workspaceID, @Param("types") List<String> typeFilter);
void insert(@Param("apiSwaggerUrlDTO") ApiSwaggerUrlDTO apiSwaggerUrlDTO); void insert(@Param("apiSwaggerUrlDTO") ApiSwaggerUrlDTO apiSwaggerUrlDTO);
ApiSwaggerUrlDTO select(String id); ApiSwaggerUrlDTO select(String id);
int updateNameByResourceID(@Param("resourceId") String resourceId, @Param("name") String name);
} }

View File

@ -61,35 +61,33 @@
AND create_time BETWEEN #{startTime} and #{endTime} AND create_time BETWEEN #{startTime} and #{endTime}
</select> </select>
<select id="findRunningTaskInfoByProjectID" resultType="io.metersphere.api.dto.datacount.response.TaskInfoResult"> <select id="findRunningTaskInfoByProjectID" resultType="io.metersphere.api.dto.datacount.response.TaskInfoResult">
SELECT apiScene.id AS scenarioId, SELECT sch.id AS taskID,
apiScene.`name` AS `name`, sch.`name` AS `name`,
sch.`value` AS rule,
sch.`enable` AS `taskStatus`,
sch.update_time AS updateTime,
sch.id AS taskID, sch.id AS taskID,
sch.`value` AS rule, sch.`value` AS rule,
sch.`enable` AS `taskStatus`, sch.`enable` AS `taskStatus`,
u.`name` AS creator, u.name AS creator,
sch.update_time AS updateTime, sch.update_time AS updateTime,
'scenario' AS taskType sch.type AS taskType,
FROM api_scenario apiScene sch.group AS taskGroup
INNER JOIN `schedule` sch ON apiScene.id = sch.resource_id FROM (
INNER JOIN `user` u ON u.id = sch.user_id schedule sch left join user u
ON sch.user_id = u.id
)
WHERE sch.`enable` = true WHERE sch.`enable` = true
AND apiScene.project_id = #{0,jdbcType=VARCHAR} AND sch.project_id = #{projectId,jdbcType=VARCHAR}
UNION and sch.group in
SELECT testPlan.id AS scenarioId, <foreach collection="types" item="item" separator="," open="(" close=")">
testPlan.`name` AS `name`, #{item}
sch.id AS taskID, </foreach>
sch.`value` AS rule,
sch.`enable` AS `taskStatus`,
u.`name` AS creator,
sch.update_time AS updateTime,
'testPlan' AS taskType
FROM test_plan testPlan
INNER JOIN `schedule` sch ON testPlan.id = sch.resource_id
INNER JOIN `user` u ON u.id = sch.user_id
WHERE sch.`enable` = true
AND testPlan.project_id = #{0,jdbcType=VARCHAR}
</select> </select>
<select id="select" resultType="io.metersphere.api.dto.definition.ApiSwaggerUrlDTO"> <select id="select" resultType="io.metersphere.api.dto.definition.ApiSwaggerUrlDTO">
select * from swagger_url_project where id=#{id} select * from swagger_url_project where id=#{id}
</select> </select>
<update id="updateNameByResourceID">
update schedule set name = #{name} where resource_id = #{resourceId}
</update>
</mapper> </mapper>

View File

@ -71,5 +71,10 @@ public interface ExtTestCaseMapper {
List<TrackCountResult> countRelevanceMaintainer(@Param("projectId") String projectId); List<TrackCountResult> countRelevanceMaintainer(@Param("projectId") String projectId);
int getTestPlanBug(@Param("planId") String planId);
int getTestPlanCase(@Param("planId") String planId);
int getTestPlanPassCase(@Param("planId") String planId);
} }

View File

@ -306,6 +306,9 @@
or test_case.num like CONCAT('%', #{request.name},'%') or test_case.num like CONCAT('%', #{request.name},'%')
or test_case.tags like CONCAT('%', #{request.name},'%')) or test_case.tags like CONCAT('%', #{request.name},'%'))
</if> </if>
<if test="request.createTime >0">
AND test_case.create_time >= #{request.createTime}
</if>
<if test="request.nodeIds != null and request.nodeIds.size() > 0"> <if test="request.nodeIds != null and request.nodeIds.size() > 0">
and test_case.node_id in and test_case.node_id in
<foreach collection="request.nodeIds" item="nodeId" separator="," open="(" close=")"> <foreach collection="request.nodeIds" item="nodeId" separator="," open="(" close=")">
@ -316,6 +319,12 @@
and test_case.project_id = #{request.projectId} and test_case.project_id = #{request.projectId}
</if> </if>
<include refid="filters"/> <include refid="filters"/>
<if test="request.caseCoverage == 'uncoverage' ">
and test_case.test_id is null and test_case.type != 'functional'
</if>
<if test="request.caseCoverage == 'coverage' ">
and test_case.test_id is not null and test_case.type != 'functional'
</if>
</where> </where>
</sql> </sql>
@ -342,8 +351,9 @@
</select> </select>
<select id="countCoverage" resultType="io.metersphere.track.response.TrackCountResult"> <select id="countCoverage" resultType="io.metersphere.track.response.TrackCountResult">
SELECT count(test_case.id) AS countNumber, if(test_case.test_id is null,"uncoverage","coverage") AS groupField SELECT count(test_case.id) AS countNumber,
FROM test_case WHERE test_case.project_id=#{projectId} GROUP BY groupField if(test_case.test_id is null,"uncoverage","coverage") AS groupField
FROM test_case WHERE test_case.project_id=#{projectId} and test_case.type != 'functional' GROUP BY groupField
</select> </select>
<select id="countFuncMaintainer" resultType="io.metersphere.track.response.TrackCountResult"> <select id="countFuncMaintainer" resultType="io.metersphere.track.response.TrackCountResult">
select count(tc.id) as countNumber, user.name as groupField from test_case tc right join user on tc.maintainer = user.id select count(tc.id) as countNumber, user.name as groupField from test_case tc right join user on tc.maintainer = user.id
@ -355,6 +365,50 @@
where tc.project_id = #{projectId} and tc.test_id is not null where tc.project_id = #{projectId} and tc.test_id is not null
group by tc.maintainer group by tc.maintainer
</select> </select>
<select id="getTestPlanBug" resultType="int">
select count(tci.issues_id) from test_plan_test_case tptc join test_case_issues tci on tptc.case_id = tci.test_case_id
where tptc.plan_id = #{planId};
</select>
<select id="getTestPlanCase" resultType="int">
select count(s)
from (
select id as s
from test_plan_test_case tptc
where tptc.plan_id = #{planId}
union all
select id as s
from test_plan_api_scenario tpas
where tpas.test_plan_id = #{planId}
union all
select id as s
from test_plan_api_case tpac
where tpac.test_plan_id = #{planId}
union all
select id as s
from test_plan_load_case tplc
where tplc.test_plan_id = #{planId}
) as temp
</select>
<select id="getTestPlanPassCase" resultType="int">
select count(s)
from (
select id as s
from test_plan_test_case tptc
where tptc.plan_id = #{planId} and tptc.status = 'Pass'
union all
select id as s
from test_plan_api_scenario tpas
where tpas.test_plan_id = #{planId} and tpas.last_result = 'Success'
union all
select id as s
from test_plan_api_case tpac
where tpac.test_plan_id = #{planId} and tpac.status = 'success'
union all
select id as s
from test_plan_load_case tplc
where tplc.test_plan_id = #{planId} and tplc.status = 'success'
) as temp
</select>
</mapper> </mapper>

View File

@ -97,10 +97,13 @@
</sql> </sql>
<select id="list" resultType="io.metersphere.track.dto.TestReviewCaseDTO"> <select id="list" resultType="io.metersphere.track.dto.TestReviewCaseDTO">
select test_case_review_test_case.id as id, test_case.id as caseId, test_case.name, test_case.priority, select test_case_review_test_case.id as id, test_case_review_test_case.reviewer,
test_case.type, test_case.node_path, test_case.method, test_case.num, test_case_review_test_case.reviewer, test_case_review_test_case.update_time, test_case_review_test_case.review_id as reviewId,
test_case.review_status, test_case_review_test_case.update_time, test_case_node.name as model, test_case.id as caseId, test_case.name, test_case.priority, test_case.test_id as testId,
project.name as projectName, test_case_review_test_case.review_id as reviewId,test_case.test_id as testId test_case.type, test_case.node_path, test_case.method, test_case.num, test_case.review_status,
test_case.remark as remark, test_case.steps as steps, test_case.node_id as nodeId,
test_case_node.name as model,
project.name as projectName
from test_case_review_test_case from test_case_review_test_case
inner join test_case on test_case_review_test_case.case_id = test_case.id inner join test_case on test_case_review_test_case.case_id = test_case.id
left join test_case_node on test_case_node.id=test_case.node_id left join test_case_node on test_case_node.id=test_case.node_id

View File

@ -42,10 +42,13 @@ public class ShiroUtils {
//api-对外文档页面提供的查询接口 //api-对外文档页面提供的查询接口
filterChainDefinitionMap.put("/api/document/**", "anon"); filterChainDefinitionMap.put("/api/document/**", "anon");
// filterChainDefinitionMap.put("/document/**", "anon"); // filterChainDefinitionMap.put("/document/**", "anon");
filterChainDefinitionMap.put("/system/theme", "anon");
} }
public static void ignoreCsrfFilter(Map<String, String> filterChainDefinitionMap) { public static void ignoreCsrfFilter(Map<String, String> filterChainDefinitionMap) {
filterChainDefinitionMap.put("/", "apikey, authc"); // 跳转到 / 不用校验 csrf filterChainDefinitionMap.put("/", "apikey, authc"); // 跳转到 / 不用校验 csrf
filterChainDefinitionMap.put("/language", "apikey, authc");// 跳转到 /language 不用校验 csrf
filterChainDefinitionMap.put("/document", "apikey, authc"); // 跳转到 /document 不用校验 csrf filterChainDefinitionMap.put("/document", "apikey, authc"); // 跳转到 /document 不用校验 csrf
} }

View File

@ -676,6 +676,13 @@ public class JmeterDocumentParser implements DocumentParser {
((List<?>) durations).remove(0); ((List<?>) durations).remove(0);
duration = o.toString(); duration = o.toString();
} }
Object units = context.getProperty("unit");
String unit = "S";
if (units instanceof List) {
Object o = ((List<?>) units).get(0);
((List<?>) units).remove(0);
unit = o.toString();
}
Object deleteds = context.getProperty("deleted"); Object deleteds = context.getProperty("deleted");
String deleted = "false"; String deleted = "false";
if (deleteds instanceof List) { if (deleteds instanceof List) {
@ -691,6 +698,17 @@ public class JmeterDocumentParser implements DocumentParser {
enabled = o.toString(); enabled = o.toString();
} }
switch (unit) {
case "M":
duration = String.valueOf(Long.parseLong(duration) * 60);
break;
case "H":
duration = String.valueOf(Long.parseLong(duration) * 60 * 60);
break;
default:
break;
}
threadGroup.setAttribute("enabled", enabled); threadGroup.setAttribute("enabled", enabled);
if (BooleanUtils.toBoolean(deleted)) { if (BooleanUtils.toBoolean(deleted)) {
threadGroup.setAttribute("enabled", "false"); threadGroup.setAttribute("enabled", "false");
@ -761,6 +779,13 @@ public class JmeterDocumentParser implements DocumentParser {
((List<?>) holds).remove(0); ((List<?>) holds).remove(0);
hold = o.toString(); hold = o.toString();
} }
Object units = context.getProperty("unit");
String unit = "S";
if (units instanceof List) {
Object o = ((List<?>) units).get(0);
((List<?>) units).remove(0);
unit = o.toString();
}
Object deleteds = context.getProperty("deleted"); Object deleteds = context.getProperty("deleted");
String deleted = "false"; String deleted = "false";
if (deleteds instanceof List) { if (deleteds instanceof List) {
@ -776,6 +801,17 @@ public class JmeterDocumentParser implements DocumentParser {
enabled = o.toString(); enabled = o.toString();
} }
switch (unit) {
case "M":
hold = String.valueOf(Long.parseLong(hold) * 60);
break;
case "H":
hold = String.valueOf(Long.parseLong(hold) * 60 * 60);
break;
default:
break;
}
threadGroup.setAttribute("enabled", enabled); threadGroup.setAttribute("enabled", enabled);
if (BooleanUtils.toBoolean(deleted)) { if (BooleanUtils.toBoolean(deleted)) {
threadGroup.setAttribute("enabled", "false"); threadGroup.setAttribute("enabled", "false");
@ -928,10 +964,10 @@ public class JmeterDocumentParser implements DocumentParser {
} }
private Element createStringProp(Document document, String name, String value) { private Element createStringProp(Document document, String name, String value) {
Element unit = document.createElement(STRING_PROP); Element element = document.createElement(STRING_PROP);
unit.setAttribute("name", name); element.setAttribute("name", name);
unit.appendChild(document.createTextNode(value)); element.appendChild(document.createTextNode(value));
return unit; return element;
} }
private void processThreadGroupName(Element threadGroup) { private void processThreadGroupName(Element threadGroup) {

View File

@ -4,9 +4,7 @@ import com.alibaba.fastjson.JSON;
import io.metersphere.api.dto.datacount.response.TaskInfoResult; import io.metersphere.api.dto.datacount.response.TaskInfoResult;
import io.metersphere.api.dto.definition.ApiSwaggerUrlDTO; import io.metersphere.api.dto.definition.ApiSwaggerUrlDTO;
import io.metersphere.base.domain.*; import io.metersphere.base.domain.*;
import io.metersphere.base.mapper.ScheduleMapper; import io.metersphere.base.mapper.*;
import io.metersphere.base.mapper.SwaggerUrlProjectMapper;
import io.metersphere.base.mapper.UserMapper;
import io.metersphere.base.mapper.ext.ExtScheduleMapper; import io.metersphere.base.mapper.ext.ExtScheduleMapper;
import io.metersphere.commons.constants.ScheduleGroup; import io.metersphere.commons.constants.ScheduleGroup;
import io.metersphere.commons.constants.ScheduleType; import io.metersphere.commons.constants.ScheduleType;
@ -38,6 +36,10 @@ import java.util.stream.Collectors;
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public class ScheduleService { public class ScheduleService {
@Resource
private TestPlanMapper testPlanMapper;
@Resource
private ApiScenarioMapper apiScenarioMapper;
@Resource @Resource
private ScheduleMapper scheduleMapper; private ScheduleMapper scheduleMapper;
@Resource @Resource
@ -214,8 +216,8 @@ public class ScheduleService {
} }
} }
public List<TaskInfoResult> findRunningTaskInfoByProjectID(String projectID) { public List<TaskInfoResult> findRunningTaskInfoByProjectID(String projectID, List<String> typeFilter) {
List<TaskInfoResult> runningTaskInfoList = extScheduleMapper.findRunningTaskInfoByProjectID(projectID); List<TaskInfoResult> runningTaskInfoList = extScheduleMapper.findRunningTaskInfoByProjectID(projectID, typeFilter);
return runningTaskInfoList; return runningTaskInfoList;
} }
@ -227,13 +229,19 @@ public class ScheduleService {
TriggerKey triggerKey = null; TriggerKey triggerKey = null;
Class clazz = null; Class clazz = null;
if("testPlan".equals(request.getScheduleFrom())){ if("testPlan".equals(request.getScheduleFrom())){
TestPlan testPlan = testPlanMapper.selectByPrimaryKey(request.getResourceId());
schedule.setName(testPlan.getName());
schedule.setProjectId(testPlan.getProjectId());
schedule.setGroup(ScheduleGroup.TEST_PLAN_TEST.name()); schedule.setGroup(ScheduleGroup.TEST_PLAN_TEST.name());
schedule.setType(ScheduleType.CRON.name()); schedule.setType(ScheduleType.CRON.name());
jobKey = TestPlanTestJob.getJobKey(request.getResourceId()); jobKey = TestPlanTestJob.getJobKey(request.getResourceId());
triggerKey = TestPlanTestJob.getTriggerKey(request.getResourceId()); triggerKey = TestPlanTestJob.getTriggerKey(request.getResourceId());
clazz = TestPlanTestJob.class; clazz = TestPlanTestJob.class;
}else { }else { // 实际上在场景中添加定时任务并不会执行到这里?
//默认为情景 //默认为情景
ApiScenarioWithBLOBs apiScene = apiScenarioMapper.selectByPrimaryKey(request.getResourceId());
schedule.setName(apiScene.getName());
schedule.setProjectId(apiScene.getProjectId());
schedule.setGroup(ScheduleGroup.API_SCENARIO_TEST.name()); schedule.setGroup(ScheduleGroup.API_SCENARIO_TEST.name());
schedule.setType(ScheduleType.CRON.name()); schedule.setType(ScheduleType.CRON.name());
jobKey = ApiScenarioTestJob.getJobKey(request.getResourceId()); jobKey = ApiScenarioTestJob.getJobKey(request.getResourceId());

View File

@ -18,6 +18,7 @@ import io.metersphere.track.dto.TestPlanCaseDTO;
import io.metersphere.track.request.testcase.EditTestCaseRequest; import io.metersphere.track.request.testcase.EditTestCaseRequest;
import io.metersphere.track.request.testcase.QueryTestCaseRequest; import io.metersphere.track.request.testcase.QueryTestCaseRequest;
import io.metersphere.track.request.testcase.TestCaseBatchRequest; import io.metersphere.track.request.testcase.TestCaseBatchRequest;
import io.metersphere.track.request.testcase.TestCaseMinderEditRequest;
import io.metersphere.track.request.testplan.FileOperationRequest; import io.metersphere.track.request.testplan.FileOperationRequest;
import io.metersphere.track.request.testplancase.QueryTestPlanCaseRequest; import io.metersphere.track.request.testplancase.QueryTestPlanCaseRequest;
import io.metersphere.track.service.TestCaseService; import io.metersphere.track.service.TestCaseService;
@ -59,6 +60,12 @@ public class TestCaseController {
return testCaseService.listTestCase(request); return testCaseService.listTestCase(request);
} }
@GetMapping("/list/detail/{projectId}")
public List<TestCaseWithBLOBs> listDetail(@PathVariable String projectId) {
checkPermissionService.checkProjectOwner(projectId);
return testCaseService.listTestCaseDetail(projectId);
}
/*jenkins项目下所有接口和性能测试用例*/ /*jenkins项目下所有接口和性能测试用例*/
@GetMapping("/list/method/{projectId}") @GetMapping("/list/method/{projectId}")
public List<TestCaseDTO> listByMethod(@PathVariable String projectId) { public List<TestCaseDTO> listByMethod(@PathVariable String projectId) {
@ -195,4 +202,11 @@ public class TestCaseController {
return testCaseService.addTestCase(testCaseWithBLOBs); return testCaseService.addTestCase(testCaseWithBLOBs);
} }
@PostMapping("/minder/edit")
@RequiresRoles(value = {RoleConstants.TEST_USER, RoleConstants.TEST_MANAGER}, logical = Logical.OR)
public void minderEdit(@RequestBody TestCaseMinderEditRequest request) {
testCaseService.minderEdit(request);
}
} }

View File

@ -37,9 +37,9 @@ public class TestCaseIssuesController {
issuesService.closeLocalIssue(id); issuesService.closeLocalIssue(id);
} }
@GetMapping("/delete/{id}") @PostMapping("/delete")
public void deleteIssue(@PathVariable String id) { public void deleteIssue(@RequestBody IssuesRequest request) {
issuesService.deleteIssue(id); issuesService.deleteIssue(request);
} }
@GetMapping("/tapd/user/{caseId}") @GetMapping("/tapd/user/{caseId}")

View File

@ -87,7 +87,7 @@ public class TrackController {
} }
@GetMapping("/bug/count/{projectId}") @GetMapping("/bug/count/{projectId}")
public BugStatustics getBugStatustics(@PathVariable String projectId) { public BugStatustics getBugStatistics(@PathVariable String projectId) {
return trackService.getBugStatustics(projectId); return trackService.getBugStatistics(projectId);
} }
} }

View File

@ -21,4 +21,10 @@ public class IssuesRequest {
* zentao bug 影响版本 * zentao bug 影响版本
*/ */
private List<String> zentaoBuilds; private List<String> zentaoBuilds;
/**
* issues id
*/
private String id;
private String caseId;
} }

View File

@ -22,4 +22,10 @@ public class QueryTestCaseRequest extends BaseQueryRequest {
private String userId; private String userId;
private String reviewId; private String reviewId;
private boolean isSelectThisWeedData = false;
private String caseCoverage;
private long createTime = 0;
} }

View File

@ -0,0 +1,14 @@
package io.metersphere.track.request.testcase;
import io.metersphere.base.domain.TestCaseWithBLOBs;
import lombok.Getter;
import lombok.Setter;
import java.util.List;
@Getter
@Setter
public class TestCaseMinderEditRequest {
private String projectId;
List<TestCaseWithBLOBs> data;
}

View File

@ -8,7 +8,7 @@ import lombok.Setter;
public class TestPlanBugCount { public class TestPlanBugCount {
private int index; private int index;
private String planName; private String planName;
private long creatTime; private long createTime;
private String status; private String status;
private int caseSize; private int caseSize;
private int bugSize; private int bugSize;

View File

@ -144,20 +144,22 @@ public class TrackStatisticsDTO {
public void countRelevance(List<TrackCountResult> relevanceResults) { public void countRelevance(List<TrackCountResult> relevanceResults) {
for (TrackCountResult countResult : relevanceResults) { for (TrackCountResult countResult : relevanceResults) {
switch (countResult.getGroupField().toUpperCase()){ switch (countResult.getGroupField()){
case TrackCount.API: case TrackCount.API:
this.apiCaseCount += countResult.getCountNumber(); this.apiCaseCount += countResult.getCountNumber();
this.allRelevanceCaseCount += countResult.getCountNumber();
break; break;
case TrackCount.PERFORMANCE: case TrackCount.PERFORMANCE:
this.performanceCaseCount += countResult.getCountNumber(); this.performanceCaseCount += countResult.getCountNumber();
this.allRelevanceCaseCount += countResult.getCountNumber();
break; break;
case TrackCount.AUTOMATION: case TrackCount.AUTOMATION:
this.scenarioCaseCount += countResult.getCountNumber(); this.scenarioCaseCount += countResult.getCountNumber();
this.allRelevanceCaseCount += countResult.getCountNumber();
break; break;
default: default:
break; break;
} }
this.allRelevanceCaseCount += countResult.getCountNumber();
} }
} }

View File

@ -1,10 +1,8 @@
package io.metersphere.track.service; package io.metersphere.track.service;
import io.metersphere.base.domain.Issues; import io.metersphere.base.domain.*;
import io.metersphere.base.domain.Project;
import io.metersphere.base.domain.ServiceIntegration;
import io.metersphere.base.domain.TestCaseWithBLOBs;
import io.metersphere.base.mapper.IssuesMapper; import io.metersphere.base.mapper.IssuesMapper;
import io.metersphere.base.mapper.TestCaseIssuesMapper;
import io.metersphere.commons.constants.IssuesManagePlatform; import io.metersphere.commons.constants.IssuesManagePlatform;
import io.metersphere.commons.constants.NoticeConstants; import io.metersphere.commons.constants.NoticeConstants;
import io.metersphere.commons.user.SessionUser; import io.metersphere.commons.user.SessionUser;
@ -43,6 +41,8 @@ public class IssuesService {
private IssuesMapper issuesMapper; private IssuesMapper issuesMapper;
@Resource @Resource
private NoticeSendService noticeSendService; private NoticeSendService noticeSendService;
@Resource
private TestCaseIssuesMapper testCaseIssuesMapper;
public void testAuth(String platform) { public void testAuth(String platform) {
AbstractIssuePlatform abstractPlatform = IssueFactory.createPlatform(platform, new IssuesRequest()); AbstractIssuePlatform abstractPlatform = IssueFactory.createPlatform(platform, new IssuesRequest());
@ -202,8 +202,14 @@ public class IssuesService {
return platform.getPlatformUser(); return platform.getPlatformUser();
} }
public void deleteIssue(String id) { public void deleteIssue(IssuesRequest request) {
String caseId = request.getCaseId();
String id = request.getId();
issuesMapper.deleteByPrimaryKey(id); issuesMapper.deleteByPrimaryKey(id);
TestCaseIssuesExample example = new TestCaseIssuesExample();
example.createCriteria().andTestCaseIdEqualTo(caseId).andIssuesIdEqualTo(id);
testCaseIssuesMapper.deleteByExample(example);
} }
private static String getIssuesContext(SessionUser user, IssuesRequest issuesRequest, String type) { private static String getIssuesContext(SessionUser user, IssuesRequest issuesRequest, String type) {

View File

@ -212,11 +212,14 @@ public class TestCaseNodeService extends NodeTreeService<TestCaseNodeDTO> {
List<String> caseIds = testCaseReviewTestCases.stream().map(TestCaseReviewTestCase::getCaseId).collect(Collectors.toList()); List<String> caseIds = testCaseReviewTestCases.stream().map(TestCaseReviewTestCase::getCaseId).collect(Collectors.toList());
List<TestCaseNodeDTO> nodeList = getReviewNodeDTO(id, caseIds); List<TestCaseNodeDTO> nodeList = getReviewNodeDTO(id, caseIds);
if (!CollectionUtils.isEmpty(nodeList)) {
TestCaseNodeDTO testCaseNodeDTO = new TestCaseNodeDTO(); TestCaseNodeDTO testCaseNodeDTO = new TestCaseNodeDTO();
testCaseNodeDTO.setName(name); testCaseNodeDTO.setName(name);
testCaseNodeDTO.setLabel(name); testCaseNodeDTO.setLabel(name);
testCaseNodeDTO.setChildren(nodeList); testCaseNodeDTO.setChildren(nodeList);
testCaseNodeDTO.setProjectId(id);
list.add(testCaseNodeDTO); list.add(testCaseNodeDTO);
}
}); });
return list; return list;

View File

@ -5,7 +5,6 @@ import com.alibaba.excel.EasyExcelFactory;
import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONArray;
import com.github.pagehelper.PageHelper; import com.github.pagehelper.PageHelper;
import io.metersphere.api.dto.definition.ApiBatchRequest;
import io.metersphere.base.domain.*; import io.metersphere.base.domain.*;
import io.metersphere.base.mapper.*; import io.metersphere.base.mapper.*;
import io.metersphere.base.mapper.ext.ExtTestCaseMapper; import io.metersphere.base.mapper.ext.ExtTestCaseMapper;
@ -14,10 +13,7 @@ import io.metersphere.commons.constants.TestCaseConstants;
import io.metersphere.commons.constants.TestCaseReviewStatus; import io.metersphere.commons.constants.TestCaseReviewStatus;
import io.metersphere.commons.exception.MSException; import io.metersphere.commons.exception.MSException;
import io.metersphere.commons.user.SessionUser; import io.metersphere.commons.user.SessionUser;
import io.metersphere.commons.utils.BeanUtils; import io.metersphere.commons.utils.*;
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.controller.request.OrderRequest;
import io.metersphere.excel.domain.ExcelErrData; import io.metersphere.excel.domain.ExcelErrData;
import io.metersphere.excel.domain.ExcelResponse; import io.metersphere.excel.domain.ExcelResponse;
@ -32,6 +28,7 @@ import io.metersphere.track.dto.TestCaseDTO;
import io.metersphere.track.request.testcase.EditTestCaseRequest; import io.metersphere.track.request.testcase.EditTestCaseRequest;
import io.metersphere.track.request.testcase.QueryTestCaseRequest; import io.metersphere.track.request.testcase.QueryTestCaseRequest;
import io.metersphere.track.request.testcase.TestCaseBatchRequest; import io.metersphere.track.request.testcase.TestCaseBatchRequest;
import io.metersphere.track.request.testcase.TestCaseMinderEditRequest;
import io.metersphere.xmind.XmindCaseParser; import io.metersphere.xmind.XmindCaseParser;
import org.apache.commons.collections4.ListUtils; import org.apache.commons.collections4.ListUtils;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
@ -188,6 +185,7 @@ public class TestCaseService {
} }
public List<TestCaseDTO> listTestCase(QueryTestCaseRequest request) { public List<TestCaseDTO> listTestCase(QueryTestCaseRequest request) {
this.initRequest(request, true);
List<OrderRequest> orderList = ServiceUtils.getDefaultOrder(request.getOrders()); List<OrderRequest> orderList = ServiceUtils.getDefaultOrder(request.getOrders());
OrderRequest order = new OrderRequest(); OrderRequest order = new OrderRequest();
// 对模板导入的测试用例排序 // 对模板导入的测试用例排序
@ -198,6 +196,25 @@ public class TestCaseService {
return extTestCaseMapper.list(request); return extTestCaseMapper.list(request);
} }
/**
* 初始化部分参数
*
* @param request
* @param checkThisWeekData
* @return
*/
private void initRequest(QueryTestCaseRequest request, boolean checkThisWeekData) {
if (checkThisWeekData) {
if (request.isSelectThisWeedData()) {
Map<String, Date> weekFirstTimeAndLastTime = DateUtils.getWeedFirstTimeAndLastTime(new Date());
Date weekFirstTime = weekFirstTimeAndLastTime.get("firstTime");
if (weekFirstTime != null) {
request.setCreateTime(weekFirstTime.getTime());
}
}
}
}
public List<TestCaseDTO> listTestCaseMthod(QueryTestCaseRequest request) { public List<TestCaseDTO> listTestCaseMthod(QueryTestCaseRequest request) {
return extTestCaseMapper.listByMethod(request); return extTestCaseMapper.listByMethod(request);
} }
@ -705,4 +722,23 @@ public class TestCaseService {
return extTestCaseMapper.list(request); return extTestCaseMapper.list(request);
} }
public List<TestCaseWithBLOBs> listTestCaseDetail(String projectId) {
TestCaseExample testCaseExample = new TestCaseExample();
testCaseExample.createCriteria().andProjectIdEqualTo(projectId);
return testCaseMapper.selectByExampleWithBLOBs(testCaseExample);
}
public void minderEdit(TestCaseMinderEditRequest request) {
List<TestCaseWithBLOBs> data = request.getData();
data.forEach(item -> {
item.setProjectId(request.getProjectId());
if (StringUtils.isBlank(item.getId()) || item.getId().length() < 20) {
item.setId(UUID.randomUUID().toString());
item.setMaintainer(SessionUtils.getUserId());
addTestCase(item);
} else {
editTestCase(item);
}
});
}
} }

View File

@ -57,6 +57,8 @@ import java.util.stream.Collectors;
@Service @Service
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public class TestPlanService { public class TestPlanService {
@Resource
ExtScheduleMapper extScheduleMapper;
@Resource @Resource
TestPlanMapper testPlanMapper; TestPlanMapper testPlanMapper;
@Resource @Resource
@ -179,6 +181,7 @@ public class TestPlanService {
testPlan.setActualEndTime(System.currentTimeMillis()); testPlan.setActualEndTime(System.currentTimeMillis());
} }
} }
extScheduleMapper.updateNameByResourceID(testPlan.getId(), testPlan.getName());// 同步更新该测试的定时任务的name
List<String> userIds = new ArrayList<>(); List<String> userIds = new ArrayList<>();
userIds.add(testPlan.getPrincipal()); userIds.add(testPlan.getPrincipal());

View File

@ -12,6 +12,7 @@ import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource; import javax.annotation.Resource;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.text.DecimalFormat;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Date; import java.util.Date;
import java.util.List; import java.util.List;
@ -110,59 +111,58 @@ public class TrackService {
return charts; return charts;
} }
public BugStatustics getBugStatustics(String projectId) { public BugStatustics getBugStatistics(String projectId) {
TestPlanExample example = new TestPlanExample(); TestPlanExample example = new TestPlanExample();
example.createCriteria().andProjectIdEqualTo(projectId); example.createCriteria().andProjectIdEqualTo(projectId);
List<TestPlan> plans = testPlanMapper.selectByExample(example); List<TestPlan> plans = testPlanMapper.selectByExample(example);
List<TestPlanBugCount> list = new ArrayList<>(); List<TestPlanBugCount> list = new ArrayList<>();
BugStatustics bugStatustics = new BugStatustics(); BugStatustics bugStatustics = new BugStatustics();
int index = 1; int index = 1;
int totalBugSize = 0;
int totalCaseSize = 0;
for (TestPlan plan : plans) { for (TestPlan plan : plans) {
TestPlanBugCount testPlanBug = new TestPlanBugCount(); TestPlanBugCount testPlanBug = new TestPlanBugCount();
testPlanBug.setIndex(index++); testPlanBug.setIndex(index++);
testPlanBug.setPlanName(plan.getName()); testPlanBug.setPlanName(plan.getName());
testPlanBug.setCreatTime(plan.getCreateTime()); testPlanBug.setCreateTime(plan.getCreateTime());
testPlanBug.setStatus(plan.getStatus()); testPlanBug.setStatus(plan.getStatus());
testPlanBug.setCaseSize(getPlanCaseSize(plan.getId()));
testPlanBug.setBugSize(getPlanBugSize(plan.getId())); int planCaseSize = getPlanCaseSize(plan.getId());
testPlanBug.setPassRage(getPlanPassRage(plan.getId())); testPlanBug.setCaseSize(planCaseSize);
int planBugSize = getPlanBugSize(plan.getId());
testPlanBug.setBugSize(planBugSize);
testPlanBug.setPassRage(getPlanPassRage(plan.getId(), planCaseSize));
list.add(testPlanBug); list.add(testPlanBug);
totalBugSize += planBugSize;
totalCaseSize += planCaseSize;
} }
// todo
bugStatustics.setList(list); bugStatustics.setList(list);
bugStatustics.setRage("1"); float rage =totalCaseSize == 0 ? 0 : (float) totalBugSize * 100 / totalCaseSize;
bugStatustics.setBugTotalSize(2); DecimalFormat df = new DecimalFormat("0.0");
bugStatustics.setRage(df.format(rage) + "%");
bugStatustics.setBugTotalSize(totalBugSize);
return bugStatustics; return bugStatustics;
} }
private int getPlanCaseSize(String planId) { private int getPlanCaseSize(String planId) {
TestPlanTestCaseExample testPlanTestCaseExample = new TestPlanTestCaseExample(); return extTestCaseMapper.getTestPlanCase(planId);
testPlanTestCaseExample.createCriteria().andPlanIdEqualTo(planId);
List<TestPlanTestCase> testPlanTestCases = testPlanTestCaseMapper.selectByExample(testPlanTestCaseExample);
TestPlanApiCaseExample testPlanApiCaseExample = new TestPlanApiCaseExample();
testPlanApiCaseExample.createCriteria().andTestPlanIdEqualTo(planId);
List<TestPlanApiCase> testPlanApiCases = testPlanApiCaseMapper.selectByExample(testPlanApiCaseExample);
TestPlanLoadCaseExample example = new TestPlanLoadCaseExample();
example.createCriteria().andTestPlanIdEqualTo(planId);
List<TestPlanLoadCase> testPlanLoadCases = testPlanLoadCaseMapper.selectByExample(example);
TestPlanApiScenarioExample testPlanApiScenarioExample = new TestPlanApiScenarioExample();
testPlanApiCaseExample.createCriteria().andTestPlanIdEqualTo(planId);
List<TestPlanApiScenario> testPlanApiScenarios = testPlanApiScenarioMapper.selectByExample(testPlanApiScenarioExample);
return testPlanTestCases.size() + testPlanApiCases.size() + testPlanLoadCases.size() + testPlanApiScenarios.size();
} }
private int getPlanBugSize(String planId) { private int getPlanBugSize(String planId) {
return 1; return extTestCaseMapper.getTestPlanBug(planId);
} }
private String getPlanPassRage(String planId) { private String getPlanPassRage(String planId, int totalSize) {
return "10%"; if (totalSize == 0) {
return "-";
}
int passSize = extTestCaseMapper.getTestPlanPassCase(planId);
float rage = (float) passSize * 100 / totalSize;
DecimalFormat df = new DecimalFormat("0.0");
return df.format(rage) + "%";
} }
} }

View File

@ -102,3 +102,48 @@ update api_scenario set original_state='Underway';
-- alter test_case_review_scenario -- alter test_case_review_scenario
alter table test_case_review_scenario modify environment longtext null; alter table test_case_review_scenario modify environment longtext null;
-- schedule table add project_id column
alter table schedule add project_id varchar(50) NULL;
-- set values for new colums of exitsting data
update schedule sch inner join test_plan testPlan on
testPlan.id = sch.resource_id
set sch.project_id = testPlan.project_id where
sch.resource_id = testPlan.id;
update schedule sch inner join swagger_url_project sup on
sup.id = sch.resource_id
set sch.project_id = sup.project_id where
sch.resource_id = sup.id;
update schedule sch inner join api_scenario apiScene on
apiScene.id = sch.resource_id
set sch.project_id = apiScene.project_id where
sch.resource_id = apiScene.id;
update schedule sch inner join load_test ldt on
ldt.id = sch.resource_id
set sch.project_id = ldt.project_id where
sch.resource_id = ldt.id;
update schedule sch inner join api_test apiTest on
apiTest.id = sch.resource_id
set sch.project_id = apiTest.project_id where
sch.resource_id = apiTest.id;
-- schedule table add name column
alter table schedule add name varchar(100) NULL;
-- set values for new colums of exitsting data
update schedule sch inner join api_scenario apiScene on
apiScene.id = sch.resource_id
set sch.name = apiScene.name;
update schedule sch inner join test_plan testPlan on
testPlan.id = sch.resource_id
set sch.name = testPlan.name;
update schedule sch inner join load_test ldt on
ldt.id = sch.resource_id
set sch.name = ldt.name;
update schedule sch inner join api_test apiTest on
apiTest.id = sch.resource_id
set sch.name = apiTest.name;
update schedule sch inner join swagger_url_project sup on
sup.id = sch.resource_id
set sch.name = LEFT(SUBSTRING_INDEX(sup.swagger_url, '/', 3), 100);
-- delete an unused colum
alter table schedule drop column custom_data;

View File

@ -31,7 +31,7 @@ import MsView from "./components/common/router/View";
import MsUser from "./components/common/head/HeaderUser"; import MsUser from "./components/common/head/HeaderUser";
import MsHeaderOrgWs from "./components/common/head/HeaderOrgWs"; import MsHeaderOrgWs from "./components/common/head/HeaderOrgWs";
import MsLanguageSwitch from "./components/common/head/LanguageSwitch"; import MsLanguageSwitch from "./components/common/head/LanguageSwitch";
import {hasLicense, saveLocalStorage, setColor, setOriginColor} from "@/common/js/utils"; import {hasLicense, saveLocalStorage, setColor, setDefaultTheme} from "@/common/js/utils";
import {registerRequestHeaders} from "@/common/js/ajax"; import {registerRequestHeaders} from "@/common/js/ajax";
import {ORIGIN_COLOR} from "@/common/js/constants"; import {ORIGIN_COLOR} from "@/common/js/constants";
@ -55,13 +55,14 @@ export default {
created() { created() {
registerRequestHeaders(); registerRequestHeaders();
if (!hasLicense()) { if (!hasLicense()) {
setOriginColor() setDefaultTheme();
this.color = ORIGIN_COLOR; this.color = ORIGIN_COLOR;
} else { } else {
// //
this.$get('/system/theme', res => { this.$get('/system/theme', res => {
this.color = res.data ? res.data : ORIGIN_COLOR; this.color = res.data ? res.data : ORIGIN_COLOR;
setColor(this.color, this.color, this.color, this.color); setColor(this.color, this.color, this.color, this.color, this.color);
this.$store.commit('setTheme', res.data);
}) })
} }
if (localStorage.getItem("store")) { if (localStorage.getItem("store")) {

View File

@ -114,12 +114,13 @@
<el-col :span="3" class="ms-col-one ms-font"> <el-col :span="3" class="ms-col-one ms-font">
<el-checkbox v-model="enableCookieShare">共享cookie</el-checkbox> <el-checkbox v-model="enableCookieShare">共享cookie</el-checkbox>
</el-col> </el-col>
<el-col :span="7"> <el-col :span="6">
<env-popover :env-map="projectEnvMap" :project-ids="projectIds" @setProjectEnvMap="setProjectEnvMap" <env-popover :env-map="projectEnvMap" :project-ids="projectIds" @setProjectEnvMap="setProjectEnvMap"
:project-list="projectList" ref="envPopover"/> :project-list="projectList" ref="envPopover"/>
</el-col> </el-col>
<el-col :span="2"> <el-col :span="3">
<el-button :disabled="scenarioDefinition.length < 1" size="small" type="primary" v-prevent-re-click @click="runDebug">{{$t('api_test.request.debug')}}</el-button> <el-button :disabled="scenarioDefinition.length < 1" size="small" type="primary" v-prevent-re-click @click="runDebug">{{$t('api_test.request.debug')}}</el-button>
<font-awesome-icon class="alt-ico" :icon="['fa', 'expand-alt']" size="lg" @click="fullScreen"/>
</el-col> </el-col>
</el-row> </el-row>
</div> </div>
@ -192,6 +193,17 @@
class="ms-sc-variable-header"/> class="ms-sc-variable-header"/>
<!--外部导入--> <!--外部导入-->
<api-import v-if="type!=='detail'" ref="apiImport" :saved="false" @refresh="apiImport"/> <api-import v-if="type!=='detail'" ref="apiImport" :saved="false" @refresh="apiImport"/>
<!--步骤最大化-->
<ms-drawer :visible="drawer" :size="100" @close="close" direction="right" :show-full-screen="false" :is-show-close="false" style="overflow: hidden">
<template v-slot:header>
<scenario-header :currentScenario="currentScenario" :projectEnvMap="projectEnvMap" :projectIds="projectIds" :projectList="projectList" :scenarioDefinition="scenarioDefinition" :enableCookieShare="enableCookieShare"
@closePage="close" @showAllBtn="showAllBtn" @runDebug="runDebug" @showScenarioParameters="showScenarioParameters" ref="maximizeHeader"/>
</template>
<maximize-scenario :scenario-definition="scenarioDefinition" :moduleOptions="moduleOptions" :currentScenario="currentScenario" :type="type" ref="maximizeScenario"/>
</ms-drawer>
</div> </div>
</el-card> </el-card>
</template> </template>
@ -224,6 +236,9 @@
import MsComponentConfig from "./component/ComponentConfig"; import MsComponentConfig from "./component/ComponentConfig";
import {handleCtrlSEvent} from "../../../../../common/js/utils"; import {handleCtrlSEvent} from "../../../../../common/js/utils";
import EnvPopover from "@/business/components/api/automation/scenario/EnvPopover"; import EnvPopover from "@/business/components/api/automation/scenario/EnvPopover";
import MaximizeScenario from "./maximize/MaximizeScenario";
import ScenarioHeader from "./maximize/ScenarioHeader";
import MsDrawer from "../../../common/components/MsDrawer";
let jsonPath = require('jsonpath'); let jsonPath = require('jsonpath');
export default { export default {
@ -243,7 +258,10 @@
MsApiCustomize, MsApiCustomize,
ApiImport, ApiImport,
MsComponentConfig, MsComponentConfig,
EnvPopover EnvPopover,
MaximizeScenario,
ScenarioHeader,
MsDrawer
}, },
data() { data() {
return { return {
@ -293,6 +311,7 @@
projectEnvMap: new Map, projectEnvMap: new Map,
projectList: [], projectList: [],
debugResult: new Map, debugResult: new Map,
drawer: false,
} }
}, },
created() { created() {
@ -423,6 +442,9 @@
} }
}, },
methods: { methods: {
showAllBtn() {
this.$refs.maximizeScenario.showAll();
},
addListener() { addListener() {
document.addEventListener("keydown", this.createCtrlSHandle); document.addEventListener("keydown", this.createCtrlSHandle);
// document.addEventListener("keydown", (even => handleCtrlSEvent(even, this.$refs.httpApi.saveApi))); // document.addEventListener("keydown", (even => handleCtrlSEvent(even, this.$refs.httpApi.saveApi)));
@ -443,6 +465,7 @@
// //
this.editScenario(); this.editScenario();
} }
this.$refs.maximizeHeader.getVariableSize();
this.reload(); this.reload();
}, },
showButton(...names) { showButton(...names) {
@ -697,8 +720,7 @@
} }
this.sort(); this.sort();
this.reload(); this.reload();
} },
,
reload() { reload() {
this.loading = true this.loading = true
this.$nextTick(() => { this.$nextTick(() => {
@ -1046,7 +1068,14 @@
// //
this.debugResult = result; this.debugResult = result;
this.sort() this.sort()
},
fullScreen() {
this.drawer = true;
},
close() {
this.drawer = false;
} }
} }
} }
</script> </script>
@ -1112,7 +1141,7 @@
} }
/deep/ .el-card__body { /deep/ .el-card__body {
padding: 15px; padding: 10px;
} }
/deep/ .el-drawer__body { /deep/ .el-drawer__body {
@ -1182,4 +1211,17 @@
.ms-sc-variable-header >>> .el-dialog__body { .ms-sc-variable-header >>> .el-dialog__body {
padding: 0px 20px; padding: 0px 20px;
} }
.alt-ico {
font-size: 15px;
margin: 0px 10px 0px;
color: #8c939d;
}
.alt-ico:hover {
color: black;
cursor: pointer;
font-size: 18px;
}
</style> </style>

View File

@ -16,6 +16,9 @@ export const ELEMENTS = new Map([
['Extract', []], ['Extract', []],
['JmeterElement', []], ['JmeterElement', []],
['CustomizeReq', ["ConstantTimer", "JSR223PreProcessor", "JSR223PostProcessor", "Assertions", "Extract"]], ['CustomizeReq', ["ConstantTimer", "JSR223PreProcessor", "JSR223PostProcessor", "Assertions", "Extract"]],
['MaxSamplerProxy', ["JSR223PreProcessor", "JSR223PostProcessor", "Assertions", "Extract"]],
['AllSamplerProxy', ["HTTPSamplerProxy", "DubboSampler", "JDBCSampler", "TCPSampler"]],
]) ])
export const ELEMENT_TYPE = { export const ELEMENT_TYPE = {

View File

@ -1,47 +1,46 @@
<template> <template>
<el-card class="api-component"> <el-card class="api-component">
<div class="header" @click="active(data)"> <div class="header" @click="active(data)">
<slot name="beforeHeaderLeft"> <slot name="beforeHeaderLeft">
<div v-if="data.index" class="el-step__icon is-text" style="margin-right: 10px;" :style="{'color': color, 'background-color': backgroundColor}"> <div v-if="data.index" class="el-step__icon is-text" style="margin-right: 10px;" :style="{'color': color, 'background-color': backgroundColor}">
<div class="el-step__icon-inner">{{data.index}}</div> <div class="el-step__icon-inner">{{data.index}}</div>
</div> </div>
<el-button class="ms-left-buttion" size="small" :style="{'color': color, 'background-color': backgroundColor}">{{title}}</el-button> <el-button class="ms-left-buttion" size="mini" :style="{'color': color, 'background-color': backgroundColor}">{{title}}</el-button>
<el-tag size="mini" v-if="data.method">{{data.method}}</el-tag>
</slot> </slot>
<span @click.stop> <span @click.stop>
<slot name="headerLeft"> <slot name="headerLeft">
<i class="icon el-icon-arrow-right" :class="{'is-active': data.active}" <i class="icon el-icon-arrow-right" :class="{'is-active': data.active}"
@click="active(data)" v-if="data.type!='scenario'"/> @click="active(data)" v-if="data.type!='scenario' && !isMax "/>
<el-input :draggable="draggable" v-if="isShowInput && isShowNameInput" size="small" v-model="data.name" class="name-input" <el-input :draggable="draggable" v-if="isShowInput && isShowNameInput" size="mini" v-model="data.name" class="name-input"
@blur="isShowInput = false" :placeholder="$t('commons.input_name')" ref="nameEdit" :disabled="data.disabled"/> @blur="isShowInput = false" :placeholder="$t('commons.input_name')" ref="nameEdit" :disabled="data.disabled"/>
<span v-else-if="isMax">
<el-tooltip :content="data.name" placement="top">
<span>{{data.name}}</span>
</el-tooltip>
</span>
<span v-else> <span v-else>
{{data.name}} {{data.name}}
<i class="el-icon-edit" style="cursor:pointer" @click="editName" v-tester v-if="data.referenced!='REF' && !data.disabled"/> <i class="el-icon-edit" style="cursor:pointer" @click="editName" v-tester v-if="data.referenced!='REF' && !data.disabled"/>
</span> </span>
</slot> </slot>
<slot name="behindHeaderLeft"></slot> <slot name="behindHeaderLeft" v-if="!isMax"></slot>
</span> </span>
<div class="header-right" @click.stop> <div class="header-right" @click.stop>
<slot name="message"></slot> <slot name="message"></slot>
<el-tooltip :content="$t('test_resource_pool.enable_disable')" placement="top"> <el-tooltip :content="$t('test_resource_pool.enable_disable')" placement="top" v-if="showBtn">
<el-switch v-model="data.enable" class="enable-switch"/> <el-switch v-model="data.enable" class="enable-switch"/>
</el-tooltip> </el-tooltip>
<slot name="button"></slot> <slot name="button"></slot>
<el-tooltip content="Copy" placement="top"> <step-extend-btns style="display: contents" @copy="copyRow" @remove="remove" v-if="showBtn"/>
<el-button size="mini" icon="el-icon-copy-document" circle @click="copyRow" :disabled="data && data.disabled"/>
</el-tooltip>
<el-tooltip :content="$t('commons.remove')" placement="top">
<el-button size="mini" icon="el-icon-delete" type="danger" circle @click="remove" :disabled="data && data.disabled"/>
</el-tooltip>
</div> </div>
</div> </div>
<div class="header"> <div class="header" v-if="!isMax">
<fieldset :disabled="data.disabled" class="ms-fieldset"> <fieldset :disabled="data.disabled" class="ms-fieldset">
<el-collapse-transition> <el-collapse-transition>6.
<div v-if="data.active && showCollapse" :draggable="draggable"> <div v-if="data.active && showCollapse" :draggable="draggable">
<el-divider></el-divider> <el-divider></el-divider>
<slot></slot> <slot></slot>
@ -54,8 +53,11 @@
</template> </template>
<script> <script>
import StepExtendBtns from "../component/StepExtendBtns";
export default { export default {
name: "ApiBaseComponent", name: "ApiBaseComponent",
components: {StepExtendBtns},
data() { data() {
return { return {
isShowInput: false isShowInput: false
@ -63,6 +65,14 @@
}, },
props: { props: {
draggable: Boolean, draggable: Boolean,
isMax: {
type: Boolean,
default: false,
},
showBtn: {
type: Boolean,
default: true,
},
data: { data: {
type: Object, type: Object,
default() { default() {
@ -104,6 +114,9 @@
this.$refs.nameEdit.focus(); this.$refs.nameEdit.focus();
}); });
} }
if (this.data && this.data.type === "JmeterElement") {
this.data.active = false;
}
}, },
methods: { methods: {
active() { active() {
@ -146,14 +159,26 @@
} }
.header-right { .header-right {
margin-right: 20px; margin-top: 5px;
float: right; float: right;
z-index: 1;
} }
.enable-switch { .enable-switch {
margin-right: 10px; margin-right: 10px;
} }
.node-title {
display: inline-block;
margin: 0px;
overflow-x: hidden;
padding-bottom: 0;
text-overflow: ellipsis;
vertical-align: middle;
white-space: nowrap;
width: 100px;
}
fieldset { fieldset {
padding: 0px; padding: 0px;
margin: 0px; margin: 0px;

View File

@ -9,6 +9,8 @@
:draggable="true" :draggable="true"
:color="displayColor.color" :color="displayColor.color"
:background-color="displayColor.backgroundColor" :background-color="displayColor.backgroundColor"
:is-max="isMax"
:show-btn="showBtn"
:title="displayTitle"> :title="displayTitle">
<template v-slot:behindHeaderLeft> <template v-slot:behindHeaderLeft>
@ -71,6 +73,7 @@
import ApiBaseComponent from "../common/ApiBaseComponent"; import ApiBaseComponent from "../common/ApiBaseComponent";
import ApiResponseComponent from "./ApiResponseComponent"; import ApiResponseComponent from "./ApiResponseComponent";
import CustomizeReqInfo from "@/business/components/api/automation/scenario/common/CustomizeReqInfo"; import CustomizeReqInfo from "@/business/components/api/automation/scenario/common/CustomizeReqInfo";
import {ELEMENTS} from "../Setting";
export default { export default {
name: "MsApiComponent", name: "MsApiComponent",
@ -82,6 +85,14 @@
type: Boolean, type: Boolean,
default: false, default: false,
}, },
isMax: {
type: Boolean,
default: false,
},
showBtn: {
type: Boolean,
default: true,
},
currentEnvironmentId: String, currentEnvironmentId: String,
projectList: Array, projectList: Array,
envMap: Map envMap: Map
@ -122,6 +133,11 @@
} }
} }
} }
// if (this.isMax && this.request && ELEMENTS.get("AllSamplerProxy").indexOf(this.request.type) != -1
// && this.request.hashTree && this.request.hashTree != null && this.request.hashTree.length > 0) {
// this.request.hashTrees = JSON.parse(JSON.stringify(this.request.hashTree));
// this.request.hashTree = undefined;
// }
}, },
computed: { computed: {
displayColor() { displayColor() {
@ -220,6 +236,12 @@
if (!this.request.projectId) { if (!this.request.projectId) {
this.request.projectId = response.data.projectId; this.request.projectId = response.data.projectId;
} }
// if (this.isMax && this.request && ELEMENTS.get("AllSamplerProxy").indexOf(this.request.type) != -1) {
// this.request.hashTrees = [];
// Object.assign(this.request.hashTrees, this.request.hashTree);
// this.request.hashTree = [];
// }
this.reload(); this.reload();
this.sort(); this.sort();
} else { } else {

View File

@ -8,6 +8,8 @@
:show-collapse="false" :show-collapse="false"
:is-show-name-input="!isDeletedOrRef" :is-show-name-input="!isDeletedOrRef"
:is-disabled="true" :is-disabled="true"
:is-max="isMax"
:show-btn="showBtn"
color="#606266" color="#606266"
background-color="#F4F4F5" background-color="#F4F4F5"
:title="$t('api_test.automation.scenario_import')"> :title="$t('api_test.automation.scenario_import')">
@ -36,6 +38,14 @@
props: { props: {
scenario: {}, scenario: {},
node: {}, node: {},
isMax: {
type: Boolean,
default: false,
},
showBtn: {
type: Boolean,
default: true,
},
draggable: { draggable: {
type: Boolean, type: Boolean,
default: false, default: false,

View File

@ -1,6 +1,7 @@
<template> <template>
<div class="request-form"> <div class="request-form">
<component :is="component" :scenario="scenario" :controller="scenario" :timer="scenario" :assertions="scenario" :extract="scenario" :jsr223-processor="scenario" :request="scenario" :currentScenario="currentScenario" :currentEnvironmentId="currentEnvironmentId" :node="node" <component :is="component" :isMax="isMax" :show-btn="showBtn"
:scenario="scenario" :controller="scenario" :timer="scenario" :assertions="scenario" :extract="scenario" :jsr223-processor="scenario" :request="scenario" :currentScenario="currentScenario" :currentEnvironmentId="currentEnvironmentId" :node="node"
:draggable="true" :title="title" :color="titleColor" :background-color="backgroundColor" @suggestClick="suggestClick(node)" :response="response" :draggable="true" :title="title" :color="titleColor" :background-color="backgroundColor" @suggestClick="suggestClick(node)" :response="response"
@remove="remove" @copyRow="copyRow" @refReload="refReload" :project-list="projectList" :env-map="envMap"/> @remove="remove" @copyRow="copyRow" @refReload="refReload" :project-list="projectList" :env-map="envMap"/>
</div> </div>
@ -24,6 +25,14 @@
props: { props: {
type: String, type: String,
scenario: {}, scenario: {},
isMax: {
type: Boolean,
default: false,
},
showBtn: {
type: Boolean,
default: true,
},
currentScenario: {}, currentScenario: {},
currentEnvironmentId: String, currentEnvironmentId: String,
response: {}, response: {},

View File

@ -5,6 +5,7 @@
:data="timer" :data="timer"
:draggable="true" :draggable="true"
:show-collapse="false" :show-collapse="false"
:is-max="isMax"
color="#67C23A" color="#67C23A"
background-color="#F2F9EE" background-color="#F2F9EE"
:title="$t('api_test.automation.wait_controller')"> :title="$t('api_test.automation.wait_controller')">
@ -26,6 +27,14 @@
props: { props: {
timer: {}, timer: {},
node: {}, node: {},
isMax: {
type: Boolean,
default: false,
},
showBtn: {
type: Boolean,
default: true,
},
draggable: { draggable: {
type: Boolean, type: Boolean,
default: false, default: false,

View File

@ -5,6 +5,8 @@
:data="controller" :data="controller"
:show-collapse="false" :show-collapse="false"
:draggable="true" :draggable="true"
:is-max="isMax"
:show-btn="showBtn"
color="#E6A23C" color="#E6A23C"
background-color="#FCF6EE" background-color="#FCF6EE"
:title="$t('api_test.automation.if_controller')"> :title="$t('api_test.automation.if_controller')">
@ -33,6 +35,14 @@
props: { props: {
controller: {}, controller: {},
node: {}, node: {},
isMax: {
type: Boolean,
default: false,
},
showBtn: {
type: Boolean,
default: true,
},
index: Object, index: Object,
draggable: { draggable: {
type: Boolean, type: Boolean,

View File

@ -5,6 +5,8 @@
:data="request" :data="request"
:draggable="draggable" :draggable="draggable"
:color="defColor" :color="defColor"
:is-max="isMax"
:show-btn="showBtn"
:background-color="defBackgroundColor" :background-color="defBackgroundColor"
:title="request.elementType"> :title="request.elementType">
@ -31,6 +33,14 @@
default: default:
false false
}, },
isMax: {
type: Boolean,
default: false,
},
showBtn: {
type: Boolean,
default: true,
},
request: { request: {
type: Object, type: Object,
}, },

View File

@ -6,6 +6,8 @@
:data="jsr223Processor" :data="jsr223Processor"
:draggable="draggable" :draggable="draggable"
:color="color" :color="color"
:is-max="isMax"
:show-btn="showBtn"
:background-color="backgroundColor" :background-color="backgroundColor"
:title="title" v-loading="loading"> :title="title" v-loading="loading">
@ -33,6 +35,14 @@ export default {
type: Boolean, type: Boolean,
default: false, default: false,
}, },
isMax: {
type: Boolean,
default: false,
},
showBtn: {
type: Boolean,
default: true,
},
isReadOnly: { isReadOnly: {
type: Boolean, type: Boolean,
default: default:

View File

@ -7,12 +7,14 @@
@remove="remove" @remove="remove"
:data="controller" :data="controller"
:draggable="true" :draggable="true"
:is-max="isMax"
:show-btn="showBtn"
color="#02A7F0" color="#02A7F0"
background-color="#F4F4F5" background-color="#F4F4F5"
:title="$t('api_test.automation.loop_controller')" v-loading="loading"> :title="$t('api_test.automation.loop_controller')" v-loading="loading">
<template v-slot:headerLeft> <template v-slot:headerLeft>
<i class="icon el-icon-arrow-right" :class="{'is-active': controller.active}" @click="active(controller)" style="margin-right: 10px"/> <i class="icon el-icon-arrow-right" :class="{'is-active': controller.active}" @click="active(controller)" style="margin-right: 10px" v-if="!isMax"/>
<el-radio @change="changeRadio" class="ms-radio" v-model="controller.loopType" label="LOOP_COUNT">{{$t('loop.loops_title')}}</el-radio> <el-radio @change="changeRadio" class="ms-radio" v-model="controller.loopType" label="LOOP_COUNT">{{$t('loop.loops_title')}}</el-radio>
<el-radio @change="changeRadio" class="ms-radio" v-model="controller.loopType" label="FOREACH">{{$t('loop.foreach')}}</el-radio> <el-radio @change="changeRadio" class="ms-radio" v-model="controller.loopType" label="FOREACH">{{$t('loop.foreach')}}</el-radio>
<el-radio @change="changeRadio" class="ms-radio" v-model="controller.loopType" label="WHILE">{{$t('loop.while')}}</el-radio> <el-radio @change="changeRadio" class="ms-radio" v-model="controller.loopType" label="WHILE">{{$t('loop.while')}}</el-radio>
@ -97,6 +99,14 @@ export default {
currentEnvironmentId: String, currentEnvironmentId: String,
currentScenario: {}, currentScenario: {},
node: {}, node: {},
isMax: {
type: Boolean,
default: false,
},
showBtn: {
type: Boolean,
default: true,
},
index: Object, index: Object,
draggable: { draggable: {
type: Boolean, type: Boolean,

View File

@ -0,0 +1,98 @@
<template>
<div>
<el-dropdown @command="handleCommand" class="scenario-ext-btn">
<el-link type="primary" :underline="false">
<el-icon class="el-icon-more"></el-icon>
</el-link>
<el-dropdown-menu slot="dropdown">
<el-dropdown-item command="copy">复制步骤</el-dropdown-item>
<el-dropdown-item command="remove" v-tester>删除步骤</el-dropdown-item>
<el-dropdown-item command="scenarioVar" v-tester>查看场景变量</el-dropdown-item>
<el-dropdown-item command="openScenario" v-tester>打开场景</el-dropdown-item>
<el-dropdown-item command="saveAs" v-tester>另存为接口定义</el-dropdown-item>
<!--<el-tooltip content="Copy" placement="top">-->
<!--<el-button size="mini" icon="el-icon-copy-document" circle @click="copyRow" :disabled="data && data.disabled"/>-->
<!--</el-tooltip>-->
<!--<el-tooltip :content="$t('commons.remove')" placement="top">-->
<!--<el-button size="mini" icon="el-icon-delete" type="danger" circle @click="remove" :disabled="data && data.disabled"/>-->
<!--</el-tooltip>-->
</el-dropdown-menu>
</el-dropdown>
<ms-reference-view @openScenario="openScenario" ref="viewRef"/>
<ms-schedule-maintain ref="scheduleMaintain" @refreshTable="refreshTable"/>
</div>
</template>
<script>
import MsReferenceView from "@/business/components/api/automation/scenario/ReferenceView";
import MsScheduleMaintain from "@/business/components/api/automation/schedule/ScheduleMaintain"
import {getCurrentProjectID, getUUID} from "@/common/js/utils";
export default {
name: "StepExtendBtns",
components: {MsReferenceView, MsScheduleMaintain},
props: {
row: Object
},
methods: {
handleCommand(cmd) {
switch (cmd) {
case "copy":
this.$emit('copy');
break;
case "remove":
this.$emit('remove');
break;
case "scenarioVar":
this.$emit('copy');
break;
case "openScenario":
this.$emit('copy');
break;
case "saveAs":
this.$emit('copy');
break;
}
},
createPerformance(row) {
this.infoDb = false;
let url = "/api/automation/genPerformanceTestJmx";
let run = {};
let scenarioIds = [];
scenarioIds.push(row.id);
run.projectId = getCurrentProjectID();
run.ids = scenarioIds;
run.id = getUUID();
run.name = row.name;
this.$post(url, run, response => {
let jmxObj = {};
jmxObj.name = response.data.name;
jmxObj.xml = response.data.xml;
jmxObj.attachFiles = response.data.attachFiles;
jmxObj.attachByteFiles = response.data.attachByteFiles;
this.$store.commit('setTest', {
name: row.name,
jmx: jmxObj
})
this.$router.push({
path: "/performance/test/create"
})
});
},
openScenario(item) {
this.$emit('openScenario', item)
},
refreshTable() {
}
}
}
</script>
<style scoped>
.scenario-ext-btn {
margin-left: 10px;
}
</style>

View File

@ -0,0 +1,146 @@
<template>
<div class="ms-header" @click="showAll">
<el-row>
<div class="ms-div" v-loading="loading">
<!-- 调试部分 -->
<el-row style="margin: 5px">
<el-col :span="6" class="ms-col-one ms-font">
{{$t('api_test.automation.step_total')}}{{scenarioDefinition.length}}
</el-col>
<el-col :span="6" class="ms-col-one ms-font">
<el-link class="head" @click="showScenarioParameters">{{$t('api_test.automation.scenario_total')}}</el-link>
{{varSize }}
</el-col>
<el-col :span="5" class="ms-col-one ms-font">
<el-checkbox v-model="enableCookieShare">共享cookie</el-checkbox>
</el-col>
<el-col :span="7">
<env-popover :env-map="envMap" :project-ids="projectIds" @setProjectEnvMap="setProjectEnvMap"
:project-list="projectList" ref="envPopover" style="margin-top: 0px"/>
</el-col>
</el-row>
</div>
<div class="ms-header-right">
<el-button :disabled="scenarioDefinition.length < 1" size="small" type="primary" v-prevent-re-click @click="runDebug">{{$t('api_test.request.debug')}}</el-button>
<i class="el-icon-close alt-ico" @click="close"/>
</div>
</el-row>
</div>
</template>
<script>
import {checkoutTestManagerOrTestUser, exportPdf} from "@/common/js/utils";
import html2canvas from 'html2canvas';
import EnvPopover from "../../scenario/EnvPopover";
export default {
name: "ScenarioHeader",
components: {EnvPopover},
props: {currentScenario: {}, scenarioDefinition: Array, enableCookieShare: Boolean, projectEnvMap: Map, projectIds: Set, projectList: Array},
data() {
return {
envMap: new Map,
loading: false,
varSize: 0,
}
},
mounted() {
this.envMap = this.projectEnvMap;
this.getVariableSize();
},
methods: {
handleExport() {
let name = this.$t('commons.report_statistics.test_case_analysis');
this.$nextTick(function () {
setTimeout(() => {
html2canvas(document.getElementById('reportAnalysis'), {
scale: 2
}).then(function (canvas) {
exportPdf(name, [canvas]);
});
}, 1000);
});
},
showAll() {
this.$emit('showAllBtn');
},
close() {
this.$emit('closePage');
},
runDebug() {
this.$emit('runDebug');
},
showScenarioParameters() {
this.$emit('showScenarioParameters');
},
getVariableSize() {
let size = 0;
if (this.currentScenario.variables) {
size += this.currentScenario.variables.length;
}
if (this.currentScenario.headers && this.currentScenario.headers.length > 1) {
size += this.currentScenario.headers.length - 1;
}
this.varSize = size;
this.reload();
},
reload() {
this.loading = true
this.$nextTick(() => {
this.loading = false
})
},
setProjectEnvMap(projectEnvMap) {
this.envMap = projectEnvMap;
}
},
}
</script>
<style scoped>
.ms-header {
border-bottom: 1px solid #E6E6E6;
height: 65px;
background-color: #FFF;
}
.ms-div {
float: left;
width: 80%;
margin-left: 20px;
margin-top: 12px;
}
.ms-span {
margin: 0px 10px 10px;
}
.ms-header-right {
float: right;
margin-bottom: 10px;
margin-top: 10px;
margin-right: 20px;
}
.alt-ico {
font-size: 18px;
margin: 10px 0px 0px;
}
.alt-ico:hover {
color: black;
cursor: pointer;
font-size: 18px;
}
.ms-font {
color: #303133;
font-family: "Helvetica Neue", Helvetica, "PingFang SC", "Hiragino Sans GB", Arial, sans-serif;
font-size: 13px;
}
.ms-col-one {
margin-top: 5px;
}
</style>

View File

@ -3,21 +3,14 @@
<span class="kv-description" v-if="description"> <span class="kv-description" v-if="description">
{{ description }} {{ description }}
</span> </span>
<el-dropdown> <el-row>
<span class="el-dropdown-link"> <el-checkbox v-model="isSelectAll" v-if="items.length > 1"/>
{{ $t('api_test.select_or_invert') }} <i class="el-icon-arrow-down el-icon--right"></i> </el-row>
</span>
<el-dropdown-menu slot="dropdown">
<el-dropdown-item @click.native="selectAll">{{ $t('api_test.select_all') }}</el-dropdown-item>
<el-dropdown-item @click.native="invertSelect">{{ $t('api_test.invert_select') }}</el-dropdown-item>
</el-dropdown-menu>
</el-dropdown>
<div class="kv-row item" v-for="(item, index) in items" :key="index"> <div class="kv-row item" v-for="(item, index) in items" :key="index">
<el-row type="flex" :gutter="20" justify="space-between" align="middle"> <el-row type="flex" :gutter="20" justify="space-between" align="middle">
<el-col class="kv-checkbox" v-if="isShowEnable"> <el-col class="kv-checkbox" v-if="isShowEnable">
<input type="checkbox" v-if="!isDisable(index)" v-model="item.enable" <el-checkbox v-if="!isDisable(index)" v-model="item.enable"
:disabled="isReadOnly"/> :disabled="isReadOnly"/>
</el-col> </el-col>
<span style="margin-left: 10px" v-else></span> <span style="margin-left: 10px" v-else></span>
@ -59,7 +52,7 @@
valuePlaceholder: String, valuePlaceholder: String,
isShowEnable: { isShowEnable: {
type: Boolean, type: Boolean,
default: false default: true
}, },
description: String, description: String,
items: Array, items: Array,
@ -73,6 +66,7 @@
return { return {
keyValues: [], keyValues: [],
loading: false, loading: false,
isSelectAll: true
} }
}, },
computed: { computed: {
@ -83,7 +77,15 @@
return this.valuePlaceholder || this.$t("api_test.value"); return this.valuePlaceholder || this.$t("api_test.value");
} }
}, },
watch: {
isSelectAll: function(to, from) {
if(from == false && to == true) {
this.selectAll();
} else if(from == true && to == false) {
this.invertSelect();
}
}
},
methods: { methods: {
moveBottom(index) { moveBottom(index) {
if (this.items.length < 2 || index === this.items.length - 2) { if (this.items.length < 2 || index === this.items.length - 2) {
@ -154,7 +156,7 @@
}, },
invertSelect() { invertSelect() {
this.items.forEach(item => { this.items.forEach(item => {
item.enable = !item.enable; item.enable = false;
}); });
}, },
}, },

View File

@ -3,19 +3,13 @@
<span class="kv-description" v-if="description"> <span class="kv-description" v-if="description">
{{ description }} {{ description }}
</span> </span>
<el-dropdown> <el-row>
<span class="el-dropdown-link"> <el-checkbox v-model="isSelectAll" v-if="parameters.length > 1"/>
{{ $t('api_test.select_or_invert') }} <i class="el-icon-arrow-down el-icon--right"></i> </el-row>
</span>
<el-dropdown-menu slot="dropdown">
<el-dropdown-item @click.native="selectAll">{{ $t('api_test.select_all') }}</el-dropdown-item>
<el-dropdown-item @click.native="invertSelect">{{ $t('api_test.invert_select') }}</el-dropdown-item>
</el-dropdown-menu>
</el-dropdown>
<div class="item kv-row" v-for="(item, index) in parameters" :key="index"> <div class="item kv-row" v-for="(item, index) in parameters" :key="index">
<el-row type="flex" :gutter="20" justify="space-between" align="middle"> <el-row type="flex" :gutter="20" justify="space-between" align="middle">
<el-col class="kv-checkbox" v-if="isShowEnable"> <el-col class="kv-checkbox" v-if="isShowEnable">
<input type="checkbox" v-if="!isDisable(index)" v-model="item.enable" <el-checkbox v-if="!isDisable(index)" v-model="item.enable"
:disabled="isReadOnly"/> :disabled="isReadOnly"/>
</el-col> </el-col>
<span style="margin-left: 10px" v-else></span> <span style="margin-left: 10px" v-else></span>
@ -131,8 +125,18 @@
return { return {
currentItem: null, currentItem: null,
requireds: REQUIRED, requireds: REQUIRED,
isSelectAll: true,
} }
}, },
watch: {
isSelectAll: function(to, from) {
if(from == false && to == true) {
this.selectAll();
} else if(from == true && to == false) {
this.invertSelect();
}
},
},
computed: { computed: {
keyText() { keyText() {
return this.keyPlaceholder || this.$t("api_test.key"); return this.keyPlaceholder || this.$t("api_test.key");
@ -191,7 +195,7 @@
// TODO key // TODO key
}, },
isDisable: function (index) { isDisable: function (index) {
return this.parameters.length - 1 === index; return this.parameters.length - 1 == index;
}, },
querySearch(queryString, cb) { querySearch(queryString, cb) {
let suggestions = this.suggestions; let suggestions = this.suggestions;
@ -235,7 +239,7 @@
}, },
invertSelect() { invertSelect() {
this.parameters.forEach(item => { this.parameters.forEach(item => {
item.enable = !item.enable; item.enable = false;
}); });
}, },
}, },

View File

@ -6,6 +6,8 @@
@active="active" @active="active"
:data="assertions" :data="assertions"
:draggable="draggable" :draggable="draggable"
:is-max="isMax"
:show-btn="showBtn"
color="#A30014" color="#A30014"
background-color="#F7E6E9" background-color="#F7E6E9"
:title="$t('api_test.definition.request.assertions_rule')"> :title="$t('api_test.definition.request.assertions_rule')">
@ -87,6 +89,14 @@
type: Boolean, type: Boolean,
default: false, default: false,
}, },
isMax: {
type: Boolean,
default: false,
},
showBtn: {
type: Boolean,
default: true,
},
assertions: {}, assertions: {},
node: {}, node: {},
request: {}, request: {},

View File

@ -142,7 +142,7 @@ export default {
status: [{required: true, message: this.$t('commons.please_select'), trigger: 'change'}], status: [{required: true, message: this.$t('commons.please_select'), trigger: 'change'}],
}, },
httpForm: {environmentId: "", tags: []}, httpForm: {environmentId: "", tags: []},
isShowEnable: false, isShowEnable: true,
maintainerOptions: [], maintainerOptions: [],
currentModule: {}, currentModule: {},
reqOptions: REQ_METHOD, reqOptions: REQ_METHOD,

View File

@ -5,6 +5,8 @@
@active="active" @active="active"
:data="extract" :data="extract"
:draggable="draggable" :draggable="draggable"
:is-max="isMax"
:show-btn="showBtn"
color="#015478" color="#015478"
background-color="#E6EEF2" background-color="#E6EEF2"
:title="$t('api_test.definition.request.extract_param')"> :title="$t('api_test.definition.request.extract_param')">
@ -41,16 +43,16 @@
</template> </template>
<script> <script>
import {EXTRACT_TYPE} from "../../model/ApiTestModel"; import {EXTRACT_TYPE} from "../../model/ApiTestModel";
import MsApiExtractEdit from "./ApiExtractEdit"; import MsApiExtractEdit from "./ApiExtractEdit";
import MsApiExtractCommon from "./ApiExtractCommon"; import MsApiExtractCommon from "./ApiExtractCommon";
import {getUUID} from "@/common/js/utils"; import {getUUID} from "@/common/js/utils";
import ApiJsonPathSuggestButton from "../assertion/ApiJsonPathSuggestButton"; import ApiJsonPathSuggestButton from "../assertion/ApiJsonPathSuggestButton";
import MsApiJsonpathSuggest from "../assertion/ApiJsonpathSuggest"; import MsApiJsonpathSuggest from "../assertion/ApiJsonpathSuggest";
import {ExtractJSONPath} from "../../../test/model/ScenarioModel"; import {ExtractJSONPath} from "../../../test/model/ScenarioModel";
import ApiBaseComponent from "../../../automation/scenario/common/ApiBaseComponent"; import ApiBaseComponent from "../../../automation/scenario/common/ApiBaseComponent";
export default { export default {
name: "MsApiExtract", name: "MsApiExtract",
components: { components: {
ApiBaseComponent, ApiBaseComponent,
@ -74,7 +76,15 @@ export default {
draggable: { draggable: {
type: Boolean, type: Boolean,
default: false, default: false,
} },
isMax: {
type: Boolean,
default: false,
},
showBtn: {
type: Boolean,
default: true,
},
}, },
data() { data() {
return { return {

View File

@ -20,8 +20,9 @@
</el-table-column> </el-table-column>
<el-table-column prop="taskType" :label="$t('api_test.home_page.running_task_list.table_coloum.task_type')" width="120" show-overflow-tooltip> <el-table-column prop="taskType" :label="$t('api_test.home_page.running_task_list.table_coloum.task_type')" width="120" show-overflow-tooltip>
<template v-slot:default="scope"> <template v-slot:default="scope">
<ms-tag v-if="scope.row.taskType == 'scenario'" type="success" effect="plain" :content="$t('api_test.home_page.running_task_list.scenario_schedule')"/> <ms-tag v-if="scope.row.taskGroup == 'API_SCENARIO_TEST'" type="success" effect="plain" :content="$t('api_test.home_page.running_task_list.scenario_schedule')"/>
<ms-tag v-if="scope.row.taskType == 'testPlan'" type="warning" effect="plain" :content="$t('api_test.home_page.running_task_list.test_plan_schedule')"/> <ms-tag v-if="scope.row.taskGroup == 'TEST_PLAN_TEST'" type="warning" effect="plain" :content="$t('api_test.home_page.running_task_list.test_plan_schedule')"/>
<ms-tag v-if="scope.row.taskGroup == 'SWAGGER_IMPORT'" type="danger" effect="plain" :content="$t('api_test.home_page.running_task_list.swagger_schedule')"/>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column prop="rule" :label="$t('api_test.home_page.running_task_list.table_coloum.run_rule')" width="120" show-overflow-tooltip/> <el-table-column prop="rule" :label="$t('api_test.home_page.running_task_list.table_coloum.run_rule')" width="120" show-overflow-tooltip/>

View File

@ -1,8 +1,11 @@
<template> <template>
<div class="minder"> <div class="minder">
<minder-editor v-if="isActive" <minder-editor
v-if="isActive"
class="minder-container" class="minder-container"
:import-json="importJson" :import-json="importJson"
:height="700"
:progress-enable="false"
@save="save" @save="save"
/> />
</div> </div>
@ -20,10 +23,10 @@ export default {
return [] return []
} }
}, },
data: { dataMap: {
type: Array, type: Map,
default() { default() {
return [] return new Map();
} }
} }
}, },
@ -52,7 +55,9 @@ export default {
root: { root: {
data: { data: {
text: "全部用例", text: "全部用例",
disable: true disable: true,
id: "root",
path: ""
}, },
children: [] children: []
}, },
@ -62,33 +67,46 @@ export default {
} }
}, },
mounted() { mounted() {
},
watch: {
dataMap() {
this.$nextTick(() => { this.$nextTick(() => {
this.parse(this.importJson.root, this.treeNodes); this.parse(this.importJson.root, this.treeNodes);
this.reload(); this.reload();
}) })
}
}, },
methods: { methods: {
save(data) { save(data) {
console.log(data); this.$emit('save', data)
// console.log(this.treeNodes);
}, },
parse(root, children) { parse(root, children) {
root.children = [];
//
let dataNodes = this.dataMap.get(root.data.id);
if (dataNodes) {
dataNodes.forEach((dataNode) => {
root.children.push(dataNode);
})
}
if (children == null || children.length < 1) { if (children == null || children.length < 1) {
return; return;
} }
root.children = [];
children.forEach((item) => { children.forEach((item) => {
let node = { let node = {
data: { data: {
text: item.name, text: item.name,
id: item.id, id: item.id,
disable: true, disable: true,
// resource: ['#'] path: root.data.path + "/" + item.name,
expandState:"collapse"
}, },
} }
root.children.push(node); root.children.push(node);
this.parse(node, item.children); this.parse(node, item.children);
}) });
}, },
reload() { reload() {
this.isActive = false; this.isActive = false;
@ -101,4 +119,9 @@ export default {
</script> </script>
<style scoped> <style scoped>
.minder-container >>> .save-btn {
right: 30px;
bottom: auto;
top: 30px;
}
</style> </style>

View File

@ -1,6 +1,6 @@
<template> <template>
<div> <div class="ms-table-header">
<el-row v-if="title" class="table-title" type="flex" justify="space-between" align="middle"> <el-row v-if="title" class="table-title" type="flex" justify="space-between" align="middle">
<slot name="title"> <slot name="title">
{{title}} {{title}}

View File

@ -2,7 +2,7 @@
<div> <div>
<template> <template>
<span>{{ $t('commons.operating') }} <span>{{ $t('commons.operating') }}
<i class='el-icon-setting' style="color:#7834c1; margin-left:10px" @click="customHeader"> </i> <i class='el-icon-setting operator-color' @click="customHeader"> </i>
</span> </span>
</template> </template>
</div> </div>
@ -21,5 +21,8 @@ export default {
</script> </script>
<style scoped> <style scoped>
.operator-color {
color: var(--count_number);
margin-left:10px;
}
</style> </style>

View File

@ -37,6 +37,13 @@
@change="calculateChart(threadGroup)" @change="calculateChart(threadGroup)"
size="mini"/> size="mini"/>
</el-form-item> </el-form-item>
<el-form-item>
<el-radio-group v-model="threadGroup.unit" :disabled="true">
<el-radio label="S">{{ $t('schedule.cron.seconds') }}</el-radio>
<el-radio label="M">{{ $t('schedule.cron.minutes') }}</el-radio>
<el-radio label="H">{{ $t('schedule.cron.hours') }}</el-radio>
</el-radio-group>
</el-form-item>
<br> <br>
<el-form-item :label="$t('load_test.rps_limit')"> <el-form-item :label="$t('load_test.rps_limit')">
<el-switch v-model="threadGroup.rpsLimitEnable" @change="calculateTotalChart()"/> <el-switch v-model="threadGroup.rpsLimitEnable" @change="calculateTotalChart()"/>
@ -59,7 +66,7 @@
@change="calculateChart(threadGroup)" @change="calculateChart(threadGroup)"
size="mini"/> size="mini"/>
</el-form-item> </el-form-item>
<el-form-item :label="$t('load_test.ramp_up_time_minutes')"> <el-form-item :label="$t('load_test.ramp_up_time_minutes', [getUnitLabel(threadGroup)])">
<el-input-number <el-input-number
:disabled="true" :disabled="true"
:min="1" :min="1"
@ -79,7 +86,7 @@
v-model="threadGroup.rampUpTime" v-model="threadGroup.rampUpTime"
size="mini"/> size="mini"/>
</el-form-item> </el-form-item>
<el-form-item :label="$t('load_test.ramp_up_time_seconds')"/> <el-form-item :label="$t('load_test.ramp_up_time_seconds', [getUnitLabel(threadGroup)])"/>
</div> </div>
</div> </div>
@ -112,7 +119,7 @@
@change="calculateChart(threadGroup)" @change="calculateChart(threadGroup)"
size="mini"/> size="mini"/>
</el-form-item> </el-form-item>
<el-form-item :label="$t('load_test.ramp_up_time_seconds')"/> <el-form-item :label="$t('load_test.ramp_up_time_seconds', [getUnitLabel(threadGroup)])"/>
</div> </div>
</el-form> </el-form>
</el-col> </el-col>
@ -137,6 +144,7 @@ const TARGET_LEVEL = "TargetLevel";
const RAMP_UP = "RampUp"; const RAMP_UP = "RampUp";
const STEPS = "Steps"; const STEPS = "Steps";
const DURATION = "duration"; const DURATION = "duration";
const UNIT = "unit";
const RPS_LIMIT = "rpsLimit"; const RPS_LIMIT = "rpsLimit";
const RPS_LIMIT_ENABLE = "rpsLimitEnable"; const RPS_LIMIT_ENABLE = "rpsLimitEnable";
const THREAD_TYPE = "threadType"; const THREAD_TYPE = "threadType";
@ -196,11 +204,10 @@ export default {
this.threadGroups[i].iterateRampUp = item.value; this.threadGroups[i].iterateRampUp = item.value;
break; break;
case DURATION: case DURATION:
if (item.unit) {
this.threadGroups[i].duration = item.value; this.threadGroups[i].duration = item.value;
} else { break;
this.threadGroups[i].duration = item.value * 60; case UNIT:
} this.threadGroups[i].unit = item.value;
break; break;
case STEPS: case STEPS:
this.threadGroups[i].step = item.value; this.threadGroups[i].step = item.value;
@ -506,6 +513,18 @@ export default {
} }
this.calculateTotalChart(); this.calculateTotalChart();
}, },
getUnitLabel(tg) {
if (tg.unit === 'S') {
return this.$t('schedule.cron.seconds');
}
if (tg.unit === 'M') {
return this.$t('schedule.cron.minutes');
}
if (tg.unit === 'H') {
return this.$t('schedule.cron.hours');
}
return this.$t('schedule.cron.seconds');
},
}, },
watch: { watch: {
report: { report: {

View File

@ -467,7 +467,8 @@ export default {
let items = { let items = {
name: name, name: name,
type: 'line', type: 'line',
data: d data: d,
smooth: true
}; };
let seriesArrayNames = seriesArray.map(m => m.name); let seriesArrayNames = seriesArray.map(m => m.name);
if (seriesArrayNames.includes(name)) { if (seriesArrayNames.includes(name)) {

View File

@ -130,7 +130,7 @@
<el-table :data="granularityData"> <el-table :data="granularityData">
<el-table-column property="start" :label="$t('load_test.duration')"> <el-table-column property="start" :label="$t('load_test.duration')">
<template v-slot:default="scope"> <template v-slot:default="scope">
<span>{{ scope.row.start }} - {{ scope.row.end }}</span> <span>{{ scope.row.start }}S - {{ scope.row.end }}S</span>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column property="granularity" :label="$t('load_test.granularity')"/> <el-table-column property="granularity" :label="$t('load_test.granularity')"/>

View File

@ -47,10 +47,17 @@
:disabled="isReadOnly" :disabled="isReadOnly"
v-model="threadGroup.duration" v-model="threadGroup.duration"
:min="1" :min="1"
:max="172800" :max="99999"
@change="calculateChart(threadGroup)" @change="calculateChart(threadGroup)"
size="mini"/> size="mini"/>
</el-form-item> </el-form-item>
<el-form-item>
<el-radio-group v-model="threadGroup.unit">
<el-radio label="S">{{ $t('schedule.cron.seconds') }}</el-radio>
<el-radio label="M">{{ $t('schedule.cron.minutes') }}</el-radio>
<el-radio label="H">{{ $t('schedule.cron.hours') }}</el-radio>
</el-radio-group>
</el-form-item>
<br> <br>
<el-form-item :label="$t('load_test.rps_limit')"> <el-form-item :label="$t('load_test.rps_limit')">
<el-switch v-model="threadGroup.rpsLimitEnable" @change="calculateTotalChart()"/> <el-switch v-model="threadGroup.rpsLimitEnable" @change="calculateTotalChart()"/>
@ -74,7 +81,7 @@
@change="calculateChart(threadGroup)" @change="calculateChart(threadGroup)"
size="mini"/> size="mini"/>
</el-form-item> </el-form-item>
<el-form-item :label="$t('load_test.ramp_up_time_minutes')"> <el-form-item :label="$t('load_test.ramp_up_time_minutes', [getUnitLabel(threadGroup)])">
<el-input-number <el-input-number
:disabled="isReadOnly" :disabled="isReadOnly"
:min="1" :min="1"
@ -95,7 +102,7 @@
@change="calculateChart(threadGroup)" @change="calculateChart(threadGroup)"
size="mini"/> size="mini"/>
</el-form-item> </el-form-item>
<el-form-item :label="$t('load_test.ramp_up_time_seconds')"/> <el-form-item :label="$t('load_test.ramp_up_time_seconds', [getUnitLabel(threadGroup)])"/>
</div> </div>
</div> </div>
@ -128,7 +135,7 @@
v-model="threadGroup.iterateRampUp" v-model="threadGroup.iterateRampUp"
size="mini"/> size="mini"/>
</el-form-item> </el-form-item>
<el-form-item :label="$t('load_test.ramp_up_time_seconds')"/> <el-form-item :label="$t('load_test.ramp_up_time_seconds', [getUnitLabel(threadGroup)])"/>
</div> </div>
</el-form> </el-form>
</el-col> </el-col>
@ -154,6 +161,7 @@ const RAMP_UP = "RampUp";
const ITERATE_RAMP_UP = "iterateRampUpTime"; const ITERATE_RAMP_UP = "iterateRampUpTime";
const STEPS = "Steps"; const STEPS = "Steps";
const DURATION = "duration"; const DURATION = "duration";
const UNIT = "unit";
const RPS_LIMIT = "rpsLimit"; const RPS_LIMIT = "rpsLimit";
const RPS_LIMIT_ENABLE = "rpsLimitEnable"; const RPS_LIMIT_ENABLE = "rpsLimitEnable";
const HOLD = "Hold"; const HOLD = "Hold";
@ -253,11 +261,10 @@ export default {
this.threadGroups[i].iterateRampUp = item.value; this.threadGroups[i].iterateRampUp = item.value;
break; break;
case DURATION: case DURATION:
if (item.unit) {
this.threadGroups[i].duration = item.value; this.threadGroups[i].duration = item.value;
} else { break;
this.threadGroups[i].duration = item.value * 60; case UNIT:
} this.threadGroups[i].unit = item.value;
break; break;
case STEPS: case STEPS:
this.threadGroups[i].step = item.value; this.threadGroups[i].step = item.value;
@ -290,6 +297,7 @@ export default {
break; break;
} }
// //
this.$set(this.threadGroups[i], "unit", this.threadGroups[i].unit || 'S');
this.$set(this.threadGroups[i], "threadType", this.threadGroups[i].threadType || 'DURATION'); this.$set(this.threadGroups[i], "threadType", this.threadGroups[i].threadType || 'DURATION');
this.$set(this.threadGroups[i], "iterateNum", this.threadGroups[i].iterateNum || 1); this.$set(this.threadGroups[i], "iterateNum", this.threadGroups[i].iterateNum || 1);
this.$set(this.threadGroups[i], "iterateRampUp", this.threadGroups[i].iterateRampUp || 10); this.$set(this.threadGroups[i], "iterateRampUp", this.threadGroups[i].iterateRampUp || 10);
@ -576,6 +584,18 @@ export default {
return true; return true;
}, },
getUnitLabel(tg) {
if (tg.unit === 'S') {
return this.$t('schedule.cron.seconds');
}
if (tg.unit === 'M') {
return this.$t('schedule.cron.minutes');
}
if (tg.unit === 'H') {
return this.$t('schedule.cron.hours');
}
return this.$t('schedule.cron.seconds');
},
convertProperty() { convertProperty() {
/// todo4jmeter ConcurrencyThreadGroup plugin /// todo4jmeter ConcurrencyThreadGroup plugin
let result = []; let result = [];
@ -585,7 +605,8 @@ export default {
{key: TARGET_LEVEL, value: this.threadGroups[i].threadNumber}, {key: TARGET_LEVEL, value: this.threadGroups[i].threadNumber},
{key: RAMP_UP, value: this.threadGroups[i].rampUpTime}, {key: RAMP_UP, value: this.threadGroups[i].rampUpTime},
{key: STEPS, value: this.threadGroups[i].step}, {key: STEPS, value: this.threadGroups[i].step},
{key: DURATION, value: this.threadGroups[i].duration, unit: 'S'}, {key: DURATION, value: this.threadGroups[i].duration, unit: this.threadGroups[i].unit},
{key: UNIT, value: this.threadGroups[i].unit},
{key: RPS_LIMIT, value: this.threadGroups[i].rpsLimit}, {key: RPS_LIMIT, value: this.threadGroups[i].rpsLimit},
{key: RPS_LIMIT_ENABLE, value: this.threadGroups[i].rpsLimitEnable}, {key: RPS_LIMIT_ENABLE, value: this.threadGroups[i].rpsLimitEnable},
{key: HOLD, value: this.threadGroups[i].duration - this.threadGroups[i].rampUpTime}, {key: HOLD, value: this.threadGroups[i].duration - this.threadGroups[i].rampUpTime},

View File

@ -31,6 +31,7 @@ export function findThreadGroup(jmxContent, handler) {
tg.enabled = tg.attributes.enabled; tg.enabled = tg.attributes.enabled;
tg.tgType = tg.name; tg.tgType = tg.name;
tg.threadType = 'DURATION'; tg.threadType = 'DURATION';
tg.unit = 'S';
}) })
return threadGroups; return threadGroups;
} }

View File

@ -39,8 +39,9 @@
@setCondition="setCondition" @setCondition="setCondition"
ref="testCaseList"> ref="testCaseList">
</test-case-list> </test-case-list>
<testcase-minder <test-case-minder
:tree-nodes="treeNodes" :tree-nodes="treeNodes"
:project-id="projectId"
v-if="activeDom === 'right'" v-if="activeDom === 'right'"
ref="testCaseList"/> ref="testCaseList"/>
</ms-tab-button> </ms-tab-button>
@ -97,17 +98,17 @@ import SelectMenu from "../common/SelectMenu";
import MsContainer from "../../common/components/MsContainer"; import MsContainer from "../../common/components/MsContainer";
import MsAsideContainer from "../../common/components/MsAsideContainer"; import MsAsideContainer from "../../common/components/MsAsideContainer";
import MsMainContainer from "../../common/components/MsMainContainer"; import MsMainContainer from "../../common/components/MsMainContainer";
import {checkoutTestManagerOrTestUser, getCurrentProjectID, getUUID, hasRoles} from "../../../../common/js/utils"; import {checkoutTestManagerOrTestUser, getCurrentProjectID, getUUID} from "../../../../common/js/utils";
import TestCaseNodeTree from "../common/TestCaseNodeTree"; import TestCaseNodeTree from "../common/TestCaseNodeTree";
import {TrackEvent,LIST_CHANGE} from "@/business/components/common/head/ListEvent";
import TestcaseMinder from "@/business/components/common/components/MsModuleMinder";
import MsTabButton from "@/business/components/common/components/MsTabButton"; import MsTabButton from "@/business/components/common/components/MsTabButton";
import TestCaseMinder from "@/business/components/track/common/minder/TestCaseMinder";
export default { export default {
name: "TestCase", name: "TestCase",
components: { components: {
TestCaseMinder,
MsTabButton, MsTabButton,
TestcaseMinder,
TestCaseNodeTree, TestCaseNodeTree,
MsMainContainer, MsMainContainer,
MsAsideContainer, MsContainer, TestCaseList, NodeTree, TestCaseEdit, SelectMenu MsAsideContainer, MsContainer, TestCaseList, NodeTree, TestCaseEdit, SelectMenu
@ -129,11 +130,13 @@ export default {
renderComponent:true, renderComponent:true,
loading: false, loading: false,
type:'', type:'',
activeDom: 'left' activeDom: 'left',
projectId: ""
} }
}, },
mounted() { mounted() {
this.init(this.$route); this.init(this.$route);
this.projectId = getCurrentProjectID();
}, },
watch: { watch: {
redirectID() { redirectID() {
@ -193,7 +196,7 @@ export default {
} }
}, },
addTab(tab) { addTab(tab) {
if (!getCurrentProjectID()) { if (!this.projectId) {
this.$warning(this.$t('commons.check_project_tip')); this.$warning(this.$t('commons.check_project_tip'));
return; return;
} }
@ -253,7 +256,7 @@ export default {
this.testCaseReadOnly = true; this.testCaseReadOnly = true;
} }
let caseId = this.$route.params.caseId; let caseId = this.$route.params.caseId;
if (!getCurrentProjectID()) { if (!this.projectId) {
this.$warning(this.$t('commons.check_project_tip')); this.$warning(this.$t('commons.check_project_tip'));
return; return;
} }

View File

@ -472,7 +472,6 @@ export default {
reload() { reload() {
this.isStepTableAlive = false; this.isStepTableAlive = false;
this.$nextTick(() => (this.isStepTableAlive = true)); this.$nextTick(() => (this.isStepTableAlive = true));
console.log(this.form)
}, },
open(testCase) { open(testCase) {
this.projectId = getCurrentProjectID(); this.projectId = getCurrentProjectID();
@ -552,9 +551,7 @@ export default {
let tmp = {}; let tmp = {};
Object.assign(tmp, testCase); Object.assign(tmp, testCase);
tmp.steps = JSON.parse(testCase.steps); tmp.steps = JSON.parse(testCase.steps);
console.log(tmp)
Object.assign(this.form, tmp); Object.assign(this.form, tmp);
console.log(this.form)
this.form.module = testCase.nodeId; this.form.module = testCase.nodeId;
this.getFileMetaData(testCase); this.getFileMetaData(testCase);
}, },
@ -631,7 +628,6 @@ export default {
let param = this.buildParam(); let param = this.buildParam();
if (this.validate(param)) { if (this.validate(param)) {
let option = this.getOption(param); let option = this.getOption(param);
console.log(option)
this.result = this.$request(option, () => { this.result = this.$request(option, () => {
this.$success(this.$t('commons.save_success')); this.$success(this.$t('commons.save_success'));
if (this.operationType == 'add' && this.isCreateContinue) { if (this.operationType == 'add' && this.isCreateContinue) {

View File

@ -312,6 +312,7 @@ export default {
currentCaseId: null, currentCaseId: null,
projectId: "", projectId: "",
selectDataCounts: 0, selectDataCounts: 0,
selectDataRange: "all"
} }
}, },
props: { props: {
@ -326,10 +327,27 @@ export default {
}, },
moduleOptions: { moduleOptions: {
type: Array type: Array
},
trashEnable: {
type: Boolean,
default: false,
} }
}, },
created: function () { created: function () {
this.$emit('setCondition', this.condition); this.$emit('setCondition', this.condition);
if (this.trashEnable) {
this.condition.filters = {status: ["Trash"]};
} else {
this.condition.filters = {status: ["Prepare", "Pass", "UnPass"]};
}
this.initTableData();
},
activated() {
if (this.trashEnable) {
this.condition.filters = {status: ["Trash"]};
} else {
this.condition.filters = {status: ["Prepare", "Pass", "UnPass"]};
}
this.initTableData(); this.initTableData();
}, },
watch: { watch: {
@ -345,6 +363,11 @@ export default {
customHeader() { customHeader() {
this.$refs.headerCustom.open(this.tableLabel) this.$refs.headerCustom.open(this.tableLabel)
}, },
getSelectDataRange() {
let dataRange = this.$route.params.dataSelectRange;
let dataType = this.$route.params.dataType;
this.selectDataRange = dataType === 'case' ? dataRange : 'all';
},
initTableData() { initTableData() {
this.projectId = getCurrentProjectID(); this.projectId = getCurrentProjectID();
this.condition.planId = ""; this.condition.planId = "";
@ -363,6 +386,29 @@ export default {
this.getData(); this.getData();
}, },
getData() { getData() {
this.getSelectDataRange();
this.condition.selectThisWeedData = false;
this.condition.caseCoverage = null;
switch (this.selectDataRange) {
case 'thisWeekCount':
this.condition.selectThisWeedData = true;
break;
case 'uncoverage':
this.condition.caseCoverage = 'uncoverage';
break;
case 'coverage':
this.condition.caseCoverage = 'coverage';
break;
case 'Prepare':
this.condition.filters.status = [this.selectDataRange];
break;
case 'Pass':
this.condition.filters.status = [this.selectDataRange];
break;
case 'UnPass':
this.condition.filters.status = [this.selectDataRange];
break;
}
if (this.projectId) { if (this.projectId) {
this.condition.projectId = this.projectId; this.condition.projectId = this.projectId;
this.result = this.$post(this.buildPagePath('/test/case/list'), this.condition, response => { this.result = this.$post(this.buildPagePath('/test/case/list'), this.condition, response => {

View File

@ -1,65 +0,0 @@
<template>
<ms-module-minder
:tree-nodes="treeNodes"/>
</template>
<script>
import MsModuleMinder from "@/business/components/common/components/MsModuleMinder";
export default {
name: "TestCaseMinder",
components: {MsModuleMinder},
data() {
return{
testCase: [],
dataMap: new Map()
}
},
props: {
treeNodes: {
type: Array,
default() {
return []
}
},
condition: Object,
projectId: String
},
mounted() {
// this.getTestCases();
},
methods: {
getTestCases() {
if (this.projectId) {
this.result = this.$get('/test/case/list/detail/' + this.projectId,response => {
this.testCase = response.data;
console.log(this.testCase)
this.parse();
});
}
},
parse() {
this.testCase.forEach(item => {
let mapItem = this.dataMap.get(item.moduleId);
let nodeItem = {
id: item.id,
name: item.name,
}
if (mapItem) {
mapItem.push(item);
} else {
mapItem = [];
mapItem.push(item);
}
if (item.tags && item.tags.length > 0) {
item.tags = JSON.parse(item.tags);
}
})
}
},
}
</script>
<style scoped>
</style>

View File

@ -0,0 +1,124 @@
<template>
<ms-module-minder
v-loading="result.loading"
:tree-nodes="treeNodes"
:data-map="dataMap"
@save="save"
/>
</template>
<script>
import MsModuleMinder from "@/business/components/common/components/MsModuleMinder";
import {getTestCaseDataMap} from "@/business/components/track/common/minder/minderUtils";
export default {
name: "TestCaseMinder",
components: {MsModuleMinder},
data() {
return{
testCase: [],
dataMap: new Map(),
result: {}
}
},
props: {
treeNodes: {
type: Array,
default() {
return []
}
},
condition: Object,
projectId: String
},
mounted() {
this.$nextTick(() => {
this.getTestCases();
})
},
methods: {
getTestCases() {
if (this.projectId) {
this.result = this.$get('/test/case/list/detail/' + this.projectId,response => {
this.testCase = response.data;
this.dataMap = getTestCaseDataMap(this.testCase);
});
}
},
save(data) {
let saveCases = [];
this.buildSaveCase(data.root, saveCases, undefined);
console.log(saveCases);
let param = {
projectId: this.projectId,
data: saveCases
}
this.result = this.$post('/test/case/minder/edit', param, () => {
this.$success(this.$t('commons.save_success'));
});
},
buildSaveCase(root, saveCases, parent) {
let data = root.data;
if (data.resource && data.resource.indexOf("用例") > -1) {
this._buildSaveCase(root, saveCases, parent);
} else {
if (root.children) {
root.children.forEach((childNode) => {
this.buildSaveCase(childNode, saveCases, root.data);
})
}
}
},
_buildSaveCase(node, saveCases, parent) {
let data = node.data;
let isChange = false;
let testCase = {
id: data.id,
name: data.text,
nodeId: parent ? parent.id : "",
nodePath: parent ? parent.path : "",
type: data.type ? data.type : 'functional',
method: data.method ? data.method: 'manual',
maintainer: data.maintainer,
priority: 'P' + data.priority,
};
if (data.changed) isChange = true;
let steps = [];
let stepNum = 1;
if (node.children) {
node.children.forEach((childNode) => {
let childData = childNode.data;
if (childData.resource && childData.resource.indexOf('前置条件') > -1) {
testCase.prerequisite = childData.text;
} else if (childData.resource && childData.resource.indexOf('备注') > -1) {
testCase.remark = childData.text;
} else {
//
let step = {};
step.num = stepNum++;
step.desc = childData.text;
if (childNode.children) {
let result = "";
childNode.children.forEach((child) => {
result += child.data.text;
if (child.data.changed) isChange = true;
})
step.result = result;
}
steps.push(step);
}
if (childData.changed) isChange = true;
})
}
testCase.steps = JSON.stringify(steps);
if (isChange) {
saveCases.push(testCase);
}
},
}
}
</script>
<style scoped>
</style>

View File

@ -0,0 +1,128 @@
<template>
<ms-module-minder
v-loading="result.loading"
:tree-nodes="treeNodes"
:data-map="dataMap"
@save="save"
/>
</template>
<script>
import MsModuleMinder from "@/business/components/common/components/MsModuleMinder";
import {getTestCaseDataMap} from "@/business/components/track/common/minder/minderUtils";
export default {
name: "TestReviewMinder",
components: {MsModuleMinder},
data() {
return{
testCase: [],
dataMap: new Map(),
result: {}
}
},
props: {
treeNodes: {
type: Array,
default() {
return []
}
},
selectNodeIds: {
type: Array
},
reviewId: {
type: String
},
projectId: String
},
mounted() {
this.$nextTick(() => {
this.getTestCases();
})
},
methods: {
getTestCases() {
if (this.projectId) {
this.result = this.$post('/test/review/case/list/all', {reviewId: this.reviewId}, response => {
this.testCase = response.data;
this.dataMap = getTestCaseDataMap(this.testCase);
});
}
},
save(data) {
// let saveCases = [];
// this.buildSaveCase(data.root, saveCases, undefined);
// console.log(saveCases);
// let param = {
// projectId: this.projectId,
// data: saveCases
// }
// this.result = this.$post('/test/case/minder/edit', param, () => {
// this.$success(this.$t('commons.save_success'));
// });
},
buildSaveCase(root, saveCases, parent) {
let data = root.data;
if (data.resource && data.resource.indexOf("用例") > -1) {
this._buildSaveCase(root, saveCases, parent);
} else {
if (root.children) {
root.children.forEach((childNode) => {
this.buildSaveCase(childNode, saveCases, root.data);
})
}
}
},
_buildSaveCase(node, saveCases, parent) {
let data = node.data;
let isChange = false;
let testCase = {
id: data.id,
name: data.text,
nodeId: parent ? parent.id : "",
nodePath: parent ? parent.path : "",
type: data.type ? data.type : 'functional',
method: data.method ? data.method : 'manual',
maintainer: data.maintainer,
priority: 'P' + data.priority,
};
if (data.changed) isChange = true;
let steps = [];
let stepNum = 1;
if (node.children) {
node.children.forEach((childNode) => {
let childData = childNode.data;
if (childData.resource && childData.resource.indexOf('前置条件') > -1) {
testCase.prerequisite = childData.text;
} else if (childData.resource && childData.resource.indexOf('备注') > -1) {
testCase.remark = childData.text;
} else {
//
let step = {};
step.num = stepNum++;
step.desc = childData.text;
if (childNode.children) {
let result = "";
childNode.children.forEach((child) => {
result += child.data.text;
if (child.data.changed) isChange = true;
})
step.result = result;
}
steps.push(step);
}
if (childData.changed) isChange = true;
})
}
testCase.steps = JSON.stringify(steps);
if (isChange) {
saveCases.push(testCase);
}
},
}
}
</script>
<style scoped>
</style>

View File

@ -0,0 +1,59 @@
export function getTestCaseDataMap(testCase) {
let dataMap = new Map();
testCase.forEach(item => {
item.steps = JSON.parse(item.steps);
// if (item.tags && item.tags.length > 0) {
// item.tags = JSON.parse(item.tags);
// }
let mapItem = dataMap.get(item.nodeId);
let nodeItem = {
data: {
id: item.id,
text: item.name,
priority: Number.parseInt(item.priority.substring(item.priority.length - 1 )),
resource: ["用例"],
type: item.type,
method: item.method,
maintainer: item.maintainer
}
}
parseChildren(nodeItem, item);
if (mapItem) {
mapItem.push(nodeItem);
} else {
mapItem = [];
mapItem.push(nodeItem);
dataMap.set(item.nodeId, mapItem);
}
})
return dataMap;
}
function parseChildren(nodeItem, item) {
nodeItem.children = [];
let children = [];
_parseChildren(children, item.prerequisite, "前置条件");
item.steps.forEach((step) => {
let descNode = _parseChildren(children, step.desc, "测试步骤");
if (descNode) {
descNode.data.num = step.num;
descNode.children = [];
_parseChildren(descNode.children, step.result, "预期结果");
}
});
_parseChildren(children, item.remark, "备注");
nodeItem.children = children;
}
function _parseChildren(children, k, v) {
if (k) {
let node = {
data: {
text: k,
resource: [v]
}
}
children.push(node);
return node;
}
}

View File

@ -29,12 +29,12 @@
<el-row :gutter="10"> <el-row :gutter="10">
<el-col :span="6"> <el-col :span="6">
<div class="square"> <div class="square">
<case-count-card :track-count-data="trackCountData" class="track-card"/> <case-count-card :track-count-data="trackCountData" class="track-card" @redirectPage="redirectPage"/>
</div> </div>
</el-col> </el-col>
<el-col :span="6"> <el-col :span="6">
<div class="square"> <div class="square">
<relevance-case-card :relevance-count-data="relevanceCountData" class="track-card"/> <relevance-case-card :relevance-count-data="relevanceCountData" class="track-card" @redirectPage="redirectPage"/>
</div> </div>
</el-col> </el-col>
<el-col :span="12"> <el-col :span="12">
@ -73,7 +73,7 @@ import MsMainContainer from "@/business/components/common/components/MsMainConta
import MsContainer from "@/business/components/common/components/MsContainer"; import MsContainer from "@/business/components/common/components/MsContainer";
import CaseCountCard from "@/business/components/track/home/components/CaseCountCard"; import CaseCountCard from "@/business/components/track/home/components/CaseCountCard";
import RelevanceCaseCard from "@/business/components/track/home/components/RelevanceCaseCard"; import RelevanceCaseCard from "@/business/components/track/home/components/RelevanceCaseCard";
import {getCurrentProjectID} from "@/common/js/utils"; import {getCurrentProjectID, getUUID} from "@/common/js/utils";
import CaseMaintenance from "@/business/components/track/home/components/CaseMaintenance"; import CaseMaintenance from "@/business/components/track/home/components/CaseMaintenance";
import {COUNT_NUMBER, COUNT_NUMBER_SHALLOW} from "@/common/js/constants"; import {COUNT_NUMBER, COUNT_NUMBER_SHALLOW} from "@/common/js/constants";
import BugCountCard from "@/business/components/track/home/components/BugCountCard"; import BugCountCard from "@/business/components/track/home/components/BugCountCard";
@ -169,7 +169,7 @@ export default {
type: 'bar', type: 'bar',
itemStyle: { itemStyle: {
normal: { normal: {
color: COUNT_NUMBER color: this.$store.state.theme.theme ? this.$store.state.theme.theme : COUNT_NUMBER
} }
} }
}, },
@ -179,14 +179,20 @@ export default {
type: 'bar', type: 'bar',
itemStyle: { itemStyle: {
normal: { normal: {
color: COUNT_NUMBER_SHALLOW color: this.$store.state.theme.theme ? this.$store.state.theme.theme : COUNT_NUMBER_SHALLOW
} }
} }
}] }]
}; };
this.caseOption = option; this.caseOption = option;
},
redirectPage(page,dataType,selectType){
switch (page){
case "case":
this.$router.push({name:'testCase',params:{dataType:dataType,dataSelectRange:selectType, projectId: getCurrentProjectID()}});
break;
}
} }
} }
} }
</script> </script>

View File

@ -15,18 +15,19 @@
{{ $t('api_test.home_page.unit_of_measurement') }} {{ $t('api_test.home_page.unit_of_measurement') }}
</span> </span>
<div> <div>
占比: 占比
<el-link type="info" @click="redirectPage('thisWeekCount')" target="_blank" style="color: #000000">{{ rage }} <span class="rage">
</el-link> {{rage}}
</span>
</div> </div>
</div> </div>
</el-aside> </el-aside>
<el-table border :data="tableData" class="adjust-table table-content" height="300"> <el-table border :data="tableData" class="adjust-table table-content" height="300">
<el-table-column prop="index" label="序号" <el-table-column prop="index" label="序号"
width="100" show-overflow-tooltip/> width="60" show-overflow-tooltip/>
<el-table-column prop="planName" label="测试计划名称" <el-table-column prop="planName" label="测试计划名称"
width="130" show-overflow-tooltip/> width="130" show-overflow-tooltip/>
<el-table-column prop="createTime" :label="$t('commons.create_time')" width="130"> <el-table-column prop="createTime" :label="$t('commons.create_time')" width="180" show-overflow-tooltip>
<template v-slot:default="scope"> <template v-slot:default="scope">
<span>{{ scope.row.createTime | timestampFormatDate }}</span> <span>{{ scope.row.createTime | timestampFormatDate }}</span>
</template> </template>
@ -35,6 +36,7 @@
prop="status" prop="status"
column-key="status" column-key="status"
:label="$t('test_track.plan.plan_status')" :label="$t('test_track.plan.plan_status')"
width="100"
show-overflow-tooltip> show-overflow-tooltip>
<template v-slot:default="scope"> <template v-slot:default="scope">
<span @click.stop="clickt = 'stop'"> <span @click.stop="clickt = 'stop'">
@ -106,6 +108,12 @@ export default {
color: var(--count_number); color: var(--count_number);
} }
.rage {
font-family: 'ArialMT', 'Arial', sans-serif;
font-size: 18px;
color: var(--count_number);
}
.main-number-show { .main-number-show {
width: 100px; width: 100px;
height: 100px; height: 100px;

View File

@ -83,27 +83,27 @@
<el-row> <el-row>
<el-col> <el-col>
<span class="default-property"> <span class="default-property">
{{$t('api_test.home_page.detail_card.running')}} 未评审
{{"\xa0\xa0"}} {{"\xa0\xa0"}}
<el-link type="info" @click="redirectPage('Underway')" target="_blank" style="color: #000000"> <el-link type="info" @click="redirectPage('Prepare')" target="_blank" style="color: #000000">
{{trackCountData.prepareCount}} {{trackCountData.prepareCount}}
</el-link> </el-link>
</span> </span>
</el-col> </el-col>
<el-col style="margin-top: 5px;"> <el-col style="margin-top: 5px;">
<span class="default-property"> <span class="default-property">
{{$t('api_test.home_page.detail_card.not_started')}} 未通过
{{"\xa0\xa0"}} {{"\xa0\xa0"}}
<el-link type="info" @click="redirectPage('Prepare')" target="_blank" style="color: #000000"> <el-link type="info" @click="redirectPage('Pass')" target="_blank" style="color: #000000">
{{trackCountData.passCount}} {{trackCountData.passCount}}
</el-link> </el-link>
</span> </span>
</el-col> </el-col>
<el-col style="margin-top: 5px;"> <el-col style="margin-top: 5px;">
<span class="main-property"> <span class="main-property">
{{$t('api_test.home_page.detail_card.finished')}} 已通过
{{"\xa0\xa0"}} {{"\xa0\xa0"}}
<el-link type="info" @click="redirectPage('Completed')" target="_blank" style="color: #000000"> <el-link type="info" @click="redirectPage('UnPass')" target="_blank" style="color: #000000">
{{trackCountData.unPassCount}} {{trackCountData.unPassCount}}
</el-link> </el-link>
</span> </span>
@ -133,7 +133,7 @@ export default {
}, },
methods: { methods: {
redirectPage(clickType){ redirectPage(clickType){
this.$emit("redirectPage","api","api",clickType); this.$emit("redirectPage","case", "case",clickType);
} }
} }
} }

View File

@ -68,7 +68,7 @@
<span class="default-property"> <span class="default-property">
未覆盖 未覆盖
{{"\xa0\xa0"}} {{"\xa0\xa0"}}
<el-link type="info" @click="redirectPage('Underway')" target="_blank" style="color: #000000"> <el-link type="info" @click="redirectPage('uncoverage')" target="_blank" style="color: #000000">
{{relevanceCountData.uncoverageCount}} {{relevanceCountData.uncoverageCount}}
</el-link> </el-link>
</span> </span>
@ -77,7 +77,7 @@
<span class="main-property"> <span class="main-property">
已覆盖 已覆盖
{{"\xa0\xa0"}} {{"\xa0\xa0"}}
<el-link type="info" @click="redirectPage('Prepare')" target="_blank" style="color: #000000"> <el-link type="info" @click="redirectPage('coverage')" target="_blank" style="color: #000000">
{{relevanceCountData.coverageCount}} {{relevanceCountData.coverageCount}}
</el-link> </el-link>
</span> </span>
@ -107,7 +107,7 @@ export default {
}, },
methods: { methods: {
redirectPage(clickType){ redirectPage(clickType){
this.$emit("redirectPage","api","api",clickType); this.$emit("redirectPage","case","case",clickType);
} }
} }
} }

View File

@ -664,8 +664,9 @@ export default {
} }
}, },
deleteIssue(row) { deleteIssue(row) {
this.result = this.$get("/issues/delete/" + row.id, () => { let caseId = this.testCase.caseId;
this.getIssues(this.testCase.caseId); this.result = this.$post("/issues/delete", {id: row.id, caseId: caseId}, () => {
this.getIssues(caseId);
this.$success(this.$t('commons.delete_success')); this.$success(this.$t('commons.delete_success'));
}) })
}, },

View File

@ -10,8 +10,16 @@
ref="nodeTree"/> ref="nodeTree"/>
</template> </template>
<template v-slot:main> <template v-slot:main>
<ms-tab-button
:active-dom.sync="activeDom"
:left-tip="'用例列表'"
:left-content="'CASE'"
:right-tip="'脑图'"
:right-content="'脑图'"
:middle-button-enable="false">
<test-review-test-case-list <test-review-test-case-list
class="table-list" class="table-list"
v-if="activeDom === 'left'"
@openTestReviewRelevanceDialog="openTestReviewRelevanceDialog" @openTestReviewRelevanceDialog="openTestReviewRelevanceDialog"
@refresh="refresh" @refresh="refresh"
:review-id="reviewId" :review-id="reviewId"
@ -19,6 +27,13 @@
:select-parent-nodes="selectParentNodes" :select-parent-nodes="selectParentNodes"
:clickType="clickType" :clickType="clickType"
ref="testPlanTestCaseList"/> ref="testPlanTestCaseList"/>
<test-review-minder
:tree-nodes="treeNodes"
:project-id="projectId"
:review-id="reviewId"
v-if="activeDom === 'right'"
/>
</ms-tab-button>
</template> </template>
<test-review-relevance <test-review-relevance
@refresh="refresh" @refresh="refresh"
@ -29,16 +44,20 @@
<script> <script>
import MsTestPlanCommonComponent from "@/business/components/track/plan/view/comonents/base/TestPlanCommonComponent"; import MsTestPlanCommonComponent from "@/business/components/track/plan/view/comonents/base/TestPlanCommonComponent";
import FunctionalTestCaseList from "@/business/components/track/plan/view/comonents/functional/FunctionalTestCaseList";
import MsNodeTree from "@/business/components/track/common/NodeTree"; import MsNodeTree from "@/business/components/track/common/NodeTree";
import TestReviewRelevance from "@/business/components/track/review/view/components/TestReviewRelevance"; import TestReviewRelevance from "@/business/components/track/review/view/components/TestReviewRelevance";
import TestReviewTestCaseList from "@/business/components/track/review/view/components/TestReviewTestCaseList"; import TestReviewTestCaseList from "@/business/components/track/review/view/components/TestReviewTestCaseList";
import MsTabButton from "@/business/components/common/components/MsTabButton";
import TestReviewMinder from "@/business/components/track/common/minder/TestReviewMinder";
import {getCurrentProjectID} from "@/common/js/utils";
export default { export default {
name: "TestReviewFunction", name: "TestReviewFunction",
components: { components: {
TestReviewMinder,
MsTabButton,
TestReviewTestCaseList, TestReviewTestCaseList,
TestReviewRelevance, MsNodeTree, FunctionalTestCaseList, MsTestPlanCommonComponent TestReviewRelevance, MsNodeTree, MsTestPlanCommonComponent
}, },
data() { data() {
return { return {
@ -49,15 +68,18 @@ export default {
selectParentNodes: [], selectParentNodes: [],
treeNodes: [], treeNodes: [],
isMenuShow: true, isMenuShow: true,
activeDom: 'left',
projectId: ""
} }
}, },
props: [ props: [
'reviewId', 'reviewId',
'redirectCharType', 'redirectCharType',
'clickType' 'clickType',
], ],
mounted() { mounted() {
this.getNodeTreeByReviewId() this.getNodeTreeByReviewId()
this.projectId = getCurrentProjectID();
}, },
activated() { activated() {
this.getNodeTreeByReviewId() this.getNodeTreeByReviewId()
@ -89,5 +111,7 @@ export default {
</script> </script>
<style scoped> <style scoped>
/deep/ .el-button-group>.el-button:first-child {
padding: 4px 1px !important;
}
</style> </style>

View File

@ -1,7 +1,5 @@
<template> <template>
<div class="card-container"> <div class="card-container">
<el-card class="card-content" v-loading="result.loading">
<template v-slot:header>
<ms-table-header :is-tester-permission="true" :condition.sync="condition" @search="initTableData" <ms-table-header :is-tester-permission="true" :condition.sync="condition" @search="initTableData"
:show-create="false" :tip="$t('commons.search_by_name_or_id')"> :show-create="false" :tip="$t('commons.search_by_name_or_id')">
<template v-slot:title> <template v-slot:title>
@ -16,7 +14,6 @@
@click="$emit('openTestReviewRelevanceDialog')"/> @click="$emit('openTestReviewRelevanceDialog')"/>
</template> </template>
</ms-table-header> </ms-table-header>
</template>
<executor-edit ref="executorEdit" :select-ids="new Set(Array.from(this.selectRows).map(row => row.id))" <executor-edit ref="executorEdit" :select-ids="new Set(Array.from(this.selectRows).map(row => row.id))"
@refresh="initTableData"/> @refresh="initTableData"/>
@ -176,7 +173,6 @@
:is-read-only="isReadOnly" :is-read-only="isReadOnly"
@refreshTable="search"/> @refreshTable="search"/>
</el-card>
<batch-edit ref="batchEdit" @batchEdit="batchEdit" <batch-edit ref="batchEdit" @batchEdit="batchEdit"
:type-arr="typeArr" :value-arr="valueArr" :dialog-title="$t('test_track.case.batch_edit_case')"/> :type-arr="typeArr" :value-arr="valueArr" :dialog-title="$t('test_track.case.batch_edit_case')"/>
@ -472,6 +468,8 @@ export default {
</script> </script>
<style scoped> <style scoped>
.ms-table-header {
margin: 20px;
}
</style> </style>

@ -1 +1 @@
Subproject commit 4c33b9c3b12a83da6d9bd2740262c6c8baaab819 Subproject commit b2571e06e8b211821409115cc2c4a7c52cbac1db

View File

@ -50,11 +50,23 @@ const IsReadOnly = {
} }
} }
const Theme = {
state: {
theme: undefined
},
mutations: {
setTheme(state, value) {
state.theme = value;
}
}
}
export default new Vuex.Store({ export default new Vuex.Store({
modules: { modules: {
api: API, api: API,
common: Common, common: Common,
switch: Switch, switch: Switch,
isReadOnly: IsReadOnly, isReadOnly: IsReadOnly,
theme: Theme
} }
}) })

View File

@ -17,6 +17,7 @@ body {
/*--color: #2c2a48;*/ /*--color: #2c2a48;*/
/*--color_shallow: #595591;*/ /*--color_shallow: #595591;*/
--color: ''; --color: '';
--primary_color: '';
--color_shallow: ''; --color_shallow: '';
--count_number: ''; --count_number: '';
--count_number_shallow: ''; --count_number_shallow: '';

View File

@ -173,3 +173,4 @@ export const ORIGIN_COLOR = '#2c2a48';
export const ORIGIN_COLOR_SHALLOW = '#595591'; export const ORIGIN_COLOR_SHALLOW = '#595591';
export const COUNT_NUMBER = '#6C317C'; export const COUNT_NUMBER = '#6C317C';
export const COUNT_NUMBER_SHALLOW = '#CDB9D2'; export const COUNT_NUMBER_SHALLOW = '#CDB9D2';
export const PRIMARY_COLOR = '#783887';

View File

@ -3,7 +3,7 @@ import {
COUNT_NUMBER_SHALLOW, COUNT_NUMBER_SHALLOW,
LicenseKey, LicenseKey,
ORIGIN_COLOR, ORIGIN_COLOR,
ORIGIN_COLOR_SHALLOW, ORIGIN_COLOR_SHALLOW, PRIMARY_COLOR,
PROJECT_ID, PROJECT_ID,
REFRESH_SESSION_USER_URL, REFRESH_SESSION_USER_URL,
ROLE_ADMIN, ROLE_ADMIN,
@ -354,19 +354,19 @@ export function objToStrMap(obj) {
return strMap; return strMap;
} }
export function getColor() { export function setColor(a, b, c, d, e) {
return localStorage.getItem('color'); // 顶部菜单背景色
}
export function setColor(a, b, c, d) {
document.body.style.setProperty('--color', a); document.body.style.setProperty('--color', a);
document.body.style.setProperty('--color_shallow', b); document.body.style.setProperty('--color_shallow', b);
// 首页颜色
document.body.style.setProperty('--count_number', c); document.body.style.setProperty('--count_number', c);
document.body.style.setProperty('--count_number_shallow', d); document.body.style.setProperty('--count_number_shallow', d);
// 主颜色
document.body.style.setProperty('--primary_color', e);
} }
export function setOriginColor() { export function setDefaultTheme() {
setColor(ORIGIN_COLOR, ORIGIN_COLOR_SHALLOW, COUNT_NUMBER, COUNT_NUMBER_SHALLOW); setColor(ORIGIN_COLOR, ORIGIN_COLOR_SHALLOW, COUNT_NUMBER, COUNT_NUMBER_SHALLOW, PRIMARY_COLOR);
} }
export function publicKeyEncrypt(input, publicKey) { export function publicKeyEncrypt(input, publicKey) {

View File

@ -481,7 +481,7 @@ export default {
delete_file: "The file already exists, please delete the file with the same name first!", delete_file: "The file already exists, please delete the file with the same name first!",
thread_num: 'Concurrent users:', thread_num: 'Concurrent users:',
input_thread_num: 'Please enter the number of threads', input_thread_num: 'Please enter the number of threads',
duration: 'Duration time (seconds)', duration: 'Duration time',
granularity: 'Aggregation time (seconds)', granularity: 'Aggregation time (seconds)',
input_duration: 'Please enter a duration', input_duration: 'Please enter a duration',
rps_limit: 'RPS Limit:', rps_limit: 'RPS Limit:',
@ -1029,6 +1029,7 @@ export default {
}, },
scenario_schedule: "Scenario", scenario_schedule: "Scenario",
test_plan_schedule: "Test plan", test_plan_schedule: "Test plan",
swagger_schedule: "swagger",
confirm: { confirm: {
close_title: "Do you want to close this scheduled task", close_title: "Do you want to close this scheduled task",
} }

View File

@ -478,14 +478,14 @@ export default {
delete_file: "文件已存在,请先删除同名文件!", delete_file: "文件已存在,请先删除同名文件!",
thread_num: '并发用户数:', thread_num: '并发用户数:',
input_thread_num: '请输入线程数', input_thread_num: '请输入线程数',
duration: '压测时长(秒)', duration: '压测时长',
granularity: '聚合时间(秒)', granularity: '聚合时间(秒)',
input_duration: '请输入时长', input_duration: '请输入时长',
rps_limit: 'RPS上限', rps_limit: 'RPS上限',
input_rps_limit: '请输入限制', input_rps_limit: '请输入限制',
ramp_up_time_within: '在', ramp_up_time_within: '在',
ramp_up_time_minutes: '内,分', ramp_up_time_minutes: '{0}内,分',
ramp_up_time_seconds: '内增加并发用户', ramp_up_time_seconds: '{0}内增加并发用户',
iterate_num: '迭代次数 (次): ', iterate_num: '迭代次数 (次): ',
by_iteration: '按迭代次数', by_iteration: '按迭代次数',
by_duration: '按持续时间', by_duration: '按持续时间',
@ -1033,6 +1033,7 @@ export default {
}, },
scenario_schedule: "场景", scenario_schedule: "场景",
test_plan_schedule: "测试计划", test_plan_schedule: "测试计划",
swagger_schedule: "swagger",
confirm: { confirm: {
close_title: "要关闭这条定时任务吗?", close_title: "要关闭这条定时任务吗?",
} }

View File

@ -478,7 +478,7 @@ export default {
delete_file: "文件已存在,請先刪除同名文件!", delete_file: "文件已存在,請先刪除同名文件!",
thread_num: '並發用戶數:', thread_num: '並發用戶數:',
input_thread_num: '請輸入線程數', input_thread_num: '請輸入線程數',
duration: '壓測時長(秒)', duration: '壓測時長',
granularity: '聚合時間(秒)', granularity: '聚合時間(秒)',
input_duration: '請輸入時長', input_duration: '請輸入時長',
rps_limit: 'RPS上限', rps_limit: 'RPS上限',
@ -1031,6 +1031,7 @@ export default {
}, },
scenario_schedule: "場景", scenario_schedule: "場景",
test_plan_schedule: "測試計畫", test_plan_schedule: "測試計畫",
swagger_schedule: "swagger",
confirm: { confirm: {
close_title: "要關閉這條定時任務嗎?", close_title: "要關閉這條定時任務嗎?",
} }

View File

@ -56,7 +56,7 @@
<script> <script>
import {publicKeyEncrypt, saveLocalStorage} from '@/common/js/utils'; import {publicKeyEncrypt, saveLocalStorage} from '@/common/js/utils';
import {DEFAULT_LANGUAGE} from "@/common/js/constants"; import {DEFAULT_LANGUAGE, PRIMARY_COLOR} from "@/common/js/constants";
const requireComponent = require.context('@/business/components/xpack/', true, /\.vue$/); const requireComponent = require.context('@/business/components/xpack/', true, /\.vue$/);
const display = requireComponent.keys().length > 0 ? requireComponent("./display/Display.vue") : {}; const display = requireComponent.keys().length > 0 ? requireComponent("./display/Display.vue") : {};
@ -91,6 +91,10 @@ export default {
} }
}, },
beforeCreate() { beforeCreate() {
this.$get('/system/theme', res => {
this.color = res.data ? res.data : PRIMARY_COLOR;
document.body.style.setProperty('--primary_color', this.color);
})
this.result = this.$get("/isLogin").then(response => { this.result = this.$get("/isLogin").then(response => {
if (display.default !== undefined) { if (display.default !== undefined) {
@ -230,7 +234,7 @@ export default {
margin-top: 12px; margin-top: 12px;
margin-bottom: 75px; margin-bottom: 75px;
font-size: 14px; font-size: 14px;
color: #843697; color: var(--primary_color);
line-height: 14px; line-height: 14px;
text-align: center; text-align: center;
} }
@ -243,18 +247,18 @@ export default {
.btn > .submit { .btn > .submit {
border-radius: 70px; border-radius: 70px;
border-color: #8B479B; border-color: var(--primary_color);
background-color: #8B479B; background-color: var(--primary_color);
} }
.btn > .submit:hover { .btn > .submit:hover {
border-color: rgba(139, 71, 155, 0.9); border-color: var(--primary_color);
background-color: rgba(139, 71, 155, 0.9); background-color: var(--primary_color);
} }
.btn > .submit:active { .btn > .submit:active {
border-color: rgba(139, 71, 155, 0.8); border-color: var(--primary_color);
background-color: rgba(139, 71, 155, 0.8); background-color: var(--primary_color);
} }
.el-form-item:first-child { .el-form-item:first-child {
@ -262,13 +266,13 @@ export default {
} }
/deep/ .el-radio__input.is-checked .el-radio__inner { /deep/ .el-radio__input.is-checked .el-radio__inner {
background-color: #783887; background-color: var(--primary_color);
background: #783887; background: var(--primary_color);
border-color: #783887; border-color: var(--primary_color);
} }
/deep/ .el-radio__input.is-checked + .el-radio__label { /deep/ .el-radio__input.is-checked + .el-radio__label {
color: #783887; color: var(--primary_color);
} }
/deep/ .el-input__inner { /deep/ .el-input__inner {
@ -284,7 +288,7 @@ export default {
} }
/deep/ .el-input__inner:focus { /deep/ .el-input__inner:focus {
border: 1px solid #783887 !important; border: 1px solid var(--primary_color) !important;
} }
.divider { .divider {