Merge branch 'master' of https://github.com/metersphere/metersphere
Conflicts: backend/src/main/resources/db/migration/V78__v1.8_release.sql
This commit is contained in:
commit
30d39b4338
|
@ -541,6 +541,11 @@
|
|||
<include name="*.html"/>
|
||||
</fileset>
|
||||
</move>
|
||||
<copy todir="src/main/resources/static/css">
|
||||
<fileset dir="../frontend/src/assets/theme">
|
||||
<include name="index.css"/>
|
||||
</fileset>
|
||||
</copy>
|
||||
</target>
|
||||
</configuration>
|
||||
<goals>
|
||||
|
|
|
@ -15,6 +15,7 @@ import io.metersphere.api.service.*;
|
|||
import io.metersphere.base.domain.ApiTest;
|
||||
import io.metersphere.base.domain.Schedule;
|
||||
import io.metersphere.commons.constants.RoleConstants;
|
||||
import io.metersphere.commons.constants.ScheduleGroup;
|
||||
import io.metersphere.commons.utils.CronUtils;
|
||||
import io.metersphere.commons.utils.PageUtils;
|
||||
import io.metersphere.commons.utils.Pager;
|
||||
|
@ -28,15 +29,13 @@ import io.metersphere.service.ScheduleService;
|
|||
import org.apache.jorphan.collections.HashTree;
|
||||
import org.apache.shiro.authz.annotation.Logical;
|
||||
import org.apache.shiro.authz.annotation.RequiresRoles;
|
||||
import org.python.core.AstList;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.text.DecimalFormat;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.*;
|
||||
|
||||
import static io.metersphere.commons.utils.JsonPathUtils.getListJson;
|
||||
|
||||
|
@ -345,8 +344,11 @@ public class APITestController {
|
|||
|
||||
@GetMapping("/runningTask/{projectID}")
|
||||
public List<TaskInfoResult> runningTask(@PathVariable String projectID) {
|
||||
|
||||
List<TaskInfoResult> resultList = scheduleService.findRunningTaskInfoByProjectID(projectID);
|
||||
List<String> typeFilter = Arrays.asList( // 首页显示的运行中定时任务,只要这3种,不需要 性能测试、api_test(旧版)
|
||||
ScheduleGroup.API_SCENARIO_TEST.name(),
|
||||
ScheduleGroup.SWAGGER_IMPORT.name(),
|
||||
ScheduleGroup.TEST_PLAN_TEST.name());
|
||||
List<TaskInfoResult> resultList = scheduleService.findRunningTaskInfoByProjectID(projectID, typeFilter);
|
||||
int dataIndex = 1;
|
||||
for (TaskInfoResult taskInfo :
|
||||
resultList) {
|
||||
|
|
|
@ -30,6 +30,7 @@ import org.springframework.web.bind.annotation.*;
|
|||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.net.MalformedURLException;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
|
@ -163,7 +164,7 @@ public class ApiDefinitionController {
|
|||
|
||||
//定时任务创建
|
||||
@PostMapping(value = "/schedule/create")
|
||||
public void createSchedule(@RequestBody ScheduleRequest request) {
|
||||
public void createSchedule(@RequestBody ScheduleRequest request) throws MalformedURLException {
|
||||
apiDefinitionService.createSchedule(request);
|
||||
}
|
||||
@PostMapping(value = "/schedule/update")
|
||||
|
|
|
@ -29,5 +29,7 @@ public class TaskInfoResult {
|
|||
private Long updateTime;
|
||||
//定时任务类型 情景定时任务/范围计划任务
|
||||
private String taskType;
|
||||
//定时任务组别 swagger/scenario/testPlan 等
|
||||
private String taskGroup;
|
||||
|
||||
}
|
||||
|
|
|
@ -339,6 +339,8 @@ public class APITestService {
|
|||
schedule.setJob(ApiTestJob.class.getName());
|
||||
schedule.setGroup(ScheduleGroup.API_TEST.name());
|
||||
schedule.setType(ScheduleType.CRON.name());
|
||||
schedule.setProjectId(request.getProjectId());
|
||||
schedule.setName(request.getName());
|
||||
return schedule;
|
||||
}
|
||||
|
||||
|
|
|
@ -25,10 +25,7 @@ import io.metersphere.base.mapper.ApiScenarioMapper;
|
|||
import io.metersphere.base.mapper.ApiScenarioReportMapper;
|
||||
import io.metersphere.base.mapper.TestCaseReviewScenarioMapper;
|
||||
import io.metersphere.base.mapper.TestPlanApiScenarioMapper;
|
||||
import io.metersphere.base.mapper.ext.ExtApiScenarioMapper;
|
||||
import io.metersphere.base.mapper.ext.ExtTestPlanApiCaseMapper;
|
||||
import io.metersphere.base.mapper.ext.ExtTestPlanMapper;
|
||||
import io.metersphere.base.mapper.ext.ExtTestPlanScenarioCaseMapper;
|
||||
import io.metersphere.base.mapper.ext.*;
|
||||
import io.metersphere.commons.constants.*;
|
||||
import io.metersphere.commons.exception.MSException;
|
||||
import io.metersphere.commons.utils.*;
|
||||
|
@ -64,6 +61,8 @@ import java.util.stream.Collectors;
|
|||
@Service
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public class ApiAutomationService {
|
||||
@Resource
|
||||
private ExtScheduleMapper extScheduleMapper;
|
||||
@Resource
|
||||
private ApiScenarioMapper apiScenarioMapper;
|
||||
@Resource
|
||||
|
@ -204,6 +203,7 @@ public class ApiAutomationService {
|
|||
|
||||
final ApiScenarioWithBLOBs scenario = buildSaveScenario(request);
|
||||
apiScenarioMapper.updateByPrimaryKeySelective(scenario);
|
||||
extScheduleMapper.updateNameByResourceID(request.getId(), request.getName());// 修改场景name,同步到修改首页定时任务
|
||||
}
|
||||
|
||||
public ApiScenarioWithBLOBs buildSaveScenario(SaveApiScenarioRequest request) {
|
||||
|
@ -753,6 +753,9 @@ public class ApiAutomationService {
|
|||
|
||||
public void createSchedule(ScheduleRequest 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.setGroup(ScheduleGroup.API_SCENARIO_TEST.name());
|
||||
schedule.setType(ScheduleType.CRON.name());
|
||||
|
|
|
@ -49,6 +49,7 @@ import sun.security.util.Cache;
|
|||
|
||||
import javax.annotation.Resource;
|
||||
import java.io.File;
|
||||
import java.net.MalformedURLException;
|
||||
import java.util.*;
|
||||
import java.util.function.Function;
|
||||
import java.util.stream.Collectors;
|
||||
|
@ -215,7 +216,6 @@ public class ApiDefinitionService {
|
|||
ApiDefinitionExample example = new ApiDefinitionExample();
|
||||
if (request.getProtocol().equals(RequestType.HTTP)) {
|
||||
example.createCriteria().andMethodEqualTo(request.getMethod()).andStatusNotEqualTo("Trash")
|
||||
.andProtocolEqualTo(request.getProtocol()).andPathEqualTo(request.getPath())
|
||||
.andProjectIdEqualTo(request.getProjectId()).andIdNotEqualTo(request.getId());
|
||||
return apiDefinitionMapper.selectByExample(example);
|
||||
} else {
|
||||
|
@ -713,7 +713,7 @@ public class ApiDefinitionService {
|
|||
}
|
||||
|
||||
/*swagger定时导入*/
|
||||
public void createSchedule(ScheduleRequest request) {
|
||||
public void createSchedule(ScheduleRequest request) throws MalformedURLException {
|
||||
/*保存swaggerUrl*/
|
||||
SwaggerUrlProject swaggerUrlProject = new SwaggerUrlProject();
|
||||
swaggerUrlProject.setId(UUID.randomUUID().toString());
|
||||
|
@ -725,6 +725,9 @@ public class ApiDefinitionService {
|
|||
scheduleService.addSwaggerUrlSchedule(swaggerUrlProject);
|
||||
request.setResourceId(swaggerUrlProject.getId());
|
||||
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.setGroup(ScheduleGroup.SWAGGER_IMPORT.name());
|
||||
schedule.setType(ScheduleType.CRON.name());
|
||||
|
|
|
@ -1,8 +1,7 @@
|
|||
package io.metersphere.base.domain;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class Schedule implements Serializable {
|
||||
|
@ -30,7 +29,9 @@ public class Schedule implements Serializable {
|
|||
|
||||
private Long updateTime;
|
||||
|
||||
private String customData;
|
||||
private String projectId;
|
||||
|
||||
private String name;
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
}
|
|
@ -913,6 +913,146 @@ public class ScheduleExample {
|
|||
addCriterion("update_time not between", value1, value2, "updateTime");
|
||||
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 {
|
||||
|
|
|
@ -244,6 +244,76 @@ public class TestCaseExample {
|
|||
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() {
|
||||
addCriterion("node_path is null");
|
||||
return (Criteria) this;
|
||||
|
@ -924,76 +994,6 @@ public class TestCaseExample {
|
|||
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() {
|
||||
addCriterion("sort is null");
|
||||
return (Criteria) this;
|
||||
|
|
|
@ -16,21 +16,15 @@ public interface ScheduleMapper {
|
|||
|
||||
int insertSelective(Schedule record);
|
||||
|
||||
List<Schedule> selectByExampleWithBLOBs(ScheduleExample example);
|
||||
|
||||
List<Schedule> selectByExample(ScheduleExample example);
|
||||
|
||||
Schedule selectByPrimaryKey(String id);
|
||||
|
||||
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 updateByPrimaryKeySelective(Schedule record);
|
||||
|
||||
int updateByPrimaryKeyWithBLOBs(Schedule record);
|
||||
|
||||
int updateByPrimaryKey(Schedule record);
|
||||
}
|
|
@ -14,9 +14,8 @@
|
|||
<result column="workspace_id" jdbcType="VARCHAR" property="workspaceId" />
|
||||
<result column="create_time" jdbcType="BIGINT" property="createTime" />
|
||||
<result column="update_time" jdbcType="BIGINT" property="updateTime" />
|
||||
</resultMap>
|
||||
<resultMap extends="BaseResultMap" id="ResultMapWithBLOBs" type="io.metersphere.base.domain.Schedule">
|
||||
<result column="custom_data" jdbcType="LONGVARCHAR" property="customData" />
|
||||
<result column="project_id" jdbcType="VARCHAR" property="projectId" />
|
||||
<result column="name" jdbcType="VARCHAR" property="name" />
|
||||
</resultMap>
|
||||
<sql id="Example_Where_Clause">
|
||||
<where>
|
||||
|
@ -78,27 +77,8 @@
|
|||
</sql>
|
||||
<sql id="Base_Column_List">
|
||||
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 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
|
||||
<if test="distinct">
|
||||
|
@ -113,11 +93,9 @@
|
|||
order by ${orderByClause}
|
||||
</if>
|
||||
</select>
|
||||
<select id="selectByPrimaryKey" parameterType="java.lang.String" resultMap="ResultMapWithBLOBs">
|
||||
<select id="selectByPrimaryKey" parameterType="java.lang.String" resultMap="BaseResultMap">
|
||||
select
|
||||
<include refid="Base_Column_List" />
|
||||
,
|
||||
<include refid="Blob_Column_List" />
|
||||
from schedule
|
||||
where id = #{id,jdbcType=VARCHAR}
|
||||
</select>
|
||||
|
@ -136,12 +114,12 @@
|
|||
`value`, `group`, job,
|
||||
`enable`, resource_id, user_id,
|
||||
workspace_id, create_time, update_time,
|
||||
custom_data)
|
||||
project_id, `name`)
|
||||
values (#{id,jdbcType=VARCHAR}, #{key,jdbcType=VARCHAR}, #{type,jdbcType=VARCHAR},
|
||||
#{value,jdbcType=VARCHAR}, #{group,jdbcType=VARCHAR}, #{job,jdbcType=VARCHAR},
|
||||
#{enable,jdbcType=BIT}, #{resourceId,jdbcType=VARCHAR}, #{userId,jdbcType=VARCHAR},
|
||||
#{workspaceId,jdbcType=VARCHAR}, #{createTime,jdbcType=BIGINT}, #{updateTime,jdbcType=BIGINT},
|
||||
#{customData,jdbcType=LONGVARCHAR})
|
||||
#{projectId,jdbcType=VARCHAR}, #{name,jdbcType=VARCHAR})
|
||||
</insert>
|
||||
<insert id="insertSelective" parameterType="io.metersphere.base.domain.Schedule">
|
||||
insert into schedule
|
||||
|
@ -182,8 +160,11 @@
|
|||
<if test="updateTime != null">
|
||||
update_time,
|
||||
</if>
|
||||
<if test="customData != null">
|
||||
custom_data,
|
||||
<if test="projectId != null">
|
||||
project_id,
|
||||
</if>
|
||||
<if test="name != null">
|
||||
`name`,
|
||||
</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
|
@ -223,8 +204,11 @@
|
|||
<if test="updateTime != null">
|
||||
#{updateTime,jdbcType=BIGINT},
|
||||
</if>
|
||||
<if test="customData != null">
|
||||
#{customData,jdbcType=LONGVARCHAR},
|
||||
<if test="projectId != null">
|
||||
#{projectId,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="name != null">
|
||||
#{name,jdbcType=VARCHAR},
|
||||
</if>
|
||||
</trim>
|
||||
</insert>
|
||||
|
@ -273,33 +257,17 @@
|
|||
<if test="record.updateTime != null">
|
||||
update_time = #{record.updateTime,jdbcType=BIGINT},
|
||||
</if>
|
||||
<if test="record.customData != null">
|
||||
custom_data = #{record.customData,jdbcType=LONGVARCHAR},
|
||||
<if test="record.projectId != null">
|
||||
project_id = #{record.projectId,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="record.name != null">
|
||||
`name` = #{record.name,jdbcType=VARCHAR},
|
||||
</if>
|
||||
</set>
|
||||
<if test="_parameter != null">
|
||||
<include refid="Update_By_Example_Where_Clause" />
|
||||
</if>
|
||||
</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 schedule
|
||||
set id = #{record.id,jdbcType=VARCHAR},
|
||||
|
@ -313,7 +281,9 @@
|
|||
user_id = #{record.userId,jdbcType=VARCHAR},
|
||||
workspace_id = #{record.workspaceId,jdbcType=VARCHAR},
|
||||
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">
|
||||
<include refid="Update_By_Example_Where_Clause" />
|
||||
</if>
|
||||
|
@ -354,28 +324,15 @@
|
|||
<if test="updateTime != null">
|
||||
update_time = #{updateTime,jdbcType=BIGINT},
|
||||
</if>
|
||||
<if test="customData != null">
|
||||
custom_data = #{customData,jdbcType=LONGVARCHAR},
|
||||
<if test="projectId != null">
|
||||
project_id = #{projectId,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="name != null">
|
||||
`name` = #{name,jdbcType=VARCHAR},
|
||||
</if>
|
||||
</set>
|
||||
where id = #{id,jdbcType=VARCHAR}
|
||||
</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 schedule
|
||||
set `key` = #{key,jdbcType=VARCHAR},
|
||||
|
@ -388,7 +345,9 @@
|
|||
user_id = #{userId,jdbcType=VARCHAR},
|
||||
workspace_id = #{workspaceId,jdbcType=VARCHAR},
|
||||
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}
|
||||
</update>
|
||||
</mapper>
|
|
@ -15,10 +15,12 @@ public interface ExtScheduleMapper {
|
|||
|
||||
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);
|
||||
|
||||
ApiSwaggerUrlDTO select(String id);
|
||||
|
||||
int updateNameByResourceID(@Param("resourceId") String resourceId, @Param("name") String name);
|
||||
|
||||
}
|
|
@ -61,35 +61,33 @@
|
|||
AND create_time BETWEEN #{startTime} and #{endTime}
|
||||
</select>
|
||||
<select id="findRunningTaskInfoByProjectID" resultType="io.metersphere.api.dto.datacount.response.TaskInfoResult">
|
||||
SELECT apiScene.id AS scenarioId,
|
||||
apiScene.`name` AS `name`,
|
||||
sch.id AS taskID,
|
||||
sch.`value` AS rule,
|
||||
sch.`enable` AS `taskStatus`,
|
||||
u.`name` AS creator,
|
||||
sch.update_time AS updateTime,
|
||||
'scenario' AS taskType
|
||||
FROM api_scenario apiScene
|
||||
INNER JOIN `schedule` sch ON apiScene.id = sch.resource_id
|
||||
INNER JOIN `user` u ON u.id = sch.user_id
|
||||
SELECT sch.id AS taskID,
|
||||
sch.`name` AS `name`,
|
||||
sch.`value` AS rule,
|
||||
sch.`enable` AS `taskStatus`,
|
||||
sch.update_time AS updateTime,
|
||||
sch.id AS taskID,
|
||||
sch.`value` AS rule,
|
||||
sch.`enable` AS `taskStatus`,
|
||||
u.name AS creator,
|
||||
sch.update_time AS updateTime,
|
||||
sch.type AS taskType,
|
||||
sch.group AS taskGroup
|
||||
FROM (
|
||||
schedule sch left join user u
|
||||
ON sch.user_id = u.id
|
||||
)
|
||||
WHERE sch.`enable` = true
|
||||
AND apiScene.project_id = #{0,jdbcType=VARCHAR}
|
||||
UNION
|
||||
SELECT testPlan.id AS scenarioId,
|
||||
testPlan.`name` AS `name`,
|
||||
sch.id AS taskID,
|
||||
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}
|
||||
AND sch.project_id = #{projectId,jdbcType=VARCHAR}
|
||||
and sch.group in
|
||||
<foreach collection="types" item="item" separator="," open="(" close=")">
|
||||
#{item}
|
||||
</foreach>
|
||||
</select>
|
||||
<select id="select" resultType="io.metersphere.api.dto.definition.ApiSwaggerUrlDTO">
|
||||
select * from swagger_url_project where id=#{id}
|
||||
</select>
|
||||
<update id="updateNameByResourceID">
|
||||
update schedule set name = #{name} where resource_id = #{resourceId}
|
||||
</update>
|
||||
</mapper>
|
|
@ -71,5 +71,10 @@ public interface ExtTestCaseMapper {
|
|||
|
||||
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);
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -306,6 +306,9 @@
|
|||
or test_case.num like CONCAT('%', #{request.name},'%')
|
||||
or test_case.tags like CONCAT('%', #{request.name},'%'))
|
||||
</if>
|
||||
<if test="request.createTime >0">
|
||||
AND test_case.create_time >= #{request.createTime}
|
||||
</if>
|
||||
<if test="request.nodeIds != null and request.nodeIds.size() > 0">
|
||||
and test_case.node_id in
|
||||
<foreach collection="request.nodeIds" item="nodeId" separator="," open="(" close=")">
|
||||
|
@ -316,6 +319,12 @@
|
|||
and test_case.project_id = #{request.projectId}
|
||||
</if>
|
||||
<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>
|
||||
</sql>
|
||||
|
||||
|
@ -342,8 +351,9 @@
|
|||
</select>
|
||||
|
||||
<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
|
||||
FROM test_case WHERE test_case.project_id=#{projectId} GROUP BY groupField
|
||||
SELECT count(test_case.id) AS countNumber,
|
||||
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 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
|
||||
|
@ -355,6 +365,50 @@
|
|||
where tc.project_id = #{projectId} and tc.test_id is not null
|
||||
group by tc.maintainer
|
||||
</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>
|
|
@ -97,10 +97,13 @@
|
|||
</sql>
|
||||
|
||||
<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,
|
||||
test_case.type, test_case.node_path, test_case.method, test_case.num, test_case_review_test_case.reviewer,
|
||||
test_case.review_status, test_case_review_test_case.update_time, test_case_node.name as model,
|
||||
project.name as projectName, test_case_review_test_case.review_id as reviewId,test_case.test_id as testId
|
||||
select test_case_review_test_case.id as id, test_case_review_test_case.reviewer,
|
||||
test_case_review_test_case.update_time, test_case_review_test_case.review_id as reviewId,
|
||||
test_case.id as caseId, test_case.name, test_case.priority, 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
|
||||
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
|
||||
|
@ -215,4 +218,4 @@
|
|||
#{id}
|
||||
</foreach>
|
||||
</select>
|
||||
</mapper>
|
||||
</mapper>
|
||||
|
|
|
@ -42,10 +42,13 @@ public class ShiroUtils {
|
|||
//api-对外文档页面提供的查询接口
|
||||
filterChainDefinitionMap.put("/api/document/**", "anon");
|
||||
// filterChainDefinitionMap.put("/document/**", "anon");
|
||||
filterChainDefinitionMap.put("/system/theme", "anon");
|
||||
|
||||
}
|
||||
|
||||
public static void ignoreCsrfFilter(Map<String, String> filterChainDefinitionMap) {
|
||||
filterChainDefinitionMap.put("/", "apikey, authc"); // 跳转到 / 不用校验 csrf
|
||||
filterChainDefinitionMap.put("/language", "apikey, authc");// 跳转到 /language 不用校验 csrf
|
||||
filterChainDefinitionMap.put("/document", "apikey, authc"); // 跳转到 /document 不用校验 csrf
|
||||
}
|
||||
|
||||
|
|
|
@ -676,6 +676,13 @@ public class JmeterDocumentParser implements DocumentParser {
|
|||
((List<?>) durations).remove(0);
|
||||
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");
|
||||
String deleted = "false";
|
||||
if (deleteds instanceof List) {
|
||||
|
@ -691,6 +698,17 @@ public class JmeterDocumentParser implements DocumentParser {
|
|||
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);
|
||||
if (BooleanUtils.toBoolean(deleted)) {
|
||||
threadGroup.setAttribute("enabled", "false");
|
||||
|
@ -761,6 +779,13 @@ public class JmeterDocumentParser implements DocumentParser {
|
|||
((List<?>) holds).remove(0);
|
||||
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");
|
||||
String deleted = "false";
|
||||
if (deleteds instanceof List) {
|
||||
|
@ -776,6 +801,17 @@ public class JmeterDocumentParser implements DocumentParser {
|
|||
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);
|
||||
if (BooleanUtils.toBoolean(deleted)) {
|
||||
threadGroup.setAttribute("enabled", "false");
|
||||
|
@ -928,10 +964,10 @@ public class JmeterDocumentParser implements DocumentParser {
|
|||
}
|
||||
|
||||
private Element createStringProp(Document document, String name, String value) {
|
||||
Element unit = document.createElement(STRING_PROP);
|
||||
unit.setAttribute("name", name);
|
||||
unit.appendChild(document.createTextNode(value));
|
||||
return unit;
|
||||
Element element = document.createElement(STRING_PROP);
|
||||
element.setAttribute("name", name);
|
||||
element.appendChild(document.createTextNode(value));
|
||||
return element;
|
||||
}
|
||||
|
||||
private void processThreadGroupName(Element threadGroup) {
|
||||
|
|
|
@ -4,9 +4,7 @@ import com.alibaba.fastjson.JSON;
|
|||
import io.metersphere.api.dto.datacount.response.TaskInfoResult;
|
||||
import io.metersphere.api.dto.definition.ApiSwaggerUrlDTO;
|
||||
import io.metersphere.base.domain.*;
|
||||
import io.metersphere.base.mapper.ScheduleMapper;
|
||||
import io.metersphere.base.mapper.SwaggerUrlProjectMapper;
|
||||
import io.metersphere.base.mapper.UserMapper;
|
||||
import io.metersphere.base.mapper.*;
|
||||
import io.metersphere.base.mapper.ext.ExtScheduleMapper;
|
||||
import io.metersphere.commons.constants.ScheduleGroup;
|
||||
import io.metersphere.commons.constants.ScheduleType;
|
||||
|
@ -38,6 +36,10 @@ import java.util.stream.Collectors;
|
|||
@Transactional(rollbackFor = Exception.class)
|
||||
public class ScheduleService {
|
||||
|
||||
@Resource
|
||||
private TestPlanMapper testPlanMapper;
|
||||
@Resource
|
||||
private ApiScenarioMapper apiScenarioMapper;
|
||||
@Resource
|
||||
private ScheduleMapper scheduleMapper;
|
||||
@Resource
|
||||
|
@ -214,8 +216,8 @@ public class ScheduleService {
|
|||
}
|
||||
}
|
||||
|
||||
public List<TaskInfoResult> findRunningTaskInfoByProjectID(String projectID) {
|
||||
List<TaskInfoResult> runningTaskInfoList = extScheduleMapper.findRunningTaskInfoByProjectID(projectID);
|
||||
public List<TaskInfoResult> findRunningTaskInfoByProjectID(String projectID, List<String> typeFilter) {
|
||||
List<TaskInfoResult> runningTaskInfoList = extScheduleMapper.findRunningTaskInfoByProjectID(projectID, typeFilter);
|
||||
return runningTaskInfoList;
|
||||
}
|
||||
|
||||
|
@ -227,13 +229,19 @@ public class ScheduleService {
|
|||
TriggerKey triggerKey = null;
|
||||
Class clazz = null;
|
||||
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.setType(ScheduleType.CRON.name());
|
||||
jobKey = TestPlanTestJob.getJobKey(request.getResourceId());
|
||||
triggerKey = TestPlanTestJob.getTriggerKey(request.getResourceId());
|
||||
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.setType(ScheduleType.CRON.name());
|
||||
jobKey = ApiScenarioTestJob.getJobKey(request.getResourceId());
|
||||
|
|
|
@ -18,6 +18,7 @@ import io.metersphere.track.dto.TestPlanCaseDTO;
|
|||
import io.metersphere.track.request.testcase.EditTestCaseRequest;
|
||||
import io.metersphere.track.request.testcase.QueryTestCaseRequest;
|
||||
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.testplancase.QueryTestPlanCaseRequest;
|
||||
import io.metersphere.track.service.TestCaseService;
|
||||
|
@ -59,6 +60,12 @@ public class TestCaseController {
|
|||
return testCaseService.listTestCase(request);
|
||||
}
|
||||
|
||||
@GetMapping("/list/detail/{projectId}")
|
||||
public List<TestCaseWithBLOBs> listDetail(@PathVariable String projectId) {
|
||||
checkPermissionService.checkProjectOwner(projectId);
|
||||
return testCaseService.listTestCaseDetail(projectId);
|
||||
}
|
||||
|
||||
/*jenkins项目下所有接口和性能测试用例*/
|
||||
@GetMapping("/list/method/{projectId}")
|
||||
public List<TestCaseDTO> listByMethod(@PathVariable String projectId) {
|
||||
|
@ -195,4 +202,11 @@ public class TestCaseController {
|
|||
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);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -37,9 +37,9 @@ public class TestCaseIssuesController {
|
|||
issuesService.closeLocalIssue(id);
|
||||
}
|
||||
|
||||
@GetMapping("/delete/{id}")
|
||||
public void deleteIssue(@PathVariable String id) {
|
||||
issuesService.deleteIssue(id);
|
||||
@PostMapping("/delete")
|
||||
public void deleteIssue(@RequestBody IssuesRequest request) {
|
||||
issuesService.deleteIssue(request);
|
||||
}
|
||||
|
||||
@GetMapping("/tapd/user/{caseId}")
|
||||
|
|
|
@ -87,7 +87,7 @@ public class TrackController {
|
|||
}
|
||||
|
||||
@GetMapping("/bug/count/{projectId}")
|
||||
public BugStatustics getBugStatustics(@PathVariable String projectId) {
|
||||
return trackService.getBugStatustics(projectId);
|
||||
public BugStatustics getBugStatistics(@PathVariable String projectId) {
|
||||
return trackService.getBugStatistics(projectId);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -21,4 +21,10 @@ public class IssuesRequest {
|
|||
* zentao bug 影响版本
|
||||
*/
|
||||
private List<String> zentaoBuilds;
|
||||
|
||||
/**
|
||||
* issues id
|
||||
*/
|
||||
private String id;
|
||||
private String caseId;
|
||||
}
|
||||
|
|
|
@ -22,4 +22,10 @@ public class QueryTestCaseRequest extends BaseQueryRequest {
|
|||
private String userId;
|
||||
|
||||
private String reviewId;
|
||||
|
||||
private boolean isSelectThisWeedData = false;
|
||||
|
||||
private String caseCoverage;
|
||||
|
||||
private long createTime = 0;
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
}
|
|
@ -8,7 +8,7 @@ import lombok.Setter;
|
|||
public class TestPlanBugCount {
|
||||
private int index;
|
||||
private String planName;
|
||||
private long creatTime;
|
||||
private long createTime;
|
||||
private String status;
|
||||
private int caseSize;
|
||||
private int bugSize;
|
||||
|
|
|
@ -144,20 +144,22 @@ public class TrackStatisticsDTO {
|
|||
|
||||
public void countRelevance(List<TrackCountResult> relevanceResults) {
|
||||
for (TrackCountResult countResult : relevanceResults) {
|
||||
switch (countResult.getGroupField().toUpperCase()){
|
||||
switch (countResult.getGroupField()){
|
||||
case TrackCount.API:
|
||||
this.apiCaseCount += countResult.getCountNumber();
|
||||
this.allRelevanceCaseCount += countResult.getCountNumber();
|
||||
break;
|
||||
case TrackCount.PERFORMANCE:
|
||||
this.performanceCaseCount += countResult.getCountNumber();
|
||||
this.allRelevanceCaseCount += countResult.getCountNumber();
|
||||
break;
|
||||
case TrackCount.AUTOMATION:
|
||||
this.scenarioCaseCount += countResult.getCountNumber();
|
||||
this.allRelevanceCaseCount += countResult.getCountNumber();
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
this.allRelevanceCaseCount += countResult.getCountNumber();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1,10 +1,8 @@
|
|||
package io.metersphere.track.service;
|
||||
|
||||
import io.metersphere.base.domain.Issues;
|
||||
import io.metersphere.base.domain.Project;
|
||||
import io.metersphere.base.domain.ServiceIntegration;
|
||||
import io.metersphere.base.domain.TestCaseWithBLOBs;
|
||||
import io.metersphere.base.domain.*;
|
||||
import io.metersphere.base.mapper.IssuesMapper;
|
||||
import io.metersphere.base.mapper.TestCaseIssuesMapper;
|
||||
import io.metersphere.commons.constants.IssuesManagePlatform;
|
||||
import io.metersphere.commons.constants.NoticeConstants;
|
||||
import io.metersphere.commons.user.SessionUser;
|
||||
|
@ -43,6 +41,8 @@ public class IssuesService {
|
|||
private IssuesMapper issuesMapper;
|
||||
@Resource
|
||||
private NoticeSendService noticeSendService;
|
||||
@Resource
|
||||
private TestCaseIssuesMapper testCaseIssuesMapper;
|
||||
|
||||
public void testAuth(String platform) {
|
||||
AbstractIssuePlatform abstractPlatform = IssueFactory.createPlatform(platform, new IssuesRequest());
|
||||
|
@ -202,8 +202,14 @@ public class IssuesService {
|
|||
return platform.getPlatformUser();
|
||||
}
|
||||
|
||||
public void deleteIssue(String id) {
|
||||
public void deleteIssue(IssuesRequest request) {
|
||||
String caseId = request.getCaseId();
|
||||
String id = request.getId();
|
||||
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) {
|
||||
|
|
|
@ -212,11 +212,14 @@ public class TestCaseNodeService extends NodeTreeService<TestCaseNodeDTO> {
|
|||
List<String> caseIds = testCaseReviewTestCases.stream().map(TestCaseReviewTestCase::getCaseId).collect(Collectors.toList());
|
||||
|
||||
List<TestCaseNodeDTO> nodeList = getReviewNodeDTO(id, caseIds);
|
||||
TestCaseNodeDTO testCaseNodeDTO = new TestCaseNodeDTO();
|
||||
testCaseNodeDTO.setName(name);
|
||||
testCaseNodeDTO.setLabel(name);
|
||||
testCaseNodeDTO.setChildren(nodeList);
|
||||
list.add(testCaseNodeDTO);
|
||||
if (!CollectionUtils.isEmpty(nodeList)) {
|
||||
TestCaseNodeDTO testCaseNodeDTO = new TestCaseNodeDTO();
|
||||
testCaseNodeDTO.setName(name);
|
||||
testCaseNodeDTO.setLabel(name);
|
||||
testCaseNodeDTO.setChildren(nodeList);
|
||||
testCaseNodeDTO.setProjectId(id);
|
||||
list.add(testCaseNodeDTO);
|
||||
}
|
||||
});
|
||||
return list;
|
||||
|
||||
|
|
|
@ -5,7 +5,6 @@ import com.alibaba.excel.EasyExcelFactory;
|
|||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.github.pagehelper.PageHelper;
|
||||
import io.metersphere.api.dto.definition.ApiBatchRequest;
|
||||
import io.metersphere.base.domain.*;
|
||||
import io.metersphere.base.mapper.*;
|
||||
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.exception.MSException;
|
||||
import io.metersphere.commons.user.SessionUser;
|
||||
import io.metersphere.commons.utils.BeanUtils;
|
||||
import io.metersphere.commons.utils.LogUtil;
|
||||
import io.metersphere.commons.utils.ServiceUtils;
|
||||
import io.metersphere.commons.utils.SessionUtils;
|
||||
import io.metersphere.commons.utils.*;
|
||||
import io.metersphere.controller.request.OrderRequest;
|
||||
import io.metersphere.excel.domain.ExcelErrData;
|
||||
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.QueryTestCaseRequest;
|
||||
import io.metersphere.track.request.testcase.TestCaseBatchRequest;
|
||||
import io.metersphere.track.request.testcase.TestCaseMinderEditRequest;
|
||||
import io.metersphere.xmind.XmindCaseParser;
|
||||
import org.apache.commons.collections4.ListUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
|
@ -188,6 +185,7 @@ public class TestCaseService {
|
|||
}
|
||||
|
||||
public List<TestCaseDTO> listTestCase(QueryTestCaseRequest request) {
|
||||
this.initRequest(request, true);
|
||||
List<OrderRequest> orderList = ServiceUtils.getDefaultOrder(request.getOrders());
|
||||
OrderRequest order = new OrderRequest();
|
||||
// 对模板导入的测试用例排序
|
||||
|
@ -198,6 +196,25 @@ public class TestCaseService {
|
|||
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) {
|
||||
return extTestCaseMapper.listByMethod(request);
|
||||
}
|
||||
|
@ -705,4 +722,23 @@ public class TestCaseService {
|
|||
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);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
|
@ -57,6 +57,8 @@ import java.util.stream.Collectors;
|
|||
@Service
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public class TestPlanService {
|
||||
@Resource
|
||||
ExtScheduleMapper extScheduleMapper;
|
||||
@Resource
|
||||
TestPlanMapper testPlanMapper;
|
||||
@Resource
|
||||
|
@ -179,6 +181,7 @@ public class TestPlanService {
|
|||
testPlan.setActualEndTime(System.currentTimeMillis());
|
||||
}
|
||||
}
|
||||
extScheduleMapper.updateNameByResourceID(testPlan.getId(), testPlan.getName());// 同步更新该测试的定时任务的name
|
||||
|
||||
List<String> userIds = new ArrayList<>();
|
||||
userIds.add(testPlan.getPrincipal());
|
||||
|
|
|
@ -12,6 +12,7 @@ import org.springframework.stereotype.Service;
|
|||
import org.springframework.transaction.annotation.Transactional;
|
||||
import javax.annotation.Resource;
|
||||
import java.math.BigDecimal;
|
||||
import java.text.DecimalFormat;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
@ -110,59 +111,58 @@ public class TrackService {
|
|||
return charts;
|
||||
}
|
||||
|
||||
public BugStatustics getBugStatustics(String projectId) {
|
||||
public BugStatustics getBugStatistics(String projectId) {
|
||||
TestPlanExample example = new TestPlanExample();
|
||||
example.createCriteria().andProjectIdEqualTo(projectId);
|
||||
List<TestPlan> plans = testPlanMapper.selectByExample(example);
|
||||
List<TestPlanBugCount> list = new ArrayList<>();
|
||||
BugStatustics bugStatustics = new BugStatustics();
|
||||
int index = 1;
|
||||
int totalBugSize = 0;
|
||||
int totalCaseSize = 0;
|
||||
for (TestPlan plan : plans) {
|
||||
TestPlanBugCount testPlanBug = new TestPlanBugCount();
|
||||
testPlanBug.setIndex(index++);
|
||||
testPlanBug.setPlanName(plan.getName());
|
||||
testPlanBug.setCreatTime(plan.getCreateTime());
|
||||
testPlanBug.setCreateTime(plan.getCreateTime());
|
||||
testPlanBug.setStatus(plan.getStatus());
|
||||
testPlanBug.setCaseSize(getPlanCaseSize(plan.getId()));
|
||||
testPlanBug.setBugSize(getPlanBugSize(plan.getId()));
|
||||
testPlanBug.setPassRage(getPlanPassRage(plan.getId()));
|
||||
|
||||
int planCaseSize = getPlanCaseSize(plan.getId());
|
||||
testPlanBug.setCaseSize(planCaseSize);
|
||||
|
||||
int planBugSize = getPlanBugSize(plan.getId());
|
||||
testPlanBug.setBugSize(planBugSize);
|
||||
testPlanBug.setPassRage(getPlanPassRage(plan.getId(), planCaseSize));
|
||||
list.add(testPlanBug);
|
||||
|
||||
totalBugSize += planBugSize;
|
||||
totalCaseSize += planCaseSize;
|
||||
}
|
||||
|
||||
// todo
|
||||
bugStatustics.setList(list);
|
||||
bugStatustics.setRage("1");
|
||||
bugStatustics.setBugTotalSize(2);
|
||||
float rage =totalCaseSize == 0 ? 0 : (float) totalBugSize * 100 / totalCaseSize;
|
||||
DecimalFormat df = new DecimalFormat("0.0");
|
||||
bugStatustics.setRage(df.format(rage) + "%");
|
||||
bugStatustics.setBugTotalSize(totalBugSize);
|
||||
return bugStatustics;
|
||||
}
|
||||
|
||||
private int getPlanCaseSize(String planId) {
|
||||
TestPlanTestCaseExample testPlanTestCaseExample = new TestPlanTestCaseExample();
|
||||
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();
|
||||
return extTestCaseMapper.getTestPlanCase(planId);
|
||||
|
||||
}
|
||||
|
||||
private int getPlanBugSize(String planId) {
|
||||
return 1;
|
||||
return extTestCaseMapper.getTestPlanBug(planId);
|
||||
}
|
||||
|
||||
private String getPlanPassRage(String planId) {
|
||||
return "10%";
|
||||
private String getPlanPassRage(String planId, int totalSize) {
|
||||
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) + "%";
|
||||
}
|
||||
}
|
||||
|
|
|
@ -101,4 +101,49 @@ update api_definition set original_state='Underway';
|
|||
update api_scenario set original_state='Underway';
|
||||
|
||||
-- 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;
|
||||
|
|
|
@ -31,7 +31,7 @@ import MsView from "./components/common/router/View";
|
|||
import MsUser from "./components/common/head/HeaderUser";
|
||||
import MsHeaderOrgWs from "./components/common/head/HeaderOrgWs";
|
||||
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 {ORIGIN_COLOR} from "@/common/js/constants";
|
||||
|
||||
|
@ -55,13 +55,14 @@ export default {
|
|||
created() {
|
||||
registerRequestHeaders();
|
||||
if (!hasLicense()) {
|
||||
setOriginColor()
|
||||
setDefaultTheme();
|
||||
this.color = ORIGIN_COLOR;
|
||||
} else {
|
||||
//
|
||||
this.$get('/system/theme', res => {
|
||||
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")) {
|
||||
|
|
|
@ -114,12 +114,13 @@
|
|||
<el-col :span="3" class="ms-col-one ms-font">
|
||||
<el-checkbox v-model="enableCookieShare">共享cookie</el-checkbox>
|
||||
</el-col>
|
||||
<el-col :span="7">
|
||||
<el-col :span="6">
|
||||
<env-popover :env-map="projectEnvMap" :project-ids="projectIds" @setProjectEnvMap="setProjectEnvMap"
|
||||
:project-list="projectList" ref="envPopover"/>
|
||||
</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>
|
||||
<font-awesome-icon class="alt-ico" :icon="['fa', 'expand-alt']" size="lg" @click="fullScreen"/>
|
||||
</el-col>
|
||||
</el-row>
|
||||
</div>
|
||||
|
@ -192,6 +193,17 @@
|
|||
class="ms-sc-variable-header"/>
|
||||
<!--外部导入-->
|
||||
<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>
|
||||
</el-card>
|
||||
</template>
|
||||
|
@ -224,6 +236,9 @@
|
|||
import MsComponentConfig from "./component/ComponentConfig";
|
||||
import {handleCtrlSEvent} from "../../../../../common/js/utils";
|
||||
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');
|
||||
export default {
|
||||
|
@ -243,7 +258,10 @@
|
|||
MsApiCustomize,
|
||||
ApiImport,
|
||||
MsComponentConfig,
|
||||
EnvPopover
|
||||
EnvPopover,
|
||||
MaximizeScenario,
|
||||
ScenarioHeader,
|
||||
MsDrawer
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
|
@ -293,6 +311,7 @@
|
|||
projectEnvMap: new Map,
|
||||
projectList: [],
|
||||
debugResult: new Map,
|
||||
drawer: false,
|
||||
}
|
||||
},
|
||||
created() {
|
||||
|
@ -423,6 +442,9 @@
|
|||
}
|
||||
},
|
||||
methods: {
|
||||
showAllBtn() {
|
||||
this.$refs.maximizeScenario.showAll();
|
||||
},
|
||||
addListener() {
|
||||
document.addEventListener("keydown", this.createCtrlSHandle);
|
||||
// document.addEventListener("keydown", (even => handleCtrlSEvent(even, this.$refs.httpApi.saveApi)));
|
||||
|
@ -443,6 +465,7 @@
|
|||
// 直接更新场景防止编辑内容丢失
|
||||
this.editScenario();
|
||||
}
|
||||
this.$refs.maximizeHeader.getVariableSize();
|
||||
this.reload();
|
||||
},
|
||||
showButton(...names) {
|
||||
|
@ -697,8 +720,7 @@
|
|||
}
|
||||
this.sort();
|
||||
this.reload();
|
||||
}
|
||||
,
|
||||
},
|
||||
reload() {
|
||||
this.loading = true
|
||||
this.$nextTick(() => {
|
||||
|
@ -1046,7 +1068,14 @@
|
|||
// 把执行结果分发给各个请求
|
||||
this.debugResult = result;
|
||||
this.sort()
|
||||
},
|
||||
fullScreen() {
|
||||
this.drawer = true;
|
||||
},
|
||||
close() {
|
||||
this.drawer = false;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
@ -1112,7 +1141,7 @@
|
|||
}
|
||||
|
||||
/deep/ .el-card__body {
|
||||
padding: 15px;
|
||||
padding: 10px;
|
||||
}
|
||||
|
||||
/deep/ .el-drawer__body {
|
||||
|
@ -1182,4 +1211,17 @@
|
|||
.ms-sc-variable-header >>> .el-dialog__body {
|
||||
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>
|
||||
|
|
|
@ -16,6 +16,9 @@ export const ELEMENTS = new Map([
|
|||
['Extract', []],
|
||||
['JmeterElement', []],
|
||||
['CustomizeReq', ["ConstantTimer", "JSR223PreProcessor", "JSR223PostProcessor", "Assertions", "Extract"]],
|
||||
['MaxSamplerProxy', ["JSR223PreProcessor", "JSR223PostProcessor", "Assertions", "Extract"]],
|
||||
['AllSamplerProxy', ["HTTPSamplerProxy", "DubboSampler", "JDBCSampler", "TCPSampler"]],
|
||||
|
||||
])
|
||||
|
||||
export const ELEMENT_TYPE = {
|
||||
|
|
|
@ -1,47 +1,46 @@
|
|||
<template>
|
||||
<el-card class="api-component">
|
||||
|
||||
<div class="header" @click="active(data)">
|
||||
|
||||
<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 class="el-step__icon-inner">{{data.index}}</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>
|
||||
|
||||
<span @click.stop>
|
||||
<slot name="headerLeft">
|
||||
<i class="icon el-icon-arrow-right" :class="{'is-active': data.active}"
|
||||
@click="active(data)" v-if="data.type!='scenario'"/>
|
||||
<el-input :draggable="draggable" v-if="isShowInput && isShowNameInput" size="small" v-model="data.name" class="name-input"
|
||||
@click="active(data)" v-if="data.type!='scenario' && !isMax "/>
|
||||
<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"/>
|
||||
<span v-else-if="isMax">
|
||||
<el-tooltip :content="data.name" placement="top">
|
||||
<span>{{data.name}}</span>
|
||||
</el-tooltip>
|
||||
</span>
|
||||
<span v-else>
|
||||
{{data.name}}
|
||||
<i class="el-icon-edit" style="cursor:pointer" @click="editName" v-tester v-if="data.referenced!='REF' && !data.disabled"/>
|
||||
</span>
|
||||
</slot>
|
||||
<slot name="behindHeaderLeft"></slot>
|
||||
<slot name="behindHeaderLeft" v-if="!isMax"></slot>
|
||||
</span>
|
||||
|
||||
<div class="header-right" @click.stop>
|
||||
<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-tooltip>
|
||||
<slot name="button"></slot>
|
||||
<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>
|
||||
<step-extend-btns style="display: contents" @copy="copyRow" @remove="remove" v-if="showBtn"/>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<div class="header">
|
||||
<div class="header" v-if="!isMax">
|
||||
<fieldset :disabled="data.disabled" class="ms-fieldset">
|
||||
<el-collapse-transition>
|
||||
<el-collapse-transition>6.
|
||||
<div v-if="data.active && showCollapse" :draggable="draggable">
|
||||
<el-divider></el-divider>
|
||||
<slot></slot>
|
||||
|
@ -54,8 +53,11 @@
|
|||
</template>
|
||||
|
||||
<script>
|
||||
import StepExtendBtns from "../component/StepExtendBtns";
|
||||
|
||||
export default {
|
||||
name: "ApiBaseComponent",
|
||||
components: {StepExtendBtns},
|
||||
data() {
|
||||
return {
|
||||
isShowInput: false
|
||||
|
@ -63,6 +65,14 @@
|
|||
},
|
||||
props: {
|
||||
draggable: Boolean,
|
||||
isMax: {
|
||||
type: Boolean,
|
||||
default: false,
|
||||
},
|
||||
showBtn: {
|
||||
type: Boolean,
|
||||
default: true,
|
||||
},
|
||||
data: {
|
||||
type: Object,
|
||||
default() {
|
||||
|
@ -104,6 +114,9 @@
|
|||
this.$refs.nameEdit.focus();
|
||||
});
|
||||
}
|
||||
if (this.data && this.data.type === "JmeterElement") {
|
||||
this.data.active = false;
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
active() {
|
||||
|
@ -146,14 +159,26 @@
|
|||
}
|
||||
|
||||
.header-right {
|
||||
margin-right: 20px;
|
||||
margin-top: 5px;
|
||||
float: right;
|
||||
z-index: 1;
|
||||
}
|
||||
|
||||
.enable-switch {
|
||||
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 {
|
||||
padding: 0px;
|
||||
margin: 0px;
|
||||
|
|
|
@ -9,6 +9,8 @@
|
|||
:draggable="true"
|
||||
:color="displayColor.color"
|
||||
:background-color="displayColor.backgroundColor"
|
||||
:is-max="isMax"
|
||||
:show-btn="showBtn"
|
||||
:title="displayTitle">
|
||||
|
||||
<template v-slot:behindHeaderLeft>
|
||||
|
@ -71,6 +73,7 @@
|
|||
import ApiBaseComponent from "../common/ApiBaseComponent";
|
||||
import ApiResponseComponent from "./ApiResponseComponent";
|
||||
import CustomizeReqInfo from "@/business/components/api/automation/scenario/common/CustomizeReqInfo";
|
||||
import {ELEMENTS} from "../Setting";
|
||||
|
||||
export default {
|
||||
name: "MsApiComponent",
|
||||
|
@ -82,6 +85,14 @@
|
|||
type: Boolean,
|
||||
default: false,
|
||||
},
|
||||
isMax: {
|
||||
type: Boolean,
|
||||
default: false,
|
||||
},
|
||||
showBtn: {
|
||||
type: Boolean,
|
||||
default: true,
|
||||
},
|
||||
currentEnvironmentId: String,
|
||||
projectList: Array,
|
||||
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: {
|
||||
displayColor() {
|
||||
|
@ -220,6 +236,12 @@
|
|||
if (!this.request.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.sort();
|
||||
} else {
|
||||
|
|
|
@ -8,6 +8,8 @@
|
|||
:show-collapse="false"
|
||||
:is-show-name-input="!isDeletedOrRef"
|
||||
:is-disabled="true"
|
||||
:is-max="isMax"
|
||||
:show-btn="showBtn"
|
||||
color="#606266"
|
||||
background-color="#F4F4F5"
|
||||
:title="$t('api_test.automation.scenario_import')">
|
||||
|
@ -36,6 +38,14 @@
|
|||
props: {
|
||||
scenario: {},
|
||||
node: {},
|
||||
isMax: {
|
||||
type: Boolean,
|
||||
default: false,
|
||||
},
|
||||
showBtn: {
|
||||
type: Boolean,
|
||||
default: true,
|
||||
},
|
||||
draggable: {
|
||||
type: Boolean,
|
||||
default: false,
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
<template>
|
||||
<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"
|
||||
@remove="remove" @copyRow="copyRow" @refReload="refReload" :project-list="projectList" :env-map="envMap"/>
|
||||
</div>
|
||||
|
@ -24,6 +25,14 @@
|
|||
props: {
|
||||
type: String,
|
||||
scenario: {},
|
||||
isMax: {
|
||||
type: Boolean,
|
||||
default: false,
|
||||
},
|
||||
showBtn: {
|
||||
type: Boolean,
|
||||
default: true,
|
||||
},
|
||||
currentScenario: {},
|
||||
currentEnvironmentId: String,
|
||||
response: {},
|
||||
|
|
|
@ -5,6 +5,7 @@
|
|||
:data="timer"
|
||||
:draggable="true"
|
||||
:show-collapse="false"
|
||||
:is-max="isMax"
|
||||
color="#67C23A"
|
||||
background-color="#F2F9EE"
|
||||
:title="$t('api_test.automation.wait_controller')">
|
||||
|
@ -26,6 +27,14 @@
|
|||
props: {
|
||||
timer: {},
|
||||
node: {},
|
||||
isMax: {
|
||||
type: Boolean,
|
||||
default: false,
|
||||
},
|
||||
showBtn: {
|
||||
type: Boolean,
|
||||
default: true,
|
||||
},
|
||||
draggable: {
|
||||
type: Boolean,
|
||||
default: false,
|
||||
|
|
|
@ -5,6 +5,8 @@
|
|||
:data="controller"
|
||||
:show-collapse="false"
|
||||
:draggable="true"
|
||||
:is-max="isMax"
|
||||
:show-btn="showBtn"
|
||||
color="#E6A23C"
|
||||
background-color="#FCF6EE"
|
||||
:title="$t('api_test.automation.if_controller')">
|
||||
|
@ -33,6 +35,14 @@
|
|||
props: {
|
||||
controller: {},
|
||||
node: {},
|
||||
isMax: {
|
||||
type: Boolean,
|
||||
default: false,
|
||||
},
|
||||
showBtn: {
|
||||
type: Boolean,
|
||||
default: true,
|
||||
},
|
||||
index: Object,
|
||||
draggable: {
|
||||
type: Boolean,
|
||||
|
|
|
@ -5,6 +5,8 @@
|
|||
:data="request"
|
||||
:draggable="draggable"
|
||||
:color="defColor"
|
||||
:is-max="isMax"
|
||||
:show-btn="showBtn"
|
||||
:background-color="defBackgroundColor"
|
||||
:title="request.elementType">
|
||||
|
||||
|
@ -31,6 +33,14 @@
|
|||
default:
|
||||
false
|
||||
},
|
||||
isMax: {
|
||||
type: Boolean,
|
||||
default: false,
|
||||
},
|
||||
showBtn: {
|
||||
type: Boolean,
|
||||
default: true,
|
||||
},
|
||||
request: {
|
||||
type: Object,
|
||||
},
|
||||
|
|
|
@ -6,6 +6,8 @@
|
|||
:data="jsr223Processor"
|
||||
:draggable="draggable"
|
||||
:color="color"
|
||||
:is-max="isMax"
|
||||
:show-btn="showBtn"
|
||||
:background-color="backgroundColor"
|
||||
:title="title" v-loading="loading">
|
||||
|
||||
|
@ -33,6 +35,14 @@ export default {
|
|||
type: Boolean,
|
||||
default: false,
|
||||
},
|
||||
isMax: {
|
||||
type: Boolean,
|
||||
default: false,
|
||||
},
|
||||
showBtn: {
|
||||
type: Boolean,
|
||||
default: true,
|
||||
},
|
||||
isReadOnly: {
|
||||
type: Boolean,
|
||||
default:
|
||||
|
|
|
@ -7,12 +7,14 @@
|
|||
@remove="remove"
|
||||
:data="controller"
|
||||
:draggable="true"
|
||||
:is-max="isMax"
|
||||
:show-btn="showBtn"
|
||||
color="#02A7F0"
|
||||
background-color="#F4F4F5"
|
||||
:title="$t('api_test.automation.loop_controller')" v-loading="loading">
|
||||
|
||||
<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="FOREACH">{{$t('loop.foreach')}}</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,
|
||||
currentScenario: {},
|
||||
node: {},
|
||||
isMax: {
|
||||
type: Boolean,
|
||||
default: false,
|
||||
},
|
||||
showBtn: {
|
||||
type: Boolean,
|
||||
default: true,
|
||||
},
|
||||
index: Object,
|
||||
draggable: {
|
||||
type: Boolean,
|
||||
|
|
|
@ -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>
|
File diff suppressed because it is too large
Load Diff
|
@ -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>
|
|
@ -3,21 +3,14 @@
|
|||
<span class="kv-description" v-if="description">
|
||||
{{ description }}
|
||||
</span>
|
||||
<el-dropdown>
|
||||
<span class="el-dropdown-link">
|
||||
{{ $t('api_test.select_or_invert') }} <i class="el-icon-arrow-down el-icon--right"></i>
|
||||
</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>
|
||||
<el-row>
|
||||
<el-checkbox v-model="isSelectAll" v-if="items.length > 1"/>
|
||||
</el-row>
|
||||
<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-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"/>
|
||||
|
||||
</el-col>
|
||||
<span style="margin-left: 10px" v-else></span>
|
||||
|
||||
|
@ -59,7 +52,7 @@
|
|||
valuePlaceholder: String,
|
||||
isShowEnable: {
|
||||
type: Boolean,
|
||||
default: false
|
||||
default: true
|
||||
},
|
||||
description: String,
|
||||
items: Array,
|
||||
|
@ -73,6 +66,7 @@
|
|||
return {
|
||||
keyValues: [],
|
||||
loading: false,
|
||||
isSelectAll: true
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
|
@ -83,7 +77,15 @@
|
|||
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: {
|
||||
moveBottom(index) {
|
||||
if (this.items.length < 2 || index === this.items.length - 2) {
|
||||
|
@ -154,7 +156,7 @@
|
|||
},
|
||||
invertSelect() {
|
||||
this.items.forEach(item => {
|
||||
item.enable = !item.enable;
|
||||
item.enable = false;
|
||||
});
|
||||
},
|
||||
},
|
||||
|
|
|
@ -3,19 +3,13 @@
|
|||
<span class="kv-description" v-if="description">
|
||||
{{ description }}
|
||||
</span>
|
||||
<el-dropdown>
|
||||
<span class="el-dropdown-link">
|
||||
{{ $t('api_test.select_or_invert') }} <i class="el-icon-arrow-down el-icon--right"></i>
|
||||
</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>
|
||||
<el-row>
|
||||
<el-checkbox v-model="isSelectAll" v-if="parameters.length > 1"/>
|
||||
</el-row>
|
||||
<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-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"/>
|
||||
</el-col>
|
||||
<span style="margin-left: 10px" v-else></span>
|
||||
|
@ -131,8 +125,18 @@
|
|||
return {
|
||||
currentItem: null,
|
||||
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: {
|
||||
keyText() {
|
||||
return this.keyPlaceholder || this.$t("api_test.key");
|
||||
|
@ -191,7 +195,7 @@
|
|||
// TODO 检查key重复
|
||||
},
|
||||
isDisable: function (index) {
|
||||
return this.parameters.length - 1 === index;
|
||||
return this.parameters.length - 1 == index;
|
||||
},
|
||||
querySearch(queryString, cb) {
|
||||
let suggestions = this.suggestions;
|
||||
|
@ -235,7 +239,7 @@
|
|||
},
|
||||
invertSelect() {
|
||||
this.parameters.forEach(item => {
|
||||
item.enable = !item.enable;
|
||||
item.enable = false;
|
||||
});
|
||||
},
|
||||
},
|
||||
|
|
|
@ -6,6 +6,8 @@
|
|||
@active="active"
|
||||
:data="assertions"
|
||||
:draggable="draggable"
|
||||
:is-max="isMax"
|
||||
:show-btn="showBtn"
|
||||
color="#A30014"
|
||||
background-color="#F7E6E9"
|
||||
:title="$t('api_test.definition.request.assertions_rule')">
|
||||
|
@ -87,6 +89,14 @@
|
|||
type: Boolean,
|
||||
default: false,
|
||||
},
|
||||
isMax: {
|
||||
type: Boolean,
|
||||
default: false,
|
||||
},
|
||||
showBtn: {
|
||||
type: Boolean,
|
||||
default: true,
|
||||
},
|
||||
assertions: {},
|
||||
node: {},
|
||||
request: {},
|
||||
|
|
|
@ -142,7 +142,7 @@ export default {
|
|||
status: [{required: true, message: this.$t('commons.please_select'), trigger: 'change'}],
|
||||
},
|
||||
httpForm: {environmentId: "", tags: []},
|
||||
isShowEnable: false,
|
||||
isShowEnable: true,
|
||||
maintainerOptions: [],
|
||||
currentModule: {},
|
||||
reqOptions: REQ_METHOD,
|
||||
|
|
|
@ -5,6 +5,8 @@
|
|||
@active="active"
|
||||
:data="extract"
|
||||
:draggable="draggable"
|
||||
:is-max="isMax"
|
||||
:show-btn="showBtn"
|
||||
color="#015478"
|
||||
background-color="#E6EEF2"
|
||||
:title="$t('api_test.definition.request.extract_param')">
|
||||
|
@ -41,26 +43,26 @@
|
|||
</template>
|
||||
|
||||
<script>
|
||||
import {EXTRACT_TYPE} from "../../model/ApiTestModel";
|
||||
import MsApiExtractEdit from "./ApiExtractEdit";
|
||||
import MsApiExtractCommon from "./ApiExtractCommon";
|
||||
import {getUUID} from "@/common/js/utils";
|
||||
import ApiJsonPathSuggestButton from "../assertion/ApiJsonPathSuggestButton";
|
||||
import MsApiJsonpathSuggest from "../assertion/ApiJsonpathSuggest";
|
||||
import {ExtractJSONPath} from "../../../test/model/ScenarioModel";
|
||||
import ApiBaseComponent from "../../../automation/scenario/common/ApiBaseComponent";
|
||||
import {EXTRACT_TYPE} from "../../model/ApiTestModel";
|
||||
import MsApiExtractEdit from "./ApiExtractEdit";
|
||||
import MsApiExtractCommon from "./ApiExtractCommon";
|
||||
import {getUUID} from "@/common/js/utils";
|
||||
import ApiJsonPathSuggestButton from "../assertion/ApiJsonPathSuggestButton";
|
||||
import MsApiJsonpathSuggest from "../assertion/ApiJsonpathSuggest";
|
||||
import {ExtractJSONPath} from "../../../test/model/ScenarioModel";
|
||||
import ApiBaseComponent from "../../../automation/scenario/common/ApiBaseComponent";
|
||||
|
||||
export default {
|
||||
name: "MsApiExtract",
|
||||
components: {
|
||||
ApiBaseComponent,
|
||||
MsApiJsonpathSuggest,
|
||||
ApiJsonPathSuggestButton,
|
||||
MsApiExtractCommon,
|
||||
MsApiExtractEdit,
|
||||
},
|
||||
props: {
|
||||
extract: {},
|
||||
export default {
|
||||
name: "MsApiExtract",
|
||||
components: {
|
||||
ApiBaseComponent,
|
||||
MsApiJsonpathSuggest,
|
||||
ApiJsonPathSuggestButton,
|
||||
MsApiExtractCommon,
|
||||
MsApiExtractEdit,
|
||||
},
|
||||
props: {
|
||||
extract: {},
|
||||
response: {},
|
||||
node: {},
|
||||
customizeStyle: {
|
||||
|
@ -74,7 +76,15 @@ export default {
|
|||
draggable: {
|
||||
type: Boolean,
|
||||
default: false,
|
||||
}
|
||||
},
|
||||
isMax: {
|
||||
type: Boolean,
|
||||
default: false,
|
||||
},
|
||||
showBtn: {
|
||||
type: Boolean,
|
||||
default: true,
|
||||
},
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
|
|
|
@ -20,8 +20,9 @@
|
|||
</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>
|
||||
<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.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 == 'API_SCENARIO_TEST'" type="success" effect="plain" :content="$t('api_test.home_page.running_task_list.scenario_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>
|
||||
</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/>
|
||||
|
|
|
@ -1,8 +1,11 @@
|
|||
<template>
|
||||
<div class="minder">
|
||||
<minder-editor v-if="isActive"
|
||||
<minder-editor
|
||||
v-if="isActive"
|
||||
class="minder-container"
|
||||
:import-json="importJson"
|
||||
:height="700"
|
||||
:progress-enable="false"
|
||||
@save="save"
|
||||
/>
|
||||
</div>
|
||||
|
@ -20,10 +23,10 @@ export default {
|
|||
return []
|
||||
}
|
||||
},
|
||||
data: {
|
||||
type: Array,
|
||||
dataMap: {
|
||||
type: Map,
|
||||
default() {
|
||||
return []
|
||||
return new Map();
|
||||
}
|
||||
}
|
||||
},
|
||||
|
@ -52,7 +55,9 @@ export default {
|
|||
root: {
|
||||
data: {
|
||||
text: "全部用例",
|
||||
disable: true
|
||||
disable: true,
|
||||
id: "root",
|
||||
path: ""
|
||||
},
|
||||
children: []
|
||||
},
|
||||
|
@ -62,33 +67,46 @@ export default {
|
|||
}
|
||||
},
|
||||
mounted() {
|
||||
this.$nextTick(() => {
|
||||
this.parse(this.importJson.root, this.treeNodes);
|
||||
this.reload();
|
||||
})
|
||||
},
|
||||
watch: {
|
||||
dataMap() {
|
||||
this.$nextTick(() => {
|
||||
this.parse(this.importJson.root, this.treeNodes);
|
||||
this.reload();
|
||||
})
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
save(data) {
|
||||
console.log(data);
|
||||
// console.log(this.treeNodes);
|
||||
this.$emit('save', data)
|
||||
},
|
||||
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) {
|
||||
return;
|
||||
}
|
||||
root.children = [];
|
||||
|
||||
children.forEach((item) => {
|
||||
let node = {
|
||||
data: {
|
||||
text: item.name,
|
||||
id: item.id,
|
||||
disable: true,
|
||||
// resource: ['#']
|
||||
path: root.data.path + "/" + item.name,
|
||||
expandState:"collapse"
|
||||
},
|
||||
}
|
||||
root.children.push(node);
|
||||
this.parse(node, item.children);
|
||||
})
|
||||
});
|
||||
},
|
||||
reload() {
|
||||
this.isActive = false;
|
||||
|
@ -101,4 +119,9 @@ export default {
|
|||
</script>
|
||||
|
||||
<style scoped>
|
||||
.minder-container >>> .save-btn {
|
||||
right: 30px;
|
||||
bottom: auto;
|
||||
top: 30px;
|
||||
}
|
||||
</style>
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
<template>
|
||||
|
||||
<div>
|
||||
<div class="ms-table-header">
|
||||
<el-row v-if="title" class="table-title" type="flex" justify="space-between" align="middle">
|
||||
<slot name="title">
|
||||
{{title}}
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
<div>
|
||||
<template>
|
||||
<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>
|
||||
</template>
|
||||
</div>
|
||||
|
@ -21,5 +21,8 @@ export default {
|
|||
</script>
|
||||
|
||||
<style scoped>
|
||||
|
||||
.operator-color {
|
||||
color: var(--count_number);
|
||||
margin-left:10px;
|
||||
}
|
||||
</style>
|
||||
|
|
|
@ -37,6 +37,13 @@
|
|||
@change="calculateChart(threadGroup)"
|
||||
size="mini"/>
|
||||
</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>
|
||||
<el-form-item :label="$t('load_test.rps_limit')">
|
||||
<el-switch v-model="threadGroup.rpsLimitEnable" @change="calculateTotalChart()"/>
|
||||
|
@ -59,7 +66,7 @@
|
|||
@change="calculateChart(threadGroup)"
|
||||
size="mini"/>
|
||||
</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
|
||||
:disabled="true"
|
||||
:min="1"
|
||||
|
@ -79,7 +86,7 @@
|
|||
v-model="threadGroup.rampUpTime"
|
||||
size="mini"/>
|
||||
</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>
|
||||
|
@ -112,7 +119,7 @@
|
|||
@change="calculateChart(threadGroup)"
|
||||
size="mini"/>
|
||||
</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>
|
||||
</el-form>
|
||||
</el-col>
|
||||
|
@ -137,6 +144,7 @@ const TARGET_LEVEL = "TargetLevel";
|
|||
const RAMP_UP = "RampUp";
|
||||
const STEPS = "Steps";
|
||||
const DURATION = "duration";
|
||||
const UNIT = "unit";
|
||||
const RPS_LIMIT = "rpsLimit";
|
||||
const RPS_LIMIT_ENABLE = "rpsLimitEnable";
|
||||
const THREAD_TYPE = "threadType";
|
||||
|
@ -196,11 +204,10 @@ export default {
|
|||
this.threadGroups[i].iterateRampUp = item.value;
|
||||
break;
|
||||
case DURATION:
|
||||
if (item.unit) {
|
||||
this.threadGroups[i].duration = item.value;
|
||||
} else {
|
||||
this.threadGroups[i].duration = item.value * 60;
|
||||
}
|
||||
this.threadGroups[i].duration = item.value;
|
||||
break;
|
||||
case UNIT:
|
||||
this.threadGroups[i].unit = item.value;
|
||||
break;
|
||||
case STEPS:
|
||||
this.threadGroups[i].step = item.value;
|
||||
|
@ -506,6 +513,18 @@ export default {
|
|||
}
|
||||
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: {
|
||||
report: {
|
||||
|
|
|
@ -467,7 +467,8 @@ export default {
|
|||
let items = {
|
||||
name: name,
|
||||
type: 'line',
|
||||
data: d
|
||||
data: d,
|
||||
smooth: true
|
||||
};
|
||||
let seriesArrayNames = seriesArray.map(m => m.name);
|
||||
if (seriesArrayNames.includes(name)) {
|
||||
|
|
|
@ -130,7 +130,7 @@
|
|||
<el-table :data="granularityData">
|
||||
<el-table-column property="start" :label="$t('load_test.duration')">
|
||||
<template v-slot:default="scope">
|
||||
<span>{{ scope.row.start }} - {{ scope.row.end }}</span>
|
||||
<span>{{ scope.row.start }}S - {{ scope.row.end }}S</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column property="granularity" :label="$t('load_test.granularity')"/>
|
||||
|
|
|
@ -47,10 +47,17 @@
|
|||
:disabled="isReadOnly"
|
||||
v-model="threadGroup.duration"
|
||||
:min="1"
|
||||
:max="172800"
|
||||
:max="99999"
|
||||
@change="calculateChart(threadGroup)"
|
||||
size="mini"/>
|
||||
</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>
|
||||
<el-form-item :label="$t('load_test.rps_limit')">
|
||||
<el-switch v-model="threadGroup.rpsLimitEnable" @change="calculateTotalChart()"/>
|
||||
|
@ -74,7 +81,7 @@
|
|||
@change="calculateChart(threadGroup)"
|
||||
size="mini"/>
|
||||
</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
|
||||
:disabled="isReadOnly"
|
||||
:min="1"
|
||||
|
@ -95,7 +102,7 @@
|
|||
@change="calculateChart(threadGroup)"
|
||||
size="mini"/>
|
||||
</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>
|
||||
|
@ -128,7 +135,7 @@
|
|||
v-model="threadGroup.iterateRampUp"
|
||||
size="mini"/>
|
||||
</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>
|
||||
</el-form>
|
||||
</el-col>
|
||||
|
@ -154,6 +161,7 @@ const RAMP_UP = "RampUp";
|
|||
const ITERATE_RAMP_UP = "iterateRampUpTime";
|
||||
const STEPS = "Steps";
|
||||
const DURATION = "duration";
|
||||
const UNIT = "unit";
|
||||
const RPS_LIMIT = "rpsLimit";
|
||||
const RPS_LIMIT_ENABLE = "rpsLimitEnable";
|
||||
const HOLD = "Hold";
|
||||
|
@ -253,11 +261,10 @@ export default {
|
|||
this.threadGroups[i].iterateRampUp = item.value;
|
||||
break;
|
||||
case DURATION:
|
||||
if (item.unit) {
|
||||
this.threadGroups[i].duration = item.value;
|
||||
} else {
|
||||
this.threadGroups[i].duration = item.value * 60;
|
||||
}
|
||||
this.threadGroups[i].duration = item.value;
|
||||
break;
|
||||
case UNIT:
|
||||
this.threadGroups[i].unit = item.value;
|
||||
break;
|
||||
case STEPS:
|
||||
this.threadGroups[i].step = item.value;
|
||||
|
@ -290,6 +297,7 @@ export default {
|
|||
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], "iterateNum", this.threadGroups[i].iterateNum || 1);
|
||||
this.$set(this.threadGroups[i], "iterateRampUp", this.threadGroups[i].iterateRampUp || 10);
|
||||
|
@ -576,6 +584,18 @@ export default {
|
|||
|
||||
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() {
|
||||
/// todo:下面4个属性是jmeter ConcurrencyThreadGroup plugin的属性,这种硬编码不太好吧,在哪能转换这种属性?
|
||||
let result = [];
|
||||
|
@ -585,7 +605,8 @@ export default {
|
|||
{key: TARGET_LEVEL, value: this.threadGroups[i].threadNumber},
|
||||
{key: RAMP_UP, value: this.threadGroups[i].rampUpTime},
|
||||
{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_ENABLE, value: this.threadGroups[i].rpsLimitEnable},
|
||||
{key: HOLD, value: this.threadGroups[i].duration - this.threadGroups[i].rampUpTime},
|
||||
|
|
|
@ -31,6 +31,7 @@ export function findThreadGroup(jmxContent, handler) {
|
|||
tg.enabled = tg.attributes.enabled;
|
||||
tg.tgType = tg.name;
|
||||
tg.threadType = 'DURATION';
|
||||
tg.unit = 'S';
|
||||
})
|
||||
return threadGroups;
|
||||
}
|
||||
|
|
|
@ -39,8 +39,9 @@
|
|||
@setCondition="setCondition"
|
||||
ref="testCaseList">
|
||||
</test-case-list>
|
||||
<testcase-minder
|
||||
<test-case-minder
|
||||
:tree-nodes="treeNodes"
|
||||
:project-id="projectId"
|
||||
v-if="activeDom === 'right'"
|
||||
ref="testCaseList"/>
|
||||
</ms-tab-button>
|
||||
|
@ -97,17 +98,17 @@ import SelectMenu from "../common/SelectMenu";
|
|||
import MsContainer from "../../common/components/MsContainer";
|
||||
import MsAsideContainer from "../../common/components/MsAsideContainer";
|
||||
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 {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 TestCaseMinder from "@/business/components/track/common/minder/TestCaseMinder";
|
||||
|
||||
export default {
|
||||
name: "TestCase",
|
||||
components: {
|
||||
TestCaseMinder,
|
||||
MsTabButton,
|
||||
TestcaseMinder,
|
||||
TestCaseNodeTree,
|
||||
MsMainContainer,
|
||||
MsAsideContainer, MsContainer, TestCaseList, NodeTree, TestCaseEdit, SelectMenu
|
||||
|
@ -129,11 +130,13 @@ export default {
|
|||
renderComponent:true,
|
||||
loading: false,
|
||||
type:'',
|
||||
activeDom: 'left'
|
||||
activeDom: 'left',
|
||||
projectId: ""
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
this.init(this.$route);
|
||||
this.projectId = getCurrentProjectID();
|
||||
},
|
||||
watch: {
|
||||
redirectID() {
|
||||
|
@ -193,7 +196,7 @@ export default {
|
|||
}
|
||||
},
|
||||
addTab(tab) {
|
||||
if (!getCurrentProjectID()) {
|
||||
if (!this.projectId) {
|
||||
this.$warning(this.$t('commons.check_project_tip'));
|
||||
return;
|
||||
}
|
||||
|
@ -253,7 +256,7 @@ export default {
|
|||
this.testCaseReadOnly = true;
|
||||
}
|
||||
let caseId = this.$route.params.caseId;
|
||||
if (!getCurrentProjectID()) {
|
||||
if (!this.projectId) {
|
||||
this.$warning(this.$t('commons.check_project_tip'));
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -472,7 +472,6 @@ export default {
|
|||
reload() {
|
||||
this.isStepTableAlive = false;
|
||||
this.$nextTick(() => (this.isStepTableAlive = true));
|
||||
console.log(this.form)
|
||||
},
|
||||
open(testCase) {
|
||||
this.projectId = getCurrentProjectID();
|
||||
|
@ -552,9 +551,7 @@ export default {
|
|||
let tmp = {};
|
||||
Object.assign(tmp, testCase);
|
||||
tmp.steps = JSON.parse(testCase.steps);
|
||||
console.log(tmp)
|
||||
Object.assign(this.form, tmp);
|
||||
console.log(this.form)
|
||||
this.form.module = testCase.nodeId;
|
||||
this.getFileMetaData(testCase);
|
||||
},
|
||||
|
@ -631,7 +628,6 @@ export default {
|
|||
let param = this.buildParam();
|
||||
if (this.validate(param)) {
|
||||
let option = this.getOption(param);
|
||||
console.log(option)
|
||||
this.result = this.$request(option, () => {
|
||||
this.$success(this.$t('commons.save_success'));
|
||||
if (this.operationType == 'add' && this.isCreateContinue) {
|
||||
|
|
|
@ -312,6 +312,7 @@ export default {
|
|||
currentCaseId: null,
|
||||
projectId: "",
|
||||
selectDataCounts: 0,
|
||||
selectDataRange: "all"
|
||||
}
|
||||
},
|
||||
props: {
|
||||
|
@ -326,10 +327,27 @@ export default {
|
|||
},
|
||||
moduleOptions: {
|
||||
type: Array
|
||||
},
|
||||
trashEnable: {
|
||||
type: Boolean,
|
||||
default: false,
|
||||
}
|
||||
},
|
||||
created: function () {
|
||||
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();
|
||||
},
|
||||
watch: {
|
||||
|
@ -345,6 +363,11 @@ export default {
|
|||
customHeader() {
|
||||
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() {
|
||||
this.projectId = getCurrentProjectID();
|
||||
this.condition.planId = "";
|
||||
|
@ -363,6 +386,29 @@ export default {
|
|||
this.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) {
|
||||
this.condition.projectId = this.projectId;
|
||||
this.result = this.$post(this.buildPagePath('/test/case/list'), this.condition, response => {
|
||||
|
|
|
@ -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>
|
|
@ -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>
|
|
@ -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>
|
|
@ -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;
|
||||
}
|
||||
}
|
|
@ -29,12 +29,12 @@
|
|||
<el-row :gutter="10">
|
||||
<el-col :span="6">
|
||||
<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>
|
||||
</el-col>
|
||||
<el-col :span="6">
|
||||
<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>
|
||||
</el-col>
|
||||
<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 CaseCountCard from "@/business/components/track/home/components/CaseCountCard";
|
||||
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 {COUNT_NUMBER, COUNT_NUMBER_SHALLOW} from "@/common/js/constants";
|
||||
import BugCountCard from "@/business/components/track/home/components/BugCountCard";
|
||||
|
@ -169,7 +169,7 @@ export default {
|
|||
type: 'bar',
|
||||
itemStyle: {
|
||||
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',
|
||||
itemStyle: {
|
||||
normal: {
|
||||
color: COUNT_NUMBER_SHALLOW
|
||||
color: this.$store.state.theme.theme ? this.$store.state.theme.theme : COUNT_NUMBER_SHALLOW
|
||||
}
|
||||
}
|
||||
}]
|
||||
};
|
||||
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>
|
||||
|
|
|
@ -15,18 +15,19 @@
|
|||
{{ $t('api_test.home_page.unit_of_measurement') }}
|
||||
</span>
|
||||
<div>
|
||||
占比:
|
||||
<el-link type="info" @click="redirectPage('thisWeekCount')" target="_blank" style="color: #000000">{{ rage }}
|
||||
</el-link>
|
||||
占比
|
||||
<span class="rage">
|
||||
{{rage}}
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
</el-aside>
|
||||
<el-table border :data="tableData" class="adjust-table table-content" height="300">
|
||||
<el-table-column prop="index" label="序号"
|
||||
width="100" show-overflow-tooltip/>
|
||||
width="60" show-overflow-tooltip/>
|
||||
<el-table-column prop="planName" label="测试计划名称"
|
||||
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">
|
||||
<span>{{ scope.row.createTime | timestampFormatDate }}</span>
|
||||
</template>
|
||||
|
@ -35,6 +36,7 @@
|
|||
prop="status"
|
||||
column-key="status"
|
||||
:label="$t('test_track.plan.plan_status')"
|
||||
width="100"
|
||||
show-overflow-tooltip>
|
||||
<template v-slot:default="scope">
|
||||
<span @click.stop="clickt = 'stop'">
|
||||
|
@ -106,6 +108,12 @@ export default {
|
|||
color: var(--count_number);
|
||||
}
|
||||
|
||||
.rage {
|
||||
font-family: 'ArialMT', 'Arial', sans-serif;
|
||||
font-size: 18px;
|
||||
color: var(--count_number);
|
||||
}
|
||||
|
||||
.main-number-show {
|
||||
width: 100px;
|
||||
height: 100px;
|
||||
|
|
|
@ -83,27 +83,27 @@
|
|||
<el-row>
|
||||
<el-col>
|
||||
<span class="default-property">
|
||||
{{$t('api_test.home_page.detail_card.running')}}
|
||||
未评审
|
||||
{{"\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}}
|
||||
</el-link>
|
||||
</span>
|
||||
</el-col>
|
||||
<el-col style="margin-top: 5px;">
|
||||
<span class="default-property">
|
||||
{{$t('api_test.home_page.detail_card.not_started')}}
|
||||
未通过
|
||||
{{"\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}}
|
||||
</el-link>
|
||||
</span>
|
||||
</el-col>
|
||||
<el-col style="margin-top: 5px;">
|
||||
<span class="main-property">
|
||||
{{$t('api_test.home_page.detail_card.finished')}}
|
||||
已通过
|
||||
{{"\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}}
|
||||
</el-link>
|
||||
</span>
|
||||
|
@ -133,7 +133,7 @@ export default {
|
|||
},
|
||||
methods: {
|
||||
redirectPage(clickType){
|
||||
this.$emit("redirectPage","api","api",clickType);
|
||||
this.$emit("redirectPage","case", "case",clickType);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -68,7 +68,7 @@
|
|||
<span class="default-property">
|
||||
未覆盖
|
||||
{{"\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}}
|
||||
</el-link>
|
||||
</span>
|
||||
|
@ -77,7 +77,7 @@
|
|||
<span class="main-property">
|
||||
已覆盖
|
||||
{{"\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}}
|
||||
</el-link>
|
||||
</span>
|
||||
|
@ -107,7 +107,7 @@ export default {
|
|||
},
|
||||
methods: {
|
||||
redirectPage(clickType){
|
||||
this.$emit("redirectPage","api","api",clickType);
|
||||
this.$emit("redirectPage","case","case",clickType);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -664,8 +664,9 @@ export default {
|
|||
}
|
||||
},
|
||||
deleteIssue(row) {
|
||||
this.result = this.$get("/issues/delete/" + row.id, () => {
|
||||
this.getIssues(this.testCase.caseId);
|
||||
let caseId = this.testCase.caseId;
|
||||
this.result = this.$post("/issues/delete", {id: row.id, caseId: caseId}, () => {
|
||||
this.getIssues(caseId);
|
||||
this.$success(this.$t('commons.delete_success'));
|
||||
})
|
||||
},
|
||||
|
|
|
@ -10,15 +10,30 @@
|
|||
ref="nodeTree"/>
|
||||
</template>
|
||||
<template v-slot:main>
|
||||
<test-review-test-case-list
|
||||
class="table-list"
|
||||
@openTestReviewRelevanceDialog="openTestReviewRelevanceDialog"
|
||||
@refresh="refresh"
|
||||
:review-id="reviewId"
|
||||
:select-node-ids="selectNodeIds"
|
||||
:select-parent-nodes="selectParentNodes"
|
||||
:clickType="clickType"
|
||||
ref="testPlanTestCaseList"/>
|
||||
<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
|
||||
class="table-list"
|
||||
v-if="activeDom === 'left'"
|
||||
@openTestReviewRelevanceDialog="openTestReviewRelevanceDialog"
|
||||
@refresh="refresh"
|
||||
:review-id="reviewId"
|
||||
:select-node-ids="selectNodeIds"
|
||||
:select-parent-nodes="selectParentNodes"
|
||||
:clickType="clickType"
|
||||
ref="testPlanTestCaseList"/>
|
||||
<test-review-minder
|
||||
:tree-nodes="treeNodes"
|
||||
:project-id="projectId"
|
||||
:review-id="reviewId"
|
||||
v-if="activeDom === 'right'"
|
||||
/>
|
||||
</ms-tab-button>
|
||||
</template>
|
||||
<test-review-relevance
|
||||
@refresh="refresh"
|
||||
|
@ -29,16 +44,20 @@
|
|||
|
||||
<script>
|
||||
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 TestReviewRelevance from "@/business/components/track/review/view/components/TestReviewRelevance";
|
||||
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 {
|
||||
name: "TestReviewFunction",
|
||||
components: {
|
||||
TestReviewMinder,
|
||||
MsTabButton,
|
||||
TestReviewTestCaseList,
|
||||
TestReviewRelevance, MsNodeTree, FunctionalTestCaseList, MsTestPlanCommonComponent
|
||||
TestReviewRelevance, MsNodeTree, MsTestPlanCommonComponent
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
|
@ -49,15 +68,18 @@ export default {
|
|||
selectParentNodes: [],
|
||||
treeNodes: [],
|
||||
isMenuShow: true,
|
||||
activeDom: 'left',
|
||||
projectId: ""
|
||||
}
|
||||
},
|
||||
props: [
|
||||
'reviewId',
|
||||
'redirectCharType',
|
||||
'clickType'
|
||||
'clickType',
|
||||
],
|
||||
mounted() {
|
||||
this.getNodeTreeByReviewId()
|
||||
this.projectId = getCurrentProjectID();
|
||||
},
|
||||
activated() {
|
||||
this.getNodeTreeByReviewId()
|
||||
|
@ -89,5 +111,7 @@ export default {
|
|||
</script>
|
||||
|
||||
<style scoped>
|
||||
|
||||
/deep/ .el-button-group>.el-button:first-child {
|
||||
padding: 4px 1px !important;
|
||||
}
|
||||
</style>
|
||||
|
|
|
@ -1,7 +1,5 @@
|
|||
<template>
|
||||
<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"
|
||||
:show-create="false" :tip="$t('commons.search_by_name_or_id')">
|
||||
<template v-slot:title>
|
||||
|
@ -16,7 +14,6 @@
|
|||
@click="$emit('openTestReviewRelevanceDialog')"/>
|
||||
</template>
|
||||
</ms-table-header>
|
||||
</template>
|
||||
|
||||
<executor-edit ref="executorEdit" :select-ids="new Set(Array.from(this.selectRows).map(row => row.id))"
|
||||
@refresh="initTableData"/>
|
||||
|
@ -176,7 +173,6 @@
|
|||
:is-read-only="isReadOnly"
|
||||
@refreshTable="search"/>
|
||||
|
||||
</el-card>
|
||||
|
||||
<batch-edit ref="batchEdit" @batchEdit="batchEdit"
|
||||
:type-arr="typeArr" :value-arr="valueArr" :dialog-title="$t('test_track.case.batch_edit_case')"/>
|
||||
|
@ -472,6 +468,8 @@ export default {
|
|||
</script>
|
||||
|
||||
<style scoped>
|
||||
|
||||
.ms-table-header {
|
||||
margin: 20px;
|
||||
}
|
||||
</style>
|
||||
|
||||
|
|
|
@ -1 +1 @@
|
|||
Subproject commit 4c33b9c3b12a83da6d9bd2740262c6c8baaab819
|
||||
Subproject commit b2571e06e8b211821409115cc2c4a7c52cbac1db
|
|
@ -50,11 +50,23 @@ const IsReadOnly = {
|
|||
}
|
||||
}
|
||||
|
||||
const Theme = {
|
||||
state: {
|
||||
theme: undefined
|
||||
},
|
||||
mutations: {
|
||||
setTheme(state, value) {
|
||||
state.theme = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export default new Vuex.Store({
|
||||
modules: {
|
||||
api: API,
|
||||
common: Common,
|
||||
switch: Switch,
|
||||
isReadOnly: IsReadOnly,
|
||||
theme: Theme
|
||||
}
|
||||
})
|
||||
|
|
|
@ -17,6 +17,7 @@ body {
|
|||
/*--color: #2c2a48;*/
|
||||
/*--color_shallow: #595591;*/
|
||||
--color: '';
|
||||
--primary_color: '';
|
||||
--color_shallow: '';
|
||||
--count_number: '';
|
||||
--count_number_shallow: '';
|
||||
|
|
|
@ -173,3 +173,4 @@ export const ORIGIN_COLOR = '#2c2a48';
|
|||
export const ORIGIN_COLOR_SHALLOW = '#595591';
|
||||
export const COUNT_NUMBER = '#6C317C';
|
||||
export const COUNT_NUMBER_SHALLOW = '#CDB9D2';
|
||||
export const PRIMARY_COLOR = '#783887';
|
||||
|
|
|
@ -1,17 +1,17 @@
|
|||
import {
|
||||
COUNT_NUMBER,
|
||||
COUNT_NUMBER_SHALLOW,
|
||||
LicenseKey,
|
||||
ORIGIN_COLOR,
|
||||
ORIGIN_COLOR_SHALLOW,
|
||||
PROJECT_ID,
|
||||
REFRESH_SESSION_USER_URL,
|
||||
ROLE_ADMIN,
|
||||
ROLE_ORG_ADMIN,
|
||||
ROLE_TEST_MANAGER,
|
||||
ROLE_TEST_USER,
|
||||
ROLE_TEST_VIEWER,
|
||||
TokenKey
|
||||
COUNT_NUMBER,
|
||||
COUNT_NUMBER_SHALLOW,
|
||||
LicenseKey,
|
||||
ORIGIN_COLOR,
|
||||
ORIGIN_COLOR_SHALLOW, PRIMARY_COLOR,
|
||||
PROJECT_ID,
|
||||
REFRESH_SESSION_USER_URL,
|
||||
ROLE_ADMIN,
|
||||
ROLE_ORG_ADMIN,
|
||||
ROLE_TEST_MANAGER,
|
||||
ROLE_TEST_USER,
|
||||
ROLE_TEST_VIEWER,
|
||||
TokenKey
|
||||
} from "./constants";
|
||||
import axios from "axios";
|
||||
import {jsPDF} from "jspdf";
|
||||
|
@ -354,19 +354,19 @@ export function objToStrMap(obj) {
|
|||
return strMap;
|
||||
}
|
||||
|
||||
export function getColor() {
|
||||
return localStorage.getItem('color');
|
||||
}
|
||||
|
||||
export function setColor(a, b, c, d) {
|
||||
export function setColor(a, b, c, d, e) {
|
||||
// 顶部菜单背景色
|
||||
document.body.style.setProperty('--color', a);
|
||||
document.body.style.setProperty('--color_shallow', b);
|
||||
// 首页颜色
|
||||
document.body.style.setProperty('--count_number', c);
|
||||
document.body.style.setProperty('--count_number_shallow', d);
|
||||
// 主颜色
|
||||
document.body.style.setProperty('--primary_color', e);
|
||||
}
|
||||
|
||||
export function setOriginColor() {
|
||||
setColor(ORIGIN_COLOR, ORIGIN_COLOR_SHALLOW, COUNT_NUMBER, COUNT_NUMBER_SHALLOW);
|
||||
export function setDefaultTheme() {
|
||||
setColor(ORIGIN_COLOR, ORIGIN_COLOR_SHALLOW, COUNT_NUMBER, COUNT_NUMBER_SHALLOW, PRIMARY_COLOR);
|
||||
}
|
||||
|
||||
export function publicKeyEncrypt(input, publicKey) {
|
||||
|
|
|
@ -481,7 +481,7 @@ export default {
|
|||
delete_file: "The file already exists, please delete the file with the same name first!",
|
||||
thread_num: 'Concurrent users:',
|
||||
input_thread_num: 'Please enter the number of threads',
|
||||
duration: 'Duration time (seconds)',
|
||||
duration: 'Duration time',
|
||||
granularity: 'Aggregation time (seconds)',
|
||||
input_duration: 'Please enter a duration',
|
||||
rps_limit: 'RPS Limit:',
|
||||
|
@ -1029,6 +1029,7 @@ export default {
|
|||
},
|
||||
scenario_schedule: "Scenario",
|
||||
test_plan_schedule: "Test plan",
|
||||
swagger_schedule: "swagger",
|
||||
confirm: {
|
||||
close_title: "Do you want to close this scheduled task?",
|
||||
}
|
||||
|
|
|
@ -478,14 +478,14 @@ export default {
|
|||
delete_file: "文件已存在,请先删除同名文件!",
|
||||
thread_num: '并发用户数:',
|
||||
input_thread_num: '请输入线程数',
|
||||
duration: '压测时长(秒)',
|
||||
duration: '压测时长',
|
||||
granularity: '聚合时间(秒)',
|
||||
input_duration: '请输入时长',
|
||||
rps_limit: 'RPS上限:',
|
||||
input_rps_limit: '请输入限制',
|
||||
ramp_up_time_within: '在',
|
||||
ramp_up_time_minutes: '秒内,分',
|
||||
ramp_up_time_seconds: '秒内增加并发用户',
|
||||
ramp_up_time_minutes: '{0}内,分',
|
||||
ramp_up_time_seconds: '{0}内增加并发用户',
|
||||
iterate_num: '迭代次数 (次): ',
|
||||
by_iteration: '按迭代次数',
|
||||
by_duration: '按持续时间',
|
||||
|
@ -1033,6 +1033,7 @@ export default {
|
|||
},
|
||||
scenario_schedule: "场景",
|
||||
test_plan_schedule: "测试计划",
|
||||
swagger_schedule: "swagger",
|
||||
confirm: {
|
||||
close_title: "要关闭这条定时任务吗?",
|
||||
}
|
||||
|
|
|
@ -478,7 +478,7 @@ export default {
|
|||
delete_file: "文件已存在,請先刪除同名文件!",
|
||||
thread_num: '並發用戶數:',
|
||||
input_thread_num: '請輸入線程數',
|
||||
duration: '壓測時長(秒)',
|
||||
duration: '壓測時長',
|
||||
granularity: '聚合時間(秒)',
|
||||
input_duration: '請輸入時長',
|
||||
rps_limit: 'RPS上限:',
|
||||
|
@ -1031,6 +1031,7 @@ export default {
|
|||
},
|
||||
scenario_schedule: "場景",
|
||||
test_plan_schedule: "測試計畫",
|
||||
swagger_schedule: "swagger",
|
||||
confirm: {
|
||||
close_title: "要關閉這條定時任務嗎?",
|
||||
}
|
||||
|
|
|
@ -56,7 +56,7 @@
|
|||
|
||||
<script>
|
||||
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 display = requireComponent.keys().length > 0 ? requireComponent("./display/Display.vue") : {};
|
||||
|
@ -91,6 +91,10 @@ export default {
|
|||
}
|
||||
},
|
||||
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 => {
|
||||
|
||||
if (display.default !== undefined) {
|
||||
|
@ -230,7 +234,7 @@ export default {
|
|||
margin-top: 12px;
|
||||
margin-bottom: 75px;
|
||||
font-size: 14px;
|
||||
color: #843697;
|
||||
color: var(--primary_color);
|
||||
line-height: 14px;
|
||||
text-align: center;
|
||||
}
|
||||
|
@ -243,18 +247,18 @@ export default {
|
|||
|
||||
.btn > .submit {
|
||||
border-radius: 70px;
|
||||
border-color: #8B479B;
|
||||
background-color: #8B479B;
|
||||
border-color: var(--primary_color);
|
||||
background-color: var(--primary_color);
|
||||
}
|
||||
|
||||
.btn > .submit:hover {
|
||||
border-color: rgba(139, 71, 155, 0.9);
|
||||
background-color: rgba(139, 71, 155, 0.9);
|
||||
border-color: var(--primary_color);
|
||||
background-color: var(--primary_color);
|
||||
}
|
||||
|
||||
.btn > .submit:active {
|
||||
border-color: rgba(139, 71, 155, 0.8);
|
||||
background-color: rgba(139, 71, 155, 0.8);
|
||||
border-color: var(--primary_color);
|
||||
background-color: var(--primary_color);
|
||||
}
|
||||
|
||||
.el-form-item:first-child {
|
||||
|
@ -262,13 +266,13 @@ export default {
|
|||
}
|
||||
|
||||
/deep/ .el-radio__input.is-checked .el-radio__inner {
|
||||
background-color: #783887;
|
||||
background: #783887;
|
||||
border-color: #783887;
|
||||
background-color: var(--primary_color);
|
||||
background: var(--primary_color);
|
||||
border-color: var(--primary_color);
|
||||
}
|
||||
|
||||
/deep/ .el-radio__input.is-checked + .el-radio__label {
|
||||
color: #783887;
|
||||
color: var(--primary_color);
|
||||
}
|
||||
|
||||
/deep/ .el-input__inner {
|
||||
|
@ -284,7 +288,7 @@ export default {
|
|||
}
|
||||
|
||||
/deep/ .el-input__inner:focus {
|
||||
border: 1px solid #783887 !important;
|
||||
border: 1px solid var(--primary_color) !important;
|
||||
}
|
||||
|
||||
.divider {
|
||||
|
|
Loading…
Reference in New Issue