feat: 性能用例支持自定义排序
This commit is contained in:
parent
38face01c9
commit
b54fd8e36a
|
@ -33,5 +33,7 @@ public class LoadTest implements Serializable {
|
||||||
|
|
||||||
private String followPeople;
|
private String followPeople;
|
||||||
|
|
||||||
|
private Long order;
|
||||||
|
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
}
|
}
|
|
@ -1043,6 +1043,66 @@ public class LoadTestExample {
|
||||||
addCriterion("follow_people not between", value1, value2, "followPeople");
|
addCriterion("follow_people not between", value1, value2, "followPeople");
|
||||||
return (Criteria) this;
|
return (Criteria) this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Criteria andOrderIsNull() {
|
||||||
|
addCriterion("`order` is null");
|
||||||
|
return (Criteria) this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Criteria andOrderIsNotNull() {
|
||||||
|
addCriterion("`order` is not null");
|
||||||
|
return (Criteria) this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Criteria andOrderEqualTo(Long value) {
|
||||||
|
addCriterion("`order` =", value, "order");
|
||||||
|
return (Criteria) this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Criteria andOrderNotEqualTo(Long value) {
|
||||||
|
addCriterion("`order` <>", value, "order");
|
||||||
|
return (Criteria) this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Criteria andOrderGreaterThan(Long value) {
|
||||||
|
addCriterion("`order` >", value, "order");
|
||||||
|
return (Criteria) this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Criteria andOrderGreaterThanOrEqualTo(Long value) {
|
||||||
|
addCriterion("`order` >=", value, "order");
|
||||||
|
return (Criteria) this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Criteria andOrderLessThan(Long value) {
|
||||||
|
addCriterion("`order` <", value, "order");
|
||||||
|
return (Criteria) this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Criteria andOrderLessThanOrEqualTo(Long value) {
|
||||||
|
addCriterion("`order` <=", value, "order");
|
||||||
|
return (Criteria) this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Criteria andOrderIn(List<Long> values) {
|
||||||
|
addCriterion("`order` in", values, "order");
|
||||||
|
return (Criteria) this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Criteria andOrderNotIn(List<Long> values) {
|
||||||
|
addCriterion("`order` not in", values, "order");
|
||||||
|
return (Criteria) this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Criteria andOrderBetween(Long value1, Long value2) {
|
||||||
|
addCriterion("`order` between", value1, value2, "order");
|
||||||
|
return (Criteria) this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Criteria andOrderNotBetween(Long value1, Long value2) {
|
||||||
|
addCriterion("`order` not between", value1, value2, "order");
|
||||||
|
return (Criteria) this;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class Criteria extends GeneratedCriteria {
|
public static class Criteria extends GeneratedCriteria {
|
||||||
|
|
|
@ -16,6 +16,7 @@
|
||||||
<result column="scenario_version" jdbcType="INTEGER" property="scenarioVersion" />
|
<result column="scenario_version" jdbcType="INTEGER" property="scenarioVersion" />
|
||||||
<result column="scenario_id" jdbcType="VARCHAR" property="scenarioId" />
|
<result column="scenario_id" jdbcType="VARCHAR" property="scenarioId" />
|
||||||
<result column="follow_people" jdbcType="VARCHAR" property="followPeople" />
|
<result column="follow_people" jdbcType="VARCHAR" property="followPeople" />
|
||||||
|
<result column="order" jdbcType="BIGINT" property="order" />
|
||||||
</resultMap>
|
</resultMap>
|
||||||
<resultMap extends="BaseResultMap" id="ResultMapWithBLOBs" type="io.metersphere.base.domain.LoadTestWithBLOBs">
|
<resultMap extends="BaseResultMap" id="ResultMapWithBLOBs" type="io.metersphere.base.domain.LoadTestWithBLOBs">
|
||||||
<result column="load_configuration" jdbcType="LONGVARCHAR" property="loadConfiguration" />
|
<result column="load_configuration" jdbcType="LONGVARCHAR" property="loadConfiguration" />
|
||||||
|
@ -81,7 +82,7 @@
|
||||||
</sql>
|
</sql>
|
||||||
<sql id="Base_Column_List">
|
<sql id="Base_Column_List">
|
||||||
id, project_id, `name`, description, create_time, update_time, `status`, test_resource_pool_id,
|
id, project_id, `name`, description, create_time, update_time, `status`, test_resource_pool_id,
|
||||||
user_id, num, create_user, scenario_version, scenario_id, follow_people
|
user_id, num, create_user, scenario_version, scenario_id, follow_people, `order`
|
||||||
</sql>
|
</sql>
|
||||||
<sql id="Blob_Column_List">
|
<sql id="Blob_Column_List">
|
||||||
load_configuration, advanced_configuration
|
load_configuration, advanced_configuration
|
||||||
|
@ -139,14 +140,16 @@
|
||||||
description, create_time, update_time,
|
description, create_time, update_time,
|
||||||
`status`, test_resource_pool_id, user_id,
|
`status`, test_resource_pool_id, user_id,
|
||||||
num, create_user, scenario_version,
|
num, create_user, scenario_version,
|
||||||
scenario_id, follow_people, load_configuration,
|
scenario_id, follow_people, `order`,
|
||||||
advanced_configuration)
|
load_configuration, advanced_configuration
|
||||||
|
)
|
||||||
values (#{id,jdbcType=VARCHAR}, #{projectId,jdbcType=VARCHAR}, #{name,jdbcType=VARCHAR},
|
values (#{id,jdbcType=VARCHAR}, #{projectId,jdbcType=VARCHAR}, #{name,jdbcType=VARCHAR},
|
||||||
#{description,jdbcType=VARCHAR}, #{createTime,jdbcType=BIGINT}, #{updateTime,jdbcType=BIGINT},
|
#{description,jdbcType=VARCHAR}, #{createTime,jdbcType=BIGINT}, #{updateTime,jdbcType=BIGINT},
|
||||||
#{status,jdbcType=VARCHAR}, #{testResourcePoolId,jdbcType=VARCHAR}, #{userId,jdbcType=VARCHAR},
|
#{status,jdbcType=VARCHAR}, #{testResourcePoolId,jdbcType=VARCHAR}, #{userId,jdbcType=VARCHAR},
|
||||||
#{num,jdbcType=INTEGER}, #{createUser,jdbcType=VARCHAR}, #{scenarioVersion,jdbcType=INTEGER},
|
#{num,jdbcType=INTEGER}, #{createUser,jdbcType=VARCHAR}, #{scenarioVersion,jdbcType=INTEGER},
|
||||||
#{scenarioId,jdbcType=VARCHAR}, #{followPeople,jdbcType=VARCHAR}, #{loadConfiguration,jdbcType=LONGVARCHAR},
|
#{scenarioId,jdbcType=VARCHAR}, #{followPeople,jdbcType=VARCHAR}, #{order,jdbcType=BIGINT},
|
||||||
#{advancedConfiguration,jdbcType=LONGVARCHAR})
|
#{loadConfiguration,jdbcType=LONGVARCHAR}, #{advancedConfiguration,jdbcType=LONGVARCHAR}
|
||||||
|
)
|
||||||
</insert>
|
</insert>
|
||||||
<insert id="insertSelective" parameterType="io.metersphere.base.domain.LoadTestWithBLOBs">
|
<insert id="insertSelective" parameterType="io.metersphere.base.domain.LoadTestWithBLOBs">
|
||||||
insert into load_test
|
insert into load_test
|
||||||
|
@ -193,6 +196,9 @@
|
||||||
<if test="followPeople != null">
|
<if test="followPeople != null">
|
||||||
follow_people,
|
follow_people,
|
||||||
</if>
|
</if>
|
||||||
|
<if test="order != null">
|
||||||
|
`order`,
|
||||||
|
</if>
|
||||||
<if test="loadConfiguration != null">
|
<if test="loadConfiguration != null">
|
||||||
load_configuration,
|
load_configuration,
|
||||||
</if>
|
</if>
|
||||||
|
@ -243,6 +249,9 @@
|
||||||
<if test="followPeople != null">
|
<if test="followPeople != null">
|
||||||
#{followPeople,jdbcType=VARCHAR},
|
#{followPeople,jdbcType=VARCHAR},
|
||||||
</if>
|
</if>
|
||||||
|
<if test="order != null">
|
||||||
|
#{order,jdbcType=BIGINT},
|
||||||
|
</if>
|
||||||
<if test="loadConfiguration != null">
|
<if test="loadConfiguration != null">
|
||||||
#{loadConfiguration,jdbcType=LONGVARCHAR},
|
#{loadConfiguration,jdbcType=LONGVARCHAR},
|
||||||
</if>
|
</if>
|
||||||
|
@ -302,6 +311,9 @@
|
||||||
<if test="record.followPeople != null">
|
<if test="record.followPeople != null">
|
||||||
follow_people = #{record.followPeople,jdbcType=VARCHAR},
|
follow_people = #{record.followPeople,jdbcType=VARCHAR},
|
||||||
</if>
|
</if>
|
||||||
|
<if test="record.order != null">
|
||||||
|
`order` = #{record.order,jdbcType=BIGINT},
|
||||||
|
</if>
|
||||||
<if test="record.loadConfiguration != null">
|
<if test="record.loadConfiguration != null">
|
||||||
load_configuration = #{record.loadConfiguration,jdbcType=LONGVARCHAR},
|
load_configuration = #{record.loadConfiguration,jdbcType=LONGVARCHAR},
|
||||||
</if>
|
</if>
|
||||||
|
@ -329,6 +341,7 @@
|
||||||
scenario_version = #{record.scenarioVersion,jdbcType=INTEGER},
|
scenario_version = #{record.scenarioVersion,jdbcType=INTEGER},
|
||||||
scenario_id = #{record.scenarioId,jdbcType=VARCHAR},
|
scenario_id = #{record.scenarioId,jdbcType=VARCHAR},
|
||||||
follow_people = #{record.followPeople,jdbcType=VARCHAR},
|
follow_people = #{record.followPeople,jdbcType=VARCHAR},
|
||||||
|
`order` = #{record.order,jdbcType=BIGINT},
|
||||||
load_configuration = #{record.loadConfiguration,jdbcType=LONGVARCHAR},
|
load_configuration = #{record.loadConfiguration,jdbcType=LONGVARCHAR},
|
||||||
advanced_configuration = #{record.advancedConfiguration,jdbcType=LONGVARCHAR}
|
advanced_configuration = #{record.advancedConfiguration,jdbcType=LONGVARCHAR}
|
||||||
<if test="_parameter != null">
|
<if test="_parameter != null">
|
||||||
|
@ -350,7 +363,8 @@
|
||||||
create_user = #{record.createUser,jdbcType=VARCHAR},
|
create_user = #{record.createUser,jdbcType=VARCHAR},
|
||||||
scenario_version = #{record.scenarioVersion,jdbcType=INTEGER},
|
scenario_version = #{record.scenarioVersion,jdbcType=INTEGER},
|
||||||
scenario_id = #{record.scenarioId,jdbcType=VARCHAR},
|
scenario_id = #{record.scenarioId,jdbcType=VARCHAR},
|
||||||
follow_people = #{record.followPeople,jdbcType=VARCHAR}
|
follow_people = #{record.followPeople,jdbcType=VARCHAR},
|
||||||
|
`order` = #{record.order,jdbcType=BIGINT}
|
||||||
<if test="_parameter != null">
|
<if test="_parameter != null">
|
||||||
<include refid="Update_By_Example_Where_Clause" />
|
<include refid="Update_By_Example_Where_Clause" />
|
||||||
</if>
|
</if>
|
||||||
|
@ -397,6 +411,9 @@
|
||||||
<if test="followPeople != null">
|
<if test="followPeople != null">
|
||||||
follow_people = #{followPeople,jdbcType=VARCHAR},
|
follow_people = #{followPeople,jdbcType=VARCHAR},
|
||||||
</if>
|
</if>
|
||||||
|
<if test="order != null">
|
||||||
|
`order` = #{order,jdbcType=BIGINT},
|
||||||
|
</if>
|
||||||
<if test="loadConfiguration != null">
|
<if test="loadConfiguration != null">
|
||||||
load_configuration = #{loadConfiguration,jdbcType=LONGVARCHAR},
|
load_configuration = #{loadConfiguration,jdbcType=LONGVARCHAR},
|
||||||
</if>
|
</if>
|
||||||
|
@ -421,6 +438,7 @@
|
||||||
scenario_version = #{scenarioVersion,jdbcType=INTEGER},
|
scenario_version = #{scenarioVersion,jdbcType=INTEGER},
|
||||||
scenario_id = #{scenarioId,jdbcType=VARCHAR},
|
scenario_id = #{scenarioId,jdbcType=VARCHAR},
|
||||||
follow_people = #{followPeople,jdbcType=VARCHAR},
|
follow_people = #{followPeople,jdbcType=VARCHAR},
|
||||||
|
`order` = #{order,jdbcType=BIGINT},
|
||||||
load_configuration = #{loadConfiguration,jdbcType=LONGVARCHAR},
|
load_configuration = #{loadConfiguration,jdbcType=LONGVARCHAR},
|
||||||
advanced_configuration = #{advancedConfiguration,jdbcType=LONGVARCHAR}
|
advanced_configuration = #{advancedConfiguration,jdbcType=LONGVARCHAR}
|
||||||
where id = #{id,jdbcType=VARCHAR}
|
where id = #{id,jdbcType=VARCHAR}
|
||||||
|
@ -439,7 +457,8 @@
|
||||||
create_user = #{createUser,jdbcType=VARCHAR},
|
create_user = #{createUser,jdbcType=VARCHAR},
|
||||||
scenario_version = #{scenarioVersion,jdbcType=INTEGER},
|
scenario_version = #{scenarioVersion,jdbcType=INTEGER},
|
||||||
scenario_id = #{scenarioId,jdbcType=VARCHAR},
|
scenario_id = #{scenarioId,jdbcType=VARCHAR},
|
||||||
follow_people = #{followPeople,jdbcType=VARCHAR}
|
follow_people = #{followPeople,jdbcType=VARCHAR},
|
||||||
|
`order` = #{order,jdbcType=BIGINT}
|
||||||
where id = #{id,jdbcType=VARCHAR}
|
where id = #{id,jdbcType=VARCHAR}
|
||||||
</update>
|
</update>
|
||||||
</mapper>
|
</mapper>
|
|
@ -22,4 +22,11 @@ public interface ExtLoadTestMapper {
|
||||||
List<FileMetadata> getProjectFiles(@Param("projectId") String projectId, @Param("loadTypes") List<String> loadType,
|
List<FileMetadata> getProjectFiles(@Param("projectId") String projectId, @Param("loadTypes") List<String> loadType,
|
||||||
@Param("request") QueryProjectFileRequest request);
|
@Param("request") QueryProjectFileRequest request);
|
||||||
|
|
||||||
|
List<String> selectProjectIds();
|
||||||
|
|
||||||
|
List<String> getIdsOrderByCreateTime(@Param("projectId") String projectId);
|
||||||
|
|
||||||
|
Long getPreOrder(@Param("projectId")String projectId, @Param("baseOrder") Long baseOrder);
|
||||||
|
|
||||||
|
Long getLastOrder(@Param("projectId")String projectId, @Param("baseOrder") Long baseOrder);
|
||||||
}
|
}
|
||||||
|
|
|
@ -156,4 +156,27 @@
|
||||||
</if>
|
</if>
|
||||||
order by update_time DESC
|
order by update_time DESC
|
||||||
</select>
|
</select>
|
||||||
</mapper>
|
|
||||||
|
<select id="selectProjectIds" resultType="java.lang.String">
|
||||||
|
select DISTINCT project_id from load_test;
|
||||||
|
</select>
|
||||||
|
<select id="getIdsOrderByCreateTime" resultType="java.lang.String">
|
||||||
|
select id from load_test where project_id = #{projectId} order by create_time ASC;
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<select id="getLastOrder" resultType="java.lang.Long">
|
||||||
|
select `order` from load_test where project_id = #{projectId}
|
||||||
|
<if test="baseOrder != null">
|
||||||
|
and `order` > #{baseOrder}
|
||||||
|
</if>
|
||||||
|
order by `order` desc limit 1;
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<select id="getPreOrder" resultType="java.lang.Long">
|
||||||
|
select `order` from load_test where project_id = #{projectId}
|
||||||
|
<if test="baseOrder != null">
|
||||||
|
and `order` < #{baseOrder}
|
||||||
|
</if>
|
||||||
|
order by `order` desc limit 1;
|
||||||
|
</select>
|
||||||
|
</mapper>
|
||||||
|
|
|
@ -119,6 +119,7 @@
|
||||||
<property name="object" value="${condition}.creator"/>
|
<property name="object" value="${condition}.creator"/>
|
||||||
</include>
|
</include>
|
||||||
</if>
|
</if>
|
||||||
|
<include refid="io.metersphere.base.mapper.ext.ExtBaseMapper.orders"/>
|
||||||
</sql>
|
</sql>
|
||||||
<select id="selectTestPlanLoadCaseList" resultType="io.metersphere.track.dto.TestPlanLoadCaseDTO">
|
<select id="selectTestPlanLoadCaseList" resultType="io.metersphere.track.dto.TestPlanLoadCaseDTO">
|
||||||
select tplc.id,
|
select tplc.id,
|
||||||
|
|
|
@ -153,6 +153,7 @@ public class ServiceUtils {
|
||||||
}
|
}
|
||||||
} catch (Throwable e) {
|
} catch (Throwable e) {
|
||||||
LogUtil.error(e.getMessage(), e);
|
LogUtil.error(e.getMessage(), e);
|
||||||
|
MSException.throwException("初始化 order 字段失败");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -97,7 +97,7 @@ public class AppStartListener implements ApplicationListener<ApplicationReadyEve
|
||||||
initFuc.run();
|
initFuc.run();
|
||||||
systemParameterService.saveInitParam(key);
|
systemParameterService.saveInitParam(key);
|
||||||
}
|
}
|
||||||
} catch (Exception e) {
|
} catch (Throwable e) {
|
||||||
LogUtil.error(e.getMessage(), e);
|
LogUtil.error(e.getMessage(), e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -112,6 +112,7 @@ public class AppStartListener implements ApplicationListener<ApplicationReadyEve
|
||||||
initOnceOperate(testCaseService::initOrderField, "init.sort.test.case");
|
initOnceOperate(testCaseService::initOrderField, "init.sort.test.case");
|
||||||
initOnceOperate(apiTestCaseService::initOrderField, "init.sort.api.test.case");
|
initOnceOperate(apiTestCaseService::initOrderField, "init.sort.api.test.case");
|
||||||
initOnceOperate(apiAutomationService::initOrderField, "init.sort.api.scenario");
|
initOnceOperate(apiAutomationService::initOrderField, "init.sort.api.scenario");
|
||||||
|
initOnceOperate(performanceTestService::initOrderField, "init.sort.load.case");
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -13,6 +13,7 @@ import io.metersphere.commons.utils.Pager;
|
||||||
import io.metersphere.commons.utils.SessionUtils;
|
import io.metersphere.commons.utils.SessionUtils;
|
||||||
import io.metersphere.consul.CacheNode;
|
import io.metersphere.consul.CacheNode;
|
||||||
import io.metersphere.controller.request.QueryScheduleRequest;
|
import io.metersphere.controller.request.QueryScheduleRequest;
|
||||||
|
import io.metersphere.controller.request.ResetOrderRequest;
|
||||||
import io.metersphere.controller.request.ScheduleRequest;
|
import io.metersphere.controller.request.ScheduleRequest;
|
||||||
import io.metersphere.dto.DashboardTestDTO;
|
import io.metersphere.dto.DashboardTestDTO;
|
||||||
import io.metersphere.dto.LoadTestDTO;
|
import io.metersphere.dto.LoadTestDTO;
|
||||||
|
@ -108,6 +109,12 @@ public class PerformanceTestController {
|
||||||
return performanceTestService.edit(request, files);
|
return performanceTestService.edit(request, files);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@PostMapping("/edit/order")
|
||||||
|
public void orderCase(@RequestBody ResetOrderRequest request) {
|
||||||
|
performanceTestService.updateOrder(request);
|
||||||
|
}
|
||||||
|
|
||||||
@GetMapping("/get/{testId}")
|
@GetMapping("/get/{testId}")
|
||||||
public LoadTestDTO get(@PathVariable String testId) {
|
public LoadTestDTO get(@PathVariable String testId) {
|
||||||
checkPermissionService.checkPerformanceTestOwner(testId);
|
checkPermissionService.checkPerformanceTestOwner(testId);
|
||||||
|
|
|
@ -20,6 +20,7 @@ import io.metersphere.config.JmeterProperties;
|
||||||
import io.metersphere.config.KafkaProperties;
|
import io.metersphere.config.KafkaProperties;
|
||||||
import io.metersphere.controller.request.OrderRequest;
|
import io.metersphere.controller.request.OrderRequest;
|
||||||
import io.metersphere.controller.request.QueryScheduleRequest;
|
import io.metersphere.controller.request.QueryScheduleRequest;
|
||||||
|
import io.metersphere.controller.request.ResetOrderRequest;
|
||||||
import io.metersphere.controller.request.ScheduleRequest;
|
import io.metersphere.controller.request.ScheduleRequest;
|
||||||
import io.metersphere.dto.DashboardTestDTO;
|
import io.metersphere.dto.DashboardTestDTO;
|
||||||
import io.metersphere.dto.LoadTestDTO;
|
import io.metersphere.dto.LoadTestDTO;
|
||||||
|
@ -113,7 +114,7 @@ public class PerformanceTestService {
|
||||||
private TestPlanLoadCaseMapper testPlanLoadCaseMapper;
|
private TestPlanLoadCaseMapper testPlanLoadCaseMapper;
|
||||||
|
|
||||||
public List<LoadTestDTO> list(QueryTestPlanRequest request) {
|
public List<LoadTestDTO> list(QueryTestPlanRequest request) {
|
||||||
request.setOrders(ServiceUtils.getDefaultOrder(request.getOrders()));
|
request.setOrders(ServiceUtils.getDefaultSortOrder(request.getOrders()));
|
||||||
return extLoadTestMapper.list(request);
|
return extLoadTestMapper.list(request);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -240,6 +241,7 @@ public class PerformanceTestService {
|
||||||
loadTest.setStatus(PerformanceTestStatus.Saved.name());
|
loadTest.setStatus(PerformanceTestStatus.Saved.name());
|
||||||
loadTest.setNum(getNextNum(request.getProjectId()));
|
loadTest.setNum(getNextNum(request.getProjectId()));
|
||||||
loadTest.setFollowPeople(request.getFollowPeople());
|
loadTest.setFollowPeople(request.getFollowPeople());
|
||||||
|
loadTest.setOrder(ServiceUtils.getNextOrder(request.getProjectId(), extLoadTestMapper::getLastOrder));
|
||||||
List<ApiLoadTest> apiList = request.getApiList();
|
List<ApiLoadTest> apiList = request.getApiList();
|
||||||
apiPerformanceService.add(apiList, loadTest.getId());
|
apiPerformanceService.add(apiList, loadTest.getId());
|
||||||
loadTestMapper.insert(loadTest);
|
loadTestMapper.insert(loadTest);
|
||||||
|
@ -863,4 +865,22 @@ public class PerformanceTestService {
|
||||||
}
|
}
|
||||||
return new ArrayList<>();
|
return new ArrayList<>();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void initOrderField() {
|
||||||
|
ServiceUtils.initOrderField(LoadTestWithBLOBs.class, LoadTestMapper.class,
|
||||||
|
extLoadTestMapper::selectProjectIds,
|
||||||
|
extLoadTestMapper::getIdsOrderByCreateTime);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 用例自定义排序
|
||||||
|
* @param request
|
||||||
|
*/
|
||||||
|
public void updateOrder(ResetOrderRequest request) {
|
||||||
|
ServiceUtils.updateOrderField(request, LoadTestWithBLOBs.class,
|
||||||
|
loadTestMapper::selectByPrimaryKey,
|
||||||
|
extLoadTestMapper::getPreOrder,
|
||||||
|
extLoadTestMapper::getLastOrder,
|
||||||
|
loadTestMapper::updateByPrimaryKeySelective);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -58,6 +58,9 @@ public class TestPlanLoadCaseService {
|
||||||
private LoadTestMapper loadTestMapper;
|
private LoadTestMapper loadTestMapper;
|
||||||
|
|
||||||
public List<LoadTest> relevanceList(LoadCaseRequest request) {
|
public List<LoadTest> relevanceList(LoadCaseRequest request) {
|
||||||
|
List<OrderRequest> orders = ServiceUtils.getDefaultSortOrder(request.getOrders());
|
||||||
|
orders.forEach(i -> i.setPrefix("load_test"));
|
||||||
|
request.setOrders(orders);
|
||||||
List<String> ids = extTestPlanLoadCaseMapper.selectIdsNotInPlan(request);
|
List<String> ids = extTestPlanLoadCaseMapper.selectIdsNotInPlan(request);
|
||||||
if (CollectionUtils.isEmpty(ids)) {
|
if (CollectionUtils.isEmpty(ids)) {
|
||||||
return new ArrayList<>();
|
return new ArrayList<>();
|
||||||
|
|
|
@ -37,4 +37,5 @@ update api_scenario set module_path = replace (`module_path`,'/默认模块','/
|
||||||
ALTER TABLE test_case ADD `order` bigint(20) NOT NULL COMMENT '自定义排序,间隔5000';
|
ALTER TABLE test_case ADD `order` bigint(20) NOT NULL COMMENT '自定义排序,间隔5000';
|
||||||
ALTER TABLE api_test_case ADD `order` bigint(20) NOT NULL COMMENT '自定义排序,间隔5000';
|
ALTER TABLE api_test_case ADD `order` bigint(20) NOT NULL COMMENT '自定义排序,间隔5000';
|
||||||
ALTER TABLE api_scenario ADD `order` bigint(20) NOT NULL COMMENT '自定义排序,间隔5000';
|
ALTER TABLE api_scenario ADD `order` bigint(20) NOT NULL COMMENT '自定义排序,间隔5000';
|
||||||
|
ALTER TABLE load_test ADD `order` bigint(20) NOT NULL COMMENT '自定义排序,间隔5000';
|
||||||
|
|
||||||
|
|
|
@ -64,7 +64,7 @@
|
||||||
fixed="right"
|
fixed="right"
|
||||||
:label="$t('commons.operating')">
|
:label="$t('commons.operating')">
|
||||||
<template slot="header">
|
<template slot="header">
|
||||||
<header-label-operate v-if="fieldKey" @exec="openCustomHeader"/>
|
<header-label-operate :disable-header-config="disableHeaderConfig" v-if="fieldKey" @exec="openCustomHeader"/>
|
||||||
</template>
|
</template>
|
||||||
<template v-slot:default="scope">
|
<template v-slot:default="scope">
|
||||||
<div>
|
<div>
|
||||||
|
@ -210,6 +210,7 @@ export default {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
disableHeaderConfig: Boolean,
|
||||||
fields: Array,
|
fields: Array,
|
||||||
fieldKey: String,
|
fieldKey: String,
|
||||||
customFields: Array,
|
customFields: Array,
|
||||||
|
@ -225,9 +226,6 @@ export default {
|
||||||
watch: {
|
watch: {
|
||||||
selectNodeIds() {
|
selectNodeIds() {
|
||||||
this.selectDataCounts = 0;
|
this.selectDataCounts = 0;
|
||||||
},
|
|
||||||
'condition.orders'() {
|
|
||||||
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
<div>
|
<div>
|
||||||
<template>
|
<template>
|
||||||
<span>{{ $t('commons.operating') }}
|
<span>{{ $t('commons.operating') }}
|
||||||
<i class='el-icon-setting operator-color' @click="customHeader"> </i>
|
<i v-if="!disableHeaderConfig" class='el-icon-setting operator-color' @click="customHeader"> </i>
|
||||||
</span>
|
</span>
|
||||||
</template>
|
</template>
|
||||||
</div>
|
</div>
|
||||||
|
@ -12,6 +12,7 @@
|
||||||
<script>
|
<script>
|
||||||
export default {
|
export default {
|
||||||
name: "HeaderLabelOperate",
|
name: "HeaderLabelOperate",
|
||||||
|
props:['disableHeaderConfig'],
|
||||||
methods: {
|
methods: {
|
||||||
customHeader() {
|
customHeader() {
|
||||||
this.$emit('exec')
|
this.$emit('exec')
|
||||||
|
|
|
@ -8,11 +8,24 @@
|
||||||
@create="create" :createTip="$t('load_test.create')"/>
|
@create="create" :createTip="$t('load_test.create')"/>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<el-table border :data="tableData" class="adjust-table test-content"
|
<ms-table
|
||||||
@sort-change="sort"
|
:data="tableData"
|
||||||
@filter-change="filter"
|
:condition="condition"
|
||||||
:height="screenHeight"
|
:page-size="pageSize"
|
||||||
>
|
:total="total"
|
||||||
|
:operators="operators"
|
||||||
|
:screenHeight="screenHeight"
|
||||||
|
:field-key="tableHeaderKey"
|
||||||
|
:remember-order="true"
|
||||||
|
:enable-order-drag="enableOrderDrag"
|
||||||
|
row-key="id"
|
||||||
|
operator-width="190px"
|
||||||
|
:screen-height="screenHeight"
|
||||||
|
:enable-selection="false"
|
||||||
|
@refresh="search"
|
||||||
|
:disable-header-config="true"
|
||||||
|
ref="table">
|
||||||
|
|
||||||
<el-table-column
|
<el-table-column
|
||||||
prop="num"
|
prop="num"
|
||||||
label="ID"
|
label="ID"
|
||||||
|
@ -73,16 +86,7 @@
|
||||||
<ms-performance-test-status :row="row"/>
|
<ms-performance-test-status :row="row"/>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column
|
</ms-table>
|
||||||
width="150"
|
|
||||||
:label="$t('commons.operating')">
|
|
||||||
<template v-slot:default="scope">
|
|
||||||
<div>
|
|
||||||
<ms-table-operators :buttons="buttons" :row="scope.row"/>
|
|
||||||
</div>
|
|
||||||
</template>
|
|
||||||
</el-table-column>
|
|
||||||
</el-table>
|
|
||||||
<ms-table-pagination :change="initTableData" :current-page.sync="currentPage" :page-size.sync="pageSize"
|
<ms-table-pagination :change="initTableData" :current-page.sync="currentPage" :page-size.sync="pageSize"
|
||||||
:total="total"/>
|
:total="total"/>
|
||||||
</el-card>
|
</el-card>
|
||||||
|
@ -100,10 +104,13 @@ import MsTableOperators from "../../common/components/MsTableOperators";
|
||||||
import {getCurrentProjectID, getCurrentWorkspaceId} from "@/common/js/utils";
|
import {getCurrentProjectID, getCurrentWorkspaceId} from "@/common/js/utils";
|
||||||
import MsTableHeader from "../../common/components/MsTableHeader";
|
import MsTableHeader from "../../common/components/MsTableHeader";
|
||||||
import {TEST_CONFIGS} from "../../common/components/search/search-components";
|
import {TEST_CONFIGS} from "../../common/components/search/search-components";
|
||||||
import {_filter, _sort,saveLastTableSortField,getLastTableSortField} from "@/common/js/tableUtils";
|
import {getLastTableSortField, handleRowDrop} from "@/common/js/tableUtils";
|
||||||
|
import MsTable from "@/business/components/common/components/table/MsTable";
|
||||||
|
import {editLoadTestCaseOrder} from "@/network/load-test";
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
components: {
|
components: {
|
||||||
|
MsTable,
|
||||||
MsTableHeader,
|
MsTableHeader,
|
||||||
MsPerformanceTestStatus,
|
MsPerformanceTestStatus,
|
||||||
MsTablePagination,
|
MsTablePagination,
|
||||||
|
@ -128,7 +135,8 @@ export default {
|
||||||
total: 0,
|
total: 0,
|
||||||
loading: false,
|
loading: false,
|
||||||
testId: null,
|
testId: null,
|
||||||
buttons: [
|
enableOrderDrag: true,
|
||||||
|
operators: [
|
||||||
{
|
{
|
||||||
tip: this.$t('commons.edit'), icon: "el-icon-edit",
|
tip: this.$t('commons.edit'), icon: "el-icon-edit",
|
||||||
exec: this.handleEdit,
|
exec: this.handleEdit,
|
||||||
|
@ -181,6 +189,8 @@ export default {
|
||||||
initTableData() {
|
initTableData() {
|
||||||
this.condition.orders = getLastTableSortField(this.tableHeaderKey);
|
this.condition.orders = getLastTableSortField(this.tableHeaderKey);
|
||||||
|
|
||||||
|
this.enableOrderDrag = this.condition.orders.length > 0 ? false : true;
|
||||||
|
|
||||||
this.condition.projectId = getCurrentProjectID();
|
this.condition.projectId = getCurrentProjectID();
|
||||||
this.condition.workspaceId = getCurrentWorkspaceId();
|
this.condition.workspaceId = getCurrentWorkspaceId();
|
||||||
this.result = this.$post(this.buildPagePath('/performance/list'), this.condition, response => {
|
this.result = this.$post(this.buildPagePath('/performance/list'), this.condition, response => {
|
||||||
|
@ -193,6 +203,16 @@ export default {
|
||||||
this.$set(test, 'reportCount', response.data);
|
this.$set(test, 'reportCount', response.data);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
this.$nextTick(() => {
|
||||||
|
handleRowDrop(this.tableData, (param) => {
|
||||||
|
param.projectId = getCurrentProjectID();
|
||||||
|
editLoadTestCaseOrder(param);
|
||||||
|
});
|
||||||
|
if (this.$refs.table) {
|
||||||
|
this.$refs.table.clear();
|
||||||
|
}
|
||||||
|
});
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
search(combine) {
|
search(combine) {
|
||||||
|
@ -235,19 +255,6 @@ export default {
|
||||||
this.initTableData();
|
this.initTableData();
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
sort(column) {
|
|
||||||
// 每次只对一个字段排序
|
|
||||||
if (this.condition.orders) {
|
|
||||||
this.condition.orders = [];
|
|
||||||
}
|
|
||||||
_sort(column, this.condition);
|
|
||||||
saveLastTableSortField(this.tableHeaderKey, JSON.stringify(this.condition.orders));
|
|
||||||
this.initTableData();
|
|
||||||
},
|
|
||||||
filter(filters) {
|
|
||||||
_filter(filters, this.condition);
|
|
||||||
this.initTableData();
|
|
||||||
},
|
|
||||||
link(row) {
|
link(row) {
|
||||||
this.$router.push({
|
this.$router.push({
|
||||||
path: '/performance/test/edit/' + row.id,
|
path: '/performance/test/edit/' + row.id,
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
import {baseGet} from "@/network/base-network";
|
import {baseGet, basePost} from "@/network/base-network";
|
||||||
|
|
||||||
export function getPerformanceReport(reportId, callback) {
|
export function getPerformanceReport(reportId, callback) {
|
||||||
return reportId ? baseGet('/performance/report/' + reportId, callback) : {};
|
return reportId ? baseGet('/performance/report/' + reportId, callback) : {};
|
||||||
|
@ -125,3 +125,7 @@ export function getPerformanceMetricQuery(resourceId, callback) {
|
||||||
export function getSharePerformanceMetricQuery(shareId, resourceId, callback) {
|
export function getSharePerformanceMetricQuery(shareId, resourceId, callback) {
|
||||||
return resourceId ? baseGet('/share/metric/query/' + shareId + '/' + resourceId, callback) : new Promise(() => {});
|
return resourceId ? baseGet('/share/metric/query/' + shareId + '/' + resourceId, callback) : new Promise(() => {});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export function editLoadTestCaseOrder(request, callback) {
|
||||||
|
return basePost('/performance/edit/order', request, callback);
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in New Issue