Merge branch 'v1.3' into master

This commit is contained in:
Captain.B 2020-09-27 15:28:49 +08:00
commit fe4a585863
22 changed files with 663 additions and 552 deletions

View File

@ -6,15 +6,17 @@ import java.io.Serializable;
@Data
public class Notice implements Serializable {
private String id;
private String event;
private String testId;
private String name;
private String email;
private String enable;
private String type;
private static final long serialVersionUID = 1L;
}

View File

@ -104,6 +104,76 @@ public class NoticeExample {
criteria.add(new Criterion(condition, value1, value2));
}
public Criteria andIdIsNull() {
addCriterion("id is null");
return (Criteria) this;
}
public Criteria andIdIsNotNull() {
addCriterion("id is not null");
return (Criteria) this;
}
public Criteria andIdEqualTo(String value) {
addCriterion("id =", value, "id");
return (Criteria) this;
}
public Criteria andIdNotEqualTo(String value) {
addCriterion("id <>", value, "id");
return (Criteria) this;
}
public Criteria andIdGreaterThan(String value) {
addCriterion("id >", value, "id");
return (Criteria) this;
}
public Criteria andIdGreaterThanOrEqualTo(String value) {
addCriterion("id >=", value, "id");
return (Criteria) this;
}
public Criteria andIdLessThan(String value) {
addCriterion("id <", value, "id");
return (Criteria) this;
}
public Criteria andIdLessThanOrEqualTo(String value) {
addCriterion("id <=", value, "id");
return (Criteria) this;
}
public Criteria andIdLike(String value) {
addCriterion("id like", value, "id");
return (Criteria) this;
}
public Criteria andIdNotLike(String value) {
addCriterion("id not like", value, "id");
return (Criteria) this;
}
public Criteria andIdIn(List<String> values) {
addCriterion("id in", values, "id");
return (Criteria) this;
}
public Criteria andIdNotIn(List<String> values) {
addCriterion("id not in", values, "id");
return (Criteria) this;
}
public Criteria andIdBetween(String value1, String value2) {
addCriterion("id between", value1, value2, "id");
return (Criteria) this;
}
public Criteria andIdNotBetween(String value1, String value2) {
addCriterion("id not between", value1, value2, "id");
return (Criteria) this;
}
public Criteria andEventIsNull() {
addCriterion("EVENT is null");
return (Criteria) this;
@ -314,76 +384,6 @@ public class NoticeExample {
return (Criteria) this;
}
public Criteria andEmailIsNull() {
addCriterion("EMAIL is null");
return (Criteria) this;
}
public Criteria andEmailIsNotNull() {
addCriterion("EMAIL is not null");
return (Criteria) this;
}
public Criteria andEmailEqualTo(String value) {
addCriterion("EMAIL =", value, "email");
return (Criteria) this;
}
public Criteria andEmailNotEqualTo(String value) {
addCriterion("EMAIL <>", value, "email");
return (Criteria) this;
}
public Criteria andEmailGreaterThan(String value) {
addCriterion("EMAIL >", value, "email");
return (Criteria) this;
}
public Criteria andEmailGreaterThanOrEqualTo(String value) {
addCriterion("EMAIL >=", value, "email");
return (Criteria) this;
}
public Criteria andEmailLessThan(String value) {
addCriterion("EMAIL <", value, "email");
return (Criteria) this;
}
public Criteria andEmailLessThanOrEqualTo(String value) {
addCriterion("EMAIL <=", value, "email");
return (Criteria) this;
}
public Criteria andEmailLike(String value) {
addCriterion("EMAIL like", value, "email");
return (Criteria) this;
}
public Criteria andEmailNotLike(String value) {
addCriterion("EMAIL not like", value, "email");
return (Criteria) this;
}
public Criteria andEmailIn(List<String> values) {
addCriterion("EMAIL in", values, "email");
return (Criteria) this;
}
public Criteria andEmailNotIn(List<String> values) {
addCriterion("EMAIL not in", values, "email");
return (Criteria) this;
}
public Criteria andEmailBetween(String value1, String value2) {
addCriterion("EMAIL between", value1, value2, "email");
return (Criteria) this;
}
public Criteria andEmailNotBetween(String value1, String value2) {
addCriterion("EMAIL not between", value1, value2, "email");
return (Criteria) this;
}
public Criteria andEnableIsNull() {
addCriterion("`ENABLE` is null");
return (Criteria) this;
@ -453,6 +453,76 @@ public class NoticeExample {
addCriterion("`ENABLE` not between", value1, value2, "enable");
return (Criteria) this;
}
public Criteria andTypeIsNull() {
addCriterion("`type` is null");
return (Criteria) this;
}
public Criteria andTypeIsNotNull() {
addCriterion("`type` is not null");
return (Criteria) this;
}
public Criteria andTypeEqualTo(String value) {
addCriterion("`type` =", value, "type");
return (Criteria) this;
}
public Criteria andTypeNotEqualTo(String value) {
addCriterion("`type` <>", value, "type");
return (Criteria) this;
}
public Criteria andTypeGreaterThan(String value) {
addCriterion("`type` >", value, "type");
return (Criteria) this;
}
public Criteria andTypeGreaterThanOrEqualTo(String value) {
addCriterion("`type` >=", value, "type");
return (Criteria) this;
}
public Criteria andTypeLessThan(String value) {
addCriterion("`type` <", value, "type");
return (Criteria) this;
}
public Criteria andTypeLessThanOrEqualTo(String value) {
addCriterion("`type` <=", value, "type");
return (Criteria) this;
}
public Criteria andTypeLike(String value) {
addCriterion("`type` like", value, "type");
return (Criteria) this;
}
public Criteria andTypeNotLike(String value) {
addCriterion("`type` not like", value, "type");
return (Criteria) this;
}
public Criteria andTypeIn(List<String> values) {
addCriterion("`type` in", values, "type");
return (Criteria) this;
}
public Criteria andTypeNotIn(List<String> values) {
addCriterion("`type` not in", values, "type");
return (Criteria) this;
}
public Criteria andTypeBetween(String value1, String value2) {
addCriterion("`type` between", value1, value2, "type");
return (Criteria) this;
}
public Criteria andTypeNotBetween(String value1, String value2) {
addCriterion("`type` not between", value1, value2, "type");
return (Criteria) this;
}
}
public static class Criteria extends GeneratedCriteria {

View File

@ -2,21 +2,30 @@ package io.metersphere.base.mapper;
import io.metersphere.base.domain.Notice;
import io.metersphere.base.domain.NoticeExample;
import java.util.List;
import org.apache.ibatis.annotations.Param;
import java.util.List;
public interface NoticeMapper {
long countByExample(NoticeExample example);
int deleteByExample(NoticeExample example);
int deleteByPrimaryKey(String id);
int insert(Notice record);
int insertSelective(Notice record);
List<Notice> selectByExample(NoticeExample example);
Notice selectByPrimaryKey(String id);
int updateByExampleSelective(@Param("record") Notice record, @Param("example") NoticeExample example);
int updateByExample(@Param("record") Notice record, @Param("example") NoticeExample example);
int updateByPrimaryKeySelective(Notice record);
int updateByPrimaryKey(Notice record);
}

View File

@ -2,11 +2,12 @@
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="io.metersphere.base.mapper.NoticeMapper">
<resultMap id="BaseResultMap" type="io.metersphere.base.domain.Notice">
<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="EMAIL" jdbcType="VARCHAR" property="email" />
<result column="ENABLE" jdbcType="VARCHAR" property="enable" />
<result column="type" jdbcType="VARCHAR" property="type" />
</resultMap>
<sql id="Example_Where_Clause">
<where>
@ -67,7 +68,7 @@
</where>
</sql>
<sql id="Base_Column_List">
EVENT, TEST_ID, `NAME`, EMAIL, `ENABLE`
id, EVENT, TEST_ID, `NAME`, `ENABLE`, `type`
</sql>
<select id="selectByExample" parameterType="io.metersphere.base.domain.NoticeExample" resultMap="BaseResultMap">
select
@ -83,6 +84,16 @@
order by ${orderByClause}
</if>
</select>
<select id="selectByPrimaryKey" parameterType="java.lang.String" resultMap="BaseResultMap">
select
<include refid="Base_Column_List" />
from notice
where id = #{id,jdbcType=VARCHAR}
</select>
<delete id="deleteByPrimaryKey" parameterType="java.lang.String">
DELETE FROM notice
WHERE id = #{id,jdbcType=VARCHAR}
</delete>
<delete id="deleteByExample" parameterType="io.metersphere.base.domain.NoticeExample">
delete from notice
<if test="_parameter != null">
@ -90,14 +101,17 @@
</if>
</delete>
<insert id="insert" parameterType="io.metersphere.base.domain.Notice">
insert into notice (EVENT, TEST_ID, `NAME`,
EMAIL, `ENABLE`)
values (#{event,jdbcType=VARCHAR}, #{testId,jdbcType=VARCHAR}, #{name,jdbcType=VARCHAR},
#{email,jdbcType=VARCHAR}, #{enable,jdbcType=VARCHAR})
INSERT INTO notice (id, EVENT, TEST_ID,
`NAME`, `ENABLE`, `type`)
VALUES (#{id,jdbcType=VARCHAR}, #{event,jdbcType=VARCHAR}, #{testId,jdbcType=VARCHAR},
#{name,jdbcType=VARCHAR}, #{enable,jdbcType=VARCHAR}, #{type,jdbcType=VARCHAR})
</insert>
<insert id="insertSelective" parameterType="io.metersphere.base.domain.Notice">
insert into notice
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null">
id,
</if>
<if test="event != null">
EVENT,
</if>
@ -107,14 +121,17 @@
<if test="name != null">
`NAME`,
</if>
<if test="email != null">
EMAIL,
</if>
<if test="enable != null">
`ENABLE`,
</if>
<if test="type != null">
`type`,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id != null">
#{id,jdbcType=VARCHAR},
</if>
<if test="event != null">
#{event,jdbcType=VARCHAR},
</if>
@ -124,12 +141,12 @@
<if test="name != null">
#{name,jdbcType=VARCHAR},
</if>
<if test="email != null">
#{email,jdbcType=VARCHAR},
</if>
<if test="enable != null">
#{enable,jdbcType=VARCHAR},
</if>
<if test="type != null">
#{type,jdbcType=VARCHAR},
</if>
</trim>
</insert>
<select id="countByExample" parameterType="io.metersphere.base.domain.NoticeExample" resultType="java.lang.Long">
@ -141,6 +158,9 @@
<update id="updateByExampleSelective" parameterType="map">
update notice
<set>
<if test="record.id != null">
id = #{record.id,jdbcType=VARCHAR},
</if>
<if test="record.event != null">
EVENT = #{record.event,jdbcType=VARCHAR},
</if>
@ -150,12 +170,12 @@
<if test="record.name != null">
`NAME` = #{record.name,jdbcType=VARCHAR},
</if>
<if test="record.email != null">
EMAIL = #{record.email,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>
</set>
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
@ -163,13 +183,44 @@
</update>
<update id="updateByExample" parameterType="map">
update notice
set EVENT = #{record.event,jdbcType=VARCHAR},
set id = #{record.id,jdbcType=VARCHAR},
EVENT = #{record.event,jdbcType=VARCHAR},
TEST_ID = #{record.testId,jdbcType=VARCHAR},
`NAME` = #{record.name,jdbcType=VARCHAR},
EMAIL = #{record.email,jdbcType=VARCHAR},
`ENABLE` = #{record.enable,jdbcType=VARCHAR}
`ENABLE` = #{record.enable,jdbcType=VARCHAR},
`type` = #{record.type,jdbcType=VARCHAR}
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
</if>
</update>
<update id="updateByPrimaryKeySelective" parameterType="io.metersphere.base.domain.Notice">
update notice
<set>
<if test="event != null">
EVENT = #{event,jdbcType=VARCHAR},
</if>
<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>
</set>
where id = #{id,jdbcType=VARCHAR}
</update>
<update id="updateByPrimaryKey" parameterType="io.metersphere.base.domain.Notice">
UPDATE notice
SET EVENT = #{event,jdbcType=VARCHAR},
TEST_ID = #{testId,jdbcType=VARCHAR},
`NAME` = #{name,jdbcType=VARCHAR},
`ENABLE` = #{enable,jdbcType=VARCHAR},
`type` = #{type,jdbcType=VARCHAR}
WHERE id = #{id,jdbcType=VARCHAR}
</update>
</mapper>

View File

@ -0,0 +1,6 @@
package io.metersphere.commons.constants;
public interface NoticeConstants {
String EXECUTE_SUCCESSFUL = "EXECUTE_SUCCESSFUL";
String EXECUTE_FAILED = "EXECUTE_FAILED";
}

View File

@ -6,8 +6,7 @@ import lombok.Data;
import java.util.List;
@Data
public class NoticeRequest extends NoticeDetail {
private String testId;
private List<NoticeDetail> notices;
public class NoticeRequest {
private String testId;
private List<NoticeDetail> notices;
}

View File

@ -6,16 +6,4 @@ import lombok.Data;
@Data
public class NoticeDetail extends Notice {
private String[] names;
private String[] emails;
private String event;
private String testId;
private String name;
private String email;
private String enable;
}

View File

@ -4,6 +4,7 @@ import io.metersphere.base.domain.ApiTestReport;
import io.metersphere.base.domain.LoadTestWithBLOBs;
import io.metersphere.base.domain.SystemParameter;
import io.metersphere.base.domain.TestCaseWithBLOBs;
import io.metersphere.commons.constants.NoticeConstants;
import io.metersphere.commons.constants.ParamConstants;
import io.metersphere.commons.utils.EncryptUtils;
import io.metersphere.commons.utils.LogUtil;
@ -222,10 +223,10 @@ public class MailService {
List<String> failEmailList = new ArrayList<>();
if (noticeList.size() > 0) {
for (NoticeDetail n : noticeList) {
if (n.getEnable().equals("true") && n.getEvent().equals("执行成功")) {
if (n.getEnable().equals("true") && n.getEvent().equals(NoticeConstants.EXECUTE_SUCCESSFUL)) {
successEmailList = userService.queryEmail(n.getNames());
}
if (n.getEnable().equals("true") && n.getEvent().equals("执行失败")) {
if (n.getEnable().equals("true") && n.getEvent().equals(NoticeConstants.EXECUTE_FAILED)) {
failEmailList = userService.queryEmail(n.getNames());
}
}

View File

@ -10,6 +10,10 @@ import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.List;
import java.util.UUID;
import static io.metersphere.commons.constants.NoticeConstants.EXECUTE_FAILED;
import static io.metersphere.commons.constants.NoticeConstants.EXECUTE_SUCCESSFUL;
@Service
public class NoticeService {
@ -17,34 +21,24 @@ public class NoticeService {
private NoticeMapper noticeMapper;
public void saveNotice(NoticeRequest noticeRequest) {
Notice notice = new Notice();
NoticeExample example = new NoticeExample();
example.createCriteria().andTestIdEqualTo(noticeRequest.getTestId());
List<Notice> notices = noticeMapper.selectByExample(example);
if (notices.size() > 0) {
noticeMapper.deleteByExample(example);
}
saveNotice(noticeRequest, notice);
}
private void saveNotice(NoticeRequest noticeRequest, Notice notice) {
noticeRequest.getNotices().forEach(n -> {
if (n.getNames().length > 0) {
for (String x : n.getNames()) {
Notice notice = new Notice();
notice.setId(UUID.randomUUID().toString());
notice.setEvent(n.getEvent());
notice.setEmail(n.getEmail());
notice.setEnable(n.getEnable());
notice.setTestId(noticeRequest.getTestId());
notice.setName(x);
notice.setType(n.getType());
noticeMapper.insert(notice);
}
} else {
notice.setEvent(n.getEvent());
notice.setEmail(n.getEmail());
notice.setEnable(n.getEnable());
notice.setTestId(noticeRequest.getTestId());
notice.setName("");
noticeMapper.insert(notice);
}
});
}
@ -53,7 +47,7 @@ public class NoticeService {
NoticeExample example = new NoticeExample();
example.createCriteria().andTestIdEqualTo(id);
List<Notice> notices = noticeMapper.selectByExample(example);
List<NoticeDetail> notice = new ArrayList<>();
List<NoticeDetail> result = new ArrayList<>();
List<String> success = new ArrayList<>();
List<String> fail = new ArrayList<>();
String[] successArray;
@ -62,29 +56,29 @@ public class NoticeService {
NoticeDetail notice2 = new NoticeDetail();
if (notices.size() > 0) {
for (Notice n : notices) {
if (n.getEvent().equals("执行成功")) {
if (n.getEvent().equals(EXECUTE_SUCCESSFUL)) {
success.add(n.getName());
notice1.setEnable(n.getEnable());
notice1.setTestId(id);
notice1.setType(n.getType());
notice1.setEvent(n.getEvent());
notice1.setEmail(n.getEmail());
}
if (n.getEvent().equals("执行失败")) {
if (n.getEvent().equals(EXECUTE_FAILED)) {
fail.add(n.getName());
notice2.setEnable(n.getEnable());
notice2.setTestId(id);
notice2.setType(n.getType());
notice2.setEvent(n.getEvent());
notice2.setEmail(n.getEmail());
}
}
successArray = success.toArray(new String[success.size()]);
failArray = fail.toArray(new String[fail.size()]);
successArray = success.toArray(new String[0]);
failArray = fail.toArray(new String[0]);
notice1.setNames(successArray);
notice2.setNames(failArray);
notice.add(notice1);
notice.add(notice2);
result.add(notice1);
result.add(notice2);
}
return notice;
return result;
}
}

View File

@ -36,6 +36,11 @@ public class TestCaseIssuesController {
issuesService.closeLocalIssue(id);
}
@GetMapping("/delete/{id}")
public void deleteIssue(@PathVariable String id) {
issuesService.deleteIssue(id);
}
@GetMapping("/tapd/user/{caseId}")
public List<TapdUser> getTapdUsers(@PathVariable String caseId) {
return issuesService.getTapdProjectUsers(caseId);

View File

@ -507,11 +507,7 @@ public class IssuesService {
}
public List<Issues> getLocalIssues(String caseId) {
List<Issues> list = extIssuesMapper.getIssues(caseId, IssuesManagePlatform.Local.toString());
List<Issues> issues = list.stream()
.filter(l -> !StringUtils.equals(l.getStatus(), "closed"))
.collect(Collectors.toList());
return issues;
return extIssuesMapper.getIssues(caseId, IssuesManagePlatform.Local.toString());
}
public String getTapdProjectId(String testCaseId) {
@ -559,4 +555,7 @@ public class IssuesService {
return users;
}
public void deleteIssue(String id) {
issuesMapper.deleteByPrimaryKey(id);
}
}

@ -1 +1 @@
Subproject commit c2dacf960cdb1ed35664bdd3432120b1203b73d8
Subproject commit cf6b06526324326a563d933e07118fac014a63b4

View File

@ -0,0 +1,10 @@
ALTER TABLE notice
ADD COLUMN id VARCHAR(50);
UPDATE notice
SET id = uuid();
ALTER TABLE notice
MODIFY COLUMN id VARCHAR(50) PRIMARY KEY;
ALTER TABLE notice
DROP COLUMN EMAIL;
ALTER TABLE notice
ADD COLUMN type VARCHAR(100) DEFAULT 'EMAIL';

View File

@ -5,7 +5,7 @@
</span>
<div class="kv-row" v-for="(item, index) in items" :key="index">
<el-row type="flex" :gutter="20" justify="space-between" align="middle">
<el-col v-if="isShowEnable" class="kv-checkbox">
<el-col class="kv-checkbox">
<input type="checkbox" v-if="!isDisable(index)" v-model="item.enable"
:disabled="isReadOnly"/>
</el-col>
@ -19,6 +19,7 @@
show-word-limit/>
</el-col>
<el-col>
<el-input :disabled="isReadOnly" v-model="item.value" size="small" @change="change"
:placeholder="valueText" show-word-limit/>
@ -42,7 +43,6 @@
keyPlaceholder: String,
valuePlaceholder: String,
description: String,
isShowEnable: Boolean,
items: Array,
isReadOnly: {
type: Boolean,
@ -52,7 +52,6 @@
},
data() {
return {
// checkedValues: []
}
},
computed: {
@ -66,11 +65,6 @@
methods: {
remove: function (index) {
if (this.isShowEnable) {
//
let checkIndex = this.checkedValues.indexOf(this.items[index].uuid);
checkIndex != -1 ? this.checkedValues.splice(checkIndex, 1) : this.checkedValues;
}
//
this.items.splice(index, 1);
this.$emit('change', this.items);

View File

@ -29,7 +29,7 @@
<el-tabs v-model="activeName" :disabled="isReadOnly">
<el-tab-pane :label="$t('api_test.scenario.variables')" name="parameters">
<ms-api-scenario-variables :isShowEnable="true" :is-read-only="isReadOnly" :items="scenario.variables"
<ms-api-scenario-variables :is-read-only="isReadOnly" :items="scenario.variables"
:description="$t('api_test.scenario.kv_description')"/>
</el-tab-pane>
<el-tab-pane :label="$t('api_test.scenario.headers')" name="headers">

View File

@ -5,8 +5,8 @@
</span>
<div class="kv-row" v-for="(item, index) in items" :key="index">
<el-row type="flex" :gutter="20" justify="space-between" align="middle">
<el-col v-if="isShowEnable" class="kv-checkbox">
<input type="checkbox" v-if="!isDisable(index)" @change="change" :value="item.uuid" v-model="checkedValues"
<el-col class="kv-checkbox">
<input type="checkbox" v-if="!isDisable(index)" @change="change" :value="item.uuid" v-model="item.enable"
:disabled="isDisable(index) || isReadOnly"/>
</el-col>
@ -41,10 +41,6 @@
type: Boolean,
default: false
},
isShowEnable: {
type: Boolean,
default: false
},
showVariable: {
type: Boolean,
default: true
@ -52,16 +48,10 @@
},
data() {
return {
checkedValues: []
}
},
methods: {
remove: function (index) {
if (this.isShowEnable) {
//
let checkIndex = this.checkedValues.indexOf(this.items[index].uuid);
checkIndex != -1 ? this.checkedValues.splice(checkIndex, 1) : this.checkedValues;
}
this.items.splice(index, 1);
this.$emit('change', this.items);
},
@ -69,10 +59,6 @@
let isNeedCreate = true;
let removeIndex = -1;
this.items.forEach((item, index) => {
//
if (this.isShowEnable) {
item.enable = this.checkedValues.indexOf(item.uuid) != -1 ? true : false;
}
if (!item.name && !item.value) {
//
if (index !== this.items.length - 1) {
@ -83,20 +69,11 @@
}
});
if (isNeedCreate) {
//
if (this.isShowEnable) {
this.items[this.items.length - 1].enable = true;
// v-model
this.checkedValues.push(this.items[this.items.length - 1].uuid);
}
this.items.push(new KeyValue());
this.items.push(new KeyValue({enable: true}));
}
this.$emit('change', this.items);
// TODO key
},
uuid: function () {
return (((1 + Math.random()) * 0x100000) | 0).toString(16).substring(1);
},
isDisable: function (index) {
return this.items.length - 1 === index;
}
@ -104,15 +81,7 @@
created() {
if (this.items.length === 0) {
this.items.push(new KeyValue());
}else if (this.isShowEnable) {
this.items.forEach((item, index) => {
let uuid = this.uuid();
item.uuid = uuid;
if (item.enable) {
this.checkedValues.push(uuid);
}
})
this.items.push(new KeyValue({enable: true}));
}
}
}

View File

@ -1,5 +1,5 @@
<template>
<el-dialog :close-on-click-modal="false" width="50%" class="schedule-edit" :visible.sync="dialogVisible"
<el-dialog :close-on-click-modal="false" width="60%" class="schedule-edit" :visible.sync="dialogVisible"
@close="close">
<template>
<div>
@ -21,7 +21,7 @@
</el-form-item>
<crontab-result :ex="form.cronValue" ref="crontabResult"/>
</el-form>
<el-dialog :title="$t('schedule.generate_expression')" :visible.sync="showCron" :modal="false">
<el-dialog width="60%" :title="$t('schedule.generate_expression')" :visible.sync="showCron" :modal="false">
<crontab @hide="showCron=false" @fill="crontabFill" :expression="schedule.value" ref="crontab"/>
</el-dialog>
</el-tab-pane>
@ -32,9 +32,12 @@
style="width: 100%">
<el-table-column
prop="event"
:label="$t('schedule.event')"
>
:label="$t('schedule.event')">
<template v-slot:default="{row}">
<span v-if="row.event === 'EXECUTE_SUCCESSFUL'"> {{ $t('schedule.event_success') }}</span>
<span v-else-if="row.event === 'EXECUTE_FAILED'"> {{ $t('schedule.event_failed') }}</span>
<span v-else>{{ row.event }}</span>
</template>
</el-table-column>
<el-table-column
prop="name"
@ -42,7 +45,8 @@
width="200"
>
<template v-slot:default="{row}">
<el-select v-model="row.names" filterable multiple placeholder="请选择" @click.native="userList()">
<el-select v-model="row.names" filterable multiple :placeholder="$t('commons.please_select')"
@click.native="userList()">
<el-option
v-for="item in options"
:key="item.id"
@ -53,7 +57,7 @@
</template>
</el-table-column>
<el-table-column
prop="email"
prop="type"
:label="$t('schedule.receiving_mode')"
>
</el-table-column>
@ -63,10 +67,10 @@
>
<template v-slot:default="{row}">
<el-switch
v-model="row.enable"
active-value="true"
inactive-value="false"
inactive-color="#DCDFE6"
v-model="row.enable"
active-value="true"
inactive-value="false"
inactive-color="#DCDFE6"
/>
</template>
</el-table-column>
@ -142,21 +146,21 @@ export default {
},
tableData: [
{
event: "执行成功",
event: "EXECUTE_SUCCESSFUL",
type: "EMAIL",
names: [],
email: "邮箱",
enable: false
},
{
event: "执行失败",
event: "EXECUTE_FAILED",
type: "EMAIL",
names: [],
email: "邮箱",
enable: false
}
],
options: [{}],
enable: true,
email: "",
type: "",
activeName: 'first',
rules: {
cronValue: [{required: true, validator: validateCron, trigger: 'blur'}],
@ -170,17 +174,18 @@ export default {
})
},
handleClick() {
if (this.activeName == "second") {
if (this.activeName === "second") {
this.result = this.$get('notice/query/' + this.testId, response => {
if (response.data.length > 0) {
this.tableData = response.data
this.tableData[0].email="邮箱"
this.tableData[0].event="执行成功"
this.tableData[1].email="邮箱"
this.tableData[1].event="执行失败"
}else{
this.tableData[0].names=[]
this.tableData[1].names=[]
this.tableData[0].event = "EXECUTE_SUCCESSFUL"
this.tableData[0].type = "EMAIL"
this.tableData[1].event = "EXECUTE_FAILED"
this.tableData[1].type = "EMAIL"
} else {
this.tableData[0].names = []
this.tableData[1].names = []
}
})
}

View File

@ -334,14 +334,10 @@
},
handleSelectAll(selection) {
if (selection.length > 0) {
if (selection.length === 1) {
this.selectRows.add(selection[0]);
} else {
this.tableData.forEach(item => {
this.$set(item, "showMore", true);
this.selectRows.add(item);
});
}
this.tableData.forEach(item => {
this.$set(item, "showMore", true);
this.selectRows.add(item);
});
} else {
this.selectRows.clear();
this.tableData.forEach(row => {
@ -350,11 +346,6 @@
}
},
handleSelectionChange(selection, row) {
// if (this.selectIds.has(row.id)) {
// this.selectIds.delete(row.id);
// } else {
// this.selectIds.add(row.id);
// }
if (this.selectRows.has(row)) {
this.$set(row, "showMore", false);
this.selectRows.delete(row);
@ -362,17 +353,6 @@
this.$set(row, "showMore", true);
this.selectRows.add(row);
}
let arr = Array.from(this.selectRows);
// 1
if (this.selectRows.size === 1) {
this.$set(arr[0], "showMore", false);
} else if (this.selectRows.size === 2) {
arr.forEach(row => {
this.$set(row, "showMore", true);
})
}
},
importTestCase() {
this.$refs.testCaseImport.open();

View File

@ -21,29 +21,29 @@
<el-col :span="12">
<el-button plain size="mini"
icon="el-icon-back"
@click="cancel">{{$t('test_track.return')}}
@click="cancel">{{ $t('test_track.return') }}
</el-button>
</el-col>
<el-col :span="12" class="head-right">
<span class="head-right-tip" v-if="index + 1 == testCases.length">
{{$t('test_track.plan_view.pre_case')}} : {{testCases[index - 1] ? testCases[index - 1].name : ''}}
{{ $t('test_track.plan_view.pre_case') }} : {{ testCases[index - 1] ? testCases[index - 1].name : '' }}
</span>
<span class="head-right-tip" v-if="index + 1 != testCases.length">
{{$t('test_track.plan_view.next_case')}} : {{testCases[index + 1] ? testCases[index + 1].name : ''}}
{{ $t('test_track.plan_view.next_case') }} : {{ testCases[index + 1] ? testCases[index + 1].name : '' }}
</span>
<el-button plain size="mini" icon="el-icon-arrow-up"
:disabled="index + 1 <= 1"
@click="handlePre()"/>
<span> {{index + 1}}/{{testCases.length}} </span>
<span> {{ index + 1 }}/{{ testCases.length }} </span>
<el-button plain size="mini" icon="el-icon-arrow-down"
:disabled="index + 1 >= testCases.length"
@click="handleNext()"/>
<el-divider direction="vertical"></el-divider>
<el-button type="primary" size="mini" :disabled="isReadOnly" @click="saveCase()">
{{$t('test_track.save')}}
{{ $t('test_track.save') }}
</el-button>
</el-col>
@ -51,7 +51,7 @@
<el-row style="margin-top: 0px;">
<el-col>
<el-divider content-position="left">{{testCase.name}}</el-divider>
<el-divider content-position="left">{{ testCase.name }}</el-divider>
</el-col>
</el-row>
@ -60,14 +60,14 @@
<div class="case_container">
<el-row>
<el-col :span="4" :offset="1">
<span class="cast_label">{{$t('test_track.case.priority')}}</span>
<span class="cast_item">{{testCase.priority}}</span>
<span class="cast_label">{{ $t('test_track.case.priority') }}</span>
<span class="cast_item">{{ testCase.priority }}</span>
</el-col>
<el-col :span="5">
<span class="cast_label">{{$t('test_track.case.case_type')}}</span>
<span class="cast_item" v-if="testCase.type == 'functional'">{{$t('commons.functional')}}</span>
<span class="cast_item" v-if="testCase.type == 'performance'">{{$t('commons.performance')}}</span>
<span class="cast_item" v-if="testCase.type == 'api'">{{$t('commons.api')}}</span>
<span class="cast_label">{{ $t('test_track.case.case_type') }}</span>
<span class="cast_item" v-if="testCase.type == 'functional'">{{ $t('commons.functional') }}</span>
<span class="cast_item" v-if="testCase.type == 'performance'">{{ $t('commons.performance') }}</span>
<span class="cast_item" v-if="testCase.type == 'api'">{{ $t('commons.api') }}</span>
</el-col>
<el-col :span="13">
<test-plan-test-case-status-button class="status-button"
@ -80,24 +80,24 @@
<el-row>
<el-col :span="4" :offset="1">
<span class="cast_label">{{$t('test_track.case.method')}}</span>
<span v-if="testCase.method == 'manual'">{{$t('test_track.case.manual')}}</span>
<span v-if="testCase.method == 'auto'">{{$t('test_track.case.auto')}}</span>
<span class="cast_label">{{ $t('test_track.case.method') }}</span>
<span v-if="testCase.method == 'manual'">{{ $t('test_track.case.manual') }}</span>
<span v-if="testCase.method == 'auto'">{{ $t('test_track.case.auto') }}</span>
</el-col>
<el-col :span="5">
<span class="cast_label">{{$t('test_track.case.module')}}</span>
<span class="cast_item">{{testCase.nodePath}}</span>
<span class="cast_label">{{ $t('test_track.case.module') }}</span>
<span class="cast_item">{{ testCase.nodePath }}</span>
</el-col>
<el-col :span="4" :offset="1">
<span class="cast_label">{{$t('test_track.plan.plan_project')}}</span>
<span class="cast_item">{{testCase.projectName}}</span>
<span class="cast_label">{{ $t('test_track.plan.plan_project') }}</span>
<span class="cast_item">{{ testCase.projectName }}</span>
</el-col>
</el-row>
<el-row>
<el-col :offset="1">
<span class="cast_label">{{$t('test_track.case.prerequisite')}}</span>
<span class="cast_item">{{testCase.prerequisite}}</span>
<span class="cast_label">{{ $t('test_track.case.prerequisite') }}</span>
<span class="cast_item">{{ testCase.prerequisite }}</span>
</el-col>
</el-row>
@ -122,7 +122,7 @@
<el-row v-if="testCase.method && testCase.method != 'auto'">
<el-col :span="20" :offset="1">
<div>
<span class="cast_label">{{$t('test_track.case.steps')}}</span>
<span class="cast_label">{{ $t('test_track.case.steps') }}</span>
</div>
<el-table
:data="testCase.steptResults"
@ -220,12 +220,14 @@
v-model="testCase.issues.content"/>
<el-row v-if="hasTapdId">
Tapd平台处理人
<el-select v-model="testCase.tapdUsers" placeholder="请选择处理人" style="width: 20%" multiple collapse-tags>
<el-option v-for="(userInfo, index) in users" :key="index" :label="userInfo.user" :value="userInfo.user"/>
<el-select v-model="testCase.tapdUsers" placeholder="请选择处理人" style="width: 20%" multiple
collapse-tags>
<el-option v-for="(userInfo, index) in users" :key="index" :label="userInfo.user"
:value="userInfo.user"/>
</el-select>
</el-row>
<el-button type="primary" size="small" @click="saveIssues">{{$t('commons.save')}}</el-button>
<el-button size="small" @click="issuesSwitch=false">{{$t('commons.cancel')}}</el-button>
<el-button type="primary" size="small" @click="saveIssues">{{ $t('commons.save') }}</el-button>
<el-button size="small" @click="issuesSwitch=false">{{ $t('commons.cancel') }}</el-button>
</el-col>
</el-row>
@ -240,10 +242,10 @@
placement="left"
width="400"
trigger="hover"
>
>
<ckeditor :editor="editor" disabled :config="readConfig"
v-model="scope.row.description"/>
<el-button slot="reference" type="text">{{$t('test_track.issue.preview')}}</el-button>
<el-button slot="reference" type="text">{{ $t('test_track.issue.preview') }}</el-button>
</el-popover>
</template>
</el-table-column>
@ -252,12 +254,19 @@
<el-table-column :label="$t('test_track.issue.operate')">
<template v-slot:default="scope">
<el-tooltip :content="$t('test_track.issue.close')"
placement="right">
placement="top" :enterable="false">
<el-button type="danger" icon="el-icon-circle-close" size="mini"
circle v-if="scope.row.platform === 'Local'"
@click="closeIssue(scope.row)"
/>
</el-tooltip>
<el-tooltip :content="$t('test_track.issue.delete')"
placement="top" :enterable="false">
<el-button type="danger" icon="el-icon-delete" size="mini"
circle v-if="scope.row.platform === 'Local'"
@click="deleteIssue(scope.row)"
/>
</el-tooltip>
</template>
</el-table-column>
</el-table>
@ -267,8 +276,9 @@
<el-row>
<el-col :span="15" :offset="1">
<div>
<span class="cast_label">{{$t('commons.remark')}}</span>
<span v-if="testCase.remark == null || testCase.remark == ''" style="color: darkgrey">{{$t('commons.not_filled')}}</span>
<span class="cast_label">{{ $t('commons.remark') }}</span>
<span v-if="testCase.remark == null || testCase.remark == ''"
style="color: darkgrey">{{ $t('commons.not_filled') }}</span>
</div>
<div>
<el-input :rows="3"
@ -293,327 +303,337 @@
</template>
<script>
import TestPlanTestCaseStatusButton from '../../common/TestPlanTestCaseStatusButton';
import ClassicEditor from '@ckeditor/ckeditor5-build-classic';
import ApiTestDetail from "./test/ApiTestDetail";
import ApiTestResult from "./test/ApiTestResult";
import PerformanceTestDetail from "./test/PerformanceTestDetail";
import PerformanceTestResult from "./test/PerformanceTestResult";
import {listenGoBack, removeGoBackListener} from "../../../../../../common/js/utils";
import {CURRENT_PROJECT} from "../../../../../../common/js/constants";
import TestPlanTestCaseStatusButton from '../../common/TestPlanTestCaseStatusButton';
import ClassicEditor from '@ckeditor/ckeditor5-build-classic';
import ApiTestDetail from "./test/ApiTestDetail";
import ApiTestResult from "./test/ApiTestResult";
import PerformanceTestDetail from "./test/PerformanceTestDetail";
import PerformanceTestResult from "./test/PerformanceTestResult";
import {listenGoBack, removeGoBackListener} from "../../../../../../common/js/utils";
import {CURRENT_PROJECT} from "../../../../../../common/js/constants";
export default {
name: "TestPlanTestCaseEdit",
components: {
PerformanceTestResult,
PerformanceTestDetail,
ApiTestResult,
ApiTestDetail,
TestPlanTestCaseStatusButton
export default {
name: "TestPlanTestCaseEdit",
components: {
PerformanceTestResult,
PerformanceTestDetail,
ApiTestResult,
ApiTestDetail,
TestPlanTestCaseStatusButton
},
data() {
return {
result: {},
showDialog: false,
testCase: {},
index: 0,
issuesSwitch: false,
testCases: [],
issues: [],
editor: ClassicEditor,
editorConfig: {
// 'increaseIndent','decreaseIndent'
toolbar: ['heading', '|', 'bold', 'italic', 'link', 'bulletedList', 'numberedList', 'blockQuote', 'insertTable', '|', 'undo', 'redo'],
},
readConfig: {toolbar: []},
test: {},
activeTab: 'detail',
isFailure: true,
users: [],
hasTapdId: false
};
},
props: {
total: {
type: Number
},
data() {
return {
result: {},
showDialog: false,
testCase: {},
index: 0,
issuesSwitch: false,
testCases: [],
issues: [],
editor: ClassicEditor,
editorConfig: {
// 'increaseIndent','decreaseIndent'
toolbar: ['heading', '|', 'bold', 'italic', 'link', 'bulletedList', 'numberedList', 'blockQuote', 'insertTable', '|', 'undo', 'redo'],
},
readConfig: {toolbar: []},
test: {},
activeTab: 'detail',
isFailure: true,
users: [],
hasTapdId: false
};
searchParam: {
type: Object
},
props: {
total: {
type: Number
},
searchParam: {
type: Object
},
isReadOnly: {
type: Boolean,
default: false
}
isReadOnly: {
type: Boolean,
default: false
}
},
methods: {
handleClose() {
removeGoBackListener(this.handleClose);
this.showDialog = false;
},
methods: {
handleClose() {
removeGoBackListener(this.handleClose);
this.showDialog = false;
},
cancel() {
this.handleClose();
this.$emit('refreshTable');
},
statusChange(status) {
this.testCase.status = status;
},
saveCase() {
let param = {};
param.id = this.testCase.id;
param.status = this.testCase.status;
param.results = [];
cancel() {
this.handleClose();
this.$emit('refreshTable');
},
statusChange(status) {
this.testCase.status = status;
},
saveCase() {
let param = {};
param.id = this.testCase.id;
param.status = this.testCase.status;
param.results = [];
for (let i = 0; i < this.testCase.steptResults.length; i++) {
let result = {};
result.actualResult = this.testCase.steptResults[i].actualResult;
result.executeResult = this.testCase.steptResults[i].executeResult;
if (result.actualResult && result.actualResult.length > 300) {
this.$warning(this.$t('test_track.plan_view.actual_result')
+ this.$t('test_track.length_less_than') + '300');
return;
}
param.results.push(result);
}
param.results = JSON.stringify(param.results);
param.issues = JSON.stringify(this.testCase.issues);
this.$post('/test/plan/case/edit', param, () => {
this.$success(this.$t('commons.save_success'));
this.updateTestCases(param);
this.setPlanStatus(this.testCase.planId);
});
},
updateTestCases(param) {
for (let i = 0; i < this.testCases.length; i++) {
let testCase = this.testCases[i];
if (testCase.id === param.id) {
testCase.results = param.results;
testCase.issues = param.issues;
testCase.status = param.status;
return;
}
}
},
handleNext() {
this.index++;
this.getTestCase(this.index);
},
handlePre() {
this.index--;
this.getTestCase(this.index);
},
getTestCase(index) {
let testCase = this.testCases[index];
let item = {};
Object.assign(item, testCase);
item.results = JSON.parse(item.results);
item.steps = JSON.parse(item.steps);
if (item.issues) {
item.issues = JSON.parse(item.issues);
} else {
item.issues = {};
item.issues.hasIssues = false;
}
item.steptResults = [];
for (let i = 0; i < item.steps.length; i++) {
if (item.results[i]) {
item.steps[i].actualResult = item.results[i].actualResult;
item.steps[i].executeResult = item.results[i].executeResult;
}
item.steptResults.push(item.steps[i]);
}
this.testCase = item;
this.initTest();
this.getIssues(testCase.caseId);
this.stepResultChange();
},
openTestCaseEdit(testCase) {
this.showDialog = true;
this.issuesSwitch = false;
this.activeTab = 'detail';
listenGoBack(this.handleClose);
this.initData(testCase);
},
initTest() {
this.$nextTick(() => {
if (this.testCase.method == 'auto') {
if (this.$refs.apiTestDetail && this.testCase.type == 'api') {
this.$refs.apiTestDetail.init();
} else if (this.testCase.type == 'performance') {
this.$refs.performanceTestDetail.init();
}
}
});
},
testRun(reportId) {
this.testCase.reportId = reportId;
this.saveReport(reportId);
this.activeTab = 'result';
},
testTabChange(data) {
if (this.testCase.type == 'performance' && data.paneName == 'result') {
this.$refs.performanceTestResult.checkReportStatus();
this.$refs.performanceTestResult.init();
}
},
saveReport(reportId) {
this.$post('/test/plan/case/edit', {id: this.testCase.id, reportId: reportId});
},
initData(testCase) {
this.result = this.$post('/test/plan/case/list/all', this.searchParam, response => {
this.testCases = response.data;
for (let i = 0; i < this.testCases.length; i++) {
if (this.testCases[i].id === testCase.id) {
this.index = i;
this.getTestCase(i);
this.getRelatedTest();
}
}
});
},
getRelatedTest() {
if (this.testCase.method == 'auto' && this.testCase.testId && this.testCase.testId != 'other') {
this.$get('/' + this.testCase.type + '/get/' + this.testCase.testId, response => {
let data = response.data;
if (data) {
this.test = data;
} else {
this.test = {};
this.$warning(this.$t("test_track.case.relate_test_not_find"));
}
});
} else if (this.testCase.testId === 'other' && this.testCase.method == 'auto') {
this.$warning(this.$t("test_track.case.other_relate_test_not_find"));
}
},
issuesChange() {
if (this.issuesSwitch) {
let desc = this.addPLabel('[' + this.$t('test_track.plan_view.operate_step') + ']');
let result = this.addPLabel('[' + this.$t('test_track.case.expected_results') + ']');
let actualResult = this.addPLabel('[' + this.$t('test_track.plan_view.actual_result') + ']');
this.testCase.steps.forEach(step => {
let stepPrefix = this.$t('test_track.plan_view.step') + step.num + ':';
desc += this.addPLabel(stepPrefix + (step.desc == undefined ? '' : step.desc));
result += this.addPLabel(stepPrefix + (step.result == undefined ? '' : step.result));
actualResult += this.addPLabel(stepPrefix + (step.actualResult == undefined ? '' : step.actualResult));
});
this.testCase.issues.content = desc + this.addPLabel('') + result + this.addPLabel('') + actualResult + this.addPLabel('');
this.$get("/test/case/project/" + this.testCase.caseId, res => {
const project = res.data;
if (project.tapdId) {
this.hasTapdId = true;
this.result = this.$get("/issues/tapd/user/" + this.testCase.caseId, response => {
let data = response.data;
this.users = data;
})
}
})
}
},
addPLabel(str) {
return "<p>" + str + "</p>";
},
setPlanStatus(planId) {
this.$post('/test/plan/edit/status/' + planId);
},
stepResultChange() {
if (this.testCase.method == 'manual') {
this.isFailure = this.testCase.steptResults.filter(s => {
return s.executeResult === 'Failure' || s.executeResult === 'Blocking';
}).length > 0;
}
},
saveIssues() {
if (!this.testCase.issues.title || !this.testCase.issues.content) {
this.$warning(this.$t('test_track.issue.title_description_required'));
for (let i = 0; i < this.testCase.steptResults.length; i++) {
let result = {};
result.actualResult = this.testCase.steptResults[i].actualResult;
result.executeResult = this.testCase.steptResults[i].executeResult;
if (result.actualResult && result.actualResult.length > 300) {
this.$warning(this.$t('test_track.plan_view.actual_result')
+ this.$t('test_track.length_less_than') + '300');
return;
}
let param = {};
param.title = this.testCase.issues.title;
param.content = this.testCase.issues.content;
param.testCaseId = this.testCase.caseId;
param.tapdUsers = this.testCase.tapdUsers;
this.result = this.$post("/issues/add", param, () => {
this.$success(this.$t('commons.save_success'));
this.getIssues(param.testCaseId);
});
this.issuesSwitch = false;
this.testCase.issues.title = "";
this.testCase.issues.content = "";
this.testCase.tapdUsers = [];
},
getIssues(caseId) {
this.result = this.$get("/issues/get/" + caseId, response => {
param.results.push(result);
}
param.results = JSON.stringify(param.results);
param.issues = JSON.stringify(this.testCase.issues);
this.$post('/test/plan/case/edit', param, () => {
this.$success(this.$t('commons.save_success'));
this.updateTestCases(param);
this.setPlanStatus(this.testCase.planId);
});
},
updateTestCases(param) {
for (let i = 0; i < this.testCases.length; i++) {
let testCase = this.testCases[i];
if (testCase.id === param.id) {
testCase.results = param.results;
testCase.issues = param.issues;
testCase.status = param.status;
return;
}
}
},
handleNext() {
this.index++;
this.getTestCase(this.index);
},
handlePre() {
this.index--;
this.getTestCase(this.index);
},
getTestCase(index) {
let testCase = this.testCases[index];
let item = {};
Object.assign(item, testCase);
item.results = JSON.parse(item.results);
item.steps = JSON.parse(item.steps);
if (item.issues) {
item.issues = JSON.parse(item.issues);
} else {
item.issues = {};
item.issues.hasIssues = false;
}
item.steptResults = [];
for (let i = 0; i < item.steps.length; i++) {
if (item.results[i]) {
item.steps[i].actualResult = item.results[i].actualResult;
item.steps[i].executeResult = item.results[i].executeResult;
}
item.steptResults.push(item.steps[i]);
}
this.testCase = item;
this.initTest();
this.getIssues(testCase.caseId);
this.stepResultChange();
},
openTestCaseEdit(testCase) {
this.showDialog = true;
this.issuesSwitch = false;
this.activeTab = 'detail';
listenGoBack(this.handleClose);
this.initData(testCase);
},
initTest() {
this.$nextTick(() => {
if (this.testCase.method == 'auto') {
if (this.$refs.apiTestDetail && this.testCase.type == 'api') {
this.$refs.apiTestDetail.init();
} else if (this.testCase.type == 'performance') {
this.$refs.performanceTestDetail.init();
}
}
});
},
testRun(reportId) {
this.testCase.reportId = reportId;
this.saveReport(reportId);
this.activeTab = 'result';
},
testTabChange(data) {
if (this.testCase.type == 'performance' && data.paneName == 'result') {
this.$refs.performanceTestResult.checkReportStatus();
this.$refs.performanceTestResult.init();
}
},
saveReport(reportId) {
this.$post('/test/plan/case/edit', {id: this.testCase.id, reportId: reportId});
},
initData(testCase) {
this.result = this.$post('/test/plan/case/list/all', this.searchParam, response => {
this.testCases = response.data;
for (let i = 0; i < this.testCases.length; i++) {
if (this.testCases[i].id === testCase.id) {
this.index = i;
this.getTestCase(i);
this.getRelatedTest();
}
}
});
},
getRelatedTest() {
if (this.testCase.method == 'auto' && this.testCase.testId && this.testCase.testId != 'other') {
this.$get('/' + this.testCase.type + '/get/' + this.testCase.testId, response => {
let data = response.data;
this.issues = data;
if (data) {
this.test = data;
} else {
this.test = {};
this.$warning(this.$t("test_track.case.relate_test_not_find"));
}
});
} else if (this.testCase.testId === 'other' && this.testCase.method == 'auto') {
this.$warning(this.$t("test_track.case.other_relate_test_not_find"));
}
},
issuesChange() {
if (this.issuesSwitch) {
let desc = this.addPLabel('[' + this.$t('test_track.plan_view.operate_step') + ']');
let result = this.addPLabel('[' + this.$t('test_track.case.expected_results') + ']');
let actualResult = this.addPLabel('[' + this.$t('test_track.plan_view.actual_result') + ']');
this.testCase.steps.forEach(step => {
let stepPrefix = this.$t('test_track.plan_view.step') + step.num + ':';
desc += this.addPLabel(stepPrefix + (step.desc == undefined ? '' : step.desc));
result += this.addPLabel(stepPrefix + (step.result == undefined ? '' : step.result));
actualResult += this.addPLabel(stepPrefix + (step.actualResult == undefined ? '' : step.actualResult));
});
this.testCase.issues.content = desc + this.addPLabel('') + result + this.addPLabel('') + actualResult + this.addPLabel('');
this.$get("/test/case/project/" + this.testCase.caseId, res => {
const project = res.data;
if (project.tapdId) {
this.hasTapdId = true;
this.result = this.$get("/issues/tapd/user/" + this.testCase.caseId, response => {
let data = response.data;
this.users = data;
})
}
})
},
closeIssue(row) {
}
},
addPLabel(str) {
return "<p>" + str + "</p>";
},
setPlanStatus(planId) {
this.$post('/test/plan/edit/status/' + planId);
},
stepResultChange() {
if (this.testCase.method == 'manual') {
this.isFailure = this.testCase.steptResults.filter(s => {
return s.executeResult === 'Failure' || s.executeResult === 'Blocking';
}).length > 0;
}
},
saveIssues() {
if (!this.testCase.issues.title || !this.testCase.issues.content) {
this.$warning(this.$t('test_track.issue.title_description_required'));
return;
}
let param = {};
param.title = this.testCase.issues.title;
param.content = this.testCase.issues.content;
param.testCaseId = this.testCase.caseId;
param.tapdUsers = this.testCase.tapdUsers;
this.result = this.$post("/issues/add", param, () => {
this.$success(this.$t('commons.save_success'));
this.getIssues(param.testCaseId);
});
this.issuesSwitch = false;
this.testCase.issues.title = "";
this.testCase.issues.content = "";
this.testCase.tapdUsers = [];
},
getIssues(caseId) {
this.result = this.$get("/issues/get/" + caseId, response => {
let data = response.data;
this.issues = data;
})
},
closeIssue(row) {
if (row.status === 'closed') {
this.$success(this.$t('test_track.issue.close_success'));
} else {
this.result = this.$get("/issues/close/" + row.id, () => {
this.getIssues(this.testCase.caseId);
this.$success(this.$t('test_track.issue.close_success'));
});
}
},
deleteIssue(row) {
this.result = this.$get("/issues/delete/" + row.id, () => {
this.getIssues(this.testCase.caseId);
this.$success(this.$t('commons.delete_success'));
})
}
}
}
</script>
<style scoped>
.border-hidden >>> .el-textarea__inner {
border-style: hidden;
background-color: white;
color: #606266;
}
.border-hidden >>> .el-textarea__inner {
border-style: hidden;
background-color: white;
color: #606266;
}
.cast_label {
color: dimgray;
}
.cast_label {
color: dimgray;
}
.status-button {
padding-left: 4%;
}
.status-button {
padding-left: 4%;
}
.head-right {
text-align: right;
}
.head-right {
text-align: right;
}
.el-col:not(.test-detail) {
line-height: 50px;
}
.el-col:not(.test-detail) {
line-height: 50px;
}
.issues-edit >>> p {
line-height: 16px;
}
.issues-edit >>> p {
line-height: 16px;
}
.status-button {
float: right;
}
.status-button {
float: right;
}
.head-right-tip {
color: darkgrey;
}
.head-right-tip {
color: darkgrey;
}
.el-scrollbar {
height: 100%;
}
.el-scrollbar {
height: 100%;
}
.container {
height: 100vh;
}
.container {
height: 100vh;
}
.case_container > .el-row {
margin-top: 1%;
}
.case_container > .el-row {
margin-top: 1%;
}
.el-switch >>> .el-switch__label {
color: dimgray;
}
.el-switch >>> .el-switch__label {
color: dimgray;
}
.el-switch >>> .el-switch__label.is-active {
color: #409EFF;
}
.el-switch >>> .el-switch__label.is-active {
color: #409EFF;
}
</style>

View File

@ -855,6 +855,7 @@ export default {
platform: "Platform",
operate: "Operate",
close: "Close",
delete: "Delete",
title_description_required: "Title and description are required",
close_success: "Closed successfully",
preview: "Preview"
@ -930,6 +931,8 @@ export default {
schedule: {
input_email: "Please input email account",
event: "event",
event_success: 'EXECUTE SUCCESSFUL',
event_failed: 'EXECUTE FAILED',
receiving_mode: "mailbox",
receiver: "Receiver",
operation: "operation",

View File

@ -861,6 +861,7 @@ export default {
platform: "平台",
operate: "操作",
close: "关闭缺陷",
delete: "删除缺陷",
title_description_required: "标题和描述必填",
close_success: "关闭成功",
preview: "预览"
@ -935,6 +936,8 @@ export default {
schedule: {
input_email: "请输入邮箱账号",
event: "事件",
event_success: '执行成功',
event_failed: '执行失败',
receiving_mode: "接收方式",
receiver: "接收人",
operation: "操作",

View File

@ -857,6 +857,7 @@ export default {
platform: "平臺",
operate: "操作",
close: "關閉缺陷",
delete: "刪除缺陷",
title_description_required: "標題和描述必填",
close_success: "關閉成功",
preview: "預覽"
@ -931,6 +932,8 @@ export default {
schedule: {
input_email: "請輸入郵箱賬號",
event: "事件",
event_success: '執行成功',
event_failed: '執行失敗',
receiving_mode: "接收方式",
receiver: "接收人",
operation: "操作",