Merge branch 'master' of github.com:fit2cloudrd/metersphere-server
This commit is contained in:
commit
4018235aaa
|
@ -167,6 +167,11 @@ curl -sSL https://github.com/metersphere/metersphere/releases/latest/download/qu
|
||||||
- 基础设施: [Docker](https://www.docker.com/), [Kubernetes](https://kubernetes.io/)
|
- 基础设施: [Docker](https://www.docker.com/), [Kubernetes](https://kubernetes.io/)
|
||||||
- 测试引擎: [JMeter](https://jmeter.apache.org/)
|
- 测试引擎: [JMeter](https://jmeter.apache.org/)
|
||||||
|
|
||||||
|
## 加入 MeterSphere 团队
|
||||||
|
我们正在招聘 MeterSphere 技术布道师,一起打造开源明星项目,请发简历到 metersphere@fit2cloud.com
|
||||||
|
|
||||||
|
点击查看 [岗位详情](https://www.zhipin.com/job_detail/b151c4b3d594688733Ny3dy1GFI~.html)
|
||||||
|
|
||||||
## 微信群
|
## 微信群
|
||||||
|
|
||||||
![wechat-group](https://metersphere.io/images/contact/wechat-group.png)
|
![wechat-group](https://metersphere.io/images/contact/wechat-group.png)
|
||||||
|
|
|
@ -33,5 +33,7 @@ public class TestCase implements Serializable {
|
||||||
|
|
||||||
private Integer sort;
|
private Integer sort;
|
||||||
|
|
||||||
|
private Integer num;
|
||||||
|
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
}
|
}
|
|
@ -1053,6 +1053,66 @@ public class TestCaseExample {
|
||||||
addCriterion("sort not between", value1, value2, "sort");
|
addCriterion("sort not between", value1, value2, "sort");
|
||||||
return (Criteria) this;
|
return (Criteria) this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Criteria andNumIsNull() {
|
||||||
|
addCriterion("num is null");
|
||||||
|
return (Criteria) this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Criteria andNumIsNotNull() {
|
||||||
|
addCriterion("num is not null");
|
||||||
|
return (Criteria) this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Criteria andNumEqualTo(Integer value) {
|
||||||
|
addCriterion("num =", value, "num");
|
||||||
|
return (Criteria) this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Criteria andNumNotEqualTo(Integer value) {
|
||||||
|
addCriterion("num <>", value, "num");
|
||||||
|
return (Criteria) this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Criteria andNumGreaterThan(Integer value) {
|
||||||
|
addCriterion("num >", value, "num");
|
||||||
|
return (Criteria) this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Criteria andNumGreaterThanOrEqualTo(Integer value) {
|
||||||
|
addCriterion("num >=", value, "num");
|
||||||
|
return (Criteria) this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Criteria andNumLessThan(Integer value) {
|
||||||
|
addCriterion("num <", value, "num");
|
||||||
|
return (Criteria) this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Criteria andNumLessThanOrEqualTo(Integer value) {
|
||||||
|
addCriterion("num <=", value, "num");
|
||||||
|
return (Criteria) this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Criteria andNumIn(List<Integer> values) {
|
||||||
|
addCriterion("num in", values, "num");
|
||||||
|
return (Criteria) this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Criteria andNumNotIn(List<Integer> values) {
|
||||||
|
addCriterion("num not in", values, "num");
|
||||||
|
return (Criteria) this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Criteria andNumBetween(Integer value1, Integer value2) {
|
||||||
|
addCriterion("num between", value1, value2, "num");
|
||||||
|
return (Criteria) this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Criteria andNumNotBetween(Integer value1, Integer value2) {
|
||||||
|
addCriterion("num not between", value1, value2, "num");
|
||||||
|
return (Criteria) this;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class Criteria extends GeneratedCriteria {
|
public static class Criteria extends GeneratedCriteria {
|
||||||
|
|
|
@ -16,6 +16,7 @@
|
||||||
<result column="update_time" jdbcType="BIGINT" property="updateTime" />
|
<result column="update_time" jdbcType="BIGINT" property="updateTime" />
|
||||||
<result column="test_id" jdbcType="VARCHAR" property="testId" />
|
<result column="test_id" jdbcType="VARCHAR" property="testId" />
|
||||||
<result column="sort" jdbcType="INTEGER" property="sort" />
|
<result column="sort" jdbcType="INTEGER" property="sort" />
|
||||||
|
<result column="num" jdbcType="INTEGER" property="num" />
|
||||||
</resultMap>
|
</resultMap>
|
||||||
<resultMap extends="BaseResultMap" id="ResultMapWithBLOBs" type="io.metersphere.base.domain.TestCaseWithBLOBs">
|
<resultMap extends="BaseResultMap" id="ResultMapWithBLOBs" type="io.metersphere.base.domain.TestCaseWithBLOBs">
|
||||||
<result column="remark" jdbcType="LONGVARCHAR" property="remark" />
|
<result column="remark" jdbcType="LONGVARCHAR" property="remark" />
|
||||||
|
@ -81,7 +82,7 @@
|
||||||
</sql>
|
</sql>
|
||||||
<sql id="Base_Column_List">
|
<sql id="Base_Column_List">
|
||||||
id, node_id, node_path, project_id, `name`, `type`, maintainer, priority, `method`,
|
id, node_id, node_path, project_id, `name`, `type`, maintainer, priority, `method`,
|
||||||
prerequisite, create_time, update_time, test_id, sort
|
prerequisite, create_time, update_time, test_id, sort, num
|
||||||
</sql>
|
</sql>
|
||||||
<sql id="Blob_Column_List">
|
<sql id="Blob_Column_List">
|
||||||
remark, steps
|
remark, steps
|
||||||
|
@ -139,14 +140,14 @@
|
||||||
project_id, `name`, `type`,
|
project_id, `name`, `type`,
|
||||||
maintainer, priority, `method`,
|
maintainer, priority, `method`,
|
||||||
prerequisite, create_time, update_time,
|
prerequisite, create_time, update_time,
|
||||||
test_id, sort, remark,
|
test_id, sort, num,
|
||||||
steps)
|
remark, steps)
|
||||||
values (#{id,jdbcType=VARCHAR}, #{nodeId,jdbcType=VARCHAR}, #{nodePath,jdbcType=VARCHAR},
|
values (#{id,jdbcType=VARCHAR}, #{nodeId,jdbcType=VARCHAR}, #{nodePath,jdbcType=VARCHAR},
|
||||||
#{projectId,jdbcType=VARCHAR}, #{name,jdbcType=VARCHAR}, #{type,jdbcType=VARCHAR},
|
#{projectId,jdbcType=VARCHAR}, #{name,jdbcType=VARCHAR}, #{type,jdbcType=VARCHAR},
|
||||||
#{maintainer,jdbcType=VARCHAR}, #{priority,jdbcType=VARCHAR}, #{method,jdbcType=VARCHAR},
|
#{maintainer,jdbcType=VARCHAR}, #{priority,jdbcType=VARCHAR}, #{method,jdbcType=VARCHAR},
|
||||||
#{prerequisite,jdbcType=VARCHAR}, #{createTime,jdbcType=BIGINT}, #{updateTime,jdbcType=BIGINT},
|
#{prerequisite,jdbcType=VARCHAR}, #{createTime,jdbcType=BIGINT}, #{updateTime,jdbcType=BIGINT},
|
||||||
#{testId,jdbcType=VARCHAR}, #{sort,jdbcType=INTEGER}, #{remark,jdbcType=LONGVARCHAR},
|
#{testId,jdbcType=VARCHAR}, #{sort,jdbcType=INTEGER}, #{num,jdbcType=INTEGER},
|
||||||
#{steps,jdbcType=LONGVARCHAR})
|
#{remark,jdbcType=LONGVARCHAR}, #{steps,jdbcType=LONGVARCHAR})
|
||||||
</insert>
|
</insert>
|
||||||
<insert id="insertSelective" parameterType="io.metersphere.base.domain.TestCaseWithBLOBs">
|
<insert id="insertSelective" parameterType="io.metersphere.base.domain.TestCaseWithBLOBs">
|
||||||
insert into test_case
|
insert into test_case
|
||||||
|
@ -193,6 +194,9 @@
|
||||||
<if test="sort != null">
|
<if test="sort != null">
|
||||||
sort,
|
sort,
|
||||||
</if>
|
</if>
|
||||||
|
<if test="num != null">
|
||||||
|
num,
|
||||||
|
</if>
|
||||||
<if test="remark != null">
|
<if test="remark != null">
|
||||||
remark,
|
remark,
|
||||||
</if>
|
</if>
|
||||||
|
@ -243,6 +247,9 @@
|
||||||
<if test="sort != null">
|
<if test="sort != null">
|
||||||
#{sort,jdbcType=INTEGER},
|
#{sort,jdbcType=INTEGER},
|
||||||
</if>
|
</if>
|
||||||
|
<if test="num != null">
|
||||||
|
#{num,jdbcType=INTEGER},
|
||||||
|
</if>
|
||||||
<if test="remark != null">
|
<if test="remark != null">
|
||||||
#{remark,jdbcType=LONGVARCHAR},
|
#{remark,jdbcType=LONGVARCHAR},
|
||||||
</if>
|
</if>
|
||||||
|
@ -302,6 +309,9 @@
|
||||||
<if test="record.sort != null">
|
<if test="record.sort != null">
|
||||||
sort = #{record.sort,jdbcType=INTEGER},
|
sort = #{record.sort,jdbcType=INTEGER},
|
||||||
</if>
|
</if>
|
||||||
|
<if test="record.num != null">
|
||||||
|
num = #{record.num,jdbcType=INTEGER},
|
||||||
|
</if>
|
||||||
<if test="record.remark != null">
|
<if test="record.remark != null">
|
||||||
remark = #{record.remark,jdbcType=LONGVARCHAR},
|
remark = #{record.remark,jdbcType=LONGVARCHAR},
|
||||||
</if>
|
</if>
|
||||||
|
@ -329,6 +339,7 @@
|
||||||
update_time = #{record.updateTime,jdbcType=BIGINT},
|
update_time = #{record.updateTime,jdbcType=BIGINT},
|
||||||
test_id = #{record.testId,jdbcType=VARCHAR},
|
test_id = #{record.testId,jdbcType=VARCHAR},
|
||||||
sort = #{record.sort,jdbcType=INTEGER},
|
sort = #{record.sort,jdbcType=INTEGER},
|
||||||
|
num = #{record.num,jdbcType=INTEGER},
|
||||||
remark = #{record.remark,jdbcType=LONGVARCHAR},
|
remark = #{record.remark,jdbcType=LONGVARCHAR},
|
||||||
steps = #{record.steps,jdbcType=LONGVARCHAR}
|
steps = #{record.steps,jdbcType=LONGVARCHAR}
|
||||||
<if test="_parameter != null">
|
<if test="_parameter != null">
|
||||||
|
@ -350,7 +361,8 @@
|
||||||
create_time = #{record.createTime,jdbcType=BIGINT},
|
create_time = #{record.createTime,jdbcType=BIGINT},
|
||||||
update_time = #{record.updateTime,jdbcType=BIGINT},
|
update_time = #{record.updateTime,jdbcType=BIGINT},
|
||||||
test_id = #{record.testId,jdbcType=VARCHAR},
|
test_id = #{record.testId,jdbcType=VARCHAR},
|
||||||
sort = #{record.sort,jdbcType=INTEGER}
|
sort = #{record.sort,jdbcType=INTEGER},
|
||||||
|
num = #{record.num,jdbcType=INTEGER}
|
||||||
<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 +409,9 @@
|
||||||
<if test="sort != null">
|
<if test="sort != null">
|
||||||
sort = #{sort,jdbcType=INTEGER},
|
sort = #{sort,jdbcType=INTEGER},
|
||||||
</if>
|
</if>
|
||||||
|
<if test="num != null">
|
||||||
|
num = #{num,jdbcType=INTEGER},
|
||||||
|
</if>
|
||||||
<if test="remark != null">
|
<if test="remark != null">
|
||||||
remark = #{remark,jdbcType=LONGVARCHAR},
|
remark = #{remark,jdbcType=LONGVARCHAR},
|
||||||
</if>
|
</if>
|
||||||
|
@ -421,6 +436,7 @@
|
||||||
update_time = #{updateTime,jdbcType=BIGINT},
|
update_time = #{updateTime,jdbcType=BIGINT},
|
||||||
test_id = #{testId,jdbcType=VARCHAR},
|
test_id = #{testId,jdbcType=VARCHAR},
|
||||||
sort = #{sort,jdbcType=INTEGER},
|
sort = #{sort,jdbcType=INTEGER},
|
||||||
|
num = #{num,jdbcType=INTEGER},
|
||||||
remark = #{remark,jdbcType=LONGVARCHAR},
|
remark = #{remark,jdbcType=LONGVARCHAR},
|
||||||
steps = #{steps,jdbcType=LONGVARCHAR}
|
steps = #{steps,jdbcType=LONGVARCHAR}
|
||||||
where id = #{id,jdbcType=VARCHAR}
|
where id = #{id,jdbcType=VARCHAR}
|
||||||
|
@ -439,7 +455,8 @@
|
||||||
create_time = #{createTime,jdbcType=BIGINT},
|
create_time = #{createTime,jdbcType=BIGINT},
|
||||||
update_time = #{updateTime,jdbcType=BIGINT},
|
update_time = #{updateTime,jdbcType=BIGINT},
|
||||||
test_id = #{testId,jdbcType=VARCHAR},
|
test_id = #{testId,jdbcType=VARCHAR},
|
||||||
sort = #{sort,jdbcType=INTEGER}
|
sort = #{sort,jdbcType=INTEGER},
|
||||||
|
num = #{num,jdbcType=INTEGER}
|
||||||
where id = #{id,jdbcType=VARCHAR}
|
where id = #{id,jdbcType=VARCHAR}
|
||||||
</update>
|
</update>
|
||||||
</mapper>
|
</mapper>
|
|
@ -17,4 +17,6 @@ public interface ExtTestCaseMapper {
|
||||||
|
|
||||||
List<TestCaseDTO> listBytestCaseIds(@Param("request") QueryTestCaseRequest request);
|
List<TestCaseDTO> listBytestCaseIds(@Param("request") QueryTestCaseRequest request);
|
||||||
|
|
||||||
|
TestCase getMaxNumByProjectId(@Param("projectId") String projectId);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -188,7 +188,8 @@
|
||||||
</where>
|
</where>
|
||||||
</select>
|
</select>
|
||||||
<select id="listBytestCaseIds" resultType="io.metersphere.track.dto.TestCaseDTO">
|
<select id="listBytestCaseIds" resultType="io.metersphere.track.dto.TestCaseDTO">
|
||||||
select test_case.*,api_test.name as apiName,load_test.name AS performName from test_case left join api_test on test_case.test_id=api_test.id left join load_test on test_case.test_id=load_test.id
|
select test_case.*,api_test.name as apiName,load_test.name AS performName from test_case left join api_test on
|
||||||
|
test_case.test_id=api_test.id left join load_test on test_case.test_id=load_test.id
|
||||||
<where>
|
<where>
|
||||||
<if test="request.testCaseIds!=null and request.testCaseIds.size() > 0">
|
<if test="request.testCaseIds!=null and request.testCaseIds.size() > 0">
|
||||||
and test_case.id in
|
and test_case.id in
|
||||||
|
@ -198,4 +199,8 @@
|
||||||
</if>
|
</if>
|
||||||
</where>
|
</where>
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
<select id="getMaxNumByProjectId" resultType="io.metersphere.base.domain.TestCase">
|
||||||
|
select * from test_case where test_case.project_id = #{projectId} order by num desc limit 1;
|
||||||
|
</select>
|
||||||
</mapper>
|
</mapper>
|
|
@ -84,6 +84,7 @@ public class TestCaseService {
|
||||||
testCase.setId(UUID.randomUUID().toString());
|
testCase.setId(UUID.randomUUID().toString());
|
||||||
testCase.setCreateTime(System.currentTimeMillis());
|
testCase.setCreateTime(System.currentTimeMillis());
|
||||||
testCase.setUpdateTime(System.currentTimeMillis());
|
testCase.setUpdateTime(System.currentTimeMillis());
|
||||||
|
testCase.setNum(getNextNum(testCase.getProjectId()));
|
||||||
testCaseMapper.insert(testCase);
|
testCaseMapper.insert(testCase);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -253,9 +254,12 @@ public class TestCaseService {
|
||||||
TestCaseMapper mapper = sqlSession.getMapper(TestCaseMapper.class);
|
TestCaseMapper mapper = sqlSession.getMapper(TestCaseMapper.class);
|
||||||
if (!testCases.isEmpty()) {
|
if (!testCases.isEmpty()) {
|
||||||
AtomicInteger sort = new AtomicInteger();
|
AtomicInteger sort = new AtomicInteger();
|
||||||
|
AtomicInteger num = new AtomicInteger();
|
||||||
|
num.set(getNextNum(projectId)+testCases.size());
|
||||||
testCases.forEach(testcase -> {
|
testCases.forEach(testcase -> {
|
||||||
testcase.setNodeId(nodePathMap.get(testcase.getNodePath()));
|
testcase.setNodeId(nodePathMap.get(testcase.getNodePath()));
|
||||||
testcase.setSort(sort.getAndIncrement());
|
testcase.setSort(sort.getAndIncrement());
|
||||||
|
testcase.setNum(num.decrementAndGet());
|
||||||
mapper.insert(testcase);
|
mapper.insert(testcase);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -429,4 +433,17 @@ public class TestCaseService {
|
||||||
MSException.throwException(Translator.get("related_case_del_fail_prefix") + " " + str + " " + Translator.get("related_case_del_fail_suffix"));
|
MSException.throwException(Translator.get("related_case_del_fail_prefix") + " " + str + " " + Translator.get("related_case_del_fail_suffix"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取项目下一个num (页面展示的ID)
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
private int getNextNum(String projectId) {
|
||||||
|
TestCase testCase = extTestCaseMapper.getMaxNumByProjectId(projectId);
|
||||||
|
if (testCase == null) {
|
||||||
|
return 100001;
|
||||||
|
} else {
|
||||||
|
return Optional.ofNullable(testCase.getNum()+1).orElse(100001);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,50 @@
|
||||||
|
alter table test_case add num int null comment 'Manually controlled growth identifier';
|
||||||
|
|
||||||
|
DROP PROCEDURE IF EXISTS test_cursor;
|
||||||
|
DELIMITER //
|
||||||
|
CREATE PROCEDURE test_cursor()
|
||||||
|
BEGIN
|
||||||
|
DECLARE projectId VARCHAR(64);
|
||||||
|
DECLARE caseId VARCHAR(64);
|
||||||
|
DECLARE num INT;
|
||||||
|
DECLARE done INT DEFAULT 0;
|
||||||
|
DECLARE cursor1 CURSOR FOR (SELECT DISTINCT project_id
|
||||||
|
FROM test_case
|
||||||
|
WHERE num IS NULL);
|
||||||
|
DECLARE cursor2 CURSOR FOR (SELECT id
|
||||||
|
FROM test_case
|
||||||
|
WHERE project_id = projectId
|
||||||
|
ORDER BY create_time);
|
||||||
|
|
||||||
|
DECLARE CONTINUE HANDLER FOR NOT FOUND SET done = TRUE;
|
||||||
|
OPEN cursor1;
|
||||||
|
outer_loop:
|
||||||
|
LOOP
|
||||||
|
FETCH cursor1 INTO projectId;
|
||||||
|
IF done
|
||||||
|
THEN
|
||||||
|
LEAVE outer_loop;
|
||||||
|
END IF;
|
||||||
|
SET num = 100001;
|
||||||
|
OPEN cursor2;
|
||||||
|
inner_loop:
|
||||||
|
LOOP
|
||||||
|
FETCH cursor2 INTO caseId;
|
||||||
|
IF done
|
||||||
|
THEN
|
||||||
|
LEAVE inner_loop;
|
||||||
|
END IF;
|
||||||
|
UPDATE test_case
|
||||||
|
SET num = num
|
||||||
|
WHERE id = caseId;
|
||||||
|
SET num = num + 1;
|
||||||
|
END LOOP;
|
||||||
|
SET done = 0;
|
||||||
|
CLOSE cursor2;
|
||||||
|
END LOOP;
|
||||||
|
CLOSE cursor1;
|
||||||
|
END //
|
||||||
|
DELIMITER ;
|
||||||
|
|
||||||
|
CALL test_cursor();
|
||||||
|
DROP PROCEDURE IF EXISTS test_cursor;
|
1159
backend/tree.txt
1159
backend/tree.txt
File diff suppressed because one or more lines are too long
|
@ -255,7 +255,7 @@
|
||||||
return this.test.isValid() && !this.change;
|
return this.test.isValid() && !this.change;
|
||||||
},
|
},
|
||||||
isDisabled() {
|
isDisabled() {
|
||||||
return !(this.test.isValid() && this.change)
|
return !(this.test.isValid())
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
|
@ -90,14 +90,14 @@
|
||||||
activeName: "parameters",
|
activeName: "parameters",
|
||||||
rules: {
|
rules: {
|
||||||
name: [
|
name: [
|
||||||
{max: 100, message: this.$t('commons.input_limit', [0, 100]), trigger: 'blur'}
|
{max: 100, message: this.$t('commons.input_limit', [1, 100]), trigger: 'blur'}
|
||||||
],
|
],
|
||||||
url: [
|
url: [
|
||||||
{max: 500, required: true, message: this.$t('commons.input_limit', [0, 500]), trigger: 'blur'},
|
{max: 500, required: true, message: this.$t('commons.input_limit', [1, 500]), trigger: 'blur'},
|
||||||
{validator: validateURL, trigger: 'blur'}
|
{validator: validateURL, trigger: 'blur'}
|
||||||
],
|
],
|
||||||
path: [
|
path: [
|
||||||
{max: 500, required: true, message: this.$t('commons.input_limit', [0, 500]), trigger: 'blur'},
|
{max: 500, required: true, message: this.$t('commons.input_limit', [1, 500]), trigger: 'blur'},
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -143,6 +143,7 @@
|
||||||
this.$error(this.$t('api_test.request.please_add_environment_to_scenario'), 2000);
|
this.$error(this.$t('api_test.request.please_add_environment_to_scenario'), 2000);
|
||||||
this.request.useEnvironment = false;
|
this.request.useEnvironment = false;
|
||||||
}
|
}
|
||||||
|
this.$refs["request"].clearValidate();
|
||||||
},
|
},
|
||||||
addProtocol(url) {
|
addProtocol(url) {
|
||||||
if (url) {
|
if (url) {
|
||||||
|
|
|
@ -8,6 +8,11 @@
|
||||||
<el-select :disabled="isReadOnly" v-model="scenario.environmentId" class="environment-select" @change="environmentChange" clearable>
|
<el-select :disabled="isReadOnly" v-model="scenario.environmentId" class="environment-select" @change="environmentChange" clearable>
|
||||||
<el-option v-for="(environment, index) in environments" :key="index" :label="environment.name + ': ' + environment.protocol + '://' + environment.socket" :value="environment.id"/>
|
<el-option v-for="(environment, index) in environments" :key="index" :label="environment.name + ': ' + environment.protocol + '://' + environment.socket" :value="environment.id"/>
|
||||||
<el-button class="environment-button" size="mini" type="primary" @click="openEnvironmentConfig">{{$t('api_test.environment.environment_config')}}</el-button>
|
<el-button class="environment-button" size="mini" type="primary" @click="openEnvironmentConfig">{{$t('api_test.environment.environment_config')}}</el-button>
|
||||||
|
<template v-slot:empty>
|
||||||
|
<div class="empty-environment">
|
||||||
|
<el-button class="environment-button" size="mini" type="primary" @click="openEnvironmentConfig">{{$t('api_test.environment.environment_config')}}</el-button>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
</el-select>
|
</el-select>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
|
|
||||||
|
@ -65,18 +70,32 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
watch: {
|
||||||
|
projectId() {
|
||||||
|
this.getEnvironments();
|
||||||
|
}
|
||||||
|
},
|
||||||
methods: {
|
methods: {
|
||||||
getEnvironments() {
|
getEnvironments() {
|
||||||
if (this.projectId) {
|
if (this.projectId) {
|
||||||
this.result = this.$get('/api/environment/list/' + this.projectId, response => {
|
this.result = this.$get('/api/environment/list/' + this.projectId, response => {
|
||||||
this.environments = response.data;
|
this.environments = response.data;
|
||||||
|
let hasEnvironment = false;
|
||||||
for (let i in this.environments) {
|
for (let i in this.environments) {
|
||||||
if (this.environments[i].id === this.scenario.environmentId) {
|
if (this.environments[i].id === this.scenario.environmentId) {
|
||||||
this.scenario.environment = this.environments[i];
|
this.scenario.environment = this.environments[i];
|
||||||
|
hasEnvironment = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (!hasEnvironment) {
|
||||||
|
this.scenario.environmentId = '';
|
||||||
|
this.scenario.environment = undefined;
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
} else {
|
||||||
|
this.scenario.environmentId = '';
|
||||||
|
this.scenario.environment = undefined;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
environmentChange(value) {
|
environmentChange(value) {
|
||||||
|
@ -97,6 +116,10 @@
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
openEnvironmentConfig() {
|
openEnvironmentConfig() {
|
||||||
|
if (!this.projectId) {
|
||||||
|
this.$error(this.$t('api_test.select_project'));
|
||||||
|
return;
|
||||||
|
}
|
||||||
this.$refs.environmentConfig.open(this.projectId);
|
this.$refs.environmentConfig.open(this.projectId);
|
||||||
},
|
},
|
||||||
environmentConfigClose() {
|
environmentConfigClose() {
|
||||||
|
@ -117,4 +140,8 @@
|
||||||
padding: 7px;
|
padding: 7px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.empty-environment {
|
||||||
|
padding: 10px 0px;
|
||||||
|
}
|
||||||
|
|
||||||
</style>
|
</style>
|
||||||
|
|
|
@ -61,7 +61,10 @@
|
||||||
return {
|
return {
|
||||||
result: {},
|
result: {},
|
||||||
rules: {
|
rules: {
|
||||||
name :[{required: true, message: this.$t('commons.input_name'), trigger: 'blur'}],
|
name :[
|
||||||
|
{required: true, message: this.$t('commons.input_name'), trigger: 'blur'},
|
||||||
|
{max: 64, message: this.$t('commons.input_limit', [1, 64]), trigger: 'blur'}
|
||||||
|
],
|
||||||
socket :[{required: true, validator: socketValidator, trigger: 'blur'}],
|
socket :[{required: true, validator: socketValidator, trigger: 'blur'}],
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
@ -83,7 +86,9 @@
|
||||||
url = '/api/environment/update';
|
url = '/api/environment/update';
|
||||||
}
|
}
|
||||||
this.result = this.$post(url, param, response => {
|
this.result = this.$post(url, param, response => {
|
||||||
this.environment.id = response.data;
|
if (!param.id) {
|
||||||
|
this.environment.id = response.data;
|
||||||
|
}
|
||||||
this.$success(this.$t('commons.save_success'));
|
this.$success(this.$t('commons.save_success'));
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
|
@ -169,9 +169,6 @@ export class Scenario extends BaseConfig {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!this.name) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -396,8 +393,6 @@ class JMXRequest {
|
||||||
constructor(request) {
|
constructor(request) {
|
||||||
if (request && request instanceof Request && (request.url || request.path)) {
|
if (request && request instanceof Request && (request.url || request.path)) {
|
||||||
this.useEnvironment = request.useEnvironment;
|
this.useEnvironment = request.useEnvironment;
|
||||||
this.environment = request.environment;
|
|
||||||
this.path = decodeURIComponent(request.path);
|
|
||||||
this.method = request.method;
|
this.method = request.method;
|
||||||
if (!request.useEnvironment) {
|
if (!request.useEnvironment) {
|
||||||
let url = new URL(request.url);
|
let url = new URL(request.url);
|
||||||
|
@ -405,19 +400,28 @@ class JMXRequest {
|
||||||
this.pathname = decodeURIComponent(url.pathname);
|
this.pathname = decodeURIComponent(url.pathname);
|
||||||
this.port = url.port;
|
this.port = url.port;
|
||||||
this.protocol = url.protocol.split(":")[0];
|
this.protocol = url.protocol.split(":")[0];
|
||||||
}
|
this.pathname = this.getPostQueryParameters(request, this.pathname);
|
||||||
|
} else {
|
||||||
if (this.method.toUpperCase() !== "GET") {
|
this.environment = request.environment;
|
||||||
// this.pathname += url.search.replace('&', '&');
|
this.port = request.environment.port;
|
||||||
this.pathname += '?';
|
this.path = decodeURIComponent(request.path);
|
||||||
request.parameters.forEach(parameter => {
|
this.path = this.getPostQueryParameters(request, this.path);
|
||||||
if (parameter.name) {
|
|
||||||
this.pathname += (parameter.name + '=' + parameter.value + '&');
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
getPostQueryParameters(request, path) {
|
||||||
|
if (this.method.toUpperCase() !== "GET") {
|
||||||
|
path += '?';
|
||||||
|
request.parameters.forEach(parameter => {
|
||||||
|
if (parameter.name) {
|
||||||
|
path += (parameter.name + '=' + parameter.value + '&');
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
return path;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
class JMeterTestPlan extends Element {
|
class JMeterTestPlan extends Element {
|
||||||
|
|
|
@ -38,6 +38,12 @@
|
||||||
class="test-content">
|
class="test-content">
|
||||||
<el-table-column
|
<el-table-column
|
||||||
type="selection"/>
|
type="selection"/>
|
||||||
|
<el-table-column
|
||||||
|
prop="num"
|
||||||
|
sortable="custom"
|
||||||
|
:label="$t('commons.id')"
|
||||||
|
show-overflow-tooltip>
|
||||||
|
</el-table-column>
|
||||||
<el-table-column
|
<el-table-column
|
||||||
prop="name"
|
prop="name"
|
||||||
:label="$t('commons.name')"
|
:label="$t('commons.name')"
|
||||||
|
@ -310,6 +316,10 @@
|
||||||
this.initTableData();
|
this.initTableData();
|
||||||
},
|
},
|
||||||
sort(column) {
|
sort(column) {
|
||||||
|
// 每次只对一个字段排序
|
||||||
|
if (this.condition.orders) {
|
||||||
|
this.condition.orders = [];
|
||||||
|
}
|
||||||
_sort(column, this.condition);
|
_sort(column, this.condition);
|
||||||
this.initTableData();
|
this.initTableData();
|
||||||
}
|
}
|
||||||
|
|
|
@ -33,7 +33,11 @@
|
||||||
|
|
||||||
<el-table-column
|
<el-table-column
|
||||||
type="selection"></el-table-column>
|
type="selection"></el-table-column>
|
||||||
|
<el-table-column
|
||||||
|
prop="num"
|
||||||
|
:label="$t('commons.id')"
|
||||||
|
show-overflow-tooltip>
|
||||||
|
</el-table-column>
|
||||||
<el-table-column
|
<el-table-column
|
||||||
prop="name"
|
prop="name"
|
||||||
:label="$t('commons.name')"
|
:label="$t('commons.name')"
|
||||||
|
|
|
@ -5,6 +5,11 @@
|
||||||
<el-table
|
<el-table
|
||||||
row-key="id"
|
row-key="id"
|
||||||
:data="failureTestCases">
|
:data="failureTestCases">
|
||||||
|
<el-table-column
|
||||||
|
prop="num"
|
||||||
|
:label="$t('commons.id')"
|
||||||
|
show-overflow-tooltip>
|
||||||
|
</el-table-column>
|
||||||
<el-table-column
|
<el-table-column
|
||||||
prop="name"
|
prop="name"
|
||||||
:label="$t('commons.name')"
|
:label="$t('commons.name')"
|
||||||
|
|
|
@ -103,6 +103,7 @@ export default {
|
||||||
input_login_username: 'Please input the user ID or email',
|
input_login_username: 'Please input the user ID or email',
|
||||||
input_name: 'Please enter name',
|
input_name: 'Please enter name',
|
||||||
formatErr: 'Format Error',
|
formatErr: 'Format Error',
|
||||||
|
id: 'ID',
|
||||||
date: {
|
date: {
|
||||||
select_date: 'Select date',
|
select_date: 'Select date',
|
||||||
start_date: 'Start date',
|
start_date: 'Start date',
|
||||||
|
|
|
@ -103,6 +103,7 @@ export default {
|
||||||
input_login_username: '请输入用户 ID 或 邮箱',
|
input_login_username: '请输入用户 ID 或 邮箱',
|
||||||
input_name: '请输入名称',
|
input_name: '请输入名称',
|
||||||
formatErr: '格式错误',
|
formatErr: '格式错误',
|
||||||
|
id: 'ID',
|
||||||
date: {
|
date: {
|
||||||
select_date: '选择日期',
|
select_date: '选择日期',
|
||||||
start_date: '开始日期',
|
start_date: '开始日期',
|
||||||
|
|
|
@ -101,6 +101,7 @@ export default {
|
||||||
delete_confirm: '請輸入以下內容,確認刪除:',
|
delete_confirm: '請輸入以下內容,確認刪除:',
|
||||||
input_name: '請輸入名稱',
|
input_name: '請輸入名稱',
|
||||||
formatErr: '格式錯誤',
|
formatErr: '格式錯誤',
|
||||||
|
id: 'ID',
|
||||||
date: {
|
date: {
|
||||||
select_date: '選擇日期',
|
select_date: '選擇日期',
|
||||||
start_date: '開始日期',
|
start_date: '開始日期',
|
||||||
|
|
Loading…
Reference in New Issue