Merge branch 'v1.3'
This commit is contained in:
commit
28b33ff0b8
|
@ -62,7 +62,7 @@
|
|||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-jetty</artifactId>
|
||||
<artifactId>spring-boot-starter-undertow</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
|
|
|
@ -7,9 +7,11 @@ import io.metersphere.api.dto.scenario.request.HttpRequest;
|
|||
import io.metersphere.commons.exception.MSException;
|
||||
import io.metersphere.commons.utils.LogUtil;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.eclipse.jetty.http.HttpHeader;
|
||||
|
||||
import java.io.*;
|
||||
import java.io.BufferedReader;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.InputStreamReader;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
@ -19,7 +21,7 @@ public abstract class ApiImportAbstractParser implements ApiImportParser {
|
|||
|
||||
protected String getApiTestStr(InputStream source) {
|
||||
StringBuilder testStr = null;
|
||||
try(BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(source, StandardCharsets.UTF_8))) {
|
||||
try (BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(source, StandardCharsets.UTF_8))) {
|
||||
testStr = new StringBuilder();
|
||||
String inputStr;
|
||||
while ((inputStr = bufferedReader.readLine()) != null) {
|
||||
|
@ -46,21 +48,21 @@ public abstract class ApiImportAbstractParser implements ApiImportParser {
|
|||
}
|
||||
|
||||
protected void addContentType(HttpRequest request, String contentType) {
|
||||
addHeader(request, HttpHeader.CONTENT_TYPE.toString(), contentType);
|
||||
addHeader(request, "Content-Type", contentType);
|
||||
}
|
||||
|
||||
protected void addCookie(HttpRequest request, String key, String value) {
|
||||
List<KeyValue> headers = Optional.ofNullable(request.getHeaders()).orElse(new ArrayList<>());
|
||||
boolean hasCookie = false;
|
||||
for (KeyValue header : headers) {
|
||||
if (StringUtils.equalsIgnoreCase(HttpHeader.COOKIE.name(), header.getName())) {
|
||||
if (StringUtils.equalsIgnoreCase("Cookie", header.getName())) {
|
||||
hasCookie = true;
|
||||
String cookies = Optional.ofNullable(header.getValue()).orElse("");
|
||||
header.setValue(cookies + key + "=" + value + ";");
|
||||
}
|
||||
}
|
||||
if (!hasCookie) {
|
||||
addHeader(request, HttpHeader.COOKIE.name(), key + "=" + value + ";");
|
||||
addHeader(request, "Cookie", key + "=" + value + ";");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -9,7 +9,6 @@ import io.metersphere.api.dto.parse.ApiImport;
|
|||
import io.metersphere.api.dto.scenario.request.RequestType;
|
||||
import io.metersphere.commons.constants.MsRequestBodyType;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.eclipse.jetty.http.HttpMethod;
|
||||
|
||||
import java.io.InputStream;
|
||||
|
||||
|
@ -62,7 +61,7 @@ public class MsParser extends ApiImportAbstractParser {
|
|||
Object body = requestObject.get("body");
|
||||
if (body instanceof JSONArray) {
|
||||
JSONArray bodies = requestObject.getJSONArray("body");
|
||||
if (StringUtils.equalsIgnoreCase(requestObject.getString("method"), HttpMethod.POST.name()) && bodies != null) {
|
||||
if (StringUtils.equalsIgnoreCase(requestObject.getString("method"), "POST") && bodies != null) {
|
||||
StringBuilder bodyStr = new StringBuilder();
|
||||
for (int i = 0; i < bodies.size(); i++) {
|
||||
String tmp = bodies.getString(i);
|
||||
|
@ -75,7 +74,7 @@ public class MsParser extends ApiImportAbstractParser {
|
|||
}
|
||||
} else if (body instanceof JSONObject) {
|
||||
JSONObject bodyObj = requestObject.getJSONObject("body");
|
||||
if (StringUtils.equalsIgnoreCase(requestObject.getString("method"), HttpMethod.POST.name()) && bodyObj != null) {
|
||||
if (StringUtils.equalsIgnoreCase(requestObject.getString("method"), "POST") && bodyObj != null) {
|
||||
JSONArray kvs = new JSONArray();
|
||||
bodyObj.keySet().forEach(key -> {
|
||||
JSONObject kv = new JSONObject();
|
||||
|
|
|
@ -12,11 +12,11 @@ public class Notice implements Serializable {
|
|||
|
||||
private String testId;
|
||||
|
||||
private String name;
|
||||
|
||||
private String enable;
|
||||
|
||||
private String type;
|
||||
|
||||
private String userId;
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
}
|
|
@ -314,76 +314,6 @@ public class NoticeExample {
|
|||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andNameIsNull() {
|
||||
addCriterion("`NAME` is null");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andNameIsNotNull() {
|
||||
addCriterion("`NAME` is not null");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andNameEqualTo(String value) {
|
||||
addCriterion("`NAME` =", value, "name");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andNameNotEqualTo(String value) {
|
||||
addCriterion("`NAME` <>", value, "name");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andNameGreaterThan(String value) {
|
||||
addCriterion("`NAME` >", value, "name");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andNameGreaterThanOrEqualTo(String value) {
|
||||
addCriterion("`NAME` >=", value, "name");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andNameLessThan(String value) {
|
||||
addCriterion("`NAME` <", value, "name");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andNameLessThanOrEqualTo(String value) {
|
||||
addCriterion("`NAME` <=", value, "name");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andNameLike(String value) {
|
||||
addCriterion("`NAME` like", value, "name");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andNameNotLike(String value) {
|
||||
addCriterion("`NAME` not like", value, "name");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andNameIn(List<String> values) {
|
||||
addCriterion("`NAME` in", values, "name");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andNameNotIn(List<String> values) {
|
||||
addCriterion("`NAME` not in", values, "name");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andNameBetween(String value1, String value2) {
|
||||
addCriterion("`NAME` between", value1, value2, "name");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andNameNotBetween(String value1, String value2) {
|
||||
addCriterion("`NAME` not between", value1, value2, "name");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andEnableIsNull() {
|
||||
addCriterion("`ENABLE` is null");
|
||||
return (Criteria) this;
|
||||
|
@ -523,6 +453,76 @@ public class NoticeExample {
|
|||
addCriterion("`type` not between", value1, value2, "type");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andUserIdIsNull() {
|
||||
addCriterion("user_id is null");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andUserIdIsNotNull() {
|
||||
addCriterion("user_id is not null");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andUserIdEqualTo(String value) {
|
||||
addCriterion("user_id =", value, "userId");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andUserIdNotEqualTo(String value) {
|
||||
addCriterion("user_id <>", value, "userId");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andUserIdGreaterThan(String value) {
|
||||
addCriterion("user_id >", value, "userId");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andUserIdGreaterThanOrEqualTo(String value) {
|
||||
addCriterion("user_id >=", value, "userId");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andUserIdLessThan(String value) {
|
||||
addCriterion("user_id <", value, "userId");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andUserIdLessThanOrEqualTo(String value) {
|
||||
addCriterion("user_id <=", value, "userId");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andUserIdLike(String value) {
|
||||
addCriterion("user_id like", value, "userId");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andUserIdNotLike(String value) {
|
||||
addCriterion("user_id not like", value, "userId");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andUserIdIn(List<String> values) {
|
||||
addCriterion("user_id in", values, "userId");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andUserIdNotIn(List<String> values) {
|
||||
addCriterion("user_id not in", values, "userId");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andUserIdBetween(String value1, String value2) {
|
||||
addCriterion("user_id between", value1, value2, "userId");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andUserIdNotBetween(String value1, String value2) {
|
||||
addCriterion("user_id not between", value1, value2, "userId");
|
||||
return (Criteria) this;
|
||||
}
|
||||
}
|
||||
|
||||
public static class Criteria extends GeneratedCriteria {
|
||||
|
|
|
@ -5,9 +5,9 @@
|
|||
<id column="id" jdbcType="VARCHAR" property="id" />
|
||||
<result column="EVENT" jdbcType="VARCHAR" property="event" />
|
||||
<result column="TEST_ID" jdbcType="VARCHAR" property="testId" />
|
||||
<result column="NAME" jdbcType="VARCHAR" property="name" />
|
||||
<result column="ENABLE" jdbcType="VARCHAR" property="enable" />
|
||||
<result column="type" jdbcType="VARCHAR" property="type" />
|
||||
<result column="user_id" jdbcType="VARCHAR" property="userId" />
|
||||
</resultMap>
|
||||
<sql id="Example_Where_Clause">
|
||||
<where>
|
||||
|
@ -68,7 +68,7 @@
|
|||
</where>
|
||||
</sql>
|
||||
<sql id="Base_Column_List">
|
||||
id, EVENT, TEST_ID, `NAME`, `ENABLE`, `type`
|
||||
id, EVENT, TEST_ID, `ENABLE`, `type`, user_id
|
||||
</sql>
|
||||
<select id="selectByExample" parameterType="io.metersphere.base.domain.NoticeExample" resultMap="BaseResultMap">
|
||||
select
|
||||
|
@ -102,9 +102,11 @@
|
|||
</delete>
|
||||
<insert id="insert" parameterType="io.metersphere.base.domain.Notice">
|
||||
INSERT INTO notice (id, EVENT, TEST_ID,
|
||||
`NAME`, `ENABLE`, `type`)
|
||||
`ENABLE`, `type`, user_id
|
||||
)
|
||||
VALUES (#{id,jdbcType=VARCHAR}, #{event,jdbcType=VARCHAR}, #{testId,jdbcType=VARCHAR},
|
||||
#{name,jdbcType=VARCHAR}, #{enable,jdbcType=VARCHAR}, #{type,jdbcType=VARCHAR})
|
||||
#{enable,jdbcType=VARCHAR}, #{type,jdbcType=VARCHAR}, #{userId,jdbcType=VARCHAR}
|
||||
)
|
||||
</insert>
|
||||
<insert id="insertSelective" parameterType="io.metersphere.base.domain.Notice">
|
||||
insert into notice
|
||||
|
@ -118,15 +120,15 @@
|
|||
<if test="testId != null">
|
||||
TEST_ID,
|
||||
</if>
|
||||
<if test="name != null">
|
||||
`NAME`,
|
||||
</if>
|
||||
<if test="enable != null">
|
||||
`ENABLE`,
|
||||
</if>
|
||||
<if test="type != null">
|
||||
`type`,
|
||||
</if>
|
||||
<if test="userId != null">
|
||||
user_id,
|
||||
</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="id != null">
|
||||
|
@ -138,15 +140,15 @@
|
|||
<if test="testId != null">
|
||||
#{testId,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="name != null">
|
||||
#{name,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="enable != null">
|
||||
#{enable,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="type != null">
|
||||
#{type,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="userId != null">
|
||||
#{userId,jdbcType=VARCHAR},
|
||||
</if>
|
||||
</trim>
|
||||
</insert>
|
||||
<select id="countByExample" parameterType="io.metersphere.base.domain.NoticeExample" resultType="java.lang.Long">
|
||||
|
@ -167,15 +169,15 @@
|
|||
<if test="record.testId != null">
|
||||
TEST_ID = #{record.testId,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="record.name != null">
|
||||
`NAME` = #{record.name,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="record.enable != null">
|
||||
`ENABLE` = #{record.enable,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="record.type != null">
|
||||
`type` = #{record.type,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="record.userId != null">
|
||||
user_id = #{record.userId,jdbcType=VARCHAR},
|
||||
</if>
|
||||
</set>
|
||||
<if test="_parameter != null">
|
||||
<include refid="Update_By_Example_Where_Clause" />
|
||||
|
@ -186,9 +188,9 @@
|
|||
set id = #{record.id,jdbcType=VARCHAR},
|
||||
EVENT = #{record.event,jdbcType=VARCHAR},
|
||||
TEST_ID = #{record.testId,jdbcType=VARCHAR},
|
||||
`NAME` = #{record.name,jdbcType=VARCHAR},
|
||||
`ENABLE` = #{record.enable,jdbcType=VARCHAR},
|
||||
`type` = #{record.type,jdbcType=VARCHAR}
|
||||
`type` = #{record.type,jdbcType=VARCHAR},
|
||||
user_id = #{record.userId,jdbcType=VARCHAR}
|
||||
<if test="_parameter != null">
|
||||
<include refid="Update_By_Example_Where_Clause" />
|
||||
</if>
|
||||
|
@ -202,15 +204,15 @@
|
|||
<if test="testId != null">
|
||||
TEST_ID = #{testId,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="name != null">
|
||||
`NAME` = #{name,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="enable != null">
|
||||
`ENABLE` = #{enable,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="type != null">
|
||||
`type` = #{type,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="userId != null">
|
||||
user_id = #{userId,jdbcType=VARCHAR},
|
||||
</if>
|
||||
</set>
|
||||
where id = #{id,jdbcType=VARCHAR}
|
||||
</update>
|
||||
|
@ -218,9 +220,9 @@
|
|||
UPDATE notice
|
||||
SET EVENT = #{event,jdbcType=VARCHAR},
|
||||
TEST_ID = #{testId,jdbcType=VARCHAR},
|
||||
`NAME` = #{name,jdbcType=VARCHAR},
|
||||
`ENABLE` = #{enable,jdbcType=VARCHAR},
|
||||
`type` = #{type,jdbcType=VARCHAR}
|
||||
`type` = #{type,jdbcType=VARCHAR},
|
||||
user_id = #{userId,jdbcType=VARCHAR}
|
||||
WHERE id = #{id,jdbcType=VARCHAR}
|
||||
</update>
|
||||
</mapper>
|
|
@ -16,8 +16,6 @@ public interface ExtUserMapper {
|
|||
|
||||
List<User> searchUser(String condition);
|
||||
|
||||
List<String> queryEmails(String[] names);
|
||||
|
||||
List<String> queryEmailByIds(List<String> userIds);
|
||||
|
||||
}
|
||||
|
|
|
@ -33,18 +33,6 @@
|
|||
</where>
|
||||
order by u.update_time desc
|
||||
</select>
|
||||
<!--查询邮箱-->
|
||||
<select id="queryEmails" parameterType="java.lang.String" resultType="java.lang.String">
|
||||
SELECT
|
||||
email
|
||||
from user
|
||||
WHERE name IN
|
||||
<foreach collection="array" item="id" index="index"
|
||||
open="(" close=")" separator=",">
|
||||
#{id}
|
||||
</foreach>
|
||||
|
||||
</select>
|
||||
<select id="queryEmailByIds" parameterType="java.lang.String" resultType="java.lang.String">
|
||||
SELECT
|
||||
email
|
||||
|
|
|
@ -3,7 +3,10 @@ package io.metersphere.notice.domain;
|
|||
import io.metersphere.base.domain.Notice;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
public class NoticeDetail extends Notice {
|
||||
private String[] names;
|
||||
private List<String> userIds = new ArrayList<>();
|
||||
}
|
||||
|
|
|
@ -231,10 +231,10 @@ public class MailService {
|
|||
if (noticeList.size() > 0) {
|
||||
for (NoticeDetail n : noticeList) {
|
||||
if (StringUtils.equals(n.getEnable(), "true") && StringUtils.equals(n.getEvent(), NoticeConstants.EXECUTE_SUCCESSFUL)) {
|
||||
successEmailList = userService.queryEmail(n.getNames());
|
||||
successEmailList = userService.queryEmail(n.getUserIds());
|
||||
}
|
||||
if (StringUtils.equals(n.getEnable(), "true") && StringUtils.equals(n.getEvent(), NoticeConstants.EXECUTE_FAILED)) {
|
||||
failEmailList = userService.queryEmail(n.getNames());
|
||||
failEmailList = userService.queryEmail(n.getUserIds());
|
||||
}
|
||||
}
|
||||
} else {
|
||||
|
|
|
@ -5,6 +5,7 @@ import io.metersphere.base.domain.NoticeExample;
|
|||
import io.metersphere.base.mapper.NoticeMapper;
|
||||
import io.metersphere.notice.controller.request.NoticeRequest;
|
||||
import io.metersphere.notice.domain.NoticeDetail;
|
||||
import org.apache.commons.collections4.CollectionUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
@ -28,14 +29,14 @@ public class NoticeService {
|
|||
noticeMapper.deleteByExample(example);
|
||||
}
|
||||
noticeRequest.getNotices().forEach(n -> {
|
||||
if (n.getNames().length > 0) {
|
||||
for (String x : n.getNames()) {
|
||||
if (CollectionUtils.isNotEmpty(n.getUserIds())) {
|
||||
for (String x : n.getUserIds()) {
|
||||
Notice notice = new Notice();
|
||||
notice.setId(UUID.randomUUID().toString());
|
||||
notice.setEvent(n.getEvent());
|
||||
notice.setEnable(n.getEnable());
|
||||
notice.setTestId(noticeRequest.getTestId());
|
||||
notice.setName(x);
|
||||
notice.setUserId(x);
|
||||
notice.setType(n.getType());
|
||||
noticeMapper.insert(notice);
|
||||
}
|
||||
|
@ -48,33 +49,29 @@ public class NoticeService {
|
|||
example.createCriteria().andTestIdEqualTo(id);
|
||||
List<Notice> notices = noticeMapper.selectByExample(example);
|
||||
List<NoticeDetail> result = new ArrayList<>();
|
||||
List<String> success = new ArrayList<>();
|
||||
List<String> fail = new ArrayList<>();
|
||||
String[] successArray;
|
||||
String[] failArray;
|
||||
List<String> successList = new ArrayList<>();
|
||||
List<String> failList = new ArrayList<>();
|
||||
NoticeDetail notice1 = new NoticeDetail();
|
||||
NoticeDetail notice2 = new NoticeDetail();
|
||||
if (notices.size() > 0) {
|
||||
for (Notice n : notices) {
|
||||
if (n.getEvent().equals(EXECUTE_SUCCESSFUL)) {
|
||||
success.add(n.getName());
|
||||
successList.add(n.getUserId());
|
||||
notice1.setEnable(n.getEnable());
|
||||
notice1.setTestId(id);
|
||||
notice1.setType(n.getType());
|
||||
notice1.setEvent(n.getEvent());
|
||||
}
|
||||
if (n.getEvent().equals(EXECUTE_FAILED)) {
|
||||
fail.add(n.getName());
|
||||
failList.add(n.getUserId());
|
||||
notice2.setEnable(n.getEnable());
|
||||
notice2.setTestId(id);
|
||||
notice2.setType(n.getType());
|
||||
notice2.setEvent(n.getEvent());
|
||||
}
|
||||
}
|
||||
successArray = success.toArray(new String[0]);
|
||||
failArray = fail.toArray(new String[0]);
|
||||
notice1.setNames(successArray);
|
||||
notice2.setNames(failArray);
|
||||
notice1.setUserIds(successList);
|
||||
notice2.setUserIds(failList);
|
||||
result.add(notice1);
|
||||
result.add(notice2);
|
||||
}
|
||||
|
|
|
@ -34,7 +34,6 @@ import org.springframework.transaction.annotation.Transactional;
|
|||
import org.springframework.util.CollectionUtils;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
|
@ -62,8 +61,8 @@ public class UserService {
|
|||
@Resource
|
||||
private WorkspaceService workspaceService;
|
||||
|
||||
public List<String> queryEmail(String[] names) {
|
||||
return extUserMapper.queryEmails(names);
|
||||
public List<String> queryEmail(List<String> userIds) {
|
||||
return extUserMapper.queryEmailByIds(userIds);
|
||||
}
|
||||
|
||||
public List<String> queryEmailByIds(List<String> userIds) {
|
||||
|
|
|
@ -1 +1 @@
|
|||
Subproject commit c2dacf960cdb1ed35664bdd3432120b1203b73d8
|
||||
Subproject commit cf6b06526324326a563d933e07118fac014a63b4
|
|
@ -0,0 +1,10 @@
|
|||
ALTER TABLE notice
|
||||
ADD user_id VARCHAR(50) NULL;
|
||||
UPDATE notice
|
||||
SET notice.user_id = (
|
||||
SELECT id
|
||||
FROM user
|
||||
WHERE notice.NAME = user.name
|
||||
);
|
||||
ALTER TABLE notice
|
||||
DROP COLUMN name;
|
|
@ -2,7 +2,7 @@
|
|||
<div class="text-container">
|
||||
<div @click="active" class="collapse">
|
||||
<i class="icon el-icon-arrow-right" :class="{'is-active': isActive}"/>
|
||||
{{$t('api_report.response')}}
|
||||
{{ $t('api_report.response') }}
|
||||
</div>
|
||||
<el-collapse-transition>
|
||||
<el-tabs v-model="activeName" v-show="isActive">
|
||||
|
@ -10,7 +10,7 @@
|
|||
<ms-code-edit :mode="mode" :read-only="true" :data="response.body" :modes="modes" ref="codeEdit"/>
|
||||
</el-tab-pane>
|
||||
<el-tab-pane label="Headers" name="headers" class="pane">
|
||||
<pre>{{response.headers}}</pre>
|
||||
<pre>{{ response.headers }}</pre>
|
||||
</el-tab-pane>
|
||||
<el-tab-pane :label="$t('api_report.assertions')" name="assertions" class="pane assertions">
|
||||
<ms-assertion-results :assertions="response.assertions"/>
|
||||
|
@ -18,7 +18,7 @@
|
|||
|
||||
<el-tab-pane v-if="activeName == 'body'" :disabled="true" name="mode" class="pane assertions">
|
||||
<template v-slot:label>
|
||||
<ms-dropdown :commands="modes" @command="modeChange"/>
|
||||
<ms-dropdown :commands="modes" :default-command="mode" @command="modeChange"/>
|
||||
</template>
|
||||
</el-tab-pane>
|
||||
|
||||
|
@ -28,80 +28,83 @@
|
|||
</template>
|
||||
|
||||
<script>
|
||||
import MsAssertionResults from "./AssertionResults";
|
||||
import MsCodeEdit from "../../../common/components/MsCodeEdit";
|
||||
import MsDropdown from "../../../common/components/MsDropdown";
|
||||
import {BODY_FORMAT} from "../../test/model/ScenarioModel";
|
||||
import MsAssertionResults from "./AssertionResults";
|
||||
import MsCodeEdit from "../../../common/components/MsCodeEdit";
|
||||
import MsDropdown from "../../../common/components/MsDropdown";
|
||||
import {BODY_FORMAT} from "../../test/model/ScenarioModel";
|
||||
|
||||
export default {
|
||||
name: "MsResponseText",
|
||||
export default {
|
||||
name: "MsResponseText",
|
||||
|
||||
components: {
|
||||
MsDropdown,
|
||||
MsCodeEdit,
|
||||
MsAssertionResults,
|
||||
components: {
|
||||
MsDropdown,
|
||||
MsCodeEdit,
|
||||
MsAssertionResults,
|
||||
},
|
||||
|
||||
props: {
|
||||
response: Object
|
||||
},
|
||||
|
||||
data() {
|
||||
return {
|
||||
isActive: true,
|
||||
activeName: "body",
|
||||
modes: ['text', 'json', 'xml', 'html'],
|
||||
mode: BODY_FORMAT.TEXT
|
||||
}
|
||||
},
|
||||
|
||||
methods: {
|
||||
active() {
|
||||
this.isActive = !this.isActive;
|
||||
},
|
||||
modeChange(mode) {
|
||||
this.mode = mode;
|
||||
}
|
||||
},
|
||||
|
||||
props: {
|
||||
response: Object
|
||||
},
|
||||
|
||||
data() {
|
||||
return {
|
||||
isActive: true,
|
||||
activeName: "body",
|
||||
modes: ['text', 'json', 'xml', 'html'],
|
||||
mode: BODY_FORMAT.TEXT
|
||||
}
|
||||
},
|
||||
|
||||
methods: {
|
||||
active() {
|
||||
this.isActive = !this.isActive;
|
||||
},
|
||||
modeChange(mode) {
|
||||
this.mode = mode;
|
||||
}
|
||||
},
|
||||
|
||||
created() {
|
||||
console.log(this.response.headers);
|
||||
if (this.response.headers.indexOf("Content-Type: application/json") > 0) {
|
||||
this.mode = BODY_FORMAT.JSON;
|
||||
}
|
||||
mounted() {
|
||||
console.log(this.response.headers);
|
||||
if (!this.response.headers) {
|
||||
return;
|
||||
}
|
||||
if (this.response.headers.indexOf("Content-Type: application/json") > 0) {
|
||||
this.mode = BODY_FORMAT.JSON;
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.text-container .icon {
|
||||
padding: 5px;
|
||||
}
|
||||
.text-container .icon {
|
||||
padding: 5px;
|
||||
}
|
||||
|
||||
.text-container .collapse {
|
||||
cursor: pointer;
|
||||
}
|
||||
.text-container .collapse {
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.text-container .collapse:hover {
|
||||
opacity: 0.8;
|
||||
}
|
||||
.text-container .collapse:hover {
|
||||
opacity: 0.8;
|
||||
}
|
||||
|
||||
.text-container .icon.is-active {
|
||||
transform: rotate(90deg);
|
||||
}
|
||||
.text-container .icon.is-active {
|
||||
transform: rotate(90deg);
|
||||
}
|
||||
|
||||
.text-container .pane {
|
||||
background-color: #F5F5F5;
|
||||
padding: 0 10px;
|
||||
height: 250px;
|
||||
overflow-y: auto;
|
||||
}
|
||||
.text-container .pane {
|
||||
background-color: #F5F5F5;
|
||||
padding: 0 10px;
|
||||
height: 250px;
|
||||
overflow-y: auto;
|
||||
}
|
||||
|
||||
.text-container .pane.assertions {
|
||||
padding: 0;
|
||||
}
|
||||
.text-container .pane.assertions {
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
pre {
|
||||
margin: 0;
|
||||
}
|
||||
pre {
|
||||
margin: 0;
|
||||
}
|
||||
</style>
|
||||
|
|
|
@ -50,14 +50,14 @@
|
|||
width="240"
|
||||
>
|
||||
<template v-slot:default="{row}">
|
||||
<el-select v-model="row.names" filterable multiple
|
||||
<el-select v-model="row.userIds" filterable multiple
|
||||
:placeholder="$t('commons.please_select')"
|
||||
@click.native="userList()" style="width: 100%;">
|
||||
<el-option
|
||||
v-for="item in options"
|
||||
:key="item.id"
|
||||
:label="item.name"
|
||||
:value="item.name">
|
||||
:value="item.id">
|
||||
</el-option>
|
||||
</el-select>
|
||||
</template>
|
||||
|
@ -154,13 +154,13 @@ export default {
|
|||
{
|
||||
event: "EXECUTE_SUCCESSFUL",
|
||||
type: "EMAIL",
|
||||
names: [],
|
||||
userIds: [],
|
||||
enable: false
|
||||
},
|
||||
{
|
||||
event: "EXECUTE_FAILED",
|
||||
type: "EMAIL",
|
||||
names: [],
|
||||
userIds: [],
|
||||
enable: false
|
||||
}
|
||||
],
|
||||
|
@ -190,8 +190,8 @@ export default {
|
|||
this.tableData[1].event = "EXECUTE_FAILED"
|
||||
this.tableData[1].type = "EMAIL"
|
||||
} else {
|
||||
this.tableData[0].names = []
|
||||
this.tableData[1].names = []
|
||||
this.tableData[0].userIds = []
|
||||
this.tableData[1].userIds = []
|
||||
}
|
||||
})
|
||||
}
|
||||
|
|
|
@ -1 +1 @@
|
|||
Subproject commit cc38137a69a0f20fadece9c0f9f50a9468c4ace9
|
||||
Subproject commit 06d935cd1d22ab36f09763745c2aff8ad3fb08c1
|
Loading…
Reference in New Issue