提交 c4d6ec1f 编写于 作者: C chenjianxing

Merge branch 'dev' of https://github.com/fit2cloudrd/metersphere-server into dev

...@@ -63,7 +63,10 @@ ...@@ -63,7 +63,10 @@
<groupId>org.springframework.boot</groupId> <groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-jetty</artifactId> <artifactId>spring-boot-starter-jetty</artifactId>
</dependency> </dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-mail</artifactId>
</dependency>
<dependency> <dependency>
<groupId>org.projectlombok</groupId> <groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId> <artifactId>lombok</artifactId>
......
...@@ -12,10 +12,7 @@ import org.apache.jmeter.visualizers.backend.AbstractBackendListenerClient; ...@@ -12,10 +12,7 @@ import org.apache.jmeter.visualizers.backend.AbstractBackendListenerClient;
import org.apache.jmeter.visualizers.backend.BackendListenerContext; import org.apache.jmeter.visualizers.backend.BackendListenerContext;
import java.io.Serializable; import java.io.Serializable;
import java.util.ArrayList; import java.util.*;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.ConcurrentHashMap;
/** /**
...@@ -72,6 +69,7 @@ public class APIBackendListenerClient extends AbstractBackendListenerClient impl ...@@ -72,6 +69,7 @@ public class APIBackendListenerClient extends AbstractBackendListenerClient impl
sampleResults.forEach(result -> { sampleResults.forEach(result -> {
String thread = StringUtils.substringBeforeLast(result.getThreadName(), " "); String thread = StringUtils.substringBeforeLast(result.getThreadName(), " ");
String order = StringUtils.substringAfterLast(result.getThreadName(), " ");
String scenarioName = StringUtils.substringBefore(thread, SPLIT); String scenarioName = StringUtils.substringBefore(thread, SPLIT);
String scenarioId = StringUtils.substringAfter(thread, SPLIT); String scenarioId = StringUtils.substringAfter(thread, SPLIT);
ScenarioResult scenarioResult; ScenarioResult scenarioResult;
...@@ -79,6 +77,7 @@ public class APIBackendListenerClient extends AbstractBackendListenerClient impl ...@@ -79,6 +77,7 @@ public class APIBackendListenerClient extends AbstractBackendListenerClient impl
scenarioResult = new ScenarioResult(); scenarioResult = new ScenarioResult();
scenarioResult.setId(scenarioId); scenarioResult.setId(scenarioId);
scenarioResult.setName(scenarioName); scenarioResult.setName(scenarioName);
scenarioResult.setOrder(StringUtils.substringBefore(order, "-"));
scenarios.put(scenarioId, scenarioResult); scenarios.put(scenarioId, scenarioResult);
} else { } else {
scenarioResult = scenarios.get(scenarioId); scenarioResult = scenarios.get(scenarioId);
...@@ -88,8 +87,8 @@ public class APIBackendListenerClient extends AbstractBackendListenerClient impl ...@@ -88,8 +87,8 @@ public class APIBackendListenerClient extends AbstractBackendListenerClient impl
scenarioResult.addSuccess(); scenarioResult.addSuccess();
testResult.addSuccess(); testResult.addSuccess();
} else { } else {
scenarioResult.addError(); scenarioResult.addError(result.getErrorCount());
testResult.addError(); testResult.addError(result.getErrorCount());
} }
RequestResult requestResult = getRequestResult(result); RequestResult requestResult = getRequestResult(result);
...@@ -103,6 +102,7 @@ public class APIBackendListenerClient extends AbstractBackendListenerClient impl ...@@ -103,6 +102,7 @@ public class APIBackendListenerClient extends AbstractBackendListenerClient impl
scenarioResult.addTotalAssertions(requestResult.getTotalAssertions()); scenarioResult.addTotalAssertions(requestResult.getTotalAssertions());
}); });
testResult.getScenarios().addAll(scenarios.values()); testResult.getScenarios().addAll(scenarios.values());
testResult.getScenarios().sort(Comparator.comparing(ScenarioResult::getOrder));
apiTestService.changeStatus(id, APITestStatus.Completed); apiTestService.changeStatus(id, APITestStatus.Completed);
apiReportService.save(testResult); apiReportService.save(testResult);
}); });
...@@ -123,6 +123,7 @@ public class APIBackendListenerClient extends AbstractBackendListenerClient impl ...@@ -123,6 +123,7 @@ public class APIBackendListenerClient extends AbstractBackendListenerClient impl
requestResult.setRequestSize(result.getSentBytes()); requestResult.setRequestSize(result.getSentBytes());
requestResult.setTotalAssertions(result.getAssertionResults().length); requestResult.setTotalAssertions(result.getAssertionResults().length);
requestResult.setSuccess(result.isSuccessful()); requestResult.setSuccess(result.isSuccessful());
requestResult.setError(result.getErrorCount());
ResponseResult responseResult = requestResult.getResponseResult(); ResponseResult responseResult = requestResult.getResponseResult();
responseResult.setBody(result.getResponseDataAsString()); responseResult.setBody(result.getResponseDataAsString());
......
...@@ -13,6 +13,8 @@ public class RequestResult { ...@@ -13,6 +13,8 @@ public class RequestResult {
private long requestSize; private long requestSize;
private int error;
private boolean success; private boolean success;
private String headers; private String headers;
......
...@@ -12,6 +12,8 @@ public class ScenarioResult { ...@@ -12,6 +12,8 @@ public class ScenarioResult {
private String name; private String name;
private String order;
private long responseTime; private long responseTime;
private int error = 0; private int error = 0;
...@@ -28,8 +30,8 @@ public class ScenarioResult { ...@@ -28,8 +30,8 @@ public class ScenarioResult {
this.responseTime += time; this.responseTime += time;
} }
public void addError() { public void addError(int count) {
this.error++; this.error += count;
} }
public void addSuccess() { public void addSuccess() {
......
...@@ -22,8 +22,8 @@ public class TestResult { ...@@ -22,8 +22,8 @@ public class TestResult {
private final List<ScenarioResult> scenarios = new ArrayList<>(); private final List<ScenarioResult> scenarios = new ArrayList<>();
public void addError() { public void addError(int count) {
this.error++; this.error += count;
} }
public void addSuccess() { public void addSuccess() {
......
...@@ -18,5 +18,7 @@ public class LoadTestReport implements Serializable { ...@@ -18,5 +18,7 @@ public class LoadTestReport implements Serializable {
private String status; private String status;
private String description;
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
} }
\ No newline at end of file
package io.metersphere.base.domain; package io.metersphere.base.domain;
import lombok.Data; import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.ToString;
import java.io.Serializable; import java.io.Serializable;
@Data @Data
public class LoadTestReportDetail implements Serializable { @EqualsAndHashCode(callSuper = true)
private String reportId; @ToString(callSuper = true)
public class LoadTestReportDetail extends LoadTestReportDetailKey implements Serializable {
private String content; private String content;
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
......
...@@ -173,6 +173,66 @@ public class LoadTestReportDetailExample { ...@@ -173,6 +173,66 @@ public class LoadTestReportDetailExample {
addCriterion("report_id not between", value1, value2, "reportId"); addCriterion("report_id not between", value1, value2, "reportId");
return (Criteria) this; return (Criteria) this;
} }
public Criteria andPartIsNull() {
addCriterion("part is null");
return (Criteria) this;
}
public Criteria andPartIsNotNull() {
addCriterion("part is not null");
return (Criteria) this;
}
public Criteria andPartEqualTo(Long value) {
addCriterion("part =", value, "part");
return (Criteria) this;
}
public Criteria andPartNotEqualTo(Long value) {
addCriterion("part <>", value, "part");
return (Criteria) this;
}
public Criteria andPartGreaterThan(Long value) {
addCriterion("part >", value, "part");
return (Criteria) this;
}
public Criteria andPartGreaterThanOrEqualTo(Long value) {
addCriterion("part >=", value, "part");
return (Criteria) this;
}
public Criteria andPartLessThan(Long value) {
addCriterion("part <", value, "part");
return (Criteria) this;
}
public Criteria andPartLessThanOrEqualTo(Long value) {
addCriterion("part <=", value, "part");
return (Criteria) this;
}
public Criteria andPartIn(List<Long> values) {
addCriterion("part in", values, "part");
return (Criteria) this;
}
public Criteria andPartNotIn(List<Long> values) {
addCriterion("part not in", values, "part");
return (Criteria) this;
}
public Criteria andPartBetween(Long value1, Long value2) {
addCriterion("part between", value1, value2, "part");
return (Criteria) this;
}
public Criteria andPartNotBetween(Long value1, Long value2) {
addCriterion("part not between", value1, value2, "part");
return (Criteria) this;
}
} }
public static class Criteria extends GeneratedCriteria { public static class Criteria extends GeneratedCriteria {
......
package io.metersphere.base.domain; package io.metersphere.base.domain;
import lombok.Data; import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.ToString;
import java.io.Serializable; import java.io.Serializable;
@Data @Data
@EqualsAndHashCode(callSuper = true) public class LoadTestReportDetailKey implements Serializable {
@ToString(callSuper = true) private String reportId;
public class LoadTestReportWithBLOBs extends LoadTestReport implements Serializable {
private String description;
private String content; private Long part;
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
} }
\ No newline at end of file
...@@ -12,6 +12,8 @@ public class LoadTestReportLog implements Serializable { ...@@ -12,6 +12,8 @@ public class LoadTestReportLog implements Serializable {
private String resourceId; private String resourceId;
private Long part;
private String content; private String content;
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
......
...@@ -313,6 +313,66 @@ public class LoadTestReportLogExample { ...@@ -313,6 +313,66 @@ public class LoadTestReportLogExample {
addCriterion("resource_id not between", value1, value2, "resourceId"); addCriterion("resource_id not between", value1, value2, "resourceId");
return (Criteria) this; return (Criteria) this;
} }
public Criteria andPartIsNull() {
addCriterion("part is null");
return (Criteria) this;
}
public Criteria andPartIsNotNull() {
addCriterion("part is not null");
return (Criteria) this;
}
public Criteria andPartEqualTo(Long value) {
addCriterion("part =", value, "part");
return (Criteria) this;
}
public Criteria andPartNotEqualTo(Long value) {
addCriterion("part <>", value, "part");
return (Criteria) this;
}
public Criteria andPartGreaterThan(Long value) {
addCriterion("part >", value, "part");
return (Criteria) this;
}
public Criteria andPartGreaterThanOrEqualTo(Long value) {
addCriterion("part >=", value, "part");
return (Criteria) this;
}
public Criteria andPartLessThan(Long value) {
addCriterion("part <", value, "part");
return (Criteria) this;
}
public Criteria andPartLessThanOrEqualTo(Long value) {
addCriterion("part <=", value, "part");
return (Criteria) this;
}
public Criteria andPartIn(List<Long> values) {
addCriterion("part in", values, "part");
return (Criteria) this;
}
public Criteria andPartNotIn(List<Long> values) {
addCriterion("part not in", values, "part");
return (Criteria) this;
}
public Criteria andPartBetween(Long value1, Long value2) {
addCriterion("part between", value1, value2, "part");
return (Criteria) this;
}
public Criteria andPartNotBetween(Long value1, Long value2) {
addCriterion("part not between", value1, value2, "part");
return (Criteria) this;
}
} }
public static class Criteria extends GeneratedCriteria { public static class Criteria extends GeneratedCriteria {
......
...@@ -2,6 +2,7 @@ package io.metersphere.base.mapper; ...@@ -2,6 +2,7 @@ package io.metersphere.base.mapper;
import io.metersphere.base.domain.LoadTestReportDetail; import io.metersphere.base.domain.LoadTestReportDetail;
import io.metersphere.base.domain.LoadTestReportDetailExample; import io.metersphere.base.domain.LoadTestReportDetailExample;
import io.metersphere.base.domain.LoadTestReportDetailKey;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
import java.util.List; import java.util.List;
...@@ -11,7 +12,7 @@ public interface LoadTestReportDetailMapper { ...@@ -11,7 +12,7 @@ public interface LoadTestReportDetailMapper {
int deleteByExample(LoadTestReportDetailExample example); int deleteByExample(LoadTestReportDetailExample example);
int deleteByPrimaryKey(String reportId); int deleteByPrimaryKey(LoadTestReportDetailKey key);
int insert(LoadTestReportDetail record); int insert(LoadTestReportDetail record);
...@@ -21,7 +22,7 @@ public interface LoadTestReportDetailMapper { ...@@ -21,7 +22,7 @@ public interface LoadTestReportDetailMapper {
List<LoadTestReportDetail> selectByExample(LoadTestReportDetailExample example); List<LoadTestReportDetail> selectByExample(LoadTestReportDetailExample example);
LoadTestReportDetail selectByPrimaryKey(String reportId); LoadTestReportDetail selectByPrimaryKey(LoadTestReportDetailKey key);
int updateByExampleSelective(@Param("record") LoadTestReportDetail record, @Param("example") LoadTestReportDetailExample example); int updateByExampleSelective(@Param("record") LoadTestReportDetail record, @Param("example") LoadTestReportDetailExample example);
......
...@@ -3,6 +3,7 @@ ...@@ -3,6 +3,7 @@
<mapper namespace="io.metersphere.base.mapper.LoadTestReportDetailMapper"> <mapper namespace="io.metersphere.base.mapper.LoadTestReportDetailMapper">
<resultMap id="BaseResultMap" type="io.metersphere.base.domain.LoadTestReportDetail"> <resultMap id="BaseResultMap" type="io.metersphere.base.domain.LoadTestReportDetail">
<id column="report_id" jdbcType="VARCHAR" property="reportId" /> <id column="report_id" jdbcType="VARCHAR" property="reportId" />
<id column="part" jdbcType="BIGINT" property="part"/>
</resultMap> </resultMap>
<resultMap extends="BaseResultMap" id="ResultMapWithBLOBs" type="io.metersphere.base.domain.LoadTestReportDetail"> <resultMap extends="BaseResultMap" id="ResultMapWithBLOBs" type="io.metersphere.base.domain.LoadTestReportDetail">
<result column="content" jdbcType="LONGVARCHAR" property="content" /> <result column="content" jdbcType="LONGVARCHAR" property="content" />
...@@ -66,7 +67,8 @@ ...@@ -66,7 +67,8 @@
</where> </where>
</sql> </sql>
<sql id="Base_Column_List"> <sql id="Base_Column_List">
report_id report_id,
part
</sql> </sql>
<sql id="Blob_Column_List"> <sql id="Blob_Column_List">
content content
...@@ -101,18 +103,20 @@ ...@@ -101,18 +103,20 @@
order by ${orderByClause} order by ${orderByClause}
</if> </if>
</select> </select>
<select id="selectByPrimaryKey" parameterType="java.lang.String" resultMap="ResultMapWithBLOBs"> <select id="selectByPrimaryKey" parameterType="io.metersphere.base.domain.LoadTestReportDetailKey" resultMap="ResultMapWithBLOBs">
select SELECT
<include refid="Base_Column_List" /> <include refid="Base_Column_List"/>
, ,
<include refid="Blob_Column_List" /> <include refid="Blob_Column_List"/>
from load_test_report_detail FROM load_test_report_detail
where report_id = #{reportId,jdbcType=VARCHAR} WHERE report_id = #{reportId,jdbcType=VARCHAR}
</select> AND part = #{part,jdbcType=BIGINT}
<delete id="deleteByPrimaryKey" parameterType="java.lang.String"> </select>
delete from load_test_report_detail <delete id="deleteByPrimaryKey" parameterType="io.metersphere.base.domain.LoadTestReportDetailKey">
where report_id = #{reportId,jdbcType=VARCHAR} DELETE FROM load_test_report_detail
</delete> WHERE report_id = #{reportId,jdbcType=VARCHAR}
AND part = #{part,jdbcType=BIGINT}
</delete>
<delete id="deleteByExample" parameterType="io.metersphere.base.domain.LoadTestReportDetailExample"> <delete id="deleteByExample" parameterType="io.metersphere.base.domain.LoadTestReportDetailExample">
delete from load_test_report_detail delete from load_test_report_detail
<if test="_parameter != null"> <if test="_parameter != null">
...@@ -120,27 +124,35 @@ ...@@ -120,27 +124,35 @@
</if> </if>
</delete> </delete>
<insert id="insert" parameterType="io.metersphere.base.domain.LoadTestReportDetail"> <insert id="insert" parameterType="io.metersphere.base.domain.LoadTestReportDetail">
insert into load_test_report_detail (report_id, content) insert into load_test_report_detail (report_id, part, content
values (#{reportId,jdbcType=VARCHAR}, #{content,jdbcType=LONGVARCHAR}) )
values (#{reportId,jdbcType=VARCHAR}, #{part,jdbcType=BIGINT}, #{content,jdbcType=LONGVARCHAR}
)
</insert> </insert>
<insert id="insertSelective" parameterType="io.metersphere.base.domain.LoadTestReportDetail"> <insert id="insertSelective" parameterType="io.metersphere.base.domain.LoadTestReportDetail">
insert into load_test_report_detail insert into load_test_report_detail
<trim prefix="(" suffix=")" suffixOverrides=","> <trim prefix="(" suffix=")" suffixOverrides=",">
<if test="reportId != null"> <if test="reportId != null">
report_id, report_id,
</if> </if>
<if test="content != null"> <if test="part != null">
content, part,
</if> </if>
</trim> <if test="content != null">
<trim prefix="values (" suffix=")" suffixOverrides=","> content,
<if test="reportId != null"> </if>
#{reportId,jdbcType=VARCHAR}, </trim>
</if> <trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="content != null"> <if test="reportId != null">
#{content,jdbcType=LONGVARCHAR}, #{reportId,jdbcType=VARCHAR},
</if> </if>
</trim> <if test="part != null">
#{part,jdbcType=BIGINT},
</if>
<if test="content != null">
#{content,jdbcType=LONGVARCHAR},
</if>
</trim>
</insert> </insert>
<select id="countByExample" parameterType="io.metersphere.base.domain.LoadTestReportDetailExample" resultType="java.lang.Long"> <select id="countByExample" parameterType="io.metersphere.base.domain.LoadTestReportDetailExample" resultType="java.lang.Long">
select count(*) from load_test_report_detail select count(*) from load_test_report_detail
...@@ -150,30 +162,35 @@ ...@@ -150,30 +162,35 @@
</select> </select>
<update id="updateByExampleSelective" parameterType="map"> <update id="updateByExampleSelective" parameterType="map">
update load_test_report_detail update load_test_report_detail
<set> <set>
<if test="record.reportId != null"> <if test="record.reportId != null">
report_id = #{record.reportId,jdbcType=VARCHAR}, report_id = #{record.reportId,jdbcType=VARCHAR},
</if> </if>
<if test="record.content != null"> <if test="record.part != null">
content = #{record.content,jdbcType=LONGVARCHAR}, part = #{record.part,jdbcType=BIGINT},
</if> </if>
</set> <if test="record.content != null">
content = #{record.content,jdbcType=LONGVARCHAR},
</if>
</set>
<if test="_parameter != null"> <if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" /> <include refid="Update_By_Example_Where_Clause" />
</if> </if>
</update> </update>
<update id="updateByExampleWithBLOBs" parameterType="map"> <update id="updateByExampleWithBLOBs" parameterType="map">
update load_test_report_detail update load_test_report_detail
set report_id = #{record.reportId,jdbcType=VARCHAR}, set report_id = #{record.reportId,jdbcType=VARCHAR},
part = #{record.part,jdbcType=BIGINT},
content = #{record.content,jdbcType=LONGVARCHAR} content = #{record.content,jdbcType=LONGVARCHAR}
<if test="_parameter != null"> <if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" /> <include refid="Update_By_Example_Where_Clause" />
</if> </if>
</update> </update>
<update id="updateByExample" parameterType="map"> <update id="updateByExample" parameterType="map">
update load_test_report_detail update load_test_report_detail
set report_id = #{record.reportId,jdbcType=VARCHAR} set report_id = #{record.reportId,jdbcType=VARCHAR},
<if test="_parameter != null"> part = #{record.part,jdbcType=BIGINT}
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" /> <include refid="Update_By_Example_Where_Clause" />
</if> </if>
</update> </update>
...@@ -184,11 +201,13 @@ ...@@ -184,11 +201,13 @@
content = #{content,jdbcType=LONGVARCHAR}, content = #{content,jdbcType=LONGVARCHAR},
</if> </if>
</set> </set>
where report_id = #{reportId,jdbcType=VARCHAR} where report_id = #{reportId,jdbcType=VARCHAR}
and part = #{part,jdbcType=BIGINT}
</update> </update>
<update id="updateByPrimaryKeyWithBLOBs" parameterType="io.metersphere.base.domain.LoadTestReportDetail"> <update id="updateByPrimaryKeyWithBLOBs" parameterType="io.metersphere.base.domain.LoadTestReportDetail">
update load_test_report_detail update load_test_report_detail
set content = #{content,jdbcType=LONGVARCHAR} set content = #{content,jdbcType=LONGVARCHAR}
where report_id = #{reportId,jdbcType=VARCHAR} where report_id = #{reportId,jdbcType=VARCHAR}
and part = #{part,jdbcType=BIGINT}
</update> </update>
</mapper> </mapper>
\ No newline at end of file
...@@ -5,6 +5,7 @@ ...@@ -5,6 +5,7 @@
<id column="id" jdbcType="VARCHAR" property="id" /> <id column="id" jdbcType="VARCHAR" property="id" />
<result column="report_id" jdbcType="VARCHAR" property="reportId" /> <result column="report_id" jdbcType="VARCHAR" property="reportId" />
<result column="resource_id" jdbcType="VARCHAR" property="resourceId" /> <result column="resource_id" jdbcType="VARCHAR" property="resourceId" />
<result column="part" jdbcType="BIGINT" property="part"/>
</resultMap> </resultMap>
<resultMap extends="BaseResultMap" id="ResultMapWithBLOBs" type="io.metersphere.base.domain.LoadTestReportLog"> <resultMap extends="BaseResultMap" id="ResultMapWithBLOBs" type="io.metersphere.base.domain.LoadTestReportLog">
<result column="content" jdbcType="LONGVARCHAR" property="content" /> <result column="content" jdbcType="LONGVARCHAR" property="content" />
...@@ -68,7 +69,10 @@ ...@@ -68,7 +69,10 @@
</where> </where>
</sql> </sql>
<sql id="Base_Column_List"> <sql id="Base_Column_List">
id, report_id, resource_id id,
report_id,
resource_id,
part
</sql> </sql>
<sql id="Blob_Column_List"> <sql id="Blob_Column_List">
content content
...@@ -122,41 +126,47 @@ ...@@ -122,41 +126,47 @@
</if> </if>
</delete> </delete>
<insert id="insert" parameterType="io.metersphere.base.domain.LoadTestReportLog"> <insert id="insert" parameterType="io.metersphere.base.domain.LoadTestReportLog">
insert into load_test_report_log (id, report_id, resource_id, insert into load_test_report_log (id, report_id, resource_id,
content) part, content)
values (#{id,jdbcType=VARCHAR}, #{reportId,jdbcType=VARCHAR}, #{resourceId,jdbcType=VARCHAR}, values (#{id,jdbcType=VARCHAR}, #{reportId,jdbcType=VARCHAR}, #{resourceId,jdbcType=VARCHAR},
#{content,jdbcType=LONGVARCHAR}) #{part,jdbcType=BIGINT}, #{content,jdbcType=LONGVARCHAR})
</insert> </insert>
<insert id="insertSelective" parameterType="io.metersphere.base.domain.LoadTestReportLog"> <insert id="insertSelective" parameterType="io.metersphere.base.domain.LoadTestReportLog">
insert into load_test_report_log insert into load_test_report_log
<trim prefix="(" suffix=")" suffixOverrides=","> <trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null"> <if test="id != null">
id, id,
</if> </if>
<if test="reportId != null"> <if test="reportId != null">
report_id, report_id,
</if> </if>
<if test="resourceId != null"> <if test="resourceId != null">
resource_id, resource_id,
</if> </if>
<if test="content != null"> <if test="part != null">
content, part,
</if> </if>
</trim> <if test="content != null">
<trim prefix="values (" suffix=")" suffixOverrides=","> content,
<if test="id != null"> </if>
#{id,jdbcType=VARCHAR}, </trim>
</if> <trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="reportId != null"> <if test="id != null">
#{reportId,jdbcType=VARCHAR}, #{id,jdbcType=VARCHAR},
</if> </if>
<if test="resourceId != null"> <if test="reportId != null">
#{resourceId,jdbcType=VARCHAR}, #{reportId,jdbcType=VARCHAR},
</if> </if>
<if test="content != null"> <if test="resourceId != null">
#{content,jdbcType=LONGVARCHAR}, #{resourceId,jdbcType=VARCHAR},
</if> </if>
</trim> <if test="part != null">
#{part,jdbcType=BIGINT},
</if>
<if test="content != null">
#{content,jdbcType=LONGVARCHAR},
</if>
</trim>
</insert> </insert>
<select id="countByExample" parameterType="io.metersphere.base.domain.LoadTestReportLogExample" resultType="java.lang.Long"> <select id="countByExample" parameterType="io.metersphere.base.domain.LoadTestReportLogExample" resultType="java.lang.Long">
select count(*) from load_test_report_log select count(*) from load_test_report_log
...@@ -166,69 +176,79 @@ ...@@ -166,69 +176,79 @@
</select> </select>
<update id="updateByExampleSelective" parameterType="map"> <update id="updateByExampleSelective" parameterType="map">
update load_test_report_log update load_test_report_log
<set> <set>
<if test="record.id != null"> <if test="record.id != null">
id = #{record.id,jdbcType=VARCHAR}, id = #{record.id,jdbcType=VARCHAR},
</if> </if>
<if test="record.reportId != null"> <if test="record.reportId != null">
report_id = #{record.reportId,jdbcType=VARCHAR}, report_id = #{record.reportId,jdbcType=VARCHAR},
</if> </if>
<if test="record.resourceId != null"> <if test="record.resourceId != null">
resource_id = #{record.resourceId,jdbcType=VARCHAR}, resource_id = #{record.resourceId,jdbcType=VARCHAR},
</if> </if>
<if test="record.content != null"> <if test="record.part != null">
content = #{record.content,jdbcType=LONGVARCHAR}, part = #{record.part,jdbcType=BIGINT},
</if> </if>
</set> <if test="record.content != null">
content = #{record.content,jdbcType=LONGVARCHAR},
</if>
</set>
<if test="_parameter != null"> <if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" /> <include refid="Update_By_Example_Where_Clause" />
</if> </if>
</update> </update>
<update id="updateByExampleWithBLOBs" parameterType="map"> <update id="updateByExampleWithBLOBs" parameterType="map">
update load_test_report_log update load_test_report_log
set id = #{record.id,jdbcType=VARCHAR}, set id = #{record.id,jdbcType=VARCHAR},
report_id = #{record.reportId,jdbcType=VARCHAR}, report_id = #{record.reportId,jdbcType=VARCHAR},
resource_id = #{record.resourceId,jdbcType=VARCHAR}, resource_id = #{record.resourceId,jdbcType=VARCHAR},
part = #{record.part,jdbcType=BIGINT},
content = #{record.content,jdbcType=LONGVARCHAR} content = #{record.content,jdbcType=LONGVARCHAR}
<if test="_parameter != null"> <if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" /> <include refid="Update_By_Example_Where_Clause" />
</if> </if>
</update> </update>
<update id="updateByExample" parameterType="map"> <update id="updateByExample" parameterType="map">
update load_test_report_log update load_test_report_log
set id = #{record.id,jdbcType=VARCHAR}, set id = #{record.id,jdbcType=VARCHAR},
report_id = #{record.reportId,jdbcType=VARCHAR}, report_id = #{record.reportId,jdbcType=VARCHAR},
resource_id = #{record.resourceId,jdbcType=VARCHAR} resource_id = #{record.resourceId,jdbcType=VARCHAR},
<if test="_parameter != null"> part = #{record.part,jdbcType=BIGINT}
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" /> <include refid="Update_By_Example_Where_Clause" />
</if> </if>
</update> </update>
<update id="updateByPrimaryKeySelective" parameterType="io.metersphere.base.domain.LoadTestReportLog"> <update id="updateByPrimaryKeySelective" parameterType="io.metersphere.base.domain.LoadTestReportLog">
update load_test_report_log update load_test_report_log
<set> <set>
<if test="reportId != null"> <if test="reportId != null">
report_id = #{reportId,jdbcType=VARCHAR}, report_id = #{reportId,jdbcType=VARCHAR},
</if> </if>
<if test="resourceId != null"> <if test="resourceId != null">
resource_id = #{resourceId,jdbcType=VARCHAR}, resource_id = #{resourceId,jdbcType=VARCHAR},
</if> </if>
<if test="content != null"> <if test="part != null">
content = #{content,jdbcType=LONGVARCHAR}, part = #{part,jdbcType=BIGINT},
</if> </if>
</set> <if test="content != null">
content = #{content,jdbcType=LONGVARCHAR},
</if>
</set>
where id = #{id,jdbcType=VARCHAR} where id = #{id,jdbcType=VARCHAR}
</update> </update>
<update id="updateByPrimaryKeyWithBLOBs" parameterType="io.metersphere.base.domain.LoadTestReportLog"> <update id="updateByPrimaryKeyWithBLOBs" parameterType="io.metersphere.base.domain.LoadTestReportLog">
update load_test_report_log update load_test_report_log
set report_id = #{reportId,jdbcType=VARCHAR}, set report_id = #{reportId,jdbcType=VARCHAR},
resource_id = #{resourceId,jdbcType=VARCHAR}, resource_id = #{resourceId,jdbcType=VARCHAR},
part = #{part,jdbcType=BIGINT},
content = #{content,jdbcType=LONGVARCHAR} content = #{content,jdbcType=LONGVARCHAR}
where id = #{id,jdbcType=VARCHAR} where id = #{id,jdbcType=VARCHAR}
</update> </update>
<update id="updateByPrimaryKey" parameterType="io.metersphere.base.domain.LoadTestReportLog"> <update id="updateByPrimaryKey" parameterType="io.metersphere.base.domain.LoadTestReportLog">
update load_test_report_log update load_test_report_log
set report_id = #{reportId,jdbcType=VARCHAR}, set report_id = #{reportId,jdbcType=VARCHAR},
resource_id = #{resourceId,jdbcType=VARCHAR} resource_id = #{resourceId,jdbcType=VARCHAR},
where id = #{id,jdbcType=VARCHAR} part = #{part,jdbcType=BIGINT}
where id = #{id,jdbcType=VARCHAR}
</update> </update>
</mapper> </mapper>
\ No newline at end of file
...@@ -2,7 +2,6 @@ package io.metersphere.base.mapper; ...@@ -2,7 +2,6 @@ package io.metersphere.base.mapper;
import io.metersphere.base.domain.LoadTestReport; import io.metersphere.base.domain.LoadTestReport;
import io.metersphere.base.domain.LoadTestReportExample; import io.metersphere.base.domain.LoadTestReportExample;
import io.metersphere.base.domain.LoadTestReportWithBLOBs;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
import java.util.List; import java.util.List;
...@@ -14,25 +13,25 @@ public interface LoadTestReportMapper { ...@@ -14,25 +13,25 @@ public interface LoadTestReportMapper {
int deleteByPrimaryKey(String id); int deleteByPrimaryKey(String id);
int insert(LoadTestReportWithBLOBs record); int insert(LoadTestReport record);
int insertSelective(LoadTestReportWithBLOBs record); int insertSelective(LoadTestReport record);
List<LoadTestReportWithBLOBs> selectByExampleWithBLOBs(LoadTestReportExample example); List<LoadTestReport> selectByExampleWithBLOBs(LoadTestReportExample example);
List<LoadTestReport> selectByExample(LoadTestReportExample example); List<LoadTestReport> selectByExample(LoadTestReportExample example);
LoadTestReportWithBLOBs selectByPrimaryKey(String id); LoadTestReport selectByPrimaryKey(String id);
int updateByExampleSelective(@Param("record") LoadTestReportWithBLOBs record, @Param("example") LoadTestReportExample example); int updateByExampleSelective(@Param("record") LoadTestReport record, @Param("example") LoadTestReportExample example);
int updateByExampleWithBLOBs(@Param("record") LoadTestReportWithBLOBs record, @Param("example") LoadTestReportExample example); int updateByExampleWithBLOBs(@Param("record") LoadTestReport record, @Param("example") LoadTestReportExample example);
int updateByExample(@Param("record") LoadTestReport record, @Param("example") LoadTestReportExample example); int updateByExample(@Param("record") LoadTestReport record, @Param("example") LoadTestReportExample example);
int updateByPrimaryKeySelective(LoadTestReportWithBLOBs record); int updateByPrimaryKeySelective(LoadTestReport record);
int updateByPrimaryKeyWithBLOBs(LoadTestReportWithBLOBs record); int updateByPrimaryKeyWithBLOBs(LoadTestReport record);
int updateByPrimaryKey(LoadTestReport record); int updateByPrimaryKey(LoadTestReport record);
} }
\ No newline at end of file
...@@ -9,9 +9,8 @@ ...@@ -9,9 +9,8 @@
<result column="update_time" jdbcType="BIGINT" property="updateTime" /> <result column="update_time" jdbcType="BIGINT" property="updateTime" />
<result column="status" jdbcType="VARCHAR" property="status" /> <result column="status" jdbcType="VARCHAR" property="status" />
</resultMap> </resultMap>
<resultMap extends="BaseResultMap" id="ResultMapWithBLOBs" type="io.metersphere.base.domain.LoadTestReportWithBLOBs"> <resultMap extends="BaseResultMap" id="ResultMapWithBLOBs" type="io.metersphere.base.domain.LoadTestReport">
<result column="description" jdbcType="LONGVARCHAR" property="description" /> <result column="description" jdbcType="LONGVARCHAR" property="description"/>
<result column="content" jdbcType="LONGVARCHAR" property="content" />
</resultMap> </resultMap>
<sql id="Example_Where_Clause"> <sql id="Example_Where_Clause">
<where> <where>
...@@ -75,7 +74,7 @@ ...@@ -75,7 +74,7 @@
id, test_id, name, create_time, update_time, status id, test_id, name, create_time, update_time, status
</sql> </sql>
<sql id="Blob_Column_List"> <sql id="Blob_Column_List">
description, content description
</sql> </sql>
<select id="selectByExampleWithBLOBs" parameterType="io.metersphere.base.domain.LoadTestReportExample" resultMap="ResultMapWithBLOBs"> <select id="selectByExampleWithBLOBs" parameterType="io.metersphere.base.domain.LoadTestReportExample" resultMap="ResultMapWithBLOBs">
select select
...@@ -125,25 +124,25 @@ ...@@ -125,25 +124,25 @@
<include refid="Example_Where_Clause" /> <include refid="Example_Where_Clause" />
</if> </if>
</delete> </delete>
<insert id="insert" parameterType="io.metersphere.base.domain.LoadTestReportWithBLOBs"> <insert id="insert" parameterType="io.metersphere.base.domain.LoadTestReport">
insert into load_test_report (id, test_id, name, INSERT INTO load_test_report (id, test_id, name,
create_time, update_time, status, create_time, update_time, status,
description, content) description)
values (#{id,jdbcType=VARCHAR}, #{testId,jdbcType=VARCHAR}, #{name,jdbcType=VARCHAR}, VALUES (#{id,jdbcType=VARCHAR}, #{testId,jdbcType=VARCHAR}, #{name,jdbcType=VARCHAR},
#{createTime,jdbcType=BIGINT}, #{updateTime,jdbcType=BIGINT}, #{status,jdbcType=VARCHAR}, #{createTime,jdbcType=BIGINT}, #{updateTime,jdbcType=BIGINT}, #{status,jdbcType=VARCHAR},
#{description,jdbcType=LONGVARCHAR}, #{content,jdbcType=LONGVARCHAR}) #{description,jdbcType=LONGVARCHAR})
</insert> </insert>
<insert id="insertSelective" parameterType="io.metersphere.base.domain.LoadTestReportWithBLOBs"> <insert id="insertSelective" parameterType="io.metersphere.base.domain.LoadTestReport">
insert into load_test_report insert into load_test_report
<trim prefix="(" suffix=")" suffixOverrides=","> <trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null"> <if test="id != null">
id, id,
</if> </if>
<if test="testId != null"> <if test="testId != null">
test_id, test_id,
</if> </if>
<if test="name != null"> <if test="name != null">
name, name,
</if> </if>
<if test="createTime != null"> <if test="createTime != null">
create_time, create_time,
...@@ -157,9 +156,6 @@ ...@@ -157,9 +156,6 @@
<if test="description != null"> <if test="description != null">
description, description,
</if> </if>
<if test="content != null">
content,
</if>
</trim> </trim>
<trim prefix="values (" suffix=")" suffixOverrides=","> <trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id != null"> <if test="id != null">
...@@ -183,9 +179,6 @@ ...@@ -183,9 +179,6 @@
<if test="description != null"> <if test="description != null">
#{description,jdbcType=LONGVARCHAR}, #{description,jdbcType=LONGVARCHAR},
</if> </if>
<if test="content != null">
#{content,jdbcType=LONGVARCHAR},
</if>
</trim> </trim>
</insert> </insert>
<select id="countByExample" parameterType="io.metersphere.base.domain.LoadTestReportExample" resultType="java.lang.Long"> <select id="countByExample" parameterType="io.metersphere.base.domain.LoadTestReportExample" resultType="java.lang.Long">
...@@ -218,25 +211,21 @@ ...@@ -218,25 +211,21 @@
<if test="record.description != null"> <if test="record.description != null">
description = #{record.description,jdbcType=LONGVARCHAR}, description = #{record.description,jdbcType=LONGVARCHAR},
</if> </if>
<if test="record.content != null">
content = #{record.content,jdbcType=LONGVARCHAR},
</if>
</set> </set>
<if test="_parameter != null"> <if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" /> <include refid="Update_By_Example_Where_Clause" />
</if> </if>
</update> </update>
<update id="updateByExampleWithBLOBs" parameterType="map"> <update id="updateByExampleWithBLOBs" parameterType="map">
update load_test_report update load_test_report
set id = #{record.id,jdbcType=VARCHAR}, set id = #{record.id,jdbcType=VARCHAR},
test_id = #{record.testId,jdbcType=VARCHAR}, test_id = #{record.testId,jdbcType=VARCHAR},
name = #{record.name,jdbcType=VARCHAR}, name = #{record.name,jdbcType=VARCHAR},
create_time = #{record.createTime,jdbcType=BIGINT}, create_time = #{record.createTime,jdbcType=BIGINT},
update_time = #{record.updateTime,jdbcType=BIGINT}, update_time = #{record.updateTime,jdbcType=BIGINT},
status = #{record.status,jdbcType=VARCHAR}, status = #{record.status,jdbcType=VARCHAR},
description = #{record.description,jdbcType=LONGVARCHAR}, description = #{record.description,jdbcType=LONGVARCHAR}
content = #{record.content,jdbcType=LONGVARCHAR} <if test="_parameter != null">
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" /> <include refid="Update_By_Example_Where_Clause" />
</if> </if>
</update> </update>
...@@ -252,17 +241,17 @@ ...@@ -252,17 +241,17 @@
<include refid="Update_By_Example_Where_Clause" /> <include refid="Update_By_Example_Where_Clause" />
</if> </if>
</update> </update>
<update id="updateByPrimaryKeySelective" parameterType="io.metersphere.base.domain.LoadTestReportWithBLOBs"> <update id="updateByPrimaryKeySelective" parameterType="io.metersphere.base.domain.LoadTestReport">
update load_test_report update load_test_report
<set> <set>
<if test="testId != null"> <if test="testId != null">
test_id = #{testId,jdbcType=VARCHAR}, test_id = #{testId,jdbcType=VARCHAR},
</if> </if>
<if test="name != null"> <if test="name != null">
name = #{name,jdbcType=VARCHAR}, name = #{name,jdbcType=VARCHAR},
</if> </if>
<if test="createTime != null"> <if test="createTime != null">
create_time = #{createTime,jdbcType=BIGINT}, create_time = #{createTime,jdbcType=BIGINT},
</if> </if>
<if test="updateTime != null"> <if test="updateTime != null">
update_time = #{updateTime,jdbcType=BIGINT}, update_time = #{updateTime,jdbcType=BIGINT},
...@@ -273,23 +262,19 @@ ...@@ -273,23 +262,19 @@
<if test="description != null"> <if test="description != null">
description = #{description,jdbcType=LONGVARCHAR}, description = #{description,jdbcType=LONGVARCHAR},
</if> </if>
<if test="content != null">
content = #{content,jdbcType=LONGVARCHAR},
</if>
</set> </set>
where id = #{id,jdbcType=VARCHAR} where id = #{id,jdbcType=VARCHAR}
</update> </update>
<update id="updateByPrimaryKeyWithBLOBs" parameterType="io.metersphere.base.domain.LoadTestReportWithBLOBs"> <update id="updateByPrimaryKeyWithBLOBs" parameterType="io.metersphere.base.domain.LoadTestReport">
update load_test_report UPDATE load_test_report
set test_id = #{testId,jdbcType=VARCHAR}, SET test_id = #{testId,jdbcType=VARCHAR},
name = #{name,jdbcType=VARCHAR}, name = #{name,jdbcType=VARCHAR},
create_time = #{createTime,jdbcType=BIGINT}, create_time = #{createTime,jdbcType=BIGINT},
update_time = #{updateTime,jdbcType=BIGINT}, update_time = #{updateTime,jdbcType=BIGINT},
status = #{status,jdbcType=VARCHAR}, status = #{status,jdbcType=VARCHAR},
description = #{description,jdbcType=LONGVARCHAR}, description = #{description,jdbcType=LONGVARCHAR}
content = #{content,jdbcType=LONGVARCHAR} WHERE id = #{id,jdbcType=VARCHAR}
where id = #{id,jdbcType=VARCHAR} </update>
</update>
<update id="updateByPrimaryKey" parameterType="io.metersphere.base.domain.LoadTestReport"> <update id="updateByPrimaryKey" parameterType="io.metersphere.base.domain.LoadTestReport">
update load_test_report update load_test_report
set test_id = #{testId,jdbcType=VARCHAR}, set test_id = #{testId,jdbcType=VARCHAR},
......
...@@ -14,8 +14,6 @@ public interface ExtLoadTestReportMapper { ...@@ -14,8 +14,6 @@ public interface ExtLoadTestReportMapper {
ReportDTO getReportTestAndProInfo(@Param("id") String id); ReportDTO getReportTestAndProInfo(@Param("id") String id);
int appendLine(@Param("testId") String id, @Param("line") String line);
LoadTestReport selectByPrimaryKey(String id); LoadTestReport selectByPrimaryKey(String id);
List<DashboardTestDTO> selectDashboardTests(@Param("workspaceId") String workspaceId, @Param("startTimestamp") long startTimestamp); List<DashboardTestDTO> selectDashboardTests(@Param("workspaceId") String workspaceId, @Param("startTimestamp") long startTimestamp);
......
...@@ -41,12 +41,6 @@ ...@@ -41,12 +41,6 @@
where ltr.id = #{id} where ltr.id = #{id}
</select> </select>
<update id="appendLine">
UPDATE load_test_report
SET content = concat(content, #{line})
WHERE id = #{testId}
</update>
<select id="selectByPrimaryKey" parameterType="java.lang.String" resultMap="BaseResultMap"> <select id="selectByPrimaryKey" parameterType="java.lang.String" resultMap="BaseResultMap">
SELECT SELECT
<include refid="Base_Column_List"/> <include refid="Base_Column_List"/>
......
...@@ -28,7 +28,7 @@ public interface ParamConstants { ...@@ -28,7 +28,7 @@ public interface ParamConstants {
} }
enum Classify implements ParamConstants { enum Classify implements ParamConstants {
MAIL("meter"),
REGISTRY("registry"); REGISTRY("registry");
private String value; private String value;
...@@ -85,4 +85,29 @@ public interface ParamConstants { ...@@ -85,4 +85,29 @@ public interface ParamConstants {
this.value = value; this.value = value;
} }
} }
public static enum MAIL {
HOST("meter.host", 1),
PORT("meter.port", 2),
ACCOUNT("meter.account", 3),
PASSWORD("meter.password", 4),
SSL("meter.ssl", 5),
TLS("meter.tls", 6),
ANON("meter.anon", 7);
private String key;
private Integer value;
private MAIL(String key, Integer value) {
this.key = key;
this.value = value;
}
public String getKey() {
return this.key;
}
public Integer getValue() {
return this.value;
}
}
} }
...@@ -22,4 +22,9 @@ public class RoleController { ...@@ -22,4 +22,9 @@ public class RoleController {
return roleService.getRoleList(sign); return roleService.getRoleList(sign);
} }
@GetMapping("/all")
public List<Role> getAllRole() {
return roleService.getAllRole();
}
} }
package io.metersphere.controller;
import io.metersphere.base.domain.SystemParameter;
import io.metersphere.service.SystemParameterService;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import javax.annotation.Resource;
import java.util.HashMap;
import java.util.List;
@RestController
@RequestMapping(value = "/system")
public class SystemParameterController {
@Resource
private SystemParameterService SystemParameterService;
@PostMapping("/edit/email")
public void editMail(@RequestBody List<SystemParameter> SystemParameter){
SystemParameterService.editMail(SystemParameter);
}
@PostMapping("/testConnection")
public void testConnection(@RequestBody HashMap<String, String> hashMap){
SystemParameterService.testConnection(hashMap);
}
}
...@@ -9,11 +9,10 @@ import io.metersphere.commons.user.SessionUser; ...@@ -9,11 +9,10 @@ import io.metersphere.commons.user.SessionUser;
import io.metersphere.commons.utils.PageUtils; import io.metersphere.commons.utils.PageUtils;
import io.metersphere.commons.utils.Pager; import io.metersphere.commons.utils.Pager;
import io.metersphere.commons.utils.SessionUtils; import io.metersphere.commons.utils.SessionUtils;
import io.metersphere.controller.request.UserRequest;
import io.metersphere.controller.request.member.AddMemberRequest; import io.metersphere.controller.request.member.AddMemberRequest;
import io.metersphere.controller.request.member.UserRequest;
import io.metersphere.controller.request.member.EditPassWordRequest; import io.metersphere.controller.request.member.EditPassWordRequest;
import io.metersphere.controller.request.member.QueryMemberRequest; import io.metersphere.controller.request.member.QueryMemberRequest;
import io.metersphere.controller.request.member.SetAdminRequest;
import io.metersphere.controller.request.organization.AddOrgMemberRequest; import io.metersphere.controller.request.organization.AddOrgMemberRequest;
import io.metersphere.controller.request.organization.QueryOrgMemberRequest; import io.metersphere.controller.request.organization.QueryOrgMemberRequest;
import io.metersphere.dto.UserDTO; import io.metersphere.dto.UserDTO;
...@@ -39,16 +38,15 @@ public class UserController { ...@@ -39,16 +38,15 @@ public class UserController {
@Resource @Resource
private WorkspaceService workspaceService; private WorkspaceService workspaceService;
// admin api
@PostMapping("/special/add") @PostMapping("/special/add")
@RequiresRoles(RoleConstants.ADMIN) @RequiresRoles(RoleConstants.ADMIN)
public UserDTO insertUser(@RequestBody User user) { public UserDTO insertUser(@RequestBody UserRequest user) {
return userService.insert(user); return userService.insert(user);
} }
@PostMapping("/special/list/{goPage}/{pageSize}") @PostMapping("/special/list/{goPage}/{pageSize}")
@RequiresRoles(RoleConstants.ADMIN) @RequiresRoles(RoleConstants.ADMIN)
public Pager<List<User>> getUserList(@PathVariable int goPage, @PathVariable int pageSize, @RequestBody UserRequest request) { public Pager<List<User>> getUserList(@PathVariable int goPage, @PathVariable int pageSize, @RequestBody io.metersphere.controller.request.UserRequest request) {
Page<Object> page = PageHelper.startPage(goPage, pageSize, true); Page<Object> page = PageHelper.startPage(goPage, pageSize, true);
return PageUtils.setPageInfo(page, userService.getUserListWithRequest(request)); return PageUtils.setPageInfo(page, userService.getUserListWithRequest(request));
} }
...@@ -67,8 +65,8 @@ public class UserController { ...@@ -67,8 +65,8 @@ public class UserController {
@PostMapping("/special/update") @PostMapping("/special/update")
@RequiresRoles(RoleConstants.ADMIN) @RequiresRoles(RoleConstants.ADMIN)
public void updateUser(@RequestBody User user) { public void updateUser(@RequestBody UserRequest user) {
userService.updateUser(user); userService.updateUserRole(user);
} }
@PostMapping("/special/ws/member/list/{goPage}/{pageSize}") @PostMapping("/special/ws/member/list/{goPage}/{pageSize}")
...@@ -120,7 +118,6 @@ public class UserController { ...@@ -120,7 +118,6 @@ public class UserController {
public List<User> getOrgMemberListByAdmin(@RequestBody QueryOrgMemberRequest request) { public List<User> getOrgMemberListByAdmin(@RequestBody QueryOrgMemberRequest request) {
return userService.getOrgMemberList(request); return userService.getOrgMemberList(request);
} }
// admin api
@GetMapping("/list") @GetMapping("/list")
@RequiresRoles(value = {RoleConstants.ADMIN, RoleConstants.ORG_ADMIN}, logical = Logical.OR) @RequiresRoles(value = {RoleConstants.ADMIN, RoleConstants.ORG_ADMIN}, logical = Logical.OR)
...@@ -270,10 +267,4 @@ public class UserController { ...@@ -270,10 +267,4 @@ public class UserController {
return userService.updateUserPassword(request); return userService.updateUserPassword(request);
} }
@PostMapping("/set/admin")
@RequiresRoles(RoleConstants.ADMIN)
public void setAdmin(@RequestBody SetAdminRequest request) {
userService.setAdmin(request);
}
} }
...@@ -11,6 +11,7 @@ import org.springframework.web.bind.annotation.RequestMapping; ...@@ -11,6 +11,7 @@ import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
import javax.annotation.Resource; import javax.annotation.Resource;
import java.util.List; import java.util.List;
import java.util.Map;
@RequestMapping("userrole") @RequestMapping("userrole")
@RestController @RestController
...@@ -20,14 +21,20 @@ public class UserRoleController { ...@@ -20,14 +21,20 @@ public class UserRoleController {
private UserRoleService userRoleService; private UserRoleService userRoleService;
@GetMapping("/list/org/{orgId}/{userId}") @GetMapping("/list/org/{orgId}/{userId}")
@RequiresRoles(value = {RoleConstants.ADMIN,RoleConstants.ORG_ADMIN}, logical = Logical.OR) @RequiresRoles(value = {RoleConstants.ADMIN, RoleConstants.ORG_ADMIN}, logical = Logical.OR)
public List<Role> getOrganizationMemberRoles(@PathVariable String orgId, @PathVariable String userId) { public List<Role> getOrganizationMemberRoles(@PathVariable String orgId, @PathVariable String userId) {
return userRoleService.getOrganizationMemberRoles(orgId, userId); return userRoleService.getOrganizationMemberRoles(orgId, userId);
} }
@GetMapping("/list/ws/{workspaceId}/{userId}") @GetMapping("/list/ws/{workspaceId}/{userId}")
@RequiresRoles(value = {RoleConstants.ADMIN,RoleConstants.ORG_ADMIN}, logical = Logical.OR) @RequiresRoles(value = {RoleConstants.ADMIN, RoleConstants.ORG_ADMIN}, logical = Logical.OR)
public List<Role> getWorkspaceMemberRoles(@PathVariable String workspaceId, @PathVariable String userId) { public List<Role> getWorkspaceMemberRoles(@PathVariable String workspaceId, @PathVariable String userId) {
return userRoleService.getWorkspaceMemberRoles(workspaceId, userId); return userRoleService.getWorkspaceMemberRoles(workspaceId, userId);
} }
@GetMapping("/all/{userId}")
@RequiresRoles(RoleConstants.ADMIN)
public List<Map<String,Object>> getUserRole(@PathVariable("userId") String userId) {
return userRoleService.getUserRole(userId);
}
} }
...@@ -38,6 +38,11 @@ public class WorkspaceController { ...@@ -38,6 +38,11 @@ public class WorkspaceController {
return workspaceService.saveWorkspace(workspace); return workspaceService.saveWorkspace(workspace);
} }
@GetMapping("/list")
public List<Workspace> getWorkspaceList() {
return workspaceService.getWorkspaceList(new WorkspaceRequest());
}
@PostMapping("special/add") @PostMapping("special/add")
@RequiresRoles(RoleConstants.ADMIN) @RequiresRoles(RoleConstants.ADMIN)
public void addWorkspaceByAdmin(@RequestBody Workspace workspace) { public void addWorkspaceByAdmin(@RequestBody Workspace workspace) {
......
package io.metersphere.controller.request.member;
import lombok.Data;
@Data
public class SetAdminRequest {
private String id;
private String adminId;
private String password;
}
package io.metersphere.controller.request.member;
import io.metersphere.base.domain.User;
import lombok.Getter;
import lombok.Setter;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
@Getter
@Setter
public class UserRequest extends User {
private List<Map<String,Object>> roles = new ArrayList<>();
}
...@@ -6,7 +6,7 @@ import lombok.Setter; ...@@ -6,7 +6,7 @@ import lombok.Setter;
@Getter @Getter
@Setter @Setter
public class LogDetailDTO { public class LogDetailDTO {
private String id; private String resourceId;
private String resourceName; private String resourceName;
private String content; private String content;
} }
...@@ -104,9 +104,9 @@ public class PerformanceReportController { ...@@ -104,9 +104,9 @@ public class PerformanceReportController {
return reportService.logs(reportId); return reportService.logs(reportId);
} }
@GetMapping("log/download/{logId}") @GetMapping("log/download/{reportId}/{resourceId}")
public ResponseEntity<byte[]> downloadLog(@PathVariable String logId) { public ResponseEntity<byte[]> downloadLog(@PathVariable String reportId, @PathVariable String resourceId) {
byte[] bytes = reportService.downloadLog(logId); byte[] bytes = reportService.downloadLog(reportId, resourceId);
return ResponseEntity.ok() return ResponseEntity.ok()
.contentType(MediaType.parseMediaType("application/octet-stream")) .contentType(MediaType.parseMediaType("application/octet-stream"))
.header(HttpHeaders.CONTENT_DISPOSITION, "attachment; filename=\"jmeter.log\"") .header(HttpHeaders.CONTENT_DISPOSITION, "attachment; filename=\"jmeter.log\"")
......
...@@ -79,7 +79,9 @@ public class PerformanceTestService { ...@@ -79,7 +79,9 @@ public class PerformanceTestService {
// delete load_test_report, delete load_test_report_detail // delete load_test_report, delete load_test_report_detail
reportIdList.forEach(reportId -> { reportIdList.forEach(reportId -> {
loadTestReportDetailMapper.deleteByPrimaryKey(reportId); LoadTestReportDetailExample example = new LoadTestReportDetailExample();
example.createCriteria().andReportIdEqualTo(reportId);
loadTestReportDetailMapper.deleteByExample(example);
reportService.deleteReport(reportId); reportService.deleteReport(reportId);
}); });
...@@ -202,7 +204,7 @@ public class PerformanceTestService { ...@@ -202,7 +204,7 @@ public class PerformanceTestService {
} }
private void startEngine(LoadTestWithBLOBs loadTest, Engine engine) { private void startEngine(LoadTestWithBLOBs loadTest, Engine engine) {
LoadTestReportWithBLOBs testReport = new LoadTestReportWithBLOBs(); LoadTestReport testReport = new LoadTestReport();
testReport.setId(engine.getReportId()); testReport.setId(engine.getReportId());
testReport.setCreateTime(engine.getStartTime()); testReport.setCreateTime(engine.getStartTime());
testReport.setUpdateTime(engine.getStartTime()); testReport.setUpdateTime(engine.getStartTime());
...@@ -216,29 +218,16 @@ public class PerformanceTestService { ...@@ -216,29 +218,16 @@ public class PerformanceTestService {
loadTest.setStatus(PerformanceTestStatus.Starting.name()); loadTest.setStatus(PerformanceTestStatus.Starting.name());
loadTestMapper.updateByPrimaryKeySelective(loadTest); loadTestMapper.updateByPrimaryKeySelective(loadTest);
// 启动正常插入 report // 启动正常插入 report
testReport.setContent(HEADERS);
testReport.setStatus(PerformanceTestStatus.Starting.name()); testReport.setStatus(PerformanceTestStatus.Starting.name());
loadTestReportMapper.insertSelective(testReport); loadTestReportMapper.insertSelective(testReport);
LoadTestReportDetail reportDetail = new LoadTestReportDetail(); LoadTestReportDetail reportDetail = new LoadTestReportDetail();
reportDetail.setContent(HEADERS); reportDetail.setContent(HEADERS);
reportDetail.setReportId(testReport.getId()); reportDetail.setReportId(testReport.getId());
reportDetail.setPart(1L);
loadTestReportDetailMapper.insertSelective(reportDetail); loadTestReportDetailMapper.insertSelective(reportDetail);
// append \n // append \n
extLoadTestReportMapper.appendLine(testReport.getId(), "\n");
// append \n
extLoadTestReportDetailMapper.appendLine(testReport.getId(), "\n"); extLoadTestReportDetailMapper.appendLine(testReport.getId(), "\n");
// 保存 load_test_report_log
String resourcePoolId = loadTest.getTestResourcePoolId();
List<TestResource> testResourceList = testResourceService.getResourcesByPoolId(resourcePoolId);
testResourceList.forEach(r -> {
LoadTestReportLog record = new LoadTestReportLog();
record.setId(UUID.randomUUID().toString());
record.setReportId(testReport.getId());
record.setResourceId(r.getId());
record.setContent(StringUtils.EMPTY);
loadTestReportLogMapper.insert(record);
});
} catch (MSException e) { } catch (MSException e) {
LogUtil.error(e); LogUtil.error(e);
loadTest.setStatus(PerformanceTestStatus.Error.name()); loadTest.setStatus(PerformanceTestStatus.Error.name());
......
...@@ -24,7 +24,9 @@ import org.springframework.stereotype.Service; ...@@ -24,7 +24,9 @@ import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource; import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.Map;
import java.util.stream.Collectors; import java.util.stream.Collectors;
@Service @Service
...@@ -57,7 +59,7 @@ public class ReportService { ...@@ -57,7 +59,7 @@ public class ReportService {
MSException.throwException("report id cannot be null"); MSException.throwException("report id cannot be null");
} }
LoadTestReportWithBLOBs loadTestReport = loadTestReportMapper.selectByPrimaryKey(reportId); LoadTestReport loadTestReport = loadTestReportMapper.selectByPrimaryKey(reportId);
LoadTestWithBLOBs loadTest = loadTestMapper.selectByPrimaryKey(loadTestReport.getTestId()); LoadTestWithBLOBs loadTest = loadTestMapper.selectByPrimaryKey(loadTestReport.getTestId());
LogUtil.info("Delete report started, report ID: %s" + reportId); LogUtil.info("Delete report started, report ID: %s" + reportId);
...@@ -142,7 +144,7 @@ public class ReportService { ...@@ -142,7 +144,7 @@ public class ReportService {
} }
public void checkReportStatus(String reportId) { public void checkReportStatus(String reportId) {
LoadTestReportWithBLOBs loadTestReport = loadTestReportMapper.selectByPrimaryKey(reportId); LoadTestReport loadTestReport = loadTestReportMapper.selectByPrimaryKey(reportId);
String reportStatus = loadTestReport.getStatus(); String reportStatus = loadTestReport.getStatus();
if (StringUtils.equals(PerformanceTestStatus.Running.name(), reportStatus)) { if (StringUtils.equals(PerformanceTestStatus.Running.name(), reportStatus)) {
MSException.throwException("Reporting in progress..."); MSException.throwException("Reporting in progress...");
...@@ -160,42 +162,50 @@ public class ReportService { ...@@ -160,42 +162,50 @@ public class ReportService {
public List<LogDetailDTO> logs(String reportId) { public List<LogDetailDTO> logs(String reportId) {
LoadTestReportLogExample example = new LoadTestReportLogExample(); LoadTestReportLogExample example = new LoadTestReportLogExample();
example.createCriteria().andReportIdEqualTo(reportId); example.createCriteria().andReportIdEqualTo(reportId);
example.setOrderByClause("part");
List<LoadTestReportLog> loadTestReportLogs = loadTestReportLogMapper.selectByExampleWithBLOBs(example); List<LoadTestReportLog> loadTestReportLogs = loadTestReportLogMapper.selectByExampleWithBLOBs(example);
return loadTestReportLogs.stream().map(log -> { Map<String, List<LoadTestReportLog>> reportLogs = loadTestReportLogs.stream().collect(Collectors.groupingBy(LoadTestReportLog::getResourceId));
List<LogDetailDTO> result = new ArrayList<>();
reportLogs.forEach((resourceId, resourceLogs) -> {
LogDetailDTO detailDTO = new LogDetailDTO(); LogDetailDTO detailDTO = new LogDetailDTO();
detailDTO.setId(log.getId()); TestResource testResource = testResourceService.getTestResource(resourceId);
TestResource testResource = testResourceService.getTestResource(log.getResourceId()); String content = resourceLogs.stream().map(LoadTestReportLog::getContent).reduce("", (a, b) -> a + b);
String content = log.getContent();
// 显示前 2048 // 显示前 2048
content = StringUtils.substring(content, 0, 2048); content = StringUtils.substring(content, 0, 2048);
detailDTO.setResourceId(resourceId);
detailDTO.setContent(content); detailDTO.setContent(content);
if (testResource == null) { if (testResource == null) {
detailDTO.setResourceName(log.getResourceId()); detailDTO.setResourceName(resourceId);
return detailDTO; result.add(detailDTO);
return;
} }
String configuration = testResource.getConfiguration(); String configuration = testResource.getConfiguration();
if (StringUtils.isBlank(configuration)) { if (StringUtils.isBlank(configuration)) {
detailDTO.setResourceName(log.getResourceId()); detailDTO.setResourceName(resourceId);
return detailDTO; result.add(detailDTO);
return;
} }
JSONObject object = JSON.parseObject(configuration); JSONObject object = JSON.parseObject(configuration);
if (StringUtils.isNotBlank(object.getString("masterUrl"))) { if (StringUtils.isNotBlank(object.getString("masterUrl"))) {
detailDTO.setResourceName(object.getString("masterUrl")); detailDTO.setResourceName(object.getString("masterUrl"));
return detailDTO; result.add(detailDTO);
return;
} }
if (StringUtils.isNotBlank(object.getString("ip"))) { if (StringUtils.isNotBlank(object.getString("ip"))) {
detailDTO.setResourceName(object.getString("ip")); detailDTO.setResourceName(object.getString("ip"));
return detailDTO; result.add(detailDTO);
} }
return detailDTO; });
}).collect(Collectors.toList()); return result;
} }
public byte[] downloadLog(String logId) {
LoadTestReportLog loadTestReportLog = loadTestReportLogMapper.selectByPrimaryKey(logId); public byte[] downloadLog(String reportId, String resourceId) {
if (loadTestReportLog != null) { LoadTestReportLogExample example = new LoadTestReportLogExample();
return loadTestReportLog.getContent().getBytes(); example.createCriteria().andReportIdEqualTo(reportId).andResourceIdEqualTo(resourceId);
} List<LoadTestReportLog> loadTestReportLogs = loadTestReportLogMapper.selectByExampleWithBLOBs(example);
return new byte[0];
String content = loadTestReportLogs.stream().map(LoadTestReportLog::getContent).reduce("", (a, b) -> a + b);
return content.getBytes();
} }
} }
package io.metersphere.service; package io.metersphere.service;
import io.metersphere.base.domain.Role; import io.metersphere.base.domain.Role;
import io.metersphere.base.mapper.RoleMapper;
import io.metersphere.base.mapper.ext.ExtRoleMapper; import io.metersphere.base.mapper.ext.ExtRoleMapper;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
...@@ -13,8 +14,14 @@ public class RoleService { ...@@ -13,8 +14,14 @@ public class RoleService {
@Resource @Resource
private ExtRoleMapper extRoleMapper; private ExtRoleMapper extRoleMapper;
@Resource
private RoleMapper roleMapper;
public List<Role> getRoleList(String sign) { public List<Role> getRoleList(String sign) {
return extRoleMapper.getRoleList(sign); return extRoleMapper.getRoleList(sign);
} }
public List<Role> getAllRole() {
return roleMapper.selectByExample(null);
}
} }
...@@ -4,14 +4,22 @@ import io.metersphere.base.domain.SystemParameter; ...@@ -4,14 +4,22 @@ import io.metersphere.base.domain.SystemParameter;
import io.metersphere.base.domain.SystemParameterExample; import io.metersphere.base.domain.SystemParameterExample;
import io.metersphere.base.mapper.SystemParameterMapper; import io.metersphere.base.mapper.SystemParameterMapper;
import io.metersphere.commons.constants.ParamConstants; import io.metersphere.commons.constants.ParamConstants;
import io.metersphere.commons.utils.EncryptUtils;
import org.apache.commons.collections.CollectionUtils; import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang3.BooleanUtils;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Properties;
import org.springframework.mail.javamail.JavaMailSenderImpl;
import javax.annotation.Resource; import javax.annotation.Resource;
@Service @Service
public class SystemParameterService { public class SystemParameterService {
...@@ -31,4 +39,43 @@ public class SystemParameterService { ...@@ -31,4 +39,43 @@ public class SystemParameterService {
} }
return result; return result;
} }
public void editMail(List<SystemParameter> parameters){
List<SystemParameter> paramList = this.getParamList(ParamConstants.Classify.MAIL.getValue());
boolean empty = paramList.size() < 2;
parameters.forEach(parameter -> {
if (parameter.getParamKey().equals(ParamConstants.MAIL.PASSWORD.getKey())) {
String string = EncryptUtils.aesEncrypt(parameter.getParamValue()).toString();
parameter.setParamValue(string);
}
if (empty) {
systemParameterMapper.insert(parameter);
} else {
systemParameterMapper.updateByPrimaryKey(parameter);
}
});
}
public List<SystemParameter> getParamList(String type) {
SystemParameterExample example = new SystemParameterExample();
example.createCriteria().andParamKeyLike(type + "%");
return systemParameterMapper.selectByExample(example);
}
public void testConnection(HashMap<String, String> hashMap){
JavaMailSenderImpl javaMailSender = new JavaMailSenderImpl();
javaMailSender.setDefaultEncoding("UTF-8");
javaMailSender.setHost(hashMap.get(ParamConstants.MAIL.PORT.getKey()));
javaMailSender.setPort(Integer.valueOf(hashMap.get(ParamConstants.MAIL.PORT.getKey())));
javaMailSender.setUsername(hashMap.get(ParamConstants.MAIL.ACCOUNT.getKey()));
javaMailSender.setPassword(hashMap.get(ParamConstants.MAIL.PASSWORD.getKey()));
Properties props = new Properties();
props.put("mail.smtp.auth", "true");
if (BooleanUtils.toBoolean(hashMap.get(ParamConstants.MAIL.SSL.getKey()))) {
props.put("mail.smtp.socketFactory.class", "javax.net.ssl.SSLSocketFactory");
}
if (BooleanUtils.toBoolean(hashMap.get(ParamConstants.MAIL.TLS.getKey()))) {
props.put("mail.smtp.starttls.enable", "true");
}
javaMailSender.setJavaMailProperties(props);
}
} }
package io.metersphere.service; package io.metersphere.service;
import io.metersphere.base.domain.Role; import io.metersphere.base.domain.Role;
import io.metersphere.base.domain.UserRole;
import io.metersphere.base.domain.UserRoleExample;
import io.metersphere.base.mapper.UserRoleMapper;
import io.metersphere.base.mapper.ext.ExtUserRoleMapper; import io.metersphere.base.mapper.ext.ExtUserRoleMapper;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource; import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
@Service @Service
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
...@@ -14,6 +22,8 @@ public class UserRoleService { ...@@ -14,6 +22,8 @@ public class UserRoleService {
@Resource @Resource
private ExtUserRoleMapper extUserRoleMapper; private ExtUserRoleMapper extUserRoleMapper;
@Resource
private UserRoleMapper userRoleMapper;
public List<Role> getOrganizationMemberRoles(String orgId, String userId) { public List<Role> getOrganizationMemberRoles(String orgId, String userId) {
return extUserRoleMapper.getOrganizationMemberRoles(orgId, userId); return extUserRoleMapper.getOrganizationMemberRoles(orgId, userId);
...@@ -23,4 +33,28 @@ public class UserRoleService { ...@@ -23,4 +33,28 @@ public class UserRoleService {
return extUserRoleMapper.getWorkspaceMemberRoles(workspaceId, userId); return extUserRoleMapper.getWorkspaceMemberRoles(workspaceId, userId);
} }
public List<Map<String,Object>> getUserRole(String userId) {
List<Map<String,Object>> list = new ArrayList<>();
UserRoleExample userRoleExample = new UserRoleExample();
userRoleExample.createCriteria().andUserIdEqualTo(userId);
List<UserRole> userRoles = userRoleMapper.selectByExample(userRoleExample);
List<String> collect = userRoles.stream()
.map(userRole -> userRole.getRoleId())
.distinct()
.collect(Collectors.toList());
for (int i = 0; i < collect.size(); i++) {
Map<String, Object> map = new HashMap<>(2);
map.put("id", collect.get(i));
map.put("Ids", new ArrayList<>());
for (int j = 0; j < userRoles.size(); j++) {
String role = userRoles.get(j).getRoleId();
if (StringUtils.equals(role, collect.get(i))) {
List ids = (List) map.get("Ids");
ids.add(userRoles.get(j).getSourceId());
}
}
list.add(map);
}
return list;
}
} }
...@@ -9,11 +9,10 @@ import io.metersphere.commons.exception.MSException; ...@@ -9,11 +9,10 @@ import io.metersphere.commons.exception.MSException;
import io.metersphere.commons.user.SessionUser; import io.metersphere.commons.user.SessionUser;
import io.metersphere.commons.utils.CodingUtil; import io.metersphere.commons.utils.CodingUtil;
import io.metersphere.commons.utils.SessionUtils; import io.metersphere.commons.utils.SessionUtils;
import io.metersphere.controller.request.UserRequest;
import io.metersphere.controller.request.member.AddMemberRequest; import io.metersphere.controller.request.member.AddMemberRequest;
import io.metersphere.controller.request.member.UserRequest;
import io.metersphere.controller.request.member.EditPassWordRequest; import io.metersphere.controller.request.member.EditPassWordRequest;
import io.metersphere.controller.request.member.QueryMemberRequest; import io.metersphere.controller.request.member.QueryMemberRequest;
import io.metersphere.controller.request.member.SetAdminRequest;
import io.metersphere.controller.request.organization.AddOrgMemberRequest; import io.metersphere.controller.request.organization.AddOrgMemberRequest;
import io.metersphere.controller.request.organization.QueryOrgMemberRequest; import io.metersphere.controller.request.organization.QueryOrgMemberRequest;
import io.metersphere.dto.UserDTO; import io.metersphere.dto.UserDTO;
...@@ -25,8 +24,7 @@ import org.springframework.stereotype.Service; ...@@ -25,8 +24,7 @@ import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.CollectionUtils; import org.springframework.util.CollectionUtils;
import javax.annotation.Resource; import javax.annotation.Resource;
import java.util.List; import java.util.*;
import java.util.UUID;
import java.util.stream.Collectors; import java.util.stream.Collectors;
@Service @Service
...@@ -48,7 +46,7 @@ public class UserService { ...@@ -48,7 +46,7 @@ public class UserService {
@Resource @Resource
private ExtUserMapper extUserMapper; private ExtUserMapper extUserMapper;
public UserDTO insert(User user) { public UserDTO insert(UserRequest user) {
checkUserParam(user); checkUserParam(user);
// //
String id = user.getId(); String id = user.getId();
...@@ -58,9 +56,44 @@ public class UserService { ...@@ -58,9 +56,44 @@ public class UserService {
} else { } else {
createUser(user); createUser(user);
} }
List<Map<String, Object>> roles = user.getRoles();
if (!roles.isEmpty()) {
insertUserRole(roles, user.getId());
}
return getUserDTO(user.getId()); return getUserDTO(user.getId());
} }
private void insertUserRole(List<Map<String, Object>> roles, String userId) {
for (int i = 0; i < roles.size(); i++) {
Map<String, Object> map = roles.get(i);
String role = (String) map.get("id");
if (StringUtils.equals(role, RoleConstants.ADMIN)) {
UserRole userRole = new UserRole();
userRole.setId(UUID.randomUUID().toString());
userRole.setUserId(userId);
userRole.setUpdateTime(System.currentTimeMillis());
userRole.setCreateTime(System.currentTimeMillis());
userRole.setRoleId(role);
// TODO 修改
userRole.setSourceId("adminSourceId");
userRoleMapper.insertSelective(userRole);
} else {
List<String> list = (List<String>) map.get("Ids");
for (int j = 0; j < list.size(); j++) {
UserRole userRole1 = new UserRole();
userRole1.setId(UUID.randomUUID().toString());
userRole1.setUserId(userId);
userRole1.setRoleId(role);
userRole1.setUpdateTime(System.currentTimeMillis());
userRole1.setCreateTime(System.currentTimeMillis());
userRole1.setSourceId(list.get(j));
// TODO 防止重复插入
userRoleMapper.insertSelective(userRole1);
}
}
}
}
private void checkUserParam(User user) { private void checkUserParam(User user) {
if (StringUtils.isBlank(user.getName())) { if (StringUtils.isBlank(user.getName())) {
...@@ -134,7 +167,7 @@ public class UserService { ...@@ -134,7 +167,7 @@ public class UserService {
return userMapper.selectByExample(null); return userMapper.selectByExample(null);
} }
public List<User> getUserListWithRequest(UserRequest request) { public List<User> getUserListWithRequest(io.metersphere.controller.request.UserRequest request) {
return extUserMapper.getUserList(request); return extUserMapper.getUserList(request);
} }
...@@ -146,6 +179,19 @@ public class UserService { ...@@ -146,6 +179,19 @@ public class UserService {
userMapper.deleteByPrimaryKey(userId); userMapper.deleteByPrimaryKey(userId);
} }
public void updateUserRole(UserRequest user) {
String userId = user.getId();
UserRoleExample userRoleExample = new UserRoleExample();
userRoleExample.createCriteria().andUserIdEqualTo(userId);
userRoleMapper.deleteByExample(userRoleExample);
List<Map<String, Object>> roles = user.getRoles();
if (!roles.isEmpty()) {
insertUserRole(roles, user.getId());
}
user.setUpdateTime(System.currentTimeMillis());
userMapper.updateByPrimaryKeySelective(user);
}
public void updateUser(User user) { public void updateUser(User user) {
user.setUpdateTime(System.currentTimeMillis()); user.setUpdateTime(System.currentTimeMillis());
userMapper.updateByPrimaryKeySelective(user); userMapper.updateByPrimaryKeySelective(user);
...@@ -270,7 +316,7 @@ public class UserService { ...@@ -270,7 +316,7 @@ public class UserService {
public void setLanguage(String lang) { public void setLanguage(String lang) {
if (SessionUtils.getUser() != null) { if (SessionUtils.getUser() != null) {
User user = new User(); UserRequest user = new UserRequest();
user.setId(SessionUtils.getUser().getId()); user.setId(SessionUtils.getUser().getId());
user.setLanguage(lang); user.setLanguage(lang);
updateUser(user); updateUser(user);
...@@ -336,23 +382,6 @@ public class UserService { ...@@ -336,23 +382,6 @@ public class UserService {
return extUserMapper.updatePassword(user); return extUserMapper.updatePassword(user);
} }
public void setAdmin(SetAdminRequest request) {
String adminId = request.getAdminId();
String password = request.getPassword();
if (!checkUserPassword(adminId, password)) {
MSException.throwException("verification failed!");
}
UserRole userRole = new UserRole();
userRole.setId(UUID.randomUUID().toString());
userRole.setUserId(request.getId());
// TODO 修改admin sourceId
userRole.setSourceId("adminSourceId");
userRole.setRoleId(RoleConstants.ADMIN);
userRole.setCreateTime(System.currentTimeMillis());
userRole.setUpdateTime(System.currentTimeMillis());
userRoleMapper.insertSelective(userRole);
}
public String getDefaultLanguage() { public String getDefaultLanguage() {
final String key = "default.language"; final String key = "default.language";
return extUserMapper.getDefaultLanguage(key); return extUserMapper.getDefaultLanguage(key);
......
...@@ -51,7 +51,6 @@ CREATE TABLE IF NOT EXISTS `load_test_report` ( ...@@ -51,7 +51,6 @@ CREATE TABLE IF NOT EXISTS `load_test_report` (
`test_id` varchar(50) NOT NULL COMMENT 'Test ID this test report belongs to', `test_id` varchar(50) NOT NULL COMMENT 'Test ID this test report belongs to',
`name` varchar(64) NOT NULL COMMENT 'Test report name', `name` varchar(64) NOT NULL COMMENT 'Test report name',
`description` varchar(255) DEFAULT NULL COMMENT 'Test report name', `description` varchar(255) DEFAULT NULL COMMENT 'Test report name',
`content` longtext,
`create_time` bigint(13) NOT NULL COMMENT 'Create timestamp', `create_time` bigint(13) NOT NULL COMMENT 'Create timestamp',
`update_time` bigint(13) NOT NULL COMMENT 'Update timestamp', `update_time` bigint(13) NOT NULL COMMENT 'Update timestamp',
`status` varchar(64) NOT NULL COMMENT 'Status of this test run', `status` varchar(64) NOT NULL COMMENT 'Status of this test run',
...@@ -64,20 +63,19 @@ CREATE TABLE IF NOT EXISTS `load_test_report` ( ...@@ -64,20 +63,19 @@ CREATE TABLE IF NOT EXISTS `load_test_report` (
CREATE TABLE IF NOT EXISTS `load_test_report_detail` ( CREATE TABLE IF NOT EXISTS `load_test_report_detail` (
`report_id` varchar(50) NOT NULL, `report_id` varchar(50) NOT NULL,
`content` longtext, `content` longtext,
PRIMARY KEY (`report_id`) `part` bigint(11) NOT NULL,
) PRIMARY KEY (`report_id`,`part`)
ENGINE=InnoDB ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin;
DEFAULT CHARSET=utf8mb4
COLLATE=utf8mb4_bin;
CREATE TABLE IF NOT EXISTS `load_test_report_log` ( CREATE TABLE IF NOT EXISTS `load_test_report_log` (
`id` varchar(50) NOT NULL, `id` varchar(50) NOT NULL,
`report_id` varchar(50) NOT NULL, `report_id` varchar(50) NOT NULL,
`resource_id` varchar(50) DEFAULT NULL, `resource_id` varchar(50) DEFAULT NULL,
`content` longtext , `content` longtext ,
`part` bigint(20) DEFAULT NULL,
PRIMARY KEY (`id`), PRIMARY KEY (`id`),
KEY `load_test_report_log_report_id_resource_name_index` (`report_id`,`resource_id`) KEY `load_test_report_log_report_id_resource_name_index` (`report_id`,`resource_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin; ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin ;
CREATE TABLE IF NOT EXISTS `load_test_report_result` ( CREATE TABLE IF NOT EXISTS `load_test_report_result` (
`id` varchar(50) NOT NULL, `id` varchar(50) NOT NULL,
......
...@@ -59,7 +59,7 @@ ...@@ -59,7 +59,7 @@
<!--要生成的数据库表 --> <!--要生成的数据库表 -->
<table tableName="test_plan_test_case"/> <table tableName="load_test_report"/>
</context> </context>
</generatorConfiguration> </generatorConfiguration>
\ No newline at end of file
...@@ -88,6 +88,7 @@ ...@@ -88,6 +88,7 @@
}, },
reportRecent: { reportRecent: {
title: this.$t('report.recent'), title: this.$t('report.recent'),
showTime: true,
url: "/api/report/recent/5", url: "/api/report/recent/5",
index: function (item) { index: function (item) {
return '/api/report/view/' + item.id; return '/api/report/view/' + item.id;
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
<el-table :data="assertions" :row-style="getRowStyle" :header-cell-style="getRowStyle"> <el-table :data="assertions" :row-style="getRowStyle" :header-cell-style="getRowStyle">
<el-table-column prop="name" :label="$t('api_report.assertions_name')" width="300"> <el-table-column prop="name" :label="$t('api_report.assertions_name')" width="300">
</el-table-column> </el-table-column>
<el-table-column prop="message" :label="$t('api_report.assertions_message')"> <el-table-column prop="message" :label="$t('api_report.assertions_error_message')">
</el-table-column> </el-table-column>
<el-table-column prop="pass" :label="$t('api_report.assertions_is_success')" width="180"> <el-table-column prop="pass" :label="$t('api_report.assertions_is_success')" width="180">
<template v-slot:default="{row}"> <template v-slot:default="{row}">
......
...@@ -105,7 +105,7 @@ ...@@ -105,7 +105,7 @@
}, },
fail() { fail() {
return (this.content.error / this.content.total).toFixed(0) + "%"; return (this.content.error / this.content.total * 100).toFixed(0) + "%";
}, },
assertions() { assertions() {
return this.content.passAssertions + " / " + this.content.totalAssertions; return this.content.passAssertions + " / " + this.content.totalAssertions;
......
...@@ -17,10 +17,10 @@ ...@@ -17,10 +17,10 @@
</div> </div>
</el-col> </el-col>
<el-col :span="2"> <el-col :span="2">
{{error}} {{request.error}}
</el-col> </el-col>
<el-col :span="2"> <el-col :span="2">
{{request.passAssertions}} / {{request.totalAssertions}} {{assertion}}
</el-col> </el-col>
<el-col :span="2"> <el-col :span="2">
<el-tag size="mini" type="success" v-if="request.success"> <el-tag size="mini" type="success" v-if="request.success">
...@@ -72,9 +72,9 @@ ...@@ -72,9 +72,9 @@
}, },
computed: { computed: {
error() { assertion() {
return this.request.totalAssertions - this.request.passAssertions; return this.request.passAssertions + " / " + this.request.totalAssertions;
} },
} }
} }
</script> </script>
......
...@@ -59,7 +59,7 @@ ...@@ -59,7 +59,7 @@
computed: { computed: {
assertion() { assertion() {
return this.scenario.passAssertions - this.scenario.totalAssertions; return this.scenario.passAssertions + " / " + this.scenario.totalAssertions;
}, },
success() { success() {
return this.scenario.error === 0; return this.scenario.error === 0;
......
...@@ -5,7 +5,8 @@ ...@@ -5,7 +5,8 @@
<el-container class="test-container" v-loading="result.loading"> <el-container class="test-container" v-loading="result.loading">
<el-header> <el-header>
<el-row type="flex" align="middle"> <el-row type="flex" align="middle">
<el-input class="test-name" v-model="test.name" maxlength="64" :placeholder="$t('api_test.input_name')"> <el-input class="test-name" v-model="test.name" maxlength="60" :placeholder="$t('api_test.input_name')"
show-word-limit>
<el-select class="test-project" v-model="test.projectId" slot="prepend" <el-select class="test-project" v-model="test.projectId" slot="prepend"
:placeholder="$t('api_test.select_project')"> :placeholder="$t('api_test.select_project')">
<el-option v-for="project in projects" :key="project.id" :label="project.name" :value="project.id"/> <el-option v-for="project in projects" :key="project.id" :label="project.name" :value="project.id"/>
...@@ -113,6 +114,9 @@ ...@@ -113,6 +114,9 @@
saveTest: function () { saveTest: function () {
this.save(() => { this.save(() => {
this.$success(this.$t('commons.save_success')); this.$success(this.$t('commons.save_success'));
this.$router.push({
path: '/api/test/edit?id=' + this.test.id
})
}) })
}, },
runTest: function () { runTest: function () {
......
...@@ -13,8 +13,12 @@ ...@@ -13,8 +13,12 @@
<el-dropdown trigger="click" @command="handleCommand"> <el-dropdown trigger="click" @command="handleCommand">
<span class="el-dropdown-link el-icon-more"/> <span class="el-dropdown-link el-icon-more"/>
<el-dropdown-menu slot="dropdown"> <el-dropdown-menu slot="dropdown">
<el-dropdown-item :command="{type: 'copy', index: index}">复制请求</el-dropdown-item> <el-dropdown-item :command="{type: 'copy', index: index}">
<el-dropdown-item :command="{type: 'delete', index: index}">删除请求</el-dropdown-item> {{$t('api_test.request.copy')}}
</el-dropdown-item>
<el-dropdown-item :command="{type: 'delete', index: index}">
{{$t('api_test.request.delete')}}
</el-dropdown-item>
</el-dropdown-menu> </el-dropdown-menu>
</el-dropdown> </el-dropdown>
</div> </div>
...@@ -50,12 +54,12 @@ ...@@ -50,12 +54,12 @@
methods: { methods: {
createRequest: function () { createRequest: function () {
let request = new Request({method: "GET"}); let request = new Request();
this.requests.push(request); this.requests.push(request);
}, },
copyRequest: function (index) { copyRequest: function (index) {
let request = this.requests[index]; let request = this.requests[index];
this.requests.push(JSON.parse(JSON.stringify(request))); this.requests.push(request.clone());
}, },
deleteRequest: function (index) { deleteRequest: function (index) {
this.requests.splice(index, 1); this.requests.splice(index, 1);
......
<template> <template>
<el-form :model="request" :rules="rules" ref="request" label-width="100px"> <el-form :model="request" :rules="rules" ref="request" label-width="100px">
<el-form-item :label="$t('api_test.request.name')" prop="name"> <el-form-item :label="$t('api_test.request.name')" prop="name">
<el-input v-model="request.name" maxlength="100"/> <el-input v-model="request.name" maxlength="100" @input="valid"/>
</el-form-item> </el-form-item>
<el-form-item :label="$t('api_test.request.url')" prop="url"> <el-form-item :label="$t('api_test.request.url')" prop="url">
...@@ -108,6 +108,10 @@ ...@@ -108,6 +108,10 @@
} }
} }
return url; return url;
},
valid(value) {
value = value.replace(/[`~!@#$%^&*()_\-+=<>?:"{}|,./;'\\[\]·!¥…()—\-《》?:“”【】、;‘’,。]/g, '').replace(/\s/g, "");
this.request.name = value;
} }
}, },
......
...@@ -12,13 +12,17 @@ ...@@ -12,13 +12,17 @@
{{$t('api_test.scenario.config')}} {{$t('api_test.scenario.config')}}
</span> </span>
</div> </div>
<!-- 暂时去掉,将来再加--> <el-dropdown trigger="click" @command="handleCommand">
<!-- <el-dropdown trigger="click" @command="handleCommand">--> <span class="el-dropdown-link el-icon-more scenario-btn"/>
<!-- <span class="el-dropdown-link el-icon-more scenario-btn"/>--> <el-dropdown-menu slot="dropdown">
<!-- <el-dropdown-menu slot="dropdown">--> <el-dropdown-item :command="{type: 'copy', index: index}">
<!-- <el-dropdown-item :command="{type:'delete', index:index}">删除场景</el-dropdown-item>--> {{$t('api_test.scenario.copy')}}
<!-- </el-dropdown-menu>--> </el-dropdown-item>
<!-- </el-dropdown>--> <el-dropdown-item :command="{type:'delete', index:index}">
{{$t('api_test.scenario.delete')}}
</el-dropdown-item>
</el-dropdown-menu>
</el-dropdown>
</template> </template>
<ms-api-request-config :requests="scenario.requests" :open="select"/> <ms-api-request-config :requests="scenario.requests" :open="select"/>
</ms-api-collapse-item> </ms-api-collapse-item>
...@@ -71,6 +75,10 @@ ...@@ -71,6 +75,10 @@
createScenario: function () { createScenario: function () {
this.scenarios.push(new Scenario()); this.scenarios.push(new Scenario());
}, },
copyScenario: function (index) {
let scenario = this.scenarios[index];
this.scenarios.push(scenario.clone());
},
deleteScenario: function (index) { deleteScenario: function (index) {
this.scenarios.splice(index, 1); this.scenarios.splice(index, 1);
if (this.scenarios.length === 0) { if (this.scenarios.length === 0) {
...@@ -83,6 +91,9 @@ ...@@ -83,6 +91,9 @@
}, },
handleCommand: function (command) { handleCommand: function (command) {
switch (command.type) { switch (command.type) {
case "copy":
this.copyScenario(command.index);
break;
case "delete": case "delete":
this.deleteScenario(command.index); this.deleteScenario(command.index);
break; break;
......
<template> <template>
<el-form :model="scenario" :rules="rules" ref="scenario" label-width="100px"> <el-form :model="scenario" :rules="rules" ref="scenario" label-width="100px">
<el-form-item :label="$t('api_test.scenario.name')" prop="name"> <el-form-item :label="$t('api_test.scenario.name')" prop="name">
<el-input v-model="scenario.name" maxlength="100"/> <el-input v-model="scenario.name" maxlength="100" @input="valid"/>
</el-form-item> </el-form-item>
<!-- <el-form-item :label="$t('api_test.scenario.base_url')" prop="url">--> <!-- <el-form-item :label="$t('api_test.scenario.base_url')" prop="url">-->
<!-- <el-input :placeholder="$t('api_test.scenario.base_url_description')" v-model="scenario.url" maxlength="100"/>--> <!-- <el-input :placeholder="$t('api_test.scenario.base_url_description')" v-model="scenario.url" maxlength="100"/>-->
<!-- </el-form-item>--> <!-- </el-form-item>-->
<el-tabs v-model="activeName"> <el-tabs v-model="activeName">
<el-tab-pane :label="$t('api_test.scenario.variables')" name="parameters"> <el-tab-pane :label="$t('api_test.scenario.variables')" name="parameters">
...@@ -43,6 +43,13 @@ ...@@ -43,6 +43,13 @@
] ]
} }
} }
},
methods: {
valid(value) {
value = value.replace(/[`~!@#$%^&*()\-+=<>?:"{}|,./;'\\[\]·!¥…()—\-《》?:“”【】、;‘’,。]/g, '').replace(/\s/g, "");
this.scenario.name = value;
}
} }
} }
</script> </script>
......
...@@ -32,13 +32,12 @@ ...@@ -32,13 +32,12 @@
methods: { methods: {
add: function () { add: function () {
this.remove();
setTimeout(() => { setTimeout(() => {
this.duration.value = this.time; this.duration.value = this.time;
}) })
}, },
remove: function () { remove: function () {
this.duration.value = null; this.duration.value = undefined;
} }
} }
} }
......
...@@ -20,7 +20,7 @@ ...@@ -20,7 +20,7 @@
</el-select> </el-select>
</el-col> </el-col>
<el-col> <el-col>
<el-input v-model="value" maxlength="255" size="small" show-word-limit <el-input v-model="value" maxlength="200" size="small" show-word-limit
:placeholder="$t('api_test.request.assertions.value')"/> :placeholder="$t('api_test.request.assertions.value')"/>
</el-col> </el-col>
<el-col class="assertion-btn"> <el-col class="assertion-btn">
......
...@@ -13,7 +13,7 @@ ...@@ -13,7 +13,7 @@
<div> <div>
{{$t("api_test.request.assertions.response_time")}} {{$t("api_test.request.assertions.response_time")}}
</div> </div>
<ms-api-assertion-response-time :response-time="assertions.responseTime" :edit="true"/> <ms-api-assertion-response-time :duration="assertions.duration" :edit="true"/>
</div> </div>
</div> </div>
......
...@@ -137,6 +137,16 @@ export class Scenario extends BaseConfig { ...@@ -137,6 +137,16 @@ export class Scenario extends BaseConfig {
options.requests = options.requests || [new Request()]; options.requests = options.requests || [new Request()];
return options; return options;
} }
clone() {
let scenario = new Scenario(this);
scenario.id = uuid();
scenario.requests.forEach(function (request) {
request.id = uuid();
});
return scenario;
}
} }
export class Request extends BaseConfig { export class Request extends BaseConfig {
...@@ -168,6 +178,12 @@ export class Request extends BaseConfig { ...@@ -168,6 +178,12 @@ export class Request extends BaseConfig {
isValid() { isValid() {
return !!this.url && !!this.method return !!this.url && !!this.method
} }
clone() {
let request = new Request(this);
request.id = uuid();
return request;
}
} }
export class Body extends BaseConfig { export class Body extends BaseConfig {
......
...@@ -6,7 +6,10 @@ ...@@ -6,7 +6,10 @@
<i class="el-icon-refresh" @click="recent"/> <i class="el-icon-refresh" @click="recent"/>
</div> </div>
<el-menu-item :key="i.id" v-for="i in items" :index="getIndex(i)" :route="getRouter(i)"> <el-menu-item :key="i.id" v-for="i in items" :index="getIndex(i)" :route="getRouter(i)">
<span class="title">{{ i.name }}</span> <template slot="title">
<div class="title">{{ i.name }}</div>
<div class="time" v-if="options.showTime && i.updateTime">{{ i.updateTime | timestampFormatDate}}</div>
</template>
</el-menu-item> </el-menu-item>
</div> </div>
</template> </template>
...@@ -81,6 +84,18 @@ ...@@ -81,6 +84,18 @@
} }
.title { .title {
display: inline-block;
padding-left: 20px; padding-left: 20px;
max-width: 200px;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
.time {
color: #C0C4CC;
display: inline-block;
padding-left: 20px;
float: right;
} }
</style> </style>
...@@ -10,6 +10,7 @@ import OrganizationMember from "../../settings/organization/OrganizationMember"; ...@@ -10,6 +10,7 @@ import OrganizationMember from "../../settings/organization/OrganizationMember";
import Member from "../../settings/workspace/WorkspaceMember"; import Member from "../../settings/workspace/WorkspaceMember";
import TestCaseReportTemplate from "../../settings/workspace/TestCaseReportTemplate"; import TestCaseReportTemplate from "../../settings/workspace/TestCaseReportTemplate";
import TestResourcePool from "../../settings/system/TestResourcePool"; import TestResourcePool from "../../settings/system/TestResourcePool";
import SystemParameterSetting from "../../settings/system/SystemParameterSetting";
import MsProject from "../../project/MsProject"; import MsProject from "../../project/MsProject";
import OrganizationWorkspace from "../../settings/organization/OrganizationWorkspace"; import OrganizationWorkspace from "../../settings/organization/OrganizationWorkspace";
import PersonSetting from "../../settings/personal/PersonSetting"; import PersonSetting from "../../settings/personal/PersonSetting";
...@@ -80,11 +81,16 @@ const router = new VueRouter({ ...@@ -80,11 +81,16 @@ const router = new VueRouter({
path: 'testresourcepool', path: 'testresourcepool',
component: TestResourcePool component: TestResourcePool
}, },
{
path: 'systemparametersetting',
component: SystemParameterSetting
},
{ {
path: 'testcase/report/template', path: 'testcase/report/template',
name: 'testCaseReportTemplate', name: 'testCaseReportTemplate',
component: TestCaseReportTemplate component: TestCaseReportTemplate
} },
] ]
}, },
{ {
......
<template> <template>
<div v-loading="result.loading"> <div v-loading="result.loading">
<el-tabs type="border-card" :stretch="true"> <el-tabs type="border-card" :stretch="true">
<el-tab-pane v-for="item in logContent" :key="item.id" :label="item.resourceName" class="logging-content"> <el-tab-pane v-for="item in logContent" :key="item.resourceId" :label="item.resourceName" class="logging-content">
{{item.content}}... {{item.content}}...
<el-link type="primary" @click="downloadLogFile(item)">{{$t('load_test.download_log_file')}}</el-link> <el-link type="primary" @click="downloadLogFile(item)">{{$t('load_test.download_log_file')}}</el-link>
</el-tab-pane> </el-tab-pane>
...@@ -27,7 +27,7 @@ ...@@ -27,7 +27,7 @@
}, },
downloadLogFile(item) { downloadLogFile(item) {
let config = { let config = {
url: '/performance/report/log/download/' + item.id, url: '/performance/report/log/download/' + this.id + '/' + item.resourceId,
method: 'get', method: 'get',
responseType: 'blob' responseType: 'blob'
}; };
......
<template> <template>
<div> <div>
<!--Domain name binding-->
<el-row type="flex" justify="start"> <el-row type="flex" justify="start">
<el-col :span="8"> <el-col :span="8">
<h3>{{$t('load_test.domain_bind')}}</h3> <h3>{{$t('load_test.domain_bind')}}</h3>
...@@ -7,7 +8,7 @@ ...@@ -7,7 +8,7 @@
</el-button> </el-button>
</el-col> </el-col>
</el-row> </el-row>
<!-- --> <!--Domain name binding form -->
<el-row> <el-row>
<el-col :span="24"> <el-col :span="24">
<el-table :data="domains" size="mini" class="tb-edit" align="center" border highlight-current-row> <el-table :data="domains" size="mini" class="tb-edit" align="center" border highlight-current-row>
...@@ -40,6 +41,7 @@ ...@@ -40,6 +41,7 @@
v-model="row.enable" v-model="row.enable"
active-color="#13ce66" active-color="#13ce66"
inactive-color="#ff4949" inactive-color="#ff4949"
active-value="readOnly"
@click="confirmEdit(row)" @click="confirmEdit(row)"
> >
</el-switch> </el-switch>
......
...@@ -9,6 +9,7 @@ ...@@ -9,6 +9,7 @@
<el-menu-item index="/setting/organization">{{$t('commons.organization')}}</el-menu-item> <el-menu-item index="/setting/organization">{{$t('commons.organization')}}</el-menu-item>
<el-menu-item index="/setting/systemworkspace">{{$t('commons.workspace')}}</el-menu-item> <el-menu-item index="/setting/systemworkspace">{{$t('commons.workspace')}}</el-menu-item>
<el-menu-item index="/setting/testresourcepool">{{$t('commons.test_resource_pool')}}</el-menu-item> <el-menu-item index="/setting/testresourcepool">{{$t('commons.test_resource_pool')}}</el-menu-item>
<el-menu-item index="/setting/systemparametersetting">{{$t('commons.system_parameter_setting')}}</el-menu-item>
</el-submenu> </el-submenu>
<el-submenu index="2" v-permission="['org_admin']" v-if="isCurrentOrganizationAdmin"> <el-submenu index="2" v-permission="['org_admin']" v-if="isCurrentOrganizationAdmin">
......
<template>
<div>
<el-card class="box-card" v-loading="result.loading">
<template v-slot:header>
<h2>{{$t('system_parameter_setting.mailbox_service_settings')}}</h2>
</template>
<!--邮件表单-->
<el-form :inline="true" :model="formInline" :rules="rules" ref="formInline" class="demo-form-inline"
:disabled="show" v-loading="loading">
<el-row>
<el-col>
<el-form-item :label="$t('system_parameter_setting.SMTP_host')" prop="host">
</el-form-item>
<el-input v-model="formInline.host" :placeholder="$t('system_parameter_setting.SMTP_host')"
v-on:input="host"></el-input>
</el-col>
</el-row>
<el-row>
<el-col>
<el-form-item :label="$t('system_parameter_setting.SMTP_port')" prop="port">
</el-form-item>
<el-input v-model="formInline.port" :placeholder="$t('system_parameter_setting.SMTP_port')"
v-on:input="port"></el-input>
</el-col>
</el-row>
<el-row>
<el-col>
<el-form-item :label="$t('system_parameter_setting.SMTP_account')" prop="account">
</el-form-item>
<el-input v-model="formInline.account" :placeholder="$t('system_parameter_setting.SMTP_account')"
v-on:input="account"></el-input>
</el-col>
</el-row>
<el-row>
<el-col>
<el-form-item :label="$t('system_parameter_setting.SMTP_password')" prop="password">
</el-form-item>
<el-input v-model="formInline.password" :placeholder="$t('system_parameter_setting.SMTP_password')"
show-password></el-input>
</el-col>
</el-row>
<!---->
<div style="border: 0px;margin-bottom: 20px;margin-top: 20px">
<el-checkbox v-model="SSL" label="开启SSL(如果SMTP端口是465,通常需要启用SSL)"></el-checkbox>
</div>
<div style="border: 0px;margin-bottom: 20px">
<el-checkbox v-model="TLS" label="开启TLS(如果SMTP端口是587,通常需要启用TLS)"></el-checkbox>
</div>
<div style="border: 0px;margin-bottom: 20px">
<el-checkbox v-model="SMTP" label="是否匿名 SMTP"></el-checkbox>
</div>
<template v-slot:footer>
</template>
</el-form>
<div style="margin-left: 640px">
<el-button type="primary" @click="testConnection('formInline')" :disabled="disabledConnection">
{{$t('system_parameter_setting.test_connection')}}
</el-button>
<el-button @click="edit" v-if="showEdit">{{$t('commons.edit')}}</el-button>
<el-button type="success" @click="save('formInline')" v-if="showSave" :disabled="disabledSave">
{{$t('commons.save')}}
</el-button>
<el-button @click="cancel" type="info" v-if="showCancel">{{$t('commons.cancel')}}</el-button>
</div>
</el-card>
</div>
</template>
<script>
export default {
name: "SystemParameterSetting",
data() {
return {
formInline: {
host: 'smtp.163.com',
port: '465',
account: 'xjj0608@153.com',
password: '2345678',
},
result: {},
SSL: false,
TLS: false,
SMTP: true,
showEdit: true,
showSave: false,
showCancel: false,
show: true,
disabledConnection: false,
disabledSave: false,
loading: false,
rules: {
host: [
{
required: true,
message: this.$t('commons.host_cannot_be_empty')
},
],
port: [
{
required: true,
message: ' '
}
],
account: [
{
required: true,
message: ' '
}]
}
}
},
methods: {
host() {
let host = this.formInline.host;
if (!host) {
this.disabledConnection = true;
this.disabledSave = true;
} else {
this.disabledConnection = false;
this.disabledSave = false;
}
},
port() {
let port = this.formInline.port;
if (!port) {
this.disabledConnection = true;
this.disabledSave = true;
} else {
this.disabledConnection = false;
this.disabledSave = false;
}
},
account() {
let account = this.formInline.account;
if (!account) {
this.disabledConnection = true;
this.disabledSave = true;
} else {
this.disabledConnection = false;
this.disabledSave = false;
}
},
testConnection(formInline) {
let param = {
"meter.host": this.formInline.host,
"meter.port": this.formInline.port,
"meter.account": this.formInline.account,
"meter.password": this.formInline.password,
"meter.ssl": this.SSL,
"meter.tls": this.TLS,
"meter.smtp": this.SMTP,
};
this.$refs[formInline].validate((valid) => {
if (valid) {
this.result = this.$post("/system/testConnection", param, response => {
let flag = response.success;
if (flag) {
this.$success(this.$t('commons.connection_successful'));
} else {
this.$message.error(this.$t('commons.connection_failed'));
}
});
} else {
return false;
}
})
},
edit() {
this.showEdit = false;
this.showSave = true;
this.showCancel = true;
this.show = false;
},
save(formInline) {
this.showEdit = true;
this.showCancel = false;
this.showSave = false;
this.show = true;
let param = [
{paramKey: "meter.host", paramValue: this.formInline.host, type: "text", sort: 1},
{paramKey: "meter.port", paramValue: this.formInline.port, type: "text", sort: 2},
{paramKey: "meter.account", paramValue: this.formInline.account, type: "text", sort: 3},
{paramKey: "meter.password", paramValue: this.formInline.password, type: "password", sort: 4},
{paramKey: "meter.ssl", paramValue: this.SSL, type: "text", sort: 5},
{paramKey: "meter.tls", paramValue: this.TLS, type: "text", sort: 6},
{paramKey: "meter.smtp", paramValue: this.SMTP, type: "text", sort: 7}
]
this.$refs[formInline].validate(valid => {
if (valid) {
this.result = this.$post("/system/edit/email", param, response => {
let flag = response.success;
if (flag) {
this.$success(this.$t('commons.save_success'));
} else {
this.$message.error(this.$t('commons.save_failed'));
}
});
} else {
return false;
}
})
},
cancel() {
this.showEdit = true;
this.showCancel = false;
this.showSave = false;
this.show = true;
}
}
}
</script>
<style scoped>
.text {
font-size: 18px;
}
.item {
margin-bottom: 30px;
}
.box-card {
padding-left: 5px;
}
/deep/ .el-input__inner {
border-width: 0px;
border-bottom-width: 1px;
}
</style>
...@@ -16,7 +16,7 @@ ...@@ -16,7 +16,7 @@
</template> </template>
</el-table-column> </el-table-column>
<el-table-column prop="email" :label="$t('commons.email')"/> <el-table-column prop="email" :label="$t('commons.email')"/>
<el-table-column prop="status" :label="$t('commons.status')"> <el-table-column prop="status" :label="$t('commons.status')" width="120">
<template v-slot:default="scope"> <template v-slot:default="scope">
<el-switch v-model="scope.row.status" <el-switch v-model="scope.row.status"
active-color="#13ce66" active-color="#13ce66"
...@@ -49,9 +49,9 @@ ...@@ -49,9 +49,9 @@
</el-card> </el-card>
<!--Create user--> <!--Create user-->
<el-dialog :title="$t('user.create')" :visible.sync="createVisible" width="30%" @closed="handleClose" <el-dialog :title="$t('user.create')" :visible.sync="createVisible" width="35%" @closed="handleClose"
:destroy-on-close="true"> :destroy-on-close="true">
<el-form :model="form" label-position="right" label-width="100px" size="small" :rules="rule" ref="createUserForm"> <el-form :model="form" label-position="right" label-width="120px" size="small" :rules="rule" ref="createUserForm">
<el-form-item label="ID" prop="id"> <el-form-item label="ID" prop="id">
<el-input v-model="form.id" autocomplete="off"/> <el-input v-model="form.id" autocomplete="off"/>
</el-form-item> </el-form-item>
...@@ -67,6 +67,74 @@ ...@@ -67,6 +67,74 @@
<el-form-item :label="$t('commons.password')" prop="password"> <el-form-item :label="$t('commons.password')" prop="password">
<el-input v-model="form.password" autocomplete="off" show-password/> <el-input v-model="form.password" autocomplete="off" show-password/>
</el-form-item> </el-form-item>
<div v-for="(role, index) in form.roles" :key="index">
<el-form-item :label="'角色'+index" :required="true">
<el-select v-model="role.id" placeholder="选择角色类型">
<el-option
v-for="item in userRole"
:key="item.id"
:label="item.name"
:value="item.id">
</el-option>
</el-select>
<el-button @click.prevent="removeRole(role)" style="margin-left: 20px;" v-if="form.roles.length > 1">删除
</el-button>
</el-form-item>
<div v-if="role.id === 'org_admin'">
<el-form-item label="选择组织" :required="true">
<el-select v-model="role.Ids" placeholder="选择组织" multiple>
<el-option
v-for="item in form.orgList"
:key="item.id"
:label="item.name"
:value="item.id">
</el-option>
</el-select>
</el-form-item>
</div>
<div v-if="role.id === 'test_manager'">
<el-form-item label="选择工作空间" :required="true">
<el-select v-model="role.Ids" placeholder="选择工作空间" multiple>
<el-option
v-for="item in form.wsList"
:key="item.id"
:label="item.name"
:value="item.id">
</el-option>
</el-select>
</el-form-item>
</div>
<div v-if="role.id ==='test_user'">
<el-form-item label="选择工作空间" :required="true">
<el-select v-model="role.Ids" placeholder="选择工作空间" multiple>
<el-option
v-for="item in form.wsList"
:key="item.id"
:label="item.name"
:value="item.id">
</el-option>
</el-select>
</el-form-item>
</div>
<div v-if="role.id ==='test_viewer'">
<el-form-item label="选择工作空间" :required="true">
<el-select v-model="role.Ids" placeholder="选择工作空间" multiple>
<el-option
v-for="item in form.wsList"
:key="item.id"
:label="item.name"
:value="item.id">
</el-option>
</el-select>
</el-form-item>
</div>
</div>
<el-form-item>
<template>
<el-button type="success" style="width: 100%;" @click="addRole()">添加角色</el-button>
</template>
</el-form-item>
</el-form> </el-form>
<template v-slot:footer> <template v-slot:footer>
<ms-dialog-footer <ms-dialog-footer
...@@ -78,7 +146,7 @@ ...@@ -78,7 +146,7 @@
<!--Modify user information in system settings--> <!--Modify user information in system settings-->
<el-dialog :title="$t('user.modify')" :visible.sync="updateVisible" width="30%" :destroy-on-close="true" <el-dialog :title="$t('user.modify')" :visible.sync="updateVisible" width="30%" :destroy-on-close="true"
@close="handleClose"> @close="handleClose">
<el-form :model="form" label-position="right" label-width="100px" size="small" :rules="rule" ref="updateUserForm"> <el-form :model="form" label-position="right" label-width="120px" size="small" :rules="rule" ref="updateUserForm">
<el-form-item label="ID" prop="id"> <el-form-item label="ID" prop="id">
<el-input v-model="form.id" autocomplete="off" :disabled="true"/> <el-input v-model="form.id" autocomplete="off" :disabled="true"/>
</el-form-item> </el-form-item>
...@@ -91,6 +159,73 @@ ...@@ -91,6 +159,73 @@
<el-form-item :label="$t('commons.phone')" prop="phone"> <el-form-item :label="$t('commons.phone')" prop="phone">
<el-input v-model="form.phone" autocomplete="off"/> <el-input v-model="form.phone" autocomplete="off"/>
</el-form-item> </el-form-item>
<div v-for="(role, index) in form.roles" :key="index">
<el-form-item :label="'角色'+index" :required="true">
<el-select v-model="role.id" placeholder="选择角色类型">
<el-option
v-for="item in userRole"
:key="item.id"
:label="item.name"
:value="item.id">
</el-option>
</el-select>
<el-button @click.prevent="removeRole(role)" style="margin-left: 20px;" v-if="form.roles.length > 1">删除
</el-button>
</el-form-item>
<div v-if="role.id === 'org_admin'">
<el-form-item label="选择组织" :required="true">
<el-select v-model="role.Ids" placeholder="选择组织" multiple>
<el-option
v-for="item in form.orgList"
:key="item.id"
:label="item.name"
:value="item.id">
</el-option>
</el-select>
</el-form-item>
</div>
<div v-if="role.id === 'test_manager'">
<el-form-item label="选择工作空间" :required="true">
<el-select v-model="role.Ids" placeholder="选择工作空间" multiple>
<el-option
v-for="item in form.wsList"
:key="item.id"
:label="item.name"
:value="item.id">
</el-option>
</el-select>
</el-form-item>
</div>
<div v-if="role.id ==='test_user'">
<el-form-item label="选择工作空间" :required="true">
<el-select v-model="role.Ids" placeholder="选择工作空间" multiple>
<el-option
v-for="item in form.wsList"
:key="item.id"
:label="item.name"
:value="item.id">
</el-option>
</el-select>
</el-form-item>
</div>
<div v-if="role.id ==='test_viewer'">
<el-form-item label="选择工作空间" :required="true">
<el-select v-model="role.Ids" placeholder="选择工作空间" multiple>
<el-option
v-for="item in form.wsList"
:key="item.id"
:label="item.name"
:value="item.id">
</el-option>
</el-select>
</el-form-item>
</div>
</div>
<el-form-item>
<template>
<el-button type="success" style="width: 100%;" @click="addRole()">添加角色</el-button>
</template>
</el-form-item>
</el-form> </el-form>
<template v-slot:footer> <template v-slot:footer>
<ms-dialog-footer <ms-dialog-footer
...@@ -152,12 +287,15 @@ ...@@ -152,12 +287,15 @@
updateVisible: false, updateVisible: false,
editPasswordVisible: false, editPasswordVisible: false,
multipleSelection: [], multipleSelection: [],
userRole: [],
currentPage: 1, currentPage: 1,
pageSize: 5, pageSize: 5,
total: 0, total: 0,
condition: {}, condition: {},
tableData: [], tableData: [],
form: {}, form: {
roles: [{}]
},
checkPasswordForm: {}, checkPasswordForm: {},
ruleForm: {}, ruleForm: {},
setAdminParam: {}, setAdminParam: {},
...@@ -216,14 +354,27 @@ ...@@ -216,14 +354,27 @@
}, },
created() { created() {
this.search(); this.search();
this.getAllRole();
}, },
methods: { methods: {
create() { create() {
this.createVisible = true; this.createVisible = true;
this.getOrgList();
this.getWsList();
}, },
edit(row) { edit(row) {
this.updateVisible = true; this.updateVisible = true;
this.form = Object.assign({}, row); this.form = Object.assign({}, row);
this.$get("/organization/list", response => {
this.$set(this.form, "orgList", response.data);
});
this.$get("/workspace/list", response => {
this.$set(this.form, "wsList", response.data);
});
this.$get('/userrole/all/' + row.id, response => {
let data = response.data;
this.$set(this.form, "roles", data);
});
}, },
editPassword(row) { editPassword(row) {
this.editPasswordVisible = true; this.editPasswordVisible = true;
...@@ -295,12 +446,12 @@ ...@@ -295,12 +446,12 @@
let roles = data.roles; let roles = data.roles;
// let userRoles = result.userRoles; // let userRoles = result.userRoles;
this.$set(this.tableData[i], "roles", roles); this.$set(this.tableData[i], "roles", roles);
}) });
} }
}) })
}, },
handleClose() { handleClose() {
this.form = {}; this.form = {roles: [{value: ''}]};
}, },
changeSwitch(row) { changeSwitch(row) {
this.$post(this.updatePath, row, () => { this.$post(this.updatePath, row, () => {
...@@ -312,7 +463,32 @@ ...@@ -312,7 +463,32 @@
}, },
handleSelectionChange(val) { handleSelectionChange(val) {
this.multipleSelection = val; this.multipleSelection = val;
} },
getOrgList() {
this.$get("/organization/list", response => {
this.$set(this.form, "orgList", response.data);
})
},
getWsList() {
this.$get("/workspace/list", response => {
this.$set(this.form, "wsList", response.data);
})
},
getAllRole() {
this.$get("/role/all", response => {
this.userRole = response.data;
})
},
addRole() {
let roles = this.form.roles;
roles.push({});
},
removeRole(item) {
let index = this.form.roles.indexOf(item)
if (index !== -1) {
this.form.roles.splice(index, 1)
}
},
} }
} }
</script> </script>
......
...@@ -56,6 +56,15 @@ export default { ...@@ -56,6 +56,15 @@ export default {
'personal_information': 'Personal Information', 'personal_information': 'Personal Information',
'exit_system': 'Exit System', 'exit_system': 'Exit System',
'verification': 'Verification', 'verification': 'Verification',
'set_admin': 'Set Admin',
'system_parameter_setting': 'System Parameter Setting',
'connection_successful': 'Connection successful',
'connection_failed': 'Connection failed',
'save_failed': 'Saved failed',
'host_cannot_be_empty': 'Host cannot be empty',
'port_cannot_be_empty': 'Port cannot be empty',
'account_cannot_be_empty': 'Account cannot be empty',
'title': 'Title', 'title': 'Title',
'custom': 'Custom', 'custom': 'Custom',
'select_date': 'Select date', 'select_date': 'Select date',
...@@ -150,9 +159,9 @@ export default { ...@@ -150,9 +159,9 @@ export default {
'please_choose_role': 'Please Choose Role', 'please_choose_role': 'Please Choose Role',
'admin': 'Admin', 'admin': 'Admin',
'org_admin': 'Org_Admin', 'org_admin': 'Org_Admin',
'test_manager': 'Test_Manager', 'test_manager': 'Test Manager',
'test_user': 'Test_User', 'test_user': 'Test User',
'test_viewer': 'Test_Viewer', 'test_viewer': 'Test Viewer',
}, },
report: { report: {
'recent': 'Recent Report', 'recent': 'Recent Report',
...@@ -252,8 +261,12 @@ export default { ...@@ -252,8 +261,12 @@ export default {
variables: "Variables", variables: "Variables",
headers: "Headers", headers: "Headers",
kv_description: "Variables are available for all requests", kv_description: "Variables are available for all requests",
copy: "Copy scenario",
delete: "Delete scenario"
}, },
request: { request: {
copy: "Copy request",
delete: "Delete request",
input_name: "Please enter the request name", input_name: "Please enter the request name",
name: "Name", name: "Name",
method: "Method", method: "Method",
...@@ -312,7 +325,7 @@ export default { ...@@ -312,7 +325,7 @@ export default {
assertions: "Assertions", assertions: "Assertions",
assertions_pass: "Passed Assertions", assertions_pass: "Passed Assertions",
assertions_name: "Assertion Name", assertions_name: "Assertion Name",
assertions_message: "Assertion Message", assertions_error_message: "Error Message",
assertions_is_success: "Fail/Success", assertions_is_success: "Fail/Success",
result: "Result", result: "Result",
success: "Success", success: "Success",
...@@ -480,6 +493,14 @@ export default { ...@@ -480,6 +493,14 @@ export default {
'status_change_success': 'Successfully changed the status!', 'status_change_success': 'Successfully changed the status!',
'status_change_failed': 'Failed to change the status, resource pool is invalid!', 'status_change_failed': 'Failed to change the status, resource pool is invalid!',
}, },
system_parameter_setting: {
'mailbox_service_settings': 'Mailbox Service Settings',
'test_connection': 'Test connection',
'SMTP_host': 'SMTP host',
'SMTP_port': 'SMTP port',
'SMTP_account': 'SMTP account',
'SMTP_password': 'SMTP password',
},
i18n: { i18n: {
'home': 'Home' 'home': 'Home'
} }
......
...@@ -80,6 +80,14 @@ export default { ...@@ -80,6 +80,14 @@ export default {
'weeks_5': '周五', 'weeks_5': '周五',
'weeks_6': '周六', 'weeks_6': '周六',
'test_unit': '测试', 'test_unit': '测试',
'set_admin': '设置为管理员',
'system_parameter_setting': '系统参数设置',
'connection_successful': '连接成功',
'connection_failed': '连接失败',
'save_failed': '保存失败',
'host_cannot_be_empty': '主机不能为空',
'port_cannot_be_empty': '端口号不能为空',
'account_cannot_be_empty': '帐户不能为空',
}, },
workspace: { workspace: {
'create': '创建工作空间', 'create': '创建工作空间',
...@@ -106,7 +114,6 @@ export default { ...@@ -106,7 +114,6 @@ export default {
'select': '选择组织', 'select': '选择组织',
}, },
project: { project: {
'name': '项目名称',
'recent': '最近的项目', 'recent': '最近的项目',
'create': '创建项目', 'create': '创建项目',
'edit': '编辑项目', 'edit': '编辑项目',
...@@ -232,7 +239,6 @@ export default { ...@@ -232,7 +239,6 @@ export default {
'pressure_prediction_chart': '压力预估图', 'pressure_prediction_chart': '压力预估图',
}, },
api_test: { api_test: {
title: "测试",
save_and_run: "保存并执行", save_and_run: "保存并执行",
run: "执行", run: "执行",
running: "正在执行", running: "正在执行",
...@@ -252,8 +258,12 @@ export default { ...@@ -252,8 +258,12 @@ export default {
variables: "自定义变量", variables: "自定义变量",
headers: "请求头", headers: "请求头",
kv_description: "所有请求可以使用自定义变量", kv_description: "所有请求可以使用自定义变量",
copy: "复制场景",
delete: "删除场景"
}, },
request: { request: {
copy: "复制请求",
delete: "删除请求",
input_name: "请输入请求名称", input_name: "请输入请求名称",
name: "请求名称", name: "请求名称",
method: "请求方法", method: "请求方法",
...@@ -312,7 +322,7 @@ export default { ...@@ -312,7 +322,7 @@ export default {
assertions: "断言", assertions: "断言",
assertions_pass: "成功断言", assertions_pass: "成功断言",
assertions_name: "断言名称", assertions_name: "断言名称",
assertions_message: "断言信息", assertions_error_message: "错误信息",
assertions_is_success: "是否成功", assertions_is_success: "是否成功",
result: "结果", result: "结果",
success: "成功", success: "成功",
...@@ -480,6 +490,14 @@ export default { ...@@ -480,6 +490,14 @@ export default {
'status_change_success': '状态修改成功!', 'status_change_success': '状态修改成功!',
'status_change_failed': '状态修改失败, 校验不通过!', 'status_change_failed': '状态修改失败, 校验不通过!',
}, },
system_parameter_setting: {
'mailbox_service_settings': '邮件服务设置',
'test_connection': '测试连接',
'SMTP_host': 'SMTP主机',
'SMTP_port': 'SMTP端口',
'SMTP_account': 'SMTP账户',
'SMTP_password': 'SMTP密码',
},
i18n: { i18n: {
'home': '首页' 'home': '首页'
} }
......
...@@ -252,8 +252,12 @@ export default { ...@@ -252,8 +252,12 @@ export default {
variables: "自定義變數", variables: "自定義變數",
headers: "請求頭", headers: "請求頭",
kv_description: "所有請求可以使用自定義變數", kv_description: "所有請求可以使用自定義變數",
copy: "複製場景",
delete: "删除場景"
}, },
request: { request: {
copy: "複製請求",
delete: "删除請求",
input_name: "請輸入請求名稱", input_name: "請輸入請求名稱",
name: "請求名稱", name: "請求名稱",
method: "請求方法", method: "請求方法",
...@@ -312,7 +316,7 @@ export default { ...@@ -312,7 +316,7 @@ export default {
assertions: "斷言", assertions: "斷言",
assertions_pass: "成功斷言", assertions_pass: "成功斷言",
assertions_name: "斷言名稱", assertions_name: "斷言名稱",
assertions_message: "斷言資訊", assertions_error_message: "錯誤資訊",
assertions_is_success: "是否成功", assertions_is_success: "是否成功",
result: "結果", result: "結果",
success: "成功", success: "成功",
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册