fix: 解决冲突

This commit is contained in:
chenjianxing 2020-10-20 13:11:10 +08:00
commit 1c9050d833
84 changed files with 4170 additions and 828 deletions

View File

@ -355,7 +355,17 @@
<artifactId>json</artifactId>
<version>20171018</version>
</dependency>
<!--钉钉sdk-->
<dependency>
<groupId>com.aliyun</groupId>
<artifactId>alibaba-dingtalk-service-sdk</artifactId>
<version>1.0.1</version>
</dependency>
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpclient</artifactId>
<version>4.5.6</version>
</dependency>
</dependencies>

View File

@ -9,6 +9,7 @@ public class AssertionRegex extends AssertionType {
private String subject;
private String expression;
private String description;
private Boolean assumeSuccess;
public AssertionRegex() {
setType(AssertionType.REGEX);

View File

@ -5,11 +5,13 @@ import io.metersphere.api.service.APITestService;
import io.metersphere.base.domain.ApiTestReport;
import io.metersphere.commons.constants.APITestStatus;
import io.metersphere.commons.constants.ApiRunMode;
import io.metersphere.commons.constants.TestPlanTestCaseStatus;
import io.metersphere.commons.utils.CommonBeanFactory;
import io.metersphere.commons.utils.LogUtil;
import io.metersphere.notice.domain.NoticeDetail;
import io.metersphere.notice.service.MailService;
import io.metersphere.notice.service.NoticeService;
import io.metersphere.track.service.TestPlanTestCaseService;
import org.apache.commons.lang3.StringUtils;
import org.apache.jmeter.assertions.AssertionResult;
import org.apache.jmeter.samplers.SampleResult;
@ -117,6 +119,21 @@ public class APIBackendListenerClient extends AbstractBackendListenerClient impl
apiReportService.complete(testResult, report);
queue.clear();
super.teardownTest(context);
TestPlanTestCaseService testPlanTestCaseService = CommonBeanFactory.getBean(TestPlanTestCaseService.class);
List<String> ids = testPlanTestCaseService.getTestPlanTestCaseIds(testResult.getTestId());
if (ids.size() > 0) {
try {
if (StringUtils.equals(APITestStatus.Success.name(), report.getStatus())) {
testPlanTestCaseService.updateTestCaseStates(ids, TestPlanTestCaseStatus.Pass.name());
} else {
testPlanTestCaseService.updateTestCaseStates(ids, TestPlanTestCaseStatus.Failure.name());
}
} catch (Exception e) {
LogUtil.error(e);
}
}
NoticeService noticeService = CommonBeanFactory.getBean(NoticeService.class);
try {
List<NoticeDetail> noticeList = noticeService.queryNotice(testResult.getTestId());

View File

@ -0,0 +1,23 @@
package io.metersphere.base.domain;
import java.io.Serializable;
import lombok.Data;
@Data
public class MessageTask implements Serializable {
private String id;
private String type;
private String event;
private String userId;
private String taskType;
private String webhook;
private String identification;
private static final long serialVersionUID = 1L;
}

View File

@ -0,0 +1,690 @@
package io.metersphere.base.domain;
import java.util.ArrayList;
import java.util.List;
public class MessageTaskExample {
protected String orderByClause;
protected boolean distinct;
protected List<Criteria> oredCriteria;
public MessageTaskExample() {
oredCriteria = new ArrayList<Criteria>();
}
public void setOrderByClause(String orderByClause) {
this.orderByClause = orderByClause;
}
public String getOrderByClause() {
return orderByClause;
}
public void setDistinct(boolean distinct) {
this.distinct = distinct;
}
public boolean isDistinct() {
return distinct;
}
public List<Criteria> getOredCriteria() {
return oredCriteria;
}
public void or(Criteria criteria) {
oredCriteria.add(criteria);
}
public Criteria or() {
Criteria criteria = createCriteriaInternal();
oredCriteria.add(criteria);
return criteria;
}
public Criteria createCriteria() {
Criteria criteria = createCriteriaInternal();
if (oredCriteria.size() == 0) {
oredCriteria.add(criteria);
}
return criteria;
}
protected Criteria createCriteriaInternal() {
Criteria criteria = new Criteria();
return criteria;
}
public void clear() {
oredCriteria.clear();
orderByClause = null;
distinct = false;
}
protected abstract static class GeneratedCriteria {
protected List<Criterion> criteria;
protected GeneratedCriteria() {
super();
criteria = new ArrayList<Criterion>();
}
public boolean isValid() {
return criteria.size() > 0;
}
public List<Criterion> getAllCriteria() {
return criteria;
}
public List<Criterion> getCriteria() {
return criteria;
}
protected void addCriterion(String condition) {
if (condition == null) {
throw new RuntimeException("Value for condition cannot be null");
}
criteria.add(new Criterion(condition));
}
protected void addCriterion(String condition, Object value, String property) {
if (value == null) {
throw new RuntimeException("Value for " + property + " cannot be null");
}
criteria.add(new Criterion(condition, value));
}
protected void addCriterion(String condition, Object value1, Object value2, String property) {
if (value1 == null || value2 == null) {
throw new RuntimeException("Between values for " + property + " cannot be null");
}
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 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 Criteria andEventIsNull() {
addCriterion("event is null");
return (Criteria) this;
}
public Criteria andEventIsNotNull() {
addCriterion("event is not null");
return (Criteria) this;
}
public Criteria andEventEqualTo(String value) {
addCriterion("event =", value, "event");
return (Criteria) this;
}
public Criteria andEventNotEqualTo(String value) {
addCriterion("event <>", value, "event");
return (Criteria) this;
}
public Criteria andEventGreaterThan(String value) {
addCriterion("event >", value, "event");
return (Criteria) this;
}
public Criteria andEventGreaterThanOrEqualTo(String value) {
addCriterion("event >=", value, "event");
return (Criteria) this;
}
public Criteria andEventLessThan(String value) {
addCriterion("event <", value, "event");
return (Criteria) this;
}
public Criteria andEventLessThanOrEqualTo(String value) {
addCriterion("event <=", value, "event");
return (Criteria) this;
}
public Criteria andEventLike(String value) {
addCriterion("event like", value, "event");
return (Criteria) this;
}
public Criteria andEventNotLike(String value) {
addCriterion("event not like", value, "event");
return (Criteria) this;
}
public Criteria andEventIn(List<String> values) {
addCriterion("event in", values, "event");
return (Criteria) this;
}
public Criteria andEventNotIn(List<String> values) {
addCriterion("event not in", values, "event");
return (Criteria) this;
}
public Criteria andEventBetween(String value1, String value2) {
addCriterion("event between", value1, value2, "event");
return (Criteria) this;
}
public Criteria andEventNotBetween(String value1, String value2) {
addCriterion("event not between", value1, value2, "event");
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 Criteria andTaskTypeIsNull() {
addCriterion("task_type is null");
return (Criteria) this;
}
public Criteria andTaskTypeIsNotNull() {
addCriterion("task_type is not null");
return (Criteria) this;
}
public Criteria andTaskTypeEqualTo(String value) {
addCriterion("task_type =", value, "taskType");
return (Criteria) this;
}
public Criteria andTaskTypeNotEqualTo(String value) {
addCriterion("task_type <>", value, "taskType");
return (Criteria) this;
}
public Criteria andTaskTypeGreaterThan(String value) {
addCriterion("task_type >", value, "taskType");
return (Criteria) this;
}
public Criteria andTaskTypeGreaterThanOrEqualTo(String value) {
addCriterion("task_type >=", value, "taskType");
return (Criteria) this;
}
public Criteria andTaskTypeLessThan(String value) {
addCriterion("task_type <", value, "taskType");
return (Criteria) this;
}
public Criteria andTaskTypeLessThanOrEqualTo(String value) {
addCriterion("task_type <=", value, "taskType");
return (Criteria) this;
}
public Criteria andTaskTypeLike(String value) {
addCriterion("task_type like", value, "taskType");
return (Criteria) this;
}
public Criteria andTaskTypeNotLike(String value) {
addCriterion("task_type not like", value, "taskType");
return (Criteria) this;
}
public Criteria andTaskTypeIn(List<String> values) {
addCriterion("task_type in", values, "taskType");
return (Criteria) this;
}
public Criteria andTaskTypeNotIn(List<String> values) {
addCriterion("task_type not in", values, "taskType");
return (Criteria) this;
}
public Criteria andTaskTypeBetween(String value1, String value2) {
addCriterion("task_type between", value1, value2, "taskType");
return (Criteria) this;
}
public Criteria andTaskTypeNotBetween(String value1, String value2) {
addCriterion("task_type not between", value1, value2, "taskType");
return (Criteria) this;
}
public Criteria andWebhookIsNull() {
addCriterion("webhook is null");
return (Criteria) this;
}
public Criteria andWebhookIsNotNull() {
addCriterion("webhook is not null");
return (Criteria) this;
}
public Criteria andWebhookEqualTo(String value) {
addCriterion("webhook =", value, "webhook");
return (Criteria) this;
}
public Criteria andWebhookNotEqualTo(String value) {
addCriterion("webhook <>", value, "webhook");
return (Criteria) this;
}
public Criteria andWebhookGreaterThan(String value) {
addCriterion("webhook >", value, "webhook");
return (Criteria) this;
}
public Criteria andWebhookGreaterThanOrEqualTo(String value) {
addCriterion("webhook >=", value, "webhook");
return (Criteria) this;
}
public Criteria andWebhookLessThan(String value) {
addCriterion("webhook <", value, "webhook");
return (Criteria) this;
}
public Criteria andWebhookLessThanOrEqualTo(String value) {
addCriterion("webhook <=", value, "webhook");
return (Criteria) this;
}
public Criteria andWebhookLike(String value) {
addCriterion("webhook like", value, "webhook");
return (Criteria) this;
}
public Criteria andWebhookNotLike(String value) {
addCriterion("webhook not like", value, "webhook");
return (Criteria) this;
}
public Criteria andWebhookIn(List<String> values) {
addCriterion("webhook in", values, "webhook");
return (Criteria) this;
}
public Criteria andWebhookNotIn(List<String> values) {
addCriterion("webhook not in", values, "webhook");
return (Criteria) this;
}
public Criteria andWebhookBetween(String value1, String value2) {
addCriterion("webhook between", value1, value2, "webhook");
return (Criteria) this;
}
public Criteria andWebhookNotBetween(String value1, String value2) {
addCriterion("webhook not between", value1, value2, "webhook");
return (Criteria) this;
}
public Criteria andIdentificationIsNull() {
addCriterion("identification is null");
return (Criteria) this;
}
public Criteria andIdentificationIsNotNull() {
addCriterion("identification is not null");
return (Criteria) this;
}
public Criteria andIdentificationEqualTo(String value) {
addCriterion("identification =", value, "identification");
return (Criteria) this;
}
public Criteria andIdentificationNotEqualTo(String value) {
addCriterion("identification <>", value, "identification");
return (Criteria) this;
}
public Criteria andIdentificationGreaterThan(String value) {
addCriterion("identification >", value, "identification");
return (Criteria) this;
}
public Criteria andIdentificationGreaterThanOrEqualTo(String value) {
addCriterion("identification >=", value, "identification");
return (Criteria) this;
}
public Criteria andIdentificationLessThan(String value) {
addCriterion("identification <", value, "identification");
return (Criteria) this;
}
public Criteria andIdentificationLessThanOrEqualTo(String value) {
addCriterion("identification <=", value, "identification");
return (Criteria) this;
}
public Criteria andIdentificationLike(String value) {
addCriterion("identification like", value, "identification");
return (Criteria) this;
}
public Criteria andIdentificationNotLike(String value) {
addCriterion("identification not like", value, "identification");
return (Criteria) this;
}
public Criteria andIdentificationIn(List<String> values) {
addCriterion("identification in", values, "identification");
return (Criteria) this;
}
public Criteria andIdentificationNotIn(List<String> values) {
addCriterion("identification not in", values, "identification");
return (Criteria) this;
}
public Criteria andIdentificationBetween(String value1, String value2) {
addCriterion("identification between", value1, value2, "identification");
return (Criteria) this;
}
public Criteria andIdentificationNotBetween(String value1, String value2) {
addCriterion("identification not between", value1, value2, "identification");
return (Criteria) this;
}
}
public static class Criteria extends GeneratedCriteria {
protected Criteria() {
super();
}
}
public static class Criterion {
private String condition;
private Object value;
private Object secondValue;
private boolean noValue;
private boolean singleValue;
private boolean betweenValue;
private boolean listValue;
private String typeHandler;
public String getCondition() {
return condition;
}
public Object getValue() {
return value;
}
public Object getSecondValue() {
return secondValue;
}
public boolean isNoValue() {
return noValue;
}
public boolean isSingleValue() {
return singleValue;
}
public boolean isBetweenValue() {
return betweenValue;
}
public boolean isListValue() {
return listValue;
}
public String getTypeHandler() {
return typeHandler;
}
protected Criterion(String condition) {
super();
this.condition = condition;
this.typeHandler = null;
this.noValue = true;
}
protected Criterion(String condition, Object value, String typeHandler) {
super();
this.condition = condition;
this.value = value;
this.typeHandler = typeHandler;
if (value instanceof List<?>) {
this.listValue = true;
} else {
this.singleValue = true;
}
}
protected Criterion(String condition, Object value) {
this(condition, value, null);
}
protected Criterion(String condition, Object value, Object secondValue, String typeHandler) {
super();
this.condition = condition;
this.value = value;
this.secondValue = secondValue;
this.typeHandler = typeHandler;
this.betweenValue = true;
}
protected Criterion(String condition, Object value, Object secondValue) {
this(condition, value, secondValue, null);
}
}
}

View File

@ -1,8 +1,7 @@
package io.metersphere.base.domain;
import lombok.Data;
import java.io.Serializable;
import lombok.Data;
@Data
public class Notice implements Serializable {

View File

@ -0,0 +1,13 @@
package io.metersphere.base.domain;
import java.io.Serializable;
import lombok.Data;
@Data
public class TestCaseFile implements Serializable {
private String caseId;
private String fileId;
private static final long serialVersionUID = 1L;
}

View File

@ -0,0 +1,340 @@
package io.metersphere.base.domain;
import java.util.ArrayList;
import java.util.List;
public class TestCaseFileExample {
protected String orderByClause;
protected boolean distinct;
protected List<Criteria> oredCriteria;
public TestCaseFileExample() {
oredCriteria = new ArrayList<Criteria>();
}
public void setOrderByClause(String orderByClause) {
this.orderByClause = orderByClause;
}
public String getOrderByClause() {
return orderByClause;
}
public void setDistinct(boolean distinct) {
this.distinct = distinct;
}
public boolean isDistinct() {
return distinct;
}
public List<Criteria> getOredCriteria() {
return oredCriteria;
}
public void or(Criteria criteria) {
oredCriteria.add(criteria);
}
public Criteria or() {
Criteria criteria = createCriteriaInternal();
oredCriteria.add(criteria);
return criteria;
}
public Criteria createCriteria() {
Criteria criteria = createCriteriaInternal();
if (oredCriteria.size() == 0) {
oredCriteria.add(criteria);
}
return criteria;
}
protected Criteria createCriteriaInternal() {
Criteria criteria = new Criteria();
return criteria;
}
public void clear() {
oredCriteria.clear();
orderByClause = null;
distinct = false;
}
protected abstract static class GeneratedCriteria {
protected List<Criterion> criteria;
protected GeneratedCriteria() {
super();
criteria = new ArrayList<Criterion>();
}
public boolean isValid() {
return criteria.size() > 0;
}
public List<Criterion> getAllCriteria() {
return criteria;
}
public List<Criterion> getCriteria() {
return criteria;
}
protected void addCriterion(String condition) {
if (condition == null) {
throw new RuntimeException("Value for condition cannot be null");
}
criteria.add(new Criterion(condition));
}
protected void addCriterion(String condition, Object value, String property) {
if (value == null) {
throw new RuntimeException("Value for " + property + " cannot be null");
}
criteria.add(new Criterion(condition, value));
}
protected void addCriterion(String condition, Object value1, Object value2, String property) {
if (value1 == null || value2 == null) {
throw new RuntimeException("Between values for " + property + " cannot be null");
}
criteria.add(new Criterion(condition, value1, value2));
}
public Criteria andCaseIdIsNull() {
addCriterion("case_id is null");
return (Criteria) this;
}
public Criteria andCaseIdIsNotNull() {
addCriterion("case_id is not null");
return (Criteria) this;
}
public Criteria andCaseIdEqualTo(String value) {
addCriterion("case_id =", value, "caseId");
return (Criteria) this;
}
public Criteria andCaseIdNotEqualTo(String value) {
addCriterion("case_id <>", value, "caseId");
return (Criteria) this;
}
public Criteria andCaseIdGreaterThan(String value) {
addCriterion("case_id >", value, "caseId");
return (Criteria) this;
}
public Criteria andCaseIdGreaterThanOrEqualTo(String value) {
addCriterion("case_id >=", value, "caseId");
return (Criteria) this;
}
public Criteria andCaseIdLessThan(String value) {
addCriterion("case_id <", value, "caseId");
return (Criteria) this;
}
public Criteria andCaseIdLessThanOrEqualTo(String value) {
addCriterion("case_id <=", value, "caseId");
return (Criteria) this;
}
public Criteria andCaseIdLike(String value) {
addCriterion("case_id like", value, "caseId");
return (Criteria) this;
}
public Criteria andCaseIdNotLike(String value) {
addCriterion("case_id not like", value, "caseId");
return (Criteria) this;
}
public Criteria andCaseIdIn(List<String> values) {
addCriterion("case_id in", values, "caseId");
return (Criteria) this;
}
public Criteria andCaseIdNotIn(List<String> values) {
addCriterion("case_id not in", values, "caseId");
return (Criteria) this;
}
public Criteria andCaseIdBetween(String value1, String value2) {
addCriterion("case_id between", value1, value2, "caseId");
return (Criteria) this;
}
public Criteria andCaseIdNotBetween(String value1, String value2) {
addCriterion("case_id not between", value1, value2, "caseId");
return (Criteria) this;
}
public Criteria andFileIdIsNull() {
addCriterion("file_id is null");
return (Criteria) this;
}
public Criteria andFileIdIsNotNull() {
addCriterion("file_id is not null");
return (Criteria) this;
}
public Criteria andFileIdEqualTo(String value) {
addCriterion("file_id =", value, "fileId");
return (Criteria) this;
}
public Criteria andFileIdNotEqualTo(String value) {
addCriterion("file_id <>", value, "fileId");
return (Criteria) this;
}
public Criteria andFileIdGreaterThan(String value) {
addCriterion("file_id >", value, "fileId");
return (Criteria) this;
}
public Criteria andFileIdGreaterThanOrEqualTo(String value) {
addCriterion("file_id >=", value, "fileId");
return (Criteria) this;
}
public Criteria andFileIdLessThan(String value) {
addCriterion("file_id <", value, "fileId");
return (Criteria) this;
}
public Criteria andFileIdLessThanOrEqualTo(String value) {
addCriterion("file_id <=", value, "fileId");
return (Criteria) this;
}
public Criteria andFileIdLike(String value) {
addCriterion("file_id like", value, "fileId");
return (Criteria) this;
}
public Criteria andFileIdNotLike(String value) {
addCriterion("file_id not like", value, "fileId");
return (Criteria) this;
}
public Criteria andFileIdIn(List<String> values) {
addCriterion("file_id in", values, "fileId");
return (Criteria) this;
}
public Criteria andFileIdNotIn(List<String> values) {
addCriterion("file_id not in", values, "fileId");
return (Criteria) this;
}
public Criteria andFileIdBetween(String value1, String value2) {
addCriterion("file_id between", value1, value2, "fileId");
return (Criteria) this;
}
public Criteria andFileIdNotBetween(String value1, String value2) {
addCriterion("file_id not between", value1, value2, "fileId");
return (Criteria) this;
}
}
public static class Criteria extends GeneratedCriteria {
protected Criteria() {
super();
}
}
public static class Criterion {
private String condition;
private Object value;
private Object secondValue;
private boolean noValue;
private boolean singleValue;
private boolean betweenValue;
private boolean listValue;
private String typeHandler;
public String getCondition() {
return condition;
}
public Object getValue() {
return value;
}
public Object getSecondValue() {
return secondValue;
}
public boolean isNoValue() {
return noValue;
}
public boolean isSingleValue() {
return singleValue;
}
public boolean isBetweenValue() {
return betweenValue;
}
public boolean isListValue() {
return listValue;
}
public String getTypeHandler() {
return typeHandler;
}
protected Criterion(String condition) {
super();
this.condition = condition;
this.typeHandler = null;
this.noValue = true;
}
protected Criterion(String condition, Object value, String typeHandler) {
super();
this.condition = condition;
this.value = value;
this.typeHandler = typeHandler;
if (value instanceof List<?>) {
this.listValue = true;
} else {
this.singleValue = true;
}
}
protected Criterion(String condition, Object value) {
this(condition, value, null);
}
protected Criterion(String condition, Object value, Object secondValue, String typeHandler) {
super();
this.condition = condition;
this.value = value;
this.secondValue = secondValue;
this.typeHandler = typeHandler;
this.betweenValue = true;
}
protected Criterion(String condition, Object value, Object secondValue) {
this(condition, value, secondValue, null);
}
}
}

View File

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

View File

@ -0,0 +1,243 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="io.metersphere.base.mapper.MessageTaskMapper">
<resultMap id="BaseResultMap" type="io.metersphere.base.domain.MessageTask">
<id column="id" jdbcType="VARCHAR" property="id" />
<result column="type" jdbcType="VARCHAR" property="type" />
<result column="event" jdbcType="VARCHAR" property="event" />
<result column="user_id" jdbcType="VARCHAR" property="userId" />
<result column="task_type" jdbcType="VARCHAR" property="taskType" />
<result column="webhook" jdbcType="VARCHAR" property="webhook" />
<result column="identification" jdbcType="VARCHAR" property="identification" />
</resultMap>
<sql id="Example_Where_Clause">
<where>
<foreach collection="oredCriteria" item="criteria" separator="or">
<if test="criteria.valid">
<trim prefix="(" prefixOverrides="and" suffix=")">
<foreach collection="criteria.criteria" item="criterion">
<choose>
<when test="criterion.noValue">
and ${criterion.condition}
</when>
<when test="criterion.singleValue">
and ${criterion.condition} #{criterion.value}
</when>
<when test="criterion.betweenValue">
and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
</when>
<when test="criterion.listValue">
and ${criterion.condition}
<foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">
#{listItem}
</foreach>
</when>
</choose>
</foreach>
</trim>
</if>
</foreach>
</where>
</sql>
<sql id="Update_By_Example_Where_Clause">
<where>
<foreach collection="example.oredCriteria" item="criteria" separator="or">
<if test="criteria.valid">
<trim prefix="(" prefixOverrides="and" suffix=")">
<foreach collection="criteria.criteria" item="criterion">
<choose>
<when test="criterion.noValue">
and ${criterion.condition}
</when>
<when test="criterion.singleValue">
and ${criterion.condition} #{criterion.value}
</when>
<when test="criterion.betweenValue">
and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
</when>
<when test="criterion.listValue">
and ${criterion.condition}
<foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">
#{listItem}
</foreach>
</when>
</choose>
</foreach>
</trim>
</if>
</foreach>
</where>
</sql>
<sql id="Base_Column_List">
id, `type`, event, user_id, task_type, webhook, identification
</sql>
<select id="selectByExample" parameterType="io.metersphere.base.domain.MessageTaskExample" resultMap="BaseResultMap">
select
<if test="distinct">
distinct
</if>
<include refid="Base_Column_List" />
from message_task
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
</if>
<if test="orderByClause != null">
order by ${orderByClause}
</if>
</select>
<select id="selectByPrimaryKey" parameterType="java.lang.String" resultMap="BaseResultMap">
select
<include refid="Base_Column_List" />
from message_task
where id = #{id,jdbcType=VARCHAR}
</select>
<delete id="deleteByPrimaryKey" parameterType="java.lang.String">
delete from message_task
where id = #{id,jdbcType=VARCHAR}
</delete>
<delete id="deleteByExample" parameterType="io.metersphere.base.domain.MessageTaskExample">
delete from message_task
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
</if>
</delete>
<insert id="insert" parameterType="io.metersphere.base.domain.MessageTask">
insert into message_task (id, `type`, event,
user_id, task_type, webhook,
identification)
values (#{id,jdbcType=VARCHAR}, #{type,jdbcType=VARCHAR}, #{event,jdbcType=VARCHAR},
#{userId,jdbcType=VARCHAR}, #{taskType,jdbcType=VARCHAR}, #{webhook,jdbcType=VARCHAR},
#{identification,jdbcType=VARCHAR})
</insert>
<insert id="insertSelective" parameterType="io.metersphere.base.domain.MessageTask">
insert into message_task
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null">
id,
</if>
<if test="type != null">
`type`,
</if>
<if test="event != null">
event,
</if>
<if test="userId != null">
user_id,
</if>
<if test="taskType != null">
task_type,
</if>
<if test="webhook != null">
webhook,
</if>
<if test="identification != null">
identification,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id != null">
#{id,jdbcType=VARCHAR},
</if>
<if test="type != null">
#{type,jdbcType=VARCHAR},
</if>
<if test="event != null">
#{event,jdbcType=VARCHAR},
</if>
<if test="userId != null">
#{userId,jdbcType=VARCHAR},
</if>
<if test="taskType != null">
#{taskType,jdbcType=VARCHAR},
</if>
<if test="webhook != null">
#{webhook,jdbcType=VARCHAR},
</if>
<if test="identification != null">
#{identification,jdbcType=VARCHAR},
</if>
</trim>
</insert>
<select id="countByExample" parameterType="io.metersphere.base.domain.MessageTaskExample" resultType="java.lang.Long">
select count(*) from message_task
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
</if>
</select>
<update id="updateByExampleSelective" parameterType="map">
update message_task
<set>
<if test="record.id != null">
id = #{record.id,jdbcType=VARCHAR},
</if>
<if test="record.type != null">
`type` = #{record.type,jdbcType=VARCHAR},
</if>
<if test="record.event != null">
event = #{record.event,jdbcType=VARCHAR},
</if>
<if test="record.userId != null">
user_id = #{record.userId,jdbcType=VARCHAR},
</if>
<if test="record.taskType != null">
task_type = #{record.taskType,jdbcType=VARCHAR},
</if>
<if test="record.webhook != null">
webhook = #{record.webhook,jdbcType=VARCHAR},
</if>
<if test="record.identification != null">
identification = #{record.identification,jdbcType=VARCHAR},
</if>
</set>
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
</if>
</update>
<update id="updateByExample" parameterType="map">
update message_task
set id = #{record.id,jdbcType=VARCHAR},
`type` = #{record.type,jdbcType=VARCHAR},
event = #{record.event,jdbcType=VARCHAR},
user_id = #{record.userId,jdbcType=VARCHAR},
task_type = #{record.taskType,jdbcType=VARCHAR},
webhook = #{record.webhook,jdbcType=VARCHAR},
identification = #{record.identification,jdbcType=VARCHAR}
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
</if>
</update>
<update id="updateByPrimaryKeySelective" parameterType="io.metersphere.base.domain.MessageTask">
update message_task
<set>
<if test="type != null">
`type` = #{type,jdbcType=VARCHAR},
</if>
<if test="event != null">
event = #{event,jdbcType=VARCHAR},
</if>
<if test="userId != null">
user_id = #{userId,jdbcType=VARCHAR},
</if>
<if test="taskType != null">
task_type = #{taskType,jdbcType=VARCHAR},
</if>
<if test="webhook != null">
webhook = #{webhook,jdbcType=VARCHAR},
</if>
<if test="identification != null">
identification = #{identification,jdbcType=VARCHAR},
</if>
</set>
where id = #{id,jdbcType=VARCHAR}
</update>
<update id="updateByPrimaryKey" parameterType="io.metersphere.base.domain.MessageTask">
update message_task
set `type` = #{type,jdbcType=VARCHAR},
event = #{event,jdbcType=VARCHAR},
user_id = #{userId,jdbcType=VARCHAR},
task_type = #{taskType,jdbcType=VARCHAR},
webhook = #{webhook,jdbcType=VARCHAR},
identification = #{identification,jdbcType=VARCHAR}
where id = #{id,jdbcType=VARCHAR}
</update>
</mapper>

View File

@ -2,9 +2,8 @@ package io.metersphere.base.mapper;
import io.metersphere.base.domain.Notice;
import io.metersphere.base.domain.NoticeExample;
import org.apache.ibatis.annotations.Param;
import java.util.List;
import org.apache.ibatis.annotations.Param;
public interface NoticeMapper {
long countByExample(NoticeExample example);

View File

@ -91,8 +91,8 @@
where id = #{id,jdbcType=VARCHAR}
</select>
<delete id="deleteByPrimaryKey" parameterType="java.lang.String">
DELETE FROM notice
WHERE id = #{id,jdbcType=VARCHAR}
delete from notice
where id = #{id,jdbcType=VARCHAR}
</delete>
<delete id="deleteByExample" parameterType="io.metersphere.base.domain.NoticeExample">
delete from notice
@ -101,10 +101,10 @@
</if>
</delete>
<insert id="insert" parameterType="io.metersphere.base.domain.Notice">
INSERT INTO notice (id, EVENT, TEST_ID,
insert into notice (id, EVENT, TEST_ID,
`ENABLE`, `type`, user_id
)
VALUES (#{id,jdbcType=VARCHAR}, #{event,jdbcType=VARCHAR}, #{testId,jdbcType=VARCHAR},
values (#{id,jdbcType=VARCHAR}, #{event,jdbcType=VARCHAR}, #{testId,jdbcType=VARCHAR},
#{enable,jdbcType=VARCHAR}, #{type,jdbcType=VARCHAR}, #{userId,jdbcType=VARCHAR}
)
</insert>
@ -217,12 +217,12 @@
where id = #{id,jdbcType=VARCHAR}
</update>
<update id="updateByPrimaryKey" parameterType="io.metersphere.base.domain.Notice">
UPDATE notice
SET EVENT = #{event,jdbcType=VARCHAR},
update notice
set EVENT = #{event,jdbcType=VARCHAR},
TEST_ID = #{testId,jdbcType=VARCHAR},
`ENABLE` = #{enable,jdbcType=VARCHAR},
`type` = #{type,jdbcType=VARCHAR},
user_id = #{userId,jdbcType=VARCHAR}
WHERE id = #{id,jdbcType=VARCHAR}
where id = #{id,jdbcType=VARCHAR}
</update>
</mapper>

View File

@ -0,0 +1,22 @@
package io.metersphere.base.mapper;
import io.metersphere.base.domain.TestCaseFile;
import io.metersphere.base.domain.TestCaseFileExample;
import java.util.List;
import org.apache.ibatis.annotations.Param;
public interface TestCaseFileMapper {
long countByExample(TestCaseFileExample example);
int deleteByExample(TestCaseFileExample example);
int insert(TestCaseFile record);
int insertSelective(TestCaseFile record);
List<TestCaseFile> selectByExample(TestCaseFileExample example);
int updateByExampleSelective(@Param("record") TestCaseFile record, @Param("example") TestCaseFileExample example);
int updateByExample(@Param("record") TestCaseFile record, @Param("example") TestCaseFileExample example);
}

View File

@ -0,0 +1,140 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="io.metersphere.base.mapper.TestCaseFileMapper">
<resultMap id="BaseResultMap" type="io.metersphere.base.domain.TestCaseFile">
<result column="case_id" jdbcType="VARCHAR" property="caseId" />
<result column="file_id" jdbcType="VARCHAR" property="fileId" />
</resultMap>
<sql id="Example_Where_Clause">
<where>
<foreach collection="oredCriteria" item="criteria" separator="or">
<if test="criteria.valid">
<trim prefix="(" prefixOverrides="and" suffix=")">
<foreach collection="criteria.criteria" item="criterion">
<choose>
<when test="criterion.noValue">
and ${criterion.condition}
</when>
<when test="criterion.singleValue">
and ${criterion.condition} #{criterion.value}
</when>
<when test="criterion.betweenValue">
and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
</when>
<when test="criterion.listValue">
and ${criterion.condition}
<foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">
#{listItem}
</foreach>
</when>
</choose>
</foreach>
</trim>
</if>
</foreach>
</where>
</sql>
<sql id="Update_By_Example_Where_Clause">
<where>
<foreach collection="example.oredCriteria" item="criteria" separator="or">
<if test="criteria.valid">
<trim prefix="(" prefixOverrides="and" suffix=")">
<foreach collection="criteria.criteria" item="criterion">
<choose>
<when test="criterion.noValue">
and ${criterion.condition}
</when>
<when test="criterion.singleValue">
and ${criterion.condition} #{criterion.value}
</when>
<when test="criterion.betweenValue">
and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
</when>
<when test="criterion.listValue">
and ${criterion.condition}
<foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">
#{listItem}
</foreach>
</when>
</choose>
</foreach>
</trim>
</if>
</foreach>
</where>
</sql>
<sql id="Base_Column_List">
case_id, file_id
</sql>
<select id="selectByExample" parameterType="io.metersphere.base.domain.TestCaseFileExample" resultMap="BaseResultMap">
select
<if test="distinct">
distinct
</if>
<include refid="Base_Column_List" />
from test_case_file
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
</if>
<if test="orderByClause != null">
order by ${orderByClause}
</if>
</select>
<delete id="deleteByExample" parameterType="io.metersphere.base.domain.TestCaseFileExample">
delete from test_case_file
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
</if>
</delete>
<insert id="insert" parameterType="io.metersphere.base.domain.TestCaseFile">
insert into test_case_file (case_id, file_id)
values (#{caseId,jdbcType=VARCHAR}, #{fileId,jdbcType=VARCHAR})
</insert>
<insert id="insertSelective" parameterType="io.metersphere.base.domain.TestCaseFile">
insert into test_case_file
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="caseId != null">
case_id,
</if>
<if test="fileId != null">
file_id,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="caseId != null">
#{caseId,jdbcType=VARCHAR},
</if>
<if test="fileId != null">
#{fileId,jdbcType=VARCHAR},
</if>
</trim>
</insert>
<select id="countByExample" parameterType="io.metersphere.base.domain.TestCaseFileExample" resultType="java.lang.Long">
select count(*) from test_case_file
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
</if>
</select>
<update id="updateByExampleSelective" parameterType="map">
update test_case_file
<set>
<if test="record.caseId != null">
case_id = #{record.caseId,jdbcType=VARCHAR},
</if>
<if test="record.fileId != null">
file_id = #{record.fileId,jdbcType=VARCHAR},
</if>
</set>
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
</if>
</update>
<update id="updateByExample" parameterType="map">
update test_case_file
set case_id = #{record.caseId,jdbcType=VARCHAR},
file_id = #{record.fileId,jdbcType=VARCHAR}
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
</if>
</update>
</mapper>

View File

@ -20,8 +20,23 @@ public interface ExtTestCaseMapper {
TestCase getMaxNumByProjectId(@Param("projectId") String projectId);
/**
* 获取不在测试计划中的用例
* @param request
* @return
*/
List<TestCase> getTestCaseByNotInPlan(@Param("request") QueryTestCaseRequest request);
/**
* 获取不在评审范围中的用例
* @param request
* @return
*/
List<TestCase> getTestCaseByNotInReview(@Param("request") QueryTestCaseRequest request);
/**
* 检查某工作空间下是否有某用例
*
* @param caseId
* @param workspaceId
* @return TestCase ID

View File

@ -97,6 +97,113 @@
</if>
</sql>
<select id="getTestCaseByNotInReview" resultType="io.metersphere.base.domain.TestCase">
select test_case.id, test_case.name, test_case.priority, test_case.type, test_case.review_status
from test_case
<where>
<if test="request.combine != null">
<include refid="combine">
<property name="condition" value="request.combine"/>
<property name="name" value="request.name"/>
</include>
</if>
and test_case.id not in (select case_id from test_case_review_test_case where review_id =#{request.reviewId})
<if test="request.name != null">
and test_case.name like CONCAT('%', #{request.name},'%')
</if>
<if test="request.projectId != null">
AND test_case.project_id = #{request.projectId}
</if>
<if test="request.nodeIds != null and request.nodeIds.size() > 0">
AND test_case.node_id IN
<foreach collection="request.nodeIds" open="(" close=")" separator="," item="nodeId">
#{nodeId}
</foreach>
</if>
<if test="request.filters != null and request.filters.size() > 0">
<foreach collection="request.filters.entrySet()" index="key" item="values">
<if test="values != null and values.size() > 0">
<choose>
<when test="key=='priority'">
and test_case.priority in
<foreach collection="values" item="value" separator="," open="(" close=")">
#{value}
</foreach>
</when>
<when test="key=='status'">
and test_case.review_status in
<foreach collection="values" item="value" separator="," open="(" close=")">
#{value}
</foreach>
</when>
<otherwise>
and test_case.type in
<foreach collection="values" item="value" separator="," open="(" close=")">
#{value}
</foreach>
</otherwise>
</choose>
</if>
</foreach>
</if>
</where>
ORDER BY test_case.update_time DESC
</select>
<select id="getTestCaseByNotInPlan" resultType="io.metersphere.base.domain.TestCase">
select test_case.id, test_case.name, test_case.priority, test_case.type, test_case.review_status
from test_case
<where>
<if test="request.combine != null">
<include refid="combine">
<property name="condition" value="request.combine"/>
<property name="name" value="request.name"/>
</include>
</if>
and test_case.id not in (select case_id from test_plan_test_case where plan_id =#{request.planId})
<if test="request.name != null">
and test_case.name like CONCAT('%', #{request.name},'%')
</if>
<if test="request.projectId != null">
AND test_case.project_id = #{request.projectId}
</if>
<if test="request.nodeIds != null and request.nodeIds.size() > 0">
AND test_case.node_id IN
<foreach collection="request.nodeIds" open="(" close=")" separator="," item="nodeId">
#{nodeId}
</foreach>
</if>
<if test="request.filters != null and request.filters.size() > 0">
<foreach collection="request.filters.entrySet()" index="key" item="values">
<if test="values != null and values.size() > 0">
<choose>
<when test="key=='priority'">
and test_case.priority in
<foreach collection="values" item="value" separator="," open="(" close=")">
#{value}
</foreach>
</when>
<when test="key=='status'">
and test_case.review_status in
<foreach collection="values" item="value" separator="," open="(" close=")">
#{value}
</foreach>
</when>
<otherwise>
and test_case.type in
<foreach collection="values" item="value" separator="," open="(" close=")">
#{value}
</foreach>
</otherwise>
</choose>
</if>
</foreach>
</if>
</where>
ORDER BY test_case.update_time DESC
</select>
<select id="getTestCaseNames" resultType="io.metersphere.base.domain.TestCase">
select test_case.id, test_case.name, test_case.priority, test_case.type, test_case.review_status

View File

@ -12,12 +12,13 @@ public interface ExtTestCaseReviewMapper {
List<TestCaseReviewDTO> list(@Param("request") QueryCaseReviewRequest params);
List<TestCaseReviewDTO> listByWorkspaceId(@Param("workspaceId") String workspaceId);
List<TestCaseReviewDTO> listByWorkspaceId(@Param("workspaceId") String workspaceId, @Param("userId") String userId);
List<TestReviewDTOWithMetric> listRelate(@Param("request") QueryTestReviewRequest request);
/**
* 检查某工作空间下是否有某测试评审
*
* @param reviewId
* @param workspaceId
* @return Review ID

View File

@ -27,11 +27,18 @@
<select id="listByWorkspaceId" resultType="io.metersphere.track.dto.TestCaseReviewDTO"
parameterType="io.metersphere.track.request.testreview.QueryCaseReviewRequest">
select distinct test_case_review.*
from test_case_review, project, test_case_review_project
where test_case_review.id = test_case_review_project.review_id
and test_case_review_project.project_id = project.id
and project.workspace_id = #{workspaceId}
order by test_case_review.update_time desc
from test_case_review, project, test_case_review_project, test_case_review_users
<where>
test_case_review.id = test_case_review_project.review_id
and test_case_review_project.project_id = project.id
and project.workspace_id = #{workspaceId}
and (
(test_case_review_users.review_id = test_case_review.id
and test_case_review_users.user_id = #{userId} )
or test_case_review.creator = #{userId}
)
</where>
order by test_case_review.update_time desc
</select>
<select id="listRelate" resultType="io.metersphere.track.dto.TestReviewDTOWithMetric">

View File

@ -26,4 +26,9 @@ public interface ExtTestPlanTestCaseMapper {
List<TestPlanCaseDTO> getPendingTestCases(@Param("request") QueryTestPlanCaseRequest request);
List<String> getStatusByPlanId(String planId);
int updateTestCaseStates(@Param("ids") List<String> ids, @Param("reportStatus") String reportStatus);
List<String> getTestPlanTestCaseIds(String testId);
}

View File

@ -285,4 +285,24 @@
from test_plan_test_case
where plan_id = #{planId}
</select>
<select id="getTestPlanTestCaseIds" resultType="java.lang.String">
select c.id from test_case a left join test_plan_test_case c on a.id=c.case_id
<where>
<if test="testId!=null">
and a.test_id=#{testId}
</if>
</where>
</select>
<update id="updateTestCaseStates" parameterType="java.lang.String">
update test_plan_test_case
<set>
<if test="reportStatus!=null">
status=#{reportStatus,jdbcType=VARCHAR}
</if>
</set>
where id in
<foreach collection="ids" item="id" index="index" open="(" close=")" separator=",">
#{id}
</foreach>
</update>
</mapper>

View File

@ -1,7 +1,9 @@
package io.metersphere.commons.constants;
public enum FileType {
JMX(".jmx"), CSV(".csv"), JSON(".json");
JMX(".jmx"), CSV(".csv"), JSON(".json"), PDF(".pdf"),
JPG(".jpg"), PNG(".png"), JPEG(".jpeg"), DOC(".doc"),
XLSX(".xlsx"), DOCX(".docx");
// 保存后缀
private String suffix;

View File

@ -3,4 +3,15 @@ package io.metersphere.commons.constants;
public interface NoticeConstants {
String EXECUTE_SUCCESSFUL = "EXECUTE_SUCCESSFUL";
String EXECUTE_FAILED = "EXECUTE_FAILED";
String EMAIL = "EMAIL";
String NAIL_ROBOT = "NAIL_ROBOT";
String WECHAT_ROBOT = "WECHAT_ROBOT";
String CREATE = "CREATE";
String UPDATE = "CREATE";
String DELETE = "DELETE";
String JENKINS_TASK = "jenkinsTask";
String TEST_PLAN_TASK = "testPlanTask";
String REVIEW_TASK = "reviewTask";
String DEFECT_TASK = "defectTask";
}

View File

@ -1,6 +1,8 @@
package io.metersphere.notice.controller;
import io.metersphere.notice.controller.request.MessageRequest;
import io.metersphere.notice.controller.request.NoticeRequest;
import io.metersphere.notice.domain.MessageSettingDetail;
import io.metersphere.notice.domain.NoticeDetail;
import io.metersphere.notice.service.NoticeService;
import org.springframework.web.bind.annotation.*;
@ -24,4 +26,19 @@ public class NoticeController {
return noticeService.queryNotice(testId);
}
@PostMapping("save/message/task")
public void saveMessage(@RequestBody MessageRequest messageRequest) {
noticeService.saveMessageTask(messageRequest);
}
@GetMapping("/search/message")
public MessageSettingDetail searchMessage() {
return noticeService.searchMessage();
}
@GetMapping("/delete/message")
public void deleteMessage() {
}
}

View File

@ -0,0 +1,11 @@
package io.metersphere.notice.controller.request;
import io.metersphere.notice.domain.MessageDetail;
import lombok.Data;
import java.util.List;
@Data
public class MessageRequest {
private List<MessageDetail> messageDetail;
}

View File

@ -0,0 +1,16 @@
package io.metersphere.notice.domain;
import io.metersphere.base.domain.MessageTask;
import lombok.Data;
import java.util.ArrayList;
import java.util.List;
@Data
public class MessageDetail extends MessageTask {
private List<String> userIds = new ArrayList<>();
private List<String> events = new ArrayList<>();
private String taskType;
private String webhook;
private String type;
}

View File

@ -0,0 +1,13 @@
package io.metersphere.notice.domain;
import lombok.Data;
import java.util.List;
@Data
public class MessageSettingDetail {
private List<MessageDetail> jenkinsTask;
private List<MessageDetail> testCasePlanTask;
private List<MessageDetail> reviewTask;
private List<MessageDetail> defectTask;
}

View File

@ -0,0 +1,45 @@
package io.metersphere.notice.message;
import com.alibaba.fastjson.JSON;
import org.apache.commons.lang3.StringUtils;
import java.util.HashMap;
import java.util.Map;
public class LinkMessage implements Message {
private String title;
private String text;
private String picUrl;
private String messageUrl;
public String toJsonString() {
Map<String, Object> items = new HashMap<String, Object>();
items.put("msgtype", "link");
Map<String, String> linkContent = new HashMap<String, String>();
if (StringUtils.isBlank(title)) {
throw new IllegalArgumentException("title should not be blank");
}
linkContent.put("title", title);
if (StringUtils.isBlank(messageUrl)) {
throw new IllegalArgumentException("messageUrl should not be blank");
}
linkContent.put("messageUrl", messageUrl);
if (StringUtils.isBlank(text)) {
throw new IllegalArgumentException("text should not be blank");
}
linkContent.put("text", text);
if (StringUtils.isNotBlank(picUrl)) {
linkContent.put("picUrl", picUrl);
}
items.put("link", linkContent);
return JSON.toJSONString(items);
}
}

View File

@ -0,0 +1,5 @@
package io.metersphere.notice.message;
public interface Message {
String toJsonString();
}

View File

@ -0,0 +1,64 @@
package io.metersphere.notice.message;
import com.alibaba.fastjson.JSON;
import org.apache.commons.lang3.StringUtils;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
public class TextMessage implements Message {
private String text;
private List<String> mentionedMobileList;
private boolean isAtAll;
public TextMessage(String text) {
this.text = text;
}
public String getText() {
return text;
}
public void setText(String text) {
this.text = text;
}
public boolean isAtAll() {
return isAtAll;
}
public void setIsAtAll(boolean isAtAll) {
this.isAtAll = isAtAll;
}
public List<String> getMentionedMobileList() {
return mentionedMobileList;
}
public void setMentionedMobileList(List<String> mentionedMobileList) {
this.mentionedMobileList = mentionedMobileList;
}
public String toJsonString() {
Map<String, Object> items = new HashMap<String, Object>();
items.put("msgtype", "text");
Map<String, Object> textContent = new HashMap<String, Object>();
if (StringUtils.isBlank(text)) {
throw new IllegalArgumentException("text should not be blank");
}
textContent.put("content", text);
if (isAtAll) {
if (mentionedMobileList == null) mentionedMobileList = new ArrayList<String>();
mentionedMobileList.add("@all");
}
if (mentionedMobileList != null && !mentionedMobileList.isEmpty()) {
textContent.put("mentioned_mobile_list", mentionedMobileList);
}
items.put("text", textContent);
return JSON.toJSONString(items);
}
}

View File

@ -0,0 +1,34 @@
package io.metersphere.notice.service;
import com.dingtalk.api.DefaultDingTalkClient;
import com.dingtalk.api.DingTalkClient;
import com.dingtalk.api.request.OapiRobotSendRequest;
import com.dingtalk.api.response.OapiRobotSendResponse;
import com.taobao.api.ApiException;
import org.springframework.stereotype.Service;
import java.util.Arrays;
import java.util.List;
@Service
public class DingTaskService {
public void sendDingTask(String context, List<String> userIds) {
DingTalkClient client = new DefaultDingTalkClient("https://oapi.dingtalk.com/robot/send?access_token=5129dc4c073d28f67c7452e0de6536c3ca496728d8c014d0a209b88a8814307a");
OapiRobotSendRequest request = new OapiRobotSendRequest();
request.setMsgtype("text");
OapiRobotSendRequest.Text text = new OapiRobotSendRequest.Text();
text.setContent(context);
request.setText(text);
OapiRobotSendRequest.At at = new OapiRobotSendRequest.At();
at.setAtMobiles(Arrays.asList("15135125273"));
request.setAt(at);
OapiRobotSendResponse response = null;
try {
response = client.execute(request);
} catch (ApiException e) {
e.printStackTrace();
}
System.out.println(response.getErrcode());
}
}

View File

@ -95,6 +95,7 @@ public class MailService {
try {
javaMailSender.send(mimeMessage);
} catch (MailException e) {
LogUtil.error(e);
LogUtil.error("Failed to send mail");
}
}
@ -249,5 +250,6 @@ public class MailService {
return recipientEmails;
}
}

View File

@ -1,17 +1,23 @@
package io.metersphere.notice.service;
import io.metersphere.base.domain.MessageTask;
import io.metersphere.base.domain.MessageTaskExample;
import io.metersphere.base.domain.Notice;
import io.metersphere.base.domain.NoticeExample;
import io.metersphere.base.mapper.MessageTaskMapper;
import io.metersphere.base.mapper.NoticeMapper;
import io.metersphere.commons.constants.NoticeConstants;
import io.metersphere.notice.controller.request.MessageRequest;
import io.metersphere.notice.controller.request.NoticeRequest;
import io.metersphere.notice.domain.MessageDetail;
import io.metersphere.notice.domain.MessageSettingDetail;
import io.metersphere.notice.domain.NoticeDetail;
import org.apache.commons.collections4.CollectionUtils;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.List;
import java.util.UUID;
import java.util.*;
import java.util.stream.Collectors;
import static io.metersphere.commons.constants.NoticeConstants.EXECUTE_FAILED;
import static io.metersphere.commons.constants.NoticeConstants.EXECUTE_SUCCESSFUL;
@ -20,6 +26,8 @@ import static io.metersphere.commons.constants.NoticeConstants.EXECUTE_SUCCESSFU
public class NoticeService {
@Resource
private NoticeMapper noticeMapper;
@Resource
private MessageTaskMapper messageTaskMapper;
public void saveNotice(NoticeRequest noticeRequest) {
NoticeExample example = new NoticeExample();
@ -78,4 +86,63 @@ public class NoticeService {
return result;
}
}
public void saveMessageTask(MessageRequest messageRequest) {
String identification = UUID.randomUUID().toString();
messageRequest.getMessageDetail().forEach(list -> {
list.getEvents().forEach(n -> {
list.getUserIds().forEach(m -> {
MessageTask message = new MessageTask();
message.setId(UUID.randomUUID().toString());
message.setEvent(n);
message.setTaskType(list.getTaskType());
message.setUserId(m);
message.setType(list.getType());
message.setWebhook(list.getWebhook());
message.setIdentification(identification);
messageTaskMapper.insert(message);
});
});
});
}
public MessageSettingDetail searchMessage() {
MessageTaskExample messageTaskExample = new MessageTaskExample();
messageTaskExample.createCriteria();
List<MessageTask> messageTaskLists = new ArrayList<>();
MessageSettingDetail messageSettingDetail = new MessageSettingDetail();
List<MessageDetail> MessageDetailList = new ArrayList<>();
messageTaskLists = messageTaskMapper.selectByExample(messageTaskExample);
Map<String, List<MessageTask>> MessageTaskMap = messageTaskLists.stream().collect(Collectors.groupingBy(e -> fetchGroupKey(e)));
MessageTaskMap.forEach((k, v) -> {
Set userIds = new HashSet();
Set events = new HashSet();
MessageDetail messageDetail = new MessageDetail();
for (MessageTask m : v) {
userIds.add(m.getUserId());
events.add(m.getEvent());
messageDetail.setTaskType(m.getTaskType());
messageDetail.setWebhook(m.getWebhook());
messageDetail.setIdentification(m.getIdentification());
messageDetail.setType(m.getType());
}
messageDetail.setEvents(new ArrayList(events));
messageDetail.setUserIds(new ArrayList(userIds));
MessageDetailList.add(messageDetail);
});
List<MessageDetail> jenkinsTask = MessageDetailList.stream().filter(a -> a.getTaskType().equals(NoticeConstants.JENKINS_TASK)).collect(Collectors.toList());
List<MessageDetail> testCasePlanTask = MessageDetailList.stream().filter(a -> a.getTaskType().equals(NoticeConstants.TEST_PLAN_TASK)).collect(Collectors.toList());
List<MessageDetail> reviewTask = MessageDetailList.stream().filter(a -> a.getTaskType().equals(NoticeConstants.REVIEW_TASK)).collect(Collectors.toList());
List<MessageDetail> defectTask = MessageDetailList.stream().filter(a -> a.getTaskType().equals(NoticeConstants.DEFECT_TASK)).collect(Collectors.toList());
messageSettingDetail.setJenkinsTask(jenkinsTask);
messageSettingDetail.setTestCasePlanTask(testCasePlanTask);
messageSettingDetail.setReviewTask(reviewTask);
messageSettingDetail.setDefectTask(defectTask);
return messageSettingDetail;
}
private static String fetchGroupKey(MessageTask user) {
return user.getTaskType() + "#" + user.getIdentification();
}
}

View File

@ -0,0 +1,27 @@
package io.metersphere.notice.service;
import io.metersphere.notice.message.TextMessage;
import io.metersphere.notice.util.SendResult;
import io.metersphere.notice.util.WxChatbotClient;
import org.springframework.stereotype.Service;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
@Service
public class WxChatTaskService {
public void enterpriseWechatTask() {
TextMessage message = new TextMessage("脸给你打歪");
List<String> mentionedMobileList = new ArrayList<String>();
mentionedMobileList.add("15135125273");//@群内成员 手机号
message.setMentionedMobileList(mentionedMobileList);
message.setIsAtAll(true);//@所有人
try {
SendResult result = WxChatbotClient.send("https://qyapi.weixin.qq.com/cgi-bin/webhook/send?key=a03acc34-4988-4200-a9c7-7c9b30c5601e", message);
System.out.println(result);
} catch (IOException e) {
e.printStackTrace();
}
}
}

View File

@ -0,0 +1,47 @@
package io.metersphere.notice.util;
import com.alibaba.fastjson.JSON;
import java.util.HashMap;
import java.util.Map;
/**
*
*/
public class SendResult {
private boolean isSuccess;
private Integer errorCode;
private String errorMsg;
public boolean isSuccess() {
return isSuccess;
}
public void setIsSuccess(boolean isSuccess) {
this.isSuccess = isSuccess;
}
public Integer getErrorCode() {
return errorCode;
}
public void setErrorCode(Integer errorCode) {
this.errorCode = errorCode;
}
public String getErrorMsg() {
return errorMsg;
}
public void setErrorMsg(String errorMsg) {
this.errorMsg = errorMsg;
}
public String toString() {
Map<String, Object> items = new HashMap<String, Object>();
items.put("errorCode", errorCode);
items.put("errorMsg", errorMsg);
items.put("isSuccess", isSuccess);
return JSON.toJSONString(items);
}
}

View File

@ -0,0 +1,50 @@
package io.metersphere.notice.util;
import com.alibaba.fastjson.JSONObject;
import io.metersphere.notice.message.Message;
import org.apache.commons.lang3.StringUtils;
import org.apache.http.HttpResponse;
import org.apache.http.HttpStatus;
import org.apache.http.client.HttpClient;
import org.apache.http.client.methods.HttpPost;
import org.apache.http.entity.StringEntity;
import org.apache.http.impl.client.HttpClients;
import org.apache.http.util.EntityUtils;
import java.io.IOException;
/**
*
*/
public class WxChatbotClient {
static HttpClient httpclient = HttpClients.createDefault();
public static SendResult send(String webhook, Message message) throws IOException {
if (StringUtils.isBlank(webhook)) {
return new SendResult();
}
HttpPost httppost = new HttpPost(webhook);
httppost.addHeader("Content-Type", "application/json; charset=utf-8");
StringEntity se = new StringEntity(message.toJsonString(), "utf-8");
httppost.setEntity(se);
SendResult sendResult = new SendResult();
HttpResponse response = httpclient.execute(httppost);
if (response.getStatusLine().getStatusCode() == HttpStatus.SC_OK) {
String result = EntityUtils.toString(response.getEntity());
JSONObject obj = JSONObject.parseObject(result);
Integer errcode = obj.getInteger("errcode");
sendResult.setErrorCode(errcode);
sendResult.setErrorMsg(obj.getString("errmsg"));
sendResult.setIsSuccess(errcode.equals(0));
}
return sendResult;
}
}

View File

@ -4,6 +4,7 @@ import io.metersphere.base.domain.*;
import io.metersphere.base.mapper.FileContentMapper;
import io.metersphere.base.mapper.FileMetadataMapper;
import io.metersphere.base.mapper.LoadTestFileMapper;
import io.metersphere.base.mapper.TestCaseFileMapper;
import io.metersphere.commons.constants.FileType;
import io.metersphere.commons.exception.MSException;
import org.springframework.stereotype.Service;
@ -12,6 +13,7 @@ import org.springframework.web.multipart.MultipartFile;
import javax.annotation.Resource;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import java.util.UUID;
import java.util.stream.Collectors;
@ -24,6 +26,8 @@ public class FileService {
private LoadTestFileMapper loadTestFileMapper;
@Resource
private FileContentMapper fileContentMapper;
@Resource
private TestCaseFileMapper testCaseFileMapper;
public byte[] loadFileAsBytes(String id) {
FileContent fileContent = fileContentMapper.selectByPrimaryKey(id);
@ -66,6 +70,19 @@ public class FileService {
loadTestFileMapper.deleteByExample(example3);
}
public void deleteFileRelatedByIds(List<String> ids) {
if (CollectionUtils.isEmpty(ids)) {
return;
}
FileMetadataExample example = new FileMetadataExample();
example.createCriteria().andIdIn(ids);
fileMetadataMapper.deleteByExample(example);
FileContentExample example2 = new FileContentExample();
example2.createCriteria().andFileIdIn(ids);
fileContentMapper.deleteByExample(example2);
}
public FileMetadata saveFile(MultipartFile file) {
final FileMetadata fileMetadata = new FileMetadata();
fileMetadata.setId(UUID.randomUUID().toString());
@ -109,4 +126,19 @@ public class FileService {
String type = filename.substring(s);
return FileType.valueOf(type.toUpperCase());
}
public List<FileMetadata> getFileMetadataByCaseId(String caseId) {
TestCaseFileExample testCaseFileExample = new TestCaseFileExample();
testCaseFileExample.createCriteria().andCaseIdEqualTo(caseId);
final List<TestCaseFile> testCaseFiles = testCaseFileMapper.selectByExample(testCaseFileExample);
if (CollectionUtils.isEmpty(testCaseFiles)) {
return new ArrayList<>();
}
List<String> fileIds = testCaseFiles.stream().map(TestCaseFile::getFileId).collect(Collectors.toList());
FileMetadataExample example = new FileMetadataExample();
example.createCriteria().andIdIn(fileIds);
return fileMetadataMapper.selectByExample(example);
}
}

View File

@ -2,6 +2,7 @@ package io.metersphere.track.controller;
import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import io.metersphere.base.domain.FileMetadata;
import io.metersphere.base.domain.Project;
import io.metersphere.base.domain.TestCase;
import io.metersphere.base.domain.TestCaseWithBLOBs;
@ -11,12 +12,18 @@ import io.metersphere.commons.utils.Pager;
import io.metersphere.commons.utils.SessionUtils;
import io.metersphere.excel.domain.ExcelResponse;
import io.metersphere.service.CheckOwnerService;
import io.metersphere.service.FileService;
import io.metersphere.track.dto.TestCaseDTO;
import io.metersphere.track.request.testcase.EditTestCaseRequest;
import io.metersphere.track.request.testcase.QueryTestCaseRequest;
import io.metersphere.track.request.testcase.TestCaseBatchRequest;
import io.metersphere.track.request.testplan.FileOperationRequest;
import io.metersphere.track.service.TestCaseService;
import org.apache.shiro.authz.annotation.Logical;
import org.apache.shiro.authz.annotation.RequiresRoles;
import org.springframework.http.HttpHeaders;
import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
@ -33,6 +40,8 @@ public class TestCaseController {
TestCaseService testCaseService;
@Resource
private CheckOwnerService checkOwnerService;
@Resource
private FileService fileService;
@PostMapping("/list/{goPage}/{pageSize}")
public Pager<List<TestCaseDTO>> list(@PathVariable int goPage, @PathVariable int pageSize, @RequestBody QueryTestCaseRequest request) {
@ -72,14 +81,16 @@ public class TestCaseController {
return testCaseService.getTestCaseByNodeId(nodeIds);
}
@PostMapping("/name")
public List<TestCase> getTestCaseNames(@RequestBody QueryTestCaseRequest request) {
return testCaseService.getTestCaseNames(request);
@PostMapping("/name/{goPage}/{pageSize}")
public Pager<List<TestCase>> getTestCaseNames(@PathVariable int goPage, @PathVariable int pageSize, @RequestBody QueryTestCaseRequest request) {
Page<Object> page = PageHelper.startPage(goPage, pageSize, true);
return PageUtils.setPageInfo(page,testCaseService.getTestCaseNames(request));
}
@PostMapping("/reviews/case")
public List<TestCase> getReviewCase(@RequestBody QueryTestCaseRequest request) {
return testCaseService.getReviewCase(request);
@PostMapping("/reviews/case/{goPage}/{pageSize}")
public Pager<List<TestCase>> getReviewCase(@PathVariable int goPage, @PathVariable int pageSize, @RequestBody QueryTestCaseRequest request) {
Page<Object> page = PageHelper.startPage(goPage, pageSize, true);
return PageUtils.setPageInfo(page, testCaseService.getReviewCase(request));
}
@GetMapping("/get/{testCaseId}")
@ -94,16 +105,16 @@ public class TestCaseController {
return testCaseService.getProjectByTestCaseId(testCaseId);
}
@PostMapping("/add")
@PostMapping(value = "/add", consumes = {"multipart/form-data"})
@RequiresRoles(value = {RoleConstants.TEST_USER, RoleConstants.TEST_MANAGER}, logical = Logical.OR)
public void addTestCase(@RequestBody TestCaseWithBLOBs testCase) {
testCaseService.addTestCase(testCase);
public void addTestCase(@RequestPart("request") TestCaseWithBLOBs testCase, @RequestPart(value = "file") List<MultipartFile> files) {
testCaseService.save(testCase, files);
}
@PostMapping("/edit")
@PostMapping(value = "/edit", consumes = {"multipart/form-data"})
@RequiresRoles(value = {RoleConstants.TEST_USER, RoleConstants.TEST_MANAGER}, logical = Logical.OR)
public void editTestCase(@RequestBody TestCaseWithBLOBs testCase) {
testCaseService.editTestCase(testCase);
public void editTestCase(@RequestPart("request") EditTestCaseRequest request, @RequestPart(value = "file") List<MultipartFile> files) {
testCaseService.edit(request, files);
}
@PostMapping("/delete/{testCaseId}")
@ -150,4 +161,18 @@ public class TestCaseController {
testCaseService.deleteTestCaseBath(request);
}
@GetMapping("/file/metadata/{caseId}")
public List<FileMetadata> getFileMetadata(@PathVariable String caseId) {
return fileService.getFileMetadataByCaseId(caseId);
}
@PostMapping("/file/download")
public ResponseEntity<byte[]> downloadJmx(@RequestBody FileOperationRequest fileOperationRequest) {
byte[] bytes = fileService.loadFileAsBytes(fileOperationRequest.getId());
return ResponseEntity.ok()
.contentType(MediaType.parseMediaType("application/octet-stream"))
.header(HttpHeaders.CONTENT_DISPOSITION, "attachment; filename=\"" + fileOperationRequest.getName() + "\"")
.body(bytes);
}
}

View File

@ -0,0 +1,14 @@
package io.metersphere.track.request.testcase;
import io.metersphere.base.domain.FileMetadata;
import io.metersphere.base.domain.TestCaseWithBLOBs;
import lombok.Getter;
import lombok.Setter;
import java.util.List;
@Getter
@Setter
public class EditTestCaseRequest extends TestCaseWithBLOBs {
private List<FileMetadata> updatedFileList;
}

View File

@ -10,5 +10,6 @@ import java.util.List;
@Setter
public class PlanCaseRelevanceRequest {
private String planId;
private String projectId;
private List<String> testCaseIds = new ArrayList<>();
}

View File

@ -10,5 +10,6 @@ import java.util.List;
@Setter
public class ReviewRelevanceRequest {
private String reviewId;
private String projectId;
private List<String> testCaseIds = new ArrayList<>();
}

View File

@ -8,10 +8,15 @@ import io.metersphere.base.mapper.TestCaseCommentMapper;
import io.metersphere.base.mapper.TestCaseMapper;
import io.metersphere.base.mapper.TestCaseReviewMapper;
import io.metersphere.base.mapper.UserMapper;
import io.metersphere.commons.constants.NoticeConstants;
import io.metersphere.commons.utils.LogUtil;
import io.metersphere.commons.utils.SessionUtils;
import io.metersphere.notice.service.DingTaskService;
import io.metersphere.notice.service.MailService;
import io.metersphere.notice.service.WxChatTaskService;
import io.metersphere.track.request.testreview.SaveCommentRequest;
import io.metersphere.track.request.testreview.SaveTestCaseReviewRequest;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
@ -34,6 +39,10 @@ public class TestCaseCommentService {
MailService mailService;
@Resource
TestCaseMapper testCaseMapper;
@Resource
DingTaskService dingTaskService;
@Resource
WxChatTaskService wxChatTaskService;
public void saveComment(SaveCommentRequest request) {
TestCaseComment testCaseComment = new TestCaseComment();
@ -49,7 +58,18 @@ public class TestCaseCommentService {
SaveTestCaseReviewRequest caseReviewRequest = new SaveTestCaseReviewRequest();
List<String> userIds = new ArrayList<>();
userIds.add(testCaseWithBLOBs.getMaintainer());
mailService.sendCommentNotice(userIds, request, testCaseWithBLOBs);
String context = getReviewContext(request, testCaseWithBLOBs);
try {
if (StringUtils.equals(NoticeConstants.NAIL_ROBOT, "NAIL_ROBOT")) {
dingTaskService.sendDingTask(context, userIds);
} else if (StringUtils.equals(NoticeConstants.WECHAT_ROBOT, "WECHAT_ROBOT")) {
wxChatTaskService.enterpriseWechatTask();
} else {
mailService.sendCommentNotice(userIds, request, testCaseWithBLOBs);
}
} catch (Exception e) {
LogUtil.error(e);
}
}
@ -72,4 +92,10 @@ public class TestCaseCommentService {
testCaseCommentExample.createCriteria().andCaseIdEqualTo(caseId);
testCaseCommentMapper.deleteByExample(testCaseCommentExample);
}
private String getReviewContext(SaveCommentRequest request, TestCaseWithBLOBs testCaseWithBLOBs) {
String context = "";
context = testCaseWithBLOBs.getMaintainer() + "发起的" + "'" + testCaseWithBLOBs.getName() + "'" + "添加评论:" + request.getDescription();
return context;
}
}

View File

@ -3,23 +3,29 @@ package io.metersphere.track.service;
import io.metersphere.base.domain.*;
import io.metersphere.base.mapper.*;
import io.metersphere.base.mapper.ext.ExtProjectMapper;
import io.metersphere.base.mapper.ext.ExtTestCaseMapper;
import io.metersphere.base.mapper.ext.ExtTestCaseReviewMapper;
import io.metersphere.base.mapper.ext.ExtTestReviewCaseMapper;
import io.metersphere.commons.constants.NoticeConstants;
import io.metersphere.commons.constants.TestCaseReviewStatus;
import io.metersphere.commons.constants.TestPlanTestCaseStatus;
import io.metersphere.commons.constants.TestReviewCaseStatus;
import io.metersphere.commons.exception.MSException;
import io.metersphere.commons.user.SessionUser;
import io.metersphere.commons.utils.LogUtil;
import io.metersphere.commons.utils.MathUtils;
import io.metersphere.commons.utils.ServiceUtils;
import io.metersphere.commons.utils.SessionUtils;
import io.metersphere.controller.request.member.QueryMemberRequest;
import io.metersphere.notice.domain.MessageDetail;
import io.metersphere.notice.domain.MessageSettingDetail;
import io.metersphere.notice.service.DingTaskService;
import io.metersphere.notice.service.MailService;
import io.metersphere.notice.service.NoticeService;
import io.metersphere.notice.service.WxChatTaskService;
import io.metersphere.service.UserService;
import io.metersphere.track.dto.TestCaseReviewDTO;
import io.metersphere.track.dto.TestReviewCaseDTO;
import io.metersphere.track.dto.TestReviewDTOWithMetric;
import io.metersphere.track.request.testcase.QueryTestCaseRequest;
import io.metersphere.track.request.testreview.QueryCaseReviewRequest;
import io.metersphere.track.request.testreview.QueryTestReviewRequest;
import io.metersphere.track.request.testreview.ReviewRelevanceRequest;
@ -32,7 +38,9 @@ import org.apache.ibatis.session.SqlSessionFactory;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.CollectionUtils;
import javax.annotation.Resource;
import java.text.SimpleDateFormat;
import java.util.*;
import java.util.stream.Collectors;
@ -66,7 +74,14 @@ public class TestCaseReviewService {
TestCaseReviewTestCaseMapper testCaseReviewTestCaseMapper;
@Resource
MailService mailService;
@Resource
ExtTestCaseMapper extTestCaseMapper;
@Resource
DingTaskService dingTaskService;
@Resource
WxChatTaskService wxChatTaskService;
@Resource
NoticeService noticeService;
public void saveTestCaseReview(SaveTestCaseReviewRequest reviewRequest) {
checkCaseReviewExist(reviewRequest);
@ -94,8 +109,19 @@ public class TestCaseReviewService {
reviewRequest.setCreator(SessionUtils.getUser().getId());
reviewRequest.setStatus(TestCaseReviewStatus.Prepare.name());
testCaseReviewMapper.insert(reviewRequest);
String context = getReviewContext(reviewRequest, "create");
MessageSettingDetail messageSettingDetail = noticeService.searchMessage();
List<MessageDetail> reviewTasklist = messageSettingDetail.getReviewTask();
try {
mailService.sendReviewerNotice(userIds, reviewRequest);
/* if (StringUtils.equals(NoticeConstants.NAIL_ROBOT, "NAIL_ROBOT")) {
dingTaskService.sendDingTask(context, userIds);
} else if (StringUtils.equals(NoticeConstants.WECHAT_ROBOT, "WECHAT_ROBOT")) {
wxChatTaskService.enterpriseWechatTask();
} else {
mailService.sendReviewerNotice(userIds, reviewRequest);
}*/
} catch (Exception e) {
LogUtil.error(e);
}
@ -146,7 +172,7 @@ public class TestCaseReviewService {
}
public List<TestCaseReviewDTO> recent(String currentWorkspaceId) {
return extTestCaseReviewMapper.listByWorkspaceId(currentWorkspaceId);
return extTestCaseReviewMapper.listByWorkspaceId(currentWorkspaceId, SessionUtils.getUserId());
}
public void editCaseReview(SaveTestCaseReviewRequest testCaseReview) {
@ -300,6 +326,16 @@ public class TestCaseReviewService {
if (testCaseIds.isEmpty()) {
return;
}
// 如果是关联全部指令则从新查询未关联的案例
if (testCaseIds.get(0).equals("all")) {
QueryTestCaseRequest req = new QueryTestCaseRequest();
req.setReviewId(request.getReviewId());
req.setProjectId(request.getProjectId());
List<TestCase> testCases = extTestCaseMapper.getTestCaseByNotInReview(req);
if (!testCases.isEmpty()) {
testCaseIds = testCases.stream().map(testCase -> testCase.getId()).collect(Collectors.toList());
}
}
SqlSession sqlSession = sqlSessionFactory.openSession(ExecutorType.BATCH);
TestCaseReviewTestCaseMapper batchMapper = sqlSession.getMapper(TestCaseReviewTestCaseMapper.class);
@ -359,7 +395,14 @@ public class TestCaseReviewService {
testCaseReviewMapper.updateByPrimaryKeySelective(testCaseReview);
try {
BeanUtils.copyProperties(testCaseReviewRequest, _testCaseReview);
mailService.sendEndNotice(userIds, testCaseReviewRequest);
String context = getReviewContext(testCaseReviewRequest, "create");
if (StringUtils.equals(NoticeConstants.NAIL_ROBOT, "NAIL_ROBOT")) {
dingTaskService.sendDingTask(context, userIds);
} else if (StringUtils.equals(NoticeConstants.WECHAT_ROBOT, "WECHAT_ROBOT")) {
wxChatTaskService.enterpriseWechatTask();
} else {
mailService.sendEndNotice(userIds, testCaseReviewRequest);
}
} catch (Exception e) {
LogUtil.error(e);
}
@ -450,4 +493,28 @@ public class TestCaseReviewService {
request.setProjectIds(projectIds);
return extTestReviewCaseMapper.list(request);
}
private String getReviewContext(SaveTestCaseReviewRequest reviewRequest, String type) {
Long startTime = reviewRequest.getCreateTime();
Long endTime = reviewRequest.getEndTime();
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
String start = null;
String sTime = String.valueOf(startTime);
String eTime = String.valueOf(endTime);
if (!sTime.equals("null")) {
start = sdf.format(new Date(Long.parseLong(sTime)));
}
String end = null;
if (!eTime.equals("null")) {
end = sdf.format(new Date(Long.parseLong(eTime)));
}
String context = "";
if (StringUtils.equals("create", type)) {
context = reviewRequest.getCreator() + "发起的" + "'" + reviewRequest.getName() + "'" + "待开始,计划开始时间是" + start + "计划结束时间为" + end + "请跟进";
} else if (StringUtils.equals("end", type)) {
context = reviewRequest.getCreator() + "发起的" + "'" + reviewRequest.getName() + "'" + "已完成,计划开始时间是" + start + "计划结束时间为" + end + "已完成";
}
return context;
}
}

View File

@ -26,10 +26,13 @@ import io.metersphere.excel.listener.EasyExcelListener;
import io.metersphere.excel.listener.TestCaseDataListener;
import io.metersphere.excel.utils.EasyExcelExporter;
import io.metersphere.i18n.Translator;
import io.metersphere.service.FileService;
import io.metersphere.track.dto.TestCaseDTO;
import io.metersphere.track.request.testcase.EditTestCaseRequest;
import io.metersphere.track.request.testcase.QueryTestCaseRequest;
import io.metersphere.track.request.testcase.TestCaseBatchRequest;
import io.metersphere.xmind.XmindCaseParser;
import org.apache.commons.collections4.ListUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.ibatis.session.ExecutorType;
import org.apache.ibatis.session.SqlSession;
@ -83,8 +86,12 @@ public class TestCaseService {
TestCaseReviewTestCaseMapper testCaseReviewTestCaseMapper;
@Resource
TestCaseCommentService testCaseCommentService;
@Resource
FileService fileService;
@Resource
TestCaseFileMapper testCaseFileMapper;
public void addTestCase(TestCaseWithBLOBs testCase) {
private TestCaseWithBLOBs addTestCase(TestCaseWithBLOBs testCase) {
testCase.setName(testCase.getName());
checkTestCaseExist(testCase);
testCase.setId(UUID.randomUUID().toString());
@ -93,6 +100,7 @@ public class TestCaseService {
testCase.setNum(getNextNum(testCase.getProjectId()));
testCase.setReviewStatus(TestCaseReviewStatus.Prepare.name());
testCaseMapper.insert(testCase);
return testCase;
}
public List<TestCase> getTestCaseByNodeId(List<String> nodeIds) {
@ -190,46 +198,24 @@ public class TestCaseService {
* @return
*/
public List<TestCase> getTestCaseNames(QueryTestCaseRequest request) {
if (StringUtils.isNotBlank(request.getPlanId())) {
TestPlan testPlan = testPlanMapper.selectByPrimaryKey(request.getPlanId());
// request 传入要查询的 projectId 切换的项目ID
}
List<TestCase> testCaseNames = extTestCaseMapper.getTestCaseNames(request);
if (StringUtils.isNotBlank(request.getPlanId())) {
TestPlanTestCaseExample testPlanTestCaseExample = new TestPlanTestCaseExample();
testPlanTestCaseExample.createCriteria().andPlanIdEqualTo(request.getPlanId());
List<String> relevanceIds = testPlanTestCaseMapper.selectByExample(testPlanTestCaseExample).stream()
.map(TestPlanTestCase::getCaseId)
.collect(Collectors.toList());
return testCaseNames.stream()
.filter(testcase -> !relevanceIds.contains(testcase.getId()))
.collect(Collectors.toList());
}
return testCaseNames;
List<OrderRequest> orderList = ServiceUtils.getDefaultOrder(request.getOrders());
OrderRequest order = new OrderRequest();
order.setName("sort");
order.setType("desc");
orderList.add(order);
request.setOrders(orderList);
return extTestCaseMapper.getTestCaseByNotInPlan(request);
}
public List<TestCase> getReviewCase(QueryTestCaseRequest request) {
List<TestCase> testCases = extTestCaseMapper.getTestCaseNames(request);
if (StringUtils.isNotBlank(request.getReviewId())) {
TestCaseReviewTestCaseExample testCaseReviewTestCaseExample = new TestCaseReviewTestCaseExample();
testCaseReviewTestCaseExample.createCriteria().andReviewIdEqualTo(request.getReviewId());
List<String> relevanceIds = testCaseReviewTestCaseMapper.selectByExample(testCaseReviewTestCaseExample).stream()
.map(TestCaseReviewTestCase::getCaseId)
.collect(Collectors.toList());
return testCases.stream()
.filter(testcase -> !relevanceIds.contains(testcase.getId()))
.collect(Collectors.toList());
}
return testCases;
List<OrderRequest> orderList = ServiceUtils.getDefaultOrder(request.getOrders());
OrderRequest order = new OrderRequest();
// 对模板导入的测试用例排序
order.setName("sort");
order.setType("desc");
orderList.add(order);
request.setOrders(orderList);
return extTestCaseMapper.getTestCaseByNotInReview(request);
}
@ -300,6 +286,7 @@ public class TestCaseService {
testCaseNodeService.createNodes(xmindParser.getNodePaths(), projectId);
}
if (!xmindParser.getTestCase().isEmpty()) {
Collections.reverse(xmindParser.getTestCase());
this.saveImportData(xmindParser.getTestCase(), projectId);
xmindParser.clear();
}
@ -349,6 +336,9 @@ public class TestCaseService {
AtomicInteger num = new AtomicInteger();
num.set(getNextNum(projectId) + testCases.size());
testCases.forEach(testcase -> {
testcase.setId(UUID.randomUUID().toString());
testcase.setCreateTime(System.currentTimeMillis());
testcase.setUpdateTime(System.currentTimeMillis());
testcase.setNodeId(nodePathMap.get(testcase.getNodePath()));
testcase.setSort(sort.getAndIncrement());
testcase.setNum(num.decrementAndGet());
@ -596,4 +586,55 @@ public class TestCaseService {
return false;
}
public String save(TestCaseWithBLOBs testCase, List<MultipartFile> files) {
if (files == null) {
throw new IllegalArgumentException(Translator.get("file_cannot_be_null"));
}
final TestCaseWithBLOBs testCaseWithBLOBs = addTestCase(testCase);
files.forEach(file -> {
final FileMetadata fileMetadata = fileService.saveFile(file);
TestCaseFile testCaseFile = new TestCaseFile();
testCaseFile.setCaseId(testCaseWithBLOBs.getId());
testCaseFile.setFileId(fileMetadata.getId());
testCaseFileMapper.insert(testCaseFile);
});
return testCaseWithBLOBs.getId();
}
public String edit(EditTestCaseRequest request, List<MultipartFile> files) {
TestCaseWithBLOBs testCaseWithBLOBs = testCaseMapper.selectByPrimaryKey(request.getId());
if (testCaseWithBLOBs == null) {
MSException.throwException(Translator.get("edit_load_test_not_found") + request.getId());
}
// 新选择了一个文件删除原来的文件
List<FileMetadata> updatedFiles = request.getUpdatedFileList();
List<FileMetadata> originFiles = fileService.getFileMetadataByCaseId(request.getId());
List<String> updatedFileIds = updatedFiles.stream().map(FileMetadata::getId).collect(Collectors.toList());
List<String> originFileIds = originFiles.stream().map(FileMetadata::getId).collect(Collectors.toList());
// 相减
List<String> deleteFileIds = ListUtils.subtract(originFileIds, updatedFileIds);
fileService.deleteFileRelatedByIds(deleteFileIds);
if (!CollectionUtils.isEmpty(deleteFileIds)) {
TestCaseFileExample testCaseFileExample = new TestCaseFileExample();
testCaseFileExample.createCriteria().andFileIdIn(deleteFileIds);
testCaseFileMapper.deleteByExample(testCaseFileExample);
}
if (files != null) {
files.forEach(file -> {
final FileMetadata fileMetadata = fileService.saveFile(file);
TestCaseFile testCaseFile = new TestCaseFile();
testCaseFile.setFileId(fileMetadata.getId());
testCaseFile.setCaseId(request.getId());
testCaseFileMapper.insert(testCaseFile);
});
}
editTestCase(request);
return request.getId();
}
}

View File

@ -6,6 +6,7 @@ import com.alibaba.fastjson.JSONObject;
import io.metersphere.base.domain.*;
import io.metersphere.base.mapper.*;
import io.metersphere.base.mapper.ext.ExtProjectMapper;
import io.metersphere.base.mapper.ext.ExtTestCaseMapper;
import io.metersphere.base.mapper.ext.ExtTestPlanMapper;
import io.metersphere.base.mapper.ext.ExtTestPlanTestCaseMapper;
import io.metersphere.commons.constants.TestPlanStatus;
@ -24,6 +25,7 @@ import io.metersphere.track.dto.TestPlanCaseDTO;
import io.metersphere.track.dto.TestPlanDTO;
import io.metersphere.track.dto.TestPlanDTOWithMetric;
import io.metersphere.track.request.testcase.PlanCaseRelevanceRequest;
import io.metersphere.track.request.testcase.QueryTestCaseRequest;
import io.metersphere.track.request.testcase.QueryTestPlanRequest;
import io.metersphere.track.request.testplan.AddTestPlanRequest;
import io.metersphere.track.request.testplancase.QueryTestPlanCaseRequest;
@ -78,6 +80,8 @@ public class TestPlanService {
TestPlanProjectService testPlanProjectService;
@Resource
ProjectMapper projectMapper;
@Resource
ExtTestCaseMapper extTestCaseMapper;
public void addTestPlan(AddTestPlanRequest testPlan) {
if (getTestPlanByName(testPlan.getName()).size() > 0) {
@ -207,6 +211,16 @@ public class TestPlanService {
return;
}
// 如果是关联全部指令则从新查询未关联的案例
if (testCaseIds.get(0).equals("all")) {
QueryTestCaseRequest req = new QueryTestCaseRequest();
req.setPlanId(request.getPlanId());
req.setProjectId(request.getProjectId());
List<TestCase> testCases = extTestCaseMapper.getTestCaseByNotInPlan(req);
if (!testCases.isEmpty()) {
testCaseIds = testCases.stream().map(testCase -> testCase.getId()).collect(Collectors.toList());
}
}
TestCaseExample testCaseExample = new TestCaseExample();
testCaseExample.createCriteria().andIdIn(testCaseIds);

View File

@ -140,4 +140,12 @@ public class TestPlanTestCaseService {
example.createCriteria().andIdIn(request.getIds());
testPlanTestCaseMapper.deleteByExample(example);
}
public List<String> getTestPlanTestCaseIds(String testId) {
return extTestPlanTestCaseMapper.getTestPlanTestCaseIds(testId);
}
public int updateTestCaseStates(List<String> ids, String reportStatus) {
return extTestPlanTestCaseMapper.updateTestCaseStates(ids, reportStatus);
}
}

View File

@ -15,10 +15,12 @@ import io.metersphere.track.dto.TestReviewCaseDTO;
import io.metersphere.track.request.testplancase.TestReviewCaseBatchRequest;
import io.metersphere.track.request.testreview.DeleteRelevanceRequest;
import io.metersphere.track.request.testreview.QueryCaseReviewRequest;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
@ -64,17 +66,17 @@ public class TestReviewTestCaseService {
return testCaseReviewUsers.stream().map(TestCaseReviewUsers::getUserId).collect(Collectors.toList());
}
private String getReviewName(List<String> userIds, Map userMap) {
StringBuilder stringBuilder = new StringBuilder();
String name = "";
private String getReviewName(List<String> userIds, Map<String, String> userMap) {
List<String> userNames = new ArrayList<>();
if (userIds.size() > 0) {
for (String id : userIds) {
stringBuilder.append(userMap.get(id)).append("");
String n = userMap.get(id);
if (StringUtils.isNotBlank(n)) {
userNames.add(n);
}
}
name = stringBuilder.toString().substring(0, stringBuilder.length() - 1);
}
return name;
return StringUtils.join(userNames, "");
}
public int deleteTestCase(DeleteRelevanceRequest request) {
@ -108,12 +110,6 @@ public class TestReviewTestCaseService {
MSException.throwException("非此用例的评审人员!");
}
TestCaseReview testCaseReview = testCaseReviewMapper.selectByPrimaryKey(reviewId);
Long endTime = testCaseReview.getEndTime();
if (System.currentTimeMillis() > endTime) {
MSException.throwException("此用例评审已到截止时间!");
}
// 记录测试用例评审状态变更
testCaseReviewTestCase.setStatus(testCaseReviewTestCase.getStatus());
testCaseReviewTestCase.setReviewer(SessionUtils.getUser().getId());

View File

@ -6,7 +6,6 @@ import com.google.common.collect.ImmutableMap;
import io.metersphere.base.domain.TestCaseWithBLOBs;
import io.metersphere.commons.constants.TestCaseConstants;
import io.metersphere.commons.utils.BeanUtils;
import io.metersphere.commons.utils.LogUtil;
import io.metersphere.excel.domain.TestCaseExcelData;
import io.metersphere.i18n.Translator;
import io.metersphere.track.service.TestCaseService;
@ -82,7 +81,11 @@ public class XmindCaseParser {
}
private final Map<String, String> caseTypeMap = ImmutableMap.of("功能测试", "functional", "性能测试", "performance", "接口测试", "api");
private final List<String> priorityList = Arrays.asList("P0", "P1", "P2", "P3");
/**
* 验证模块的合规性
*/
public void validate() {
nodePaths.forEach(nodePath -> {
String[] nodes = nodePath.split("/");
@ -90,24 +93,100 @@ public class XmindCaseParser {
process.append(Translator.get("test_case_node_level_tip") +
TestCaseConstants.MAX_NODE_DEPTH + Translator.get("test_case_node_level") + "; ");
}
String path = "";
for (int i = 0; i < nodes.length; i++) {
if (i != 0 && StringUtils.equals(nodes[i].trim(), "")) {
process.append(Translator.get("module_not_null") + "; ");
process.append(Translator.get("module") + ":【" + path + "" + Translator.get("module_not_null") + "; ");
} else if (nodes[i].trim().length() > 30) {
process.append(nodes[i].trim() + "" + Translator.get("test_track.length_less_than") + "30 ;");
} else {
path += nodes[i].trim() + "/";
}
}
});
}
/**
* 验证用例的合规性
*/
private boolean validate(TestCaseWithBLOBs data) {
String nodePath = data.getNodePath();
if (!nodePath.startsWith("/")) {
nodePath = "/" + nodePath;
}
if (nodePath.endsWith("/")) {
nodePath = nodePath.substring(0, nodePath.length() - 1);
}
data.setNodePath(nodePath);
StringBuilder stringBuilder = new StringBuilder();
if (data.getName().length() > 50) {
stringBuilder.append(data.getName() + "" + Translator.get("test_case") + Translator.get("test_track.length_less_than") + "50 ;");
}
if (!StringUtils.isEmpty(nodePath)) {
String[] nodes = nodePath.split("/");
if (nodes.length > TestCaseConstants.MAX_NODE_DEPTH + 1) {
stringBuilder.append(Translator.get("test_case_node_level_tip") +
TestCaseConstants.MAX_NODE_DEPTH + Translator.get("test_case_node_level") + "; ");
}
for (int i = 0; i < nodes.length; i++) {
if (i != 0 && StringUtils.equals(nodes[i].trim(), "")) {
stringBuilder.append(Translator.get("test_case") + ":【" + data.getName() + "" + Translator.get("module_not_null") + "; ");
break;
} else if (nodes[i].trim().length() > 30) {
stringBuilder.append(nodes[i].trim() + "" + Translator.get("module") + Translator.get("test_track.length_less_than") + "30 ;");
break;
}
}
}
if (StringUtils.equals(data.getType(), TestCaseConstants.Type.Functional.getValue()) && StringUtils.equals(data.getMethod(), TestCaseConstants.Method.Auto.getValue())) {
stringBuilder.append(Translator.get("functional_method_tip") + "; ");
}
if (testCaseNames.contains(data.getName())) {
boolean dbExist = testCaseService.exist(data);
if (dbExist) {
stringBuilder.append(Translator.get("test_case_already_exists_excel") + "" + data.getName() + "; ");
}
} else {
testCaseNames.add(data.getName());
}
// 用例等级和用例性质处理
if (!priorityList.contains(data.getPriority())) {
stringBuilder.append(data.getName() + "" + Translator.get("test_case_priority") + Translator.get("incorrect_format") + "; ");
}
if (data.getType() == null) {
stringBuilder.append(data.getName() + "" + Translator.get("test_case_type") + Translator.get("incorrect_format") + "; ");
}
// 重复用例校验
TestCaseExcelData compartData = new TestCaseExcelData();
BeanUtils.copyBean(compartData, data);
if (compartDatas.contains(compartData)) {
stringBuilder.append(Translator.get("test_case_already_exists_excel") + "" + compartData.getName() + "; ");
}
if (!StringUtils.isEmpty(stringBuilder.toString())) {
process.append(stringBuilder.toString());
return false;
}
compartDatas.add(compartData);
return true;
}
/**
* 递归处理案例数据
*/
private void recursion(Attached parent, int level, List<Attached> attacheds) {
for (Attached item : attacheds) {
if (isAvailable(item.getTitle(), TC_REGEX)) { // 用例
if (isAvailable(item.getTitle(), TC_REGEX)) {
item.setParent(parent);
this.newTestCase(item.getTitle(), parent.getPath(), item.getChildren() != null ? item.getChildren().getAttached() : null);
this.formatTestCase(item.getTitle(), parent.getPath(), item.getChildren() != null ? item.getChildren().getAttached() : null);
} else {
String nodePath = parent.getPath() + "/" + item.getTitle();
item.setPath(nodePath);
@ -121,7 +200,8 @@ public class XmindCaseParser {
if (nodePath.endsWith("/")) {
nodePath = nodePath.substring(0, nodePath.length() - 1);
}
nodePaths.add(nodePath); // 没有用例的路径
// 没有用例的路径
nodePaths.add(nodePath);
}
}
}
@ -151,27 +231,36 @@ public class XmindCaseParser {
*/
private String getSteps(List<Attached> attacheds) {
JSONArray jsonArray = new JSONArray();
for (int i = 0; i < attacheds.size(); i++) {
if (!attacheds.isEmpty()) {
for (int i = 0; i < attacheds.size(); i++) {
// 保持插入顺序判断用例是否有相同的steps
JSONObject step = new JSONObject(true);
step.put("num", i + 1);
step.put("desc", attacheds.get(i).getTitle());
if (attacheds.get(i).getChildren() != null && !attacheds.get(i).getChildren().getAttached().isEmpty()) {
step.put("result", attacheds.get(i).getChildren().getAttached().get(0).getTitle());
}
jsonArray.add(step);
}
} else {
// 保持插入顺序判断用例是否有相同的steps
JSONObject step = new JSONObject(true);
step.put("num", i + 1);
step.put("desc", attacheds.get(i).getTitle());
if (attacheds.get(i).getChildren() != null && !attacheds.get(i).getChildren().getAttached().isEmpty()) {
step.put("result", attacheds.get(i).getChildren().getAttached().get(0).getTitle());
}
step.put("num", 1);
step.put("desc", "");
step.put("result", "");
jsonArray.add(step);
}
return jsonArray.toJSONString();
}
/**
* 初始化一个用例
* 格式化一个用例
*/
private void newTestCase(String title, String nodePath, List<Attached> attacheds) {
private void formatTestCase(String title, String nodePath, List<Attached> attacheds) {
TestCaseWithBLOBs testCase = new TestCaseWithBLOBs();
testCase.setProjectId(projectId);
testCase.setMaintainer(maintainer);
testCase.setPriority("P0");
testCase.setPriority(priorityList.get(0));
testCase.setMethod("manual");
testCase.setType("functional");
@ -183,26 +272,21 @@ public class XmindCaseParser {
}
// 用例名称
testCase.setName(this.replace(tcArr[1], TC_REGEX));
if (!nodePath.startsWith("/")) {
nodePath = "/" + nodePath;
}
if (nodePath.endsWith("/")) {
nodePath = nodePath.substring(0, nodePath.length() - 1);
}
testCase.setNodePath(nodePath);
// 用例等级和用例性质处理
if (tcArr[0].indexOf("-") != -1) {
String[] otArr = tcArr[0].split("-");
for (String item : otArr) {
if (item.toUpperCase().startsWith("P")) {
for (String item : tcArr[0].split("-")) {
if (isAvailable(item, TC_REGEX)) {
continue;
} else if (item.toUpperCase().startsWith("P")) {
testCase.setPriority(item.toUpperCase());
} else {
Optional.ofNullable(caseTypeMap.get(item)).ifPresent(opt -> testCase.setType(opt));
testCase.setType(caseTypeMap.get(item));
}
}
}
// 测试步骤处理
List<Attached> steps = new LinkedList<>();
if (attacheds != null && !attacheds.isEmpty()) {
@ -216,78 +300,12 @@ public class XmindCaseParser {
}
});
}
if (!steps.isEmpty()) {
testCase.setSteps(this.getSteps(steps));
} else {
JSONArray jsonArray = new JSONArray();
// 保持插入顺序判断用例是否有相同的steps
JSONObject step = new JSONObject(true);
step.put("num", 1);
step.put("desc", "");
step.put("result", "");
jsonArray.add(step);
testCase.setSteps(jsonArray.toJSONString());
}
TestCaseExcelData compartData = new TestCaseExcelData();
BeanUtils.copyBean(compartData, testCase);
if (compartDatas.contains(compartData)) {
process.append(Translator.get("test_case_already_exists_excel") + "" + testCase.getName() + "; ");
} else if (validate(testCase)) {
testCase.setId(UUID.randomUUID().toString());
testCase.setCreateTime(System.currentTimeMillis());
testCase.setUpdateTime(System.currentTimeMillis());
testCase.setSteps(this.getSteps(steps));
// 校验合规性
if (validate(testCase)) {
testCases.add(testCase);
}
compartDatas.add(compartData);
}
/**
* 验证合法性
*/
private boolean validate(TestCaseWithBLOBs data) {
String nodePath = data.getNodePath();
StringBuilder stringBuilder = new StringBuilder();
if (data.getName().length() > 50) {
stringBuilder.append(data.getName() + "" + Translator.get("test_case") + Translator.get("test_track.length_less_than") + "50 ;");
}
if (!StringUtils.isEmpty(nodePath)) {
String[] nodes = nodePath.split("/");
if (nodes.length > TestCaseConstants.MAX_NODE_DEPTH + 1) {
stringBuilder.append(Translator.get("test_case_node_level_tip") +
TestCaseConstants.MAX_NODE_DEPTH + Translator.get("test_case_node_level") + "; ");
}
for (int i = 0; i < nodes.length; i++) {
if (i != 0 && StringUtils.equals(nodes[i].trim(), "")) {
stringBuilder.append(Translator.get("module_not_null") + "; ");
break;
} else if (nodes[i].trim().length() > 30) {
stringBuilder.append(nodes[i].trim() + "" + Translator.get("module") + Translator.get("test_track.length_less_than") + "30 ;");
break;
}
}
}
if (StringUtils.equals(data.getType(), TestCaseConstants.Type.Functional.getValue()) && StringUtils.equals(data.getMethod(), TestCaseConstants.Method.Auto.getValue())) {
stringBuilder.append(Translator.get("functional_method_tip") + "; ");
}
if (testCaseNames.contains(data.getName())) {
boolean dbExist = testCaseService.exist(data);
if (dbExist) {
// db exist
stringBuilder.append(Translator.get("test_case_already_exists_excel") + "" + data.getName() + "; ");
}
} else {
testCaseNames.add(data.getName());
}
if (!StringUtils.isEmpty(stringBuilder.toString())) {
process.append(stringBuilder.toString());
return false;
}
return true;
}
/**
@ -323,8 +341,8 @@ public class XmindCaseParser {
}
}
}
this.validate(); //检查目录合规性
//检查目录合规性
this.validate();
} catch (Exception ex) {
return ex.getMessage();
}

View File

@ -0,0 +1,7 @@
create table if not exists test_case_file
(
case_id varchar(64) null,
file_id varchar(64) null,
constraint test_case_file_unique_key
unique (case_id, file_id)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

View File

@ -0,0 +1,12 @@
CREATE TABLE IF NOT EXISTS message_task (
id varchar(50) NOT NULL,
type varchar(50) NOT NULL COMMENT '消息类型',
event varchar(255) NOT NULL COMMENT '通知事件类型',
user_id varchar(50) NOT NULL COMMENT '接收人id',
task_type varchar(64) NOT NULL,
webhook varchar(255) COMMENT 'webhook地址',
CONSTRAINT message_manage_pk
PRIMARY KEY (id)
)
ENGINE = InnoDB
DEFAULT CHARSET = utf8mb4;

View File

@ -0,0 +1 @@
alter table test_case modify prerequisite varchar(500) null comment 'Test case prerequisite condition';

View File

@ -0,0 +1,2 @@
alter table message_task
add identification varchar(255) not null;

View File

@ -64,9 +64,9 @@
<!--要生成的数据库表 -->
<table tableName="jar_config"/>
<!--<table tableName="notice"/>-->
<table tableName="schedule"/>
<table tableName="notice"/>
<table tableName="message_task"/>
</context>
</generatorConfiguration>

View File

@ -34,7 +34,8 @@
"html2canvas": "^1.0.0-rc.7",
"jspdf": "^2.1.1",
"yan-progress": "^1.0.3",
"nprogress": "^0.2.0"
"nprogress": "^0.2.0",
"el-table-infinite-scroll": "^1.0.10"
},
"devDependencies": {
"@vue/cli-plugin-babel": "^4.1.0",

View File

@ -13,8 +13,14 @@
<el-input :disabled="isReadOnly" v-model="regex.expression" size="small" show-word-limit
:placeholder="$t('api_test.request.assertions.expression')"/>
</el-col>
<el-col class="assertion-checkbox">
<el-checkbox v-model="regex.assumeSuccess" :disabled="isReadOnly">
{{ $t('api_test.request.assertions.ignore_status') }}
</el-checkbox>
</el-col>
<el-col class="assertion-btn">
<el-button :disabled="isReadOnly" type="danger" size="mini" icon="el-icon-delete" circle @click="remove" v-if="edit"/>
<el-button :disabled="isReadOnly" type="danger" size="mini" icon="el-icon-delete" circle @click="remove"
v-if="edit"/>
<el-button :disabled="isReadOnly" type="primary" size="small" @click="add" v-else>Add</el-button>
</el-col>
</el-row>
@ -22,77 +28,82 @@
</template>
<script>
import {ASSERTION_REGEX_SUBJECT, Regex} from "../../model/ScenarioModel";
import {ASSERTION_REGEX_SUBJECT, Regex} from "../../model/ScenarioModel";
export default {
name: "MsApiAssertionRegex",
export default {
name: "MsApiAssertionRegex",
props: {
regex: {
type: Regex,
default: () => {
return new Regex();
}
},
edit: {
type: Boolean,
default: false
},
index: Number,
list: Array,
callback: Function,
isReadOnly: {
type: Boolean,
default: false
props: {
regex: {
type: Regex,
default: () => {
return new Regex();
}
},
data() {
return {
subjects: ASSERTION_REGEX_SUBJECT,
}
edit: {
type: Boolean,
default: false
},
index: Number,
list: Array,
callback: Function,
isReadOnly: {
type: Boolean,
default: false
}
},
watch: {
'regex.subject'() {
this.setRegexDescription();
},
'regex.expression'() {
this.setRegexDescription();
}
data() {
return {
subjects: ASSERTION_REGEX_SUBJECT,
}
},
watch: {
'regex.subject'() {
this.setRegexDescription();
},
'regex.expression'() {
this.setRegexDescription();
}
},
methods: {
add: function () {
this.list.push(this.getRegex());
this.callback();
},
remove: function () {
this.list.splice(this.index, 1);
},
getRegex() {
let regex = new Regex(this.regex);
regex.description = regex.subject + " has: " + regex.expression;
return regex;
},
setRegexDescription() {
this.regex.description = this.regex.subject + " has: " + this.regex.expression;
}
methods: {
add: function () {
this.list.push(this.getRegex());
this.callback();
},
remove: function () {
this.list.splice(this.index, 1);
},
getRegex() {
let regex = new Regex(this.regex);
regex.description = regex.subject + " has: " + regex.expression;
return regex;
},
setRegexDescription() {
this.regex.description = this.regex.subject + " has: " + this.regex.expression;
}
}
}
</script>
<style scoped>
.assertion-select {
width: 250px;
}
.assertion-select {
width: 250px;
}
.assertion-item {
width: 100%;
}
.assertion-item {
width: 100%;
}
.assertion-btn {
text-align: center;
width: 60px;
}
.assertion-checkbox {
text-align: center;
width: 120px;
}
.assertion-btn {
text-align: center;
width: 60px;
}
</style>

View File

@ -23,88 +23,100 @@
<el-input :disabled="isReadOnly" v-model="value" maxlength="200" size="small" show-word-limit
:placeholder="$t('api_test.request.assertions.value')"/>
</el-col>
<el-col class="assertion-checkbox">
<el-checkbox v-model="assumeSuccess" :disabled="isReadOnly">
{{ $t('api_test.request.assertions.ignore_status') }}
</el-checkbox>
</el-col>
<el-col class="assertion-btn">
<el-button :disabled="isReadOnly" type="primary" size="small" @click="add">Add</el-button>
<el-button :disabled="isReadOnly" type="primary" size="small" @click="add">Add</el-button>
</el-col>
</el-row>
</div>
</template>
<script>
import {Regex, ASSERTION_REGEX_SUBJECT} from "../../model/ScenarioModel";
import {Regex, ASSERTION_REGEX_SUBJECT} from "../../model/ScenarioModel";
export default {
name: "MsApiAssertionText",
export default {
name: "MsApiAssertionText",
props: {
list: Array,
callback: Function,
isReadOnly: {
type: Boolean,
default: false
}
props: {
list: Array,
callback: Function,
isReadOnly: {
type: Boolean,
default: false
}
},
data() {
return {
subjects: ASSERTION_REGEX_SUBJECT,
subject: "",
condition: "",
assumeSuccess: false,
value: ""
}
},
methods: {
add: function () {
this.list.push(this.toRegex());
this.callback();
},
data() {
return {
subjects: ASSERTION_REGEX_SUBJECT,
subject: "",
condition: "",
value: ""
toRegex: function () {
let expression = "";
let description = this.subject;
switch (this.condition) {
case "CONTAINS":
expression = ".*" + this.value + ".*";
description += " contains: " + this.value;
break;
case "NOT_CONTAINS":
expression = "(?s)^((?!" + this.value + ").)*$";
description += " not contains: " + this.value;
break;
case "EQUALS":
expression = "^" + this.value + "$";
description += " equals: " + this.value;
break;
case "START_WITH":
expression = "^" + this.value;
description += " start with: " + this.value;
break;
case "END_WITH":
expression = this.value + "$";
description += " end with: " + this.value;
break;
}
},
methods: {
add: function () {
this.list.push(this.toRegex());
this.callback();
},
toRegex: function () {
let expression = "";
let description = this.subject;
switch (this.condition) {
case "CONTAINS":
expression = ".*" + this.value + ".*";
description += " contains: " + this.value;
break;
case "NOT_CONTAINS":
expression = "(?s)^((?!" + this.value + ").)*$";
description += " not contains: " + this.value;
break;
case "EQUALS":
expression = "^" + this.value + "$";
description += " equals: " + this.value;
break;
case "START_WITH":
expression = "^" + this.value;
description += " start with: " + this.value;
break;
case "END_WITH":
expression = this.value + "$";
description += " end with: " + this.value;
break;
return new Regex({
subject: this.subject,
expression: expression,
description: description,
assumeSuccess: this.assumeSuccess
}
return new Regex({
subject: this.subject,
expression: expression,
description: description
}
);
}
);
}
}
}
</script>
<style scoped>
.assertion-select {
width: 250px;
}
.assertion-select {
width: 250px;
}
.assertion-item {
width: 100%;
}
.assertion-item {
width: 100%;
}
.assertion-btn {
width: 60px;
}
.assertion-checkbox {
text-align: center;
width: 120px;
}
.assertion-btn {
width: 60px;
}
</style>

View File

@ -124,7 +124,7 @@
</template>
<script>
import {Scenario, TCPRequest} from "@/business/components/api/test/model/ScenarioModel";
import {Scenario, TCPConfig, TCPRequest} from "@/business/components/api/test/model/ScenarioModel";
import MsApiAssertions from "@/business/components/api/test/components/assertion/ApiAssertions";
import MsApiExtract from "@/business/components/api/test/components/extract/ApiExtract";
import MsJsr233Processor from "@/business/components/api/test/components/processor/Jsr233Processor";
@ -143,7 +143,7 @@ export default {
data() {
return {
activeName: "assertions",
classes: TCPRequest.CLASSES,
classes: TCPConfig.CLASSES,
rules: {
server: [
{

View File

@ -415,7 +415,7 @@ export class ResponseAssertion extends DefaultTestElement {
this.assertion = assertion || {};
this.stringProp('Assertion.test_field', this.assertion.field);
this.boolProp('Assertion.assume_success', false);
this.boolProp('Assertion.assume_success', this.assertion.assumeSuccess);
this.intProp('Assertion.test_type', this.assertion.type);
this.stringProp('Assertion.custom_message', this.assertion.message);
@ -440,11 +440,12 @@ export class JSONPathAssertion extends DefaultTestElement {
}
export class ResponseCodeAssertion extends ResponseAssertion {
constructor(testName, type, value, message) {
constructor(testName, type, value, assumeSuccess, message) {
let assertion = {
field: 'Assertion.response_code',
type: type,
value: value,
assumeSuccess: assumeSuccess,
message: message,
}
super(testName, assertion)
@ -452,11 +453,12 @@ export class ResponseCodeAssertion extends ResponseAssertion {
}
export class ResponseDataAssertion extends ResponseAssertion {
constructor(testName, type, value, message) {
constructor(testName, type, value, assumeSuccess, message) {
let assertion = {
field: 'Assertion.response_data',
type: type,
value: value,
assumeSuccess: assumeSuccess,
message: message,
}
super(testName, assertion)
@ -464,11 +466,12 @@ export class ResponseDataAssertion extends ResponseAssertion {
}
export class ResponseHeadersAssertion extends ResponseAssertion {
constructor(testName, type, value, message) {
constructor(testName, type, value, assumeSuccess, message) {
let assertion = {
field: 'Assertion.response_headers',
type: type,
value: value,
assumeSuccess: assumeSuccess,
message: message,
}
super(testName, assertion)

View File

@ -785,6 +785,7 @@ export class Regex extends AssertionType {
this.subject = undefined;
this.expression = undefined;
this.description = undefined;
this.assumeSuccess = false;
this.set(options);
}
@ -1423,13 +1424,14 @@ class JMXGenerator {
let name = regex.description;
let type = JMX_ASSERTION_CONDITION.CONTAINS; // 固定用Match自己写正则
let value = regex.expression;
let assumeSuccess = regex.assumeSuccess;
switch (regex.subject) {
case ASSERTION_REGEX_SUBJECT.RESPONSE_CODE:
return new ResponseCodeAssertion(name, type, value);
return new ResponseCodeAssertion(name, type, value, assumeSuccess);
case ASSERTION_REGEX_SUBJECT.RESPONSE_DATA:
return new ResponseDataAssertion(name, type, value);
return new ResponseDataAssertion(name, type, value, assumeSuccess);
case ASSERTION_REGEX_SUBJECT.RESPONSE_HEADERS:
return new ResponseHeadersAssertion(name, type, value);
return new ResponseHeadersAssertion(name, type, value, assumeSuccess);
}
}

View File

@ -139,9 +139,9 @@ export default {
{text: 'Error', value: 'Error'}
],
triggerFilters: [
{text: '手动', value: 'MANUAL'},
{text: '定时任务', value: 'SCHEDULE'},
{text: 'API', value: 'API'}
{text: this.$t('commons.trigger_mode.manual'), value: 'MANUAL'},
{text: this.$t('commons.trigger_mode.schedule'), value: 'SCHEDULE'},
{text: this.$t('commons.trigger_mode.api'), value: 'API'}
],
buttons: [
{

View File

@ -125,6 +125,8 @@ export default {
this.isReadOnly = true;
}
this.getTest(this.$route.params.testId);
},
activated() {
this.listProjects();
},
mounted() {

View File

@ -201,6 +201,9 @@ export default {
case RPS_LIMIT:
this.rpsLimit = d.value;
break;
case RPS_LIMIT_ENABLE:
this.rpsLimitEnable = d.value;
break;
default:
break;
}

View File

@ -39,8 +39,6 @@
<template v-if="baseUrl == 'api'" v-slot:behind>
<ms-table-operator-button :is-tester-permission="true" :tip="$t('api_test.environment.environment_config')" icon="el-icon-setting"
type="info" @exec="openEnvironmentConfig(scope.row)"/>
<!--<ms-table-operator-button :is-tester-permission="true" :tip="$t('api_test.jar_config.title')" icon="el-icon-box"-->
<!--type="info" @exec="openJarConfig(scope.row)"/>-->
</template>
</ms-table-operator>
</template>
@ -98,12 +96,10 @@ import MsTableOperatorButton from "../common/components/MsTableOperatorButton";
import ApiEnvironmentConfig from "../api/test/components/ApiEnvironmentConfig";
import TemplateComponent from "../track/plan/view/comonents/report/TemplateComponent/TemplateComponent";
import {ApiEvent, LIST_CHANGE, PerformanceEvent, TrackEvent} from "@/business/components/common/head/ListEvent";
import MsJarConfig from "../api/test/components/jar/JarConfig";
export default {
name: "MsProject",
components: {
MsJarConfig,
TemplateComponent,
ApiEnvironmentConfig,
MsTableOperatorButton,
@ -131,7 +127,7 @@ export default {
{min: 2, max: 50, message: this.$t('commons.input_limit', [2, 50]), trigger: 'blur'}
],
description: [
{max: 500, message: this.$t('commons.input_limit', [0, 500]), trigger: 'blur'}
{max: 250, message: this.$t('commons.input_limit', [0, 250]), trigger: 'blur'}
],
},
}
@ -280,9 +276,6 @@ export default {
},
openEnvironmentConfig(project) {
this.$refs.environmentConfig.open(project.id);
},
openJarConfig(project) {
this.$refs.jarConfig.open(project.id);
}
}
}

View File

@ -1,7 +1,7 @@
<template>
<div class="header-title" v-loading="result.loading">
<div>
<div>{{$t('organization.integration.select_defect_platform')}}</div>
<div>{{ $t('organization.integration.select_defect_platform') }}</div>
<el-radio-group v-model="platform" style="margin-top: 10px" @change="change">
<el-radio label="Tapd">
<img class="platform" src="../../../../assets/tapd.png" alt="Tapd"/>
@ -13,7 +13,7 @@
</div>
<div style="width: 500px">
<div style="margin-top: 20px;margin-bottom: 10px">{{$t('organization.integration.basic_auth_info')}}</div>
<div style="margin-top: 20px;margin-bottom: 10px">{{ $t('organization.integration.basic_auth_info') }}</div>
<el-form :model="form" ref="form" label-width="120px" size="small" :disabled="show" :rules="rules">
<el-form-item :label="$t('organization.integration.api_account')" prop="account">
<el-input v-model="form.account" :placeholder="$t('organization.integration.input_api_account')"/>
@ -25,36 +25,37 @@
<el-form-item :label="$t('organization.integration.jira_url')" prop="url" v-if="platform === 'Jira'">
<el-input v-model="form.url" :placeholder="$t('organization.integration.input_jira_url')"/>
</el-form-item>
<el-form-item :label="$t('organization.integration.jira_issuetype')" prop="issuetype" v-if="platform === 'Jira'">
<el-form-item :label="$t('organization.integration.jira_issuetype')" prop="issuetype"
v-if="platform === 'Jira'">
<el-input v-model="form.issuetype" :placeholder="$t('organization.integration.input_jira_issuetype')"/>
</el-form-item>
</el-form>
</div>
<div style="margin-left: 120px">
<el-button type="primary" size="mini" :disabled="!show" @click="testConnection">{{$t('ldap.test_connect')}}
<el-button type="primary" size="mini" :disabled="!show" @click="testConnection">{{ $t('ldap.test_connect') }}
</el-button>
<el-button v-if="showEdit" size="mini" @click="edit">{{$t('commons.edit')}}</el-button>
<el-button type="primary" v-if="showSave" size="mini" @click="save('form')">{{$t('commons.save')}}</el-button>
<el-button v-if="showCancel" size="mini" @click="cancelEdit">{{$t('organization.integration.cancel_edit')}}
<el-button v-if="showEdit" size="mini" @click="edit">{{ $t('commons.edit') }}</el-button>
<el-button type="primary" v-if="showSave" size="mini" @click="save('form')">{{ $t('commons.save') }}</el-button>
<el-button v-if="showCancel" size="mini" @click="cancelEdit">{{ $t('organization.integration.cancel_edit') }}
</el-button>
<el-button type="info" size="mini" @click="cancelIntegration('form')" :disabled="!show">
{{$t('organization.integration.cancel_integration')}}
{{ $t('organization.integration.cancel_integration') }}
</el-button>
</div>
<div class="defect-tip">
<div>{{$t('organization.integration.use_tip')}}</div>
<div>{{ $t('organization.integration.use_tip') }}</div>
<div>
1. {{$t('organization.integration.use_tip_tapd')}}
1. {{ $t('organization.integration.use_tip_tapd') }}
</div>
<div>
2. {{$t('organization.integration.use_tip_jira')}}
2. {{ $t('organization.integration.use_tip_jira') }}
</div>
<div>
3. {{$t('organization.integration.use_tip_two')}}
3. {{ $t('organization.integration.use_tip_two') }}
<router-link to="/track/project/all" style="margin-left: 5px">
{{$t('organization.integration.link_the_project_now')}}
{{ $t('organization.integration.link_the_project_now') }}
</router-link>
</div>
</div>
@ -62,197 +63,197 @@
</template>
<script>
import {getCurrentUser} from "../../../../common/js/utils";
import {getCurrentUser} from "../../../../common/js/utils";
export default {
name: "IssuesManagement",
data() {
return {
form: {},
result: {},
platform: '',
orgId: '',
show: true,
showEdit: true,
showSave: false,
showCancel: false,
rules: {
account: {
required: true,
message: this.$t('organization.integration.input_api_account'),
trigger: ['change', 'blur']
},
password: {
required: true,
message: this.$t('organization.integration.input_api_password'),
trigger: ['change', 'blur']
},
url: {
required: true,
message: this.$t('organization.integration.input_jira_url'),
trigger: ['change', 'blur']
},
issuetype: {
required: true,
message: this.$t('organization.integration.input_jira_issuetype'),
trigger: ['change', 'blur']
}
export default {
name: "IssuesManagement",
data() {
return {
form: {},
result: {},
platform: '',
orgId: '',
show: true,
showEdit: true,
showSave: false,
showCancel: false,
rules: {
account: {
required: true,
message: this.$t('organization.integration.input_api_account'),
trigger: ['change', 'blur']
},
}
password: {
required: true,
message: this.$t('organization.integration.input_api_password'),
trigger: ['change', 'blur']
},
url: {
required: true,
message: this.$t('organization.integration.input_jira_url'),
trigger: ['change', 'blur']
},
issuetype: {
required: true,
message: this.$t('organization.integration.input_jira_issuetype'),
trigger: ['change', 'blur']
}
},
}
},
created() {
this.init(this.platform);
},
methods: {
init(platform) {
let param = {};
param.platform = platform;
param.orgId = getCurrentUser().lastOrganizationId;
this.result = this.$post("service/integration/type", param, response => {
let data = response.data;
this.platform = data.platform;
if (data.configuration) {
let config = JSON.parse(data.configuration);
this.$set(this.form, 'account', config.account);
this.$set(this.form, 'password', config.password);
this.$set(this.form, 'url', config.url);
this.$set(this.form, 'issuetype', config.issuetype);
} else {
this.clear();
}
})
},
created() {
edit() {
this.show = false;
this.showEdit = false;
this.showSave = true;
this.showCancel = true;
},
cancelEdit() {
this.showEdit = true;
this.showCancel = false;
this.showSave = false;
this.show = true;
this.init(this.platform);
},
methods: {
init(platform) {
let param = {};
param.platform = platform;
param.orgId = getCurrentUser().lastOrganizationId;
this.result = this.$post("service/integration/type", param, response => {
let data = response.data;
this.platform = data.platform;
if (data.configuration) {
let config = JSON.parse(data.configuration);
this.$set(this.form, 'account', config.account);
this.$set(this.form, 'password', config.password);
this.$set(this.form, 'url', config.url);
this.$set(this.form, 'issuetype', config.issuetype);
} else {
this.clear();
}
})
},
edit() {
this.show = false;
this.showEdit = false;
this.showSave = true;
this.showCancel = true;
},
cancelEdit() {
this.showEdit = true;
this.showCancel = false;
this.showSave = false;
this.show = true;
this.init(this.platform);
},
cancelIntegration() {
if (this.form.account && this.form.password && this.platform) {
cancelIntegration() {
if (this.form.account && this.form.password && this.platform) {
this.$alert(this.$t('organization.integration.cancel_confirm') + this.platform + "", '', {
confirmButtonText: this.$t('commons.confirm'),
callback: (action) => {
if (action === 'confirm') {
let param = {};
param.orgId = getCurrentUser().lastOrganizationId;
param.platform = this.platform;
this.result = this.$post("service/integration/delete", param, () => {
this.$success(this.$t('organization.integration.successful_operation'));
this.init('');
});
}
this.$alert(this.$t('organization.integration.cancel_confirm') + this.platform + "", '', {
confirmButtonText: this.$t('commons.confirm'),
callback: (action) => {
if (action === 'confirm') {
let param = {};
param.orgId = getCurrentUser().lastOrganizationId;
param.platform = this.platform;
this.result = this.$post("service/integration/delete", param, () => {
this.$success(this.$t('organization.integration.successful_operation'));
this.init('');
});
}
});
} else {
this.$warning(this.$t('organization.integration.not_integrated'));
}
},
save(form) {
if (!this.platform) {
this.$warning(this.$t('organization.integration.choose_platform'));
return;
}
this.$refs[form].validate(valid => {
if (valid) {
let formatUrl = this.form.url.trim();
if (!formatUrl.endsWith('/')) {
formatUrl = formatUrl + '/';
}
let param = {};
let auth = {
account: this.form.account,
password: this.form.password,
url: formatUrl,
issuetype: this.form.issuetype
};
param.organizationId = getCurrentUser().lastOrganizationId;
param.platform = this.platform;
param.configuration = JSON.stringify(auth);
this.result = this.$post("service/integration/save", param, () => {
this.show = true;
this.showEdit = true;
this.showSave = false;
this.showCancel = false;
this.init(this.platform);
this.$success(this.$t('commons.save_success'));
});
} else {
return false;
}
})
},
change(platform) {
this.show = true;
this.showEdit = true;
this.showCancel = false;
this.showSave = false;
let param = {};
param.orgId = getCurrentUser().lastOrganizationId;
param.platform = platform;
this.result = this.$post("service/integration/type", param, response => {
let data = response.data;
if (data.configuration) {
let config = JSON.parse(data.configuration);
this.$set(this.form, 'account', config.account);
this.$set(this.form, 'password', config.password);
this.$set(this.form, 'url', config.url);
this.$set(this.form, 'issuetype', config.issuetype);
} else {
this.clear();
}
})
},
clear() {
this.$set(this.form, 'account', '');
this.$set(this.form, 'password', '');
this.$set(this.form, 'url', '');
this.$set(this.form, 'issuetype', '');
this.$nextTick(() => {
this.$refs.form.clearValidate();
});
},
testConnection() {
if (this.form.account && this.form.password && this.platform) {
this.result = this.$get("issues/auth/" + this.platform, () => {
this.$success(this.$t('organization.integration.verified'));
} else {
this.$warning(this.$t('organization.integration.not_integrated'));
}
},
save(form) {
if (!this.platform) {
this.$warning(this.$t('organization.integration.choose_platform'));
return;
}
this.$refs[form].validate(valid => {
if (valid) {
let formatUrl = this.form.url.trim();
if (!formatUrl.endsWith('/')) {
formatUrl = formatUrl + '/';
}
let param = {};
let auth = {
account: this.form.account,
password: this.form.password,
url: formatUrl,
issuetype: this.form.issuetype
};
param.organizationId = getCurrentUser().lastOrganizationId;
param.platform = this.platform;
param.configuration = JSON.stringify(auth);
this.result = this.$post("service/integration/save", param, () => {
this.show = true;
this.showEdit = true;
this.showSave = false;
this.showCancel = false;
this.init(this.platform);
this.$success(this.$t('commons.save_success'));
});
} else {
this.$warning(this.$t('organization.integration.not_integrated'));
return false;
}
})
},
change(platform) {
this.show = true;
this.showEdit = true;
this.showCancel = false;
this.showSave = false;
let param = {};
param.orgId = getCurrentUser().lastOrganizationId;
param.platform = platform;
this.result = this.$post("service/integration/type", param, response => {
let data = response.data;
if (data.configuration) {
let config = JSON.parse(data.configuration);
this.$set(this.form, 'account', config.account);
this.$set(this.form, 'password', config.password);
this.$set(this.form, 'url', config.url);
this.$set(this.form, 'issuetype', config.issuetype);
} else {
this.clear();
}
})
},
clear() {
this.$set(this.form, 'account', '');
this.$set(this.form, 'password', '');
this.$set(this.form, 'url', '');
this.$set(this.form, 'issuetype', '');
this.$nextTick(() => {
this.$refs.form.clearValidate();
});
},
testConnection() {
if (this.form.account && this.form.password && this.platform) {
this.result = this.$get("issues/auth/" + this.platform, () => {
this.$success(this.$t('organization.integration.verified'));
});
} else {
this.$warning(this.$t('organization.integration.not_integrated'));
return false;
}
}
}
}
</script>
<style scoped>
.header-title {
padding: 10px 30px;
}
.header-title {
padding: 10px 30px;
}
.defect-tip {
background: #EDEDED;
border: solid #E1E1E1 1px;
margin: 10px 0;
padding: 10px;
border-radius: 3px;
}
.defect-tip {
background: #EDEDED;
border: solid #E1E1E1 1px;
margin: 10px 0;
padding: 10px;
border-radius: 3px;
}
.platform {
height: 90px;
vertical-align: middle
}
.platform {
height: 90px;
vertical-align: middle
}
</style>

View File

@ -0,0 +1,31 @@
<template>
<div>
<el-card>
<el-tabs class="system-setting" v-model="activeName">
<el-tab-pane :label="$t('organization.message_settings')" name="message">
<message-notification/>
</el-tab-pane>
</el-tabs>
</el-card>
</div>
</template>
<script>
import MessageNotification from "./TaskNotification"
export default {
name: "MessageSettings",
components: {
MessageNotification
},
data(){
return{
activeName: 'message'
}
}
}
</script>
<style scoped>
</style>

View File

@ -0,0 +1,554 @@
<template>
<div style="margin-left: 40px">
<el-form :model="form" ref="from">
<el-row class="row">
<el-col :span="20">
<div class="grid-content bg-purple-dark">
<el-row>
<el-col :span="6">
<span style="font-weight:bold;">{{ $t('organization.message.jenkins_task_notification') }}</span>
</el-col>
<el-col :span="14">
<el-button type="text" icon="el-icon-plus" size="mini"
@click="handleAddTaskModel('jenkinsTask')">
{{ $t('organization.message.create_new_notification') }}
</el-button>
</el-col>
</el-row>
</div>
<el-table
:data="form.jenkinsTask"
class="tb-edit"
border
size="mini"
:header-cell-style="{background:'#ededed'}"
>
<el-table-column :label="$t('schedule.event')" min-width="20%" prop="events">
<template slot-scope="scope">
<el-select v-model="scope.row.events" multiple
:placeholder="$t('organization.message.select_events')"
prop="events">
<el-option
v-for="item in jenkinsEventOptions"
:key="item.value"
:label="item.label"
:value="item.value">
</el-option>
</el-select>
</template>
</el-table-column>
<el-table-column :label="$t('schedule.receiver')" prop="userIds" min-width="20%">
<template v-slot:default="{row}">
<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 jenkinsReceiverOptions"
:key="item.id"
:label="item.name"
:value="item.id">
</el-option>
</el-select>
</template>
</el-table-column>
<el-table-column :label="$t('schedule.receiving_mode')" min-width="20%" prop="type">
<template slot-scope="scope">
<el-select v-model="scope.row.type" :placeholder="$t('organization.message.select_receiving_method')">
<el-option
v-for="item in receiveTypeOptions"
:key="item.value"
:label="item.label"
:value="item.value">
</el-option>
</el-select>
</template>
</el-table-column>
<el-table-column label="webhook" min-width="20%" prop="webhook">
<template v-slot:default="scope">
<el-input v-model="scope.row.webhook" placeholder="webhook地址"></el-input>
</template>
</el-table-column>
<el-table-column :label="$t('commons.operating')" min-width="20%" prop="result">
<template v-slot:default="scope">
<el-button
type="primary"
size="mini"
v-show="scope.row.result.showSave"
@click="handleAddTask(scope.$index,scope.row)"
>{{ $t('commons.add') }}
</el-button>
<el-button
size="mini"
v-show="scope.row.result.showCancel"
@click.native.prevent="removeRowTask(scope.$index,form.jenkinsTask)"
>{{ $t('commons.cancel') }}
</el-button>
<el-button
type="danger"
icon="el-icon-delete"
size="mini"
v-show="scope.row.result.showDelete"
@click.native.prevent="deleteRowTask(scope.$index,form.jenkinsTask)"
></el-button>
</template>
</el-table-column>
</el-table>
</el-col>
</el-row>
<el-row class="row">
<el-col :span="20">
<div class="grid-content bg-purple-dark">
<el-row>
<el-col :span="6">
<span style="font-weight:bold;">{{ $t('organization.message.test_plan_task_notification') }}</span>
</el-col>
<el-col :span="14">
<el-button type="text" icon="el-icon-plus" size="mini" @click="handleAddTaskModel('testPlanTask')">
{{ $t('organization.message.create_new_notification') }}
</el-button>
</el-col>
</el-row>
</div>
<el-table
:data="form.testPlanTask"
class="tb-edit"
border
size="mini"
:header-cell-style="{background:'#EDEDED'}"
>
<el-table-column :label="$t('schedule.event')" min-width="20%" prop="events">
<template slot-scope="scope">
<el-select v-model="scope.row.events" multiple :placeholder="$t('organization.message.select_events')"
prop="events">
<el-option
v-for="item in otherEventOptions"
:key="item.value"
:label="item.label"
:value="item.value">
</el-option>
</el-select>
</template>
</el-table-column>
<el-table-column :label="$t('schedule.receiver')" prop="userIds" min-width="20%">
<template v-slot:default="{row}">
<el-select v-model="row.userIds" filterable multiple
:placeholder="$t('commons.please_select')"
@click.native="defectAndTestPlanUserList()" style="width: 100%;">
<el-option
v-for="item in testPlanReceiverOptions"
:key="item.id"
:label="item.name"
:value="item.id">
</el-option>
</el-select>
</template>
</el-table-column>
<el-table-column :label="$t('schedule.receiving_mode')" min-width="20%" prop="type">
<template slot-scope="scope">
<el-select v-model="scope.row.type" :placeholder="$t('organization.message.select_receiving_method')">
<el-option
v-for="item in receiveTypeOptions"
:key="item.value"
:label="item.label"
:value="item.value">
</el-option>
</el-select>
</template>
</el-table-column>
<el-table-column label="webhook" min-width="20%" prop="webhook">
<template v-slot:default="scope">
<el-input v-model="scope.row.webhook" placeholder="webhook地址"></el-input>
</template>
</el-table-column>
<el-table-column :label="$t('commons.operating')" min-width="20%" prop="result">
<template v-slot:default="scope">
<el-button
type="primary"
size="mini"
v-show="scope.row.result.showSave"
@click="handleAddTask(scope.$index,scope.row)"
>{{ $t('commons.add') }}
</el-button>
<el-button
size="mini"
v-show="scope.row.result.showCancel"
@click.native.prevent="removeRowTask(scope.$index,form.testPlanTask)"
>{{ $t('commons.cancel') }}
</el-button>
<el-button
type="danger"
icon="el-icon-delete"
size="mini"
v-show="scope.row.result.showDelete"
@click.native.prevent="deleteRowTask(scope.$index,form.testPlanTask)"
></el-button>
</template>
</el-table-column>
</el-table>
</el-col>
</el-row>
<el-row class="row">
<el-col :span="20">
<div class="grid-content bg-purple-dark">
<el-row>
<el-col :span="6">
<span style="font-weight:bold;">{{ $t('organization.message.test_review_task_notice') }}</span>
</el-col>
<el-col :span="14">
<el-button type="text" icon="el-icon-plus" size="mini" @click="handleAddTaskModel('reviewTask')">
{{ $t('organization.message.create_new_notification') }}
</el-button>
</el-col>
</el-row>
</div>
<el-table
:data="form.reviewTask"
class="tb-edit"
border
size="mini"
:header-cell-style="{background:'#EDEDED'}"
>
<el-table-column :label="$t('schedule.event')" min-width="20%" prop="events">
<template slot-scope="scope">
<el-select v-model="scope.row.events" multiple :placeholder="$t('organization.message.select_events')"
prop="event">
<el-option
v-for="item in otherEventOptions"
:key="item.value"
:label="item.label"
:value="item.value">
</el-option>
</el-select>
</template>
</el-table-column>
<el-table-column :label="$t('schedule.receiver')" prop="receiver" min-width="20%">
<template v-slot:default="{row}">
<el-select v-model="row.userIds" filterable multiple
:placeholder="$t('commons.please_select')"
@click.native="reviewUerList()" style="width: 100%;">
<el-option
v-for="item in reviewReceiverOptions"
:key="item.id"
:label="item.name"
:value="item.id">
</el-option>
</el-select>
</template>
</el-table-column>
<el-table-column :label="$t('schedule.receiving_mode')" min-width="20%" prop="type">
<template slot-scope="scope">
<el-select v-model="scope.row.type" :placeholder="$t('organization.message.select_receiving_method')">
<el-option
v-for="item in receiveTypeOptions"
:key="item.value"
:label="item.label"
:value="item.value">
</el-option>
</el-select>
</template>
</el-table-column>
<el-table-column label="webhook" min-width="20%" prop="webhook">
<template v-slot:default="scope">
<el-input v-model="scope.row.webhook" placeholder="webhook地址"></el-input>
</template>
</el-table-column>
<el-table-column :label="$t('commons.operating')" min-width="20%" prop="result">
<template v-slot:default="scope">
<el-button
type="primary"
size="mini"
v-show="scope.row.result.showSave"
@click="handleAddTask(scope.$index,scope.row)"
>{{ $t('commons.add') }}
</el-button>
<el-button
size="mini"
v-show="scope.row.result.showCancel"
@click.native.prevent="removeRowTask(scope.$index,form.reviewTask)"
>{{ $t('commons.cancel') }}
</el-button>
<el-button
type="danger"
icon="el-icon-delete"
size="mini"
v-show="scope.row.result.showDelete"
@click.native.prevent="deleteRowTask(scope.$index,form.reviewTask)"
></el-button>
</template>
</el-table-column>
</el-table>
</el-col>
</el-row>
<el-row class="row">
<el-col :span="20">
<div class="grid-content bg-purple-dark">
<el-row>
<el-col :span="6">
<span style="font-weight:bold;">{{ $t('organization.message.defect_task_notification') }}</span>
</el-col>
<el-col :span="14">
<el-button type="text" icon="el-icon-plus" size="mini" @click="handleAddTaskModel('defectTask')">
{{ $t('organization.message.create_new_notification') }}
</el-button>
</el-col>
</el-row>
</div>
<el-table
:data="form.defectTask"
class="tb-edit"
border
size="mini"
:header-cell-style="{background:'#EDEDED'}"
>
<el-table-column :label="$t('schedule.event')" min-width="20%" prop="events">
<template slot-scope="scope">
<el-select v-model="scope.row.events" multiple :placeholder="$t('organization.message.select_events')"
prop="event">
<el-option
v-for="item in otherEventOptions"
:key="item.value"
:label="item.label"
:value="item.value">
</el-option>
</el-select>
</template>
</el-table-column>
<el-table-column :label="$t('schedule.receiver')" prop="receiver" min-width="20%">
<template v-slot:default="{row}">
<el-select v-model="row.userIds" filterable multiple
:placeholder="$t('commons.please_select')"
@click.native="defectAndTestPlanUserList()" style="width: 100%;">
<el-option
v-for="item in defectReceiverOptions"
:key="item.id"
:label="item.name"
:value="item.id">
</el-option>
</el-select>
</template>
</el-table-column>
<el-table-column :label="$t('schedule.receiving_mode')" min-width="20%" prop="type">
<template slot-scope="scope">
<el-select v-model="scope.row.type" :placeholder="$t('organization.message.select_receiving_method')">
<el-option
v-for="item in receiveTypeOptions"
:key="item.value"
:label="item.label"
:value="item.value">
</el-option>
</el-select>
</template>
</el-table-column>
<el-table-column label="webhook" min-width="20%" prop="webhook">
<template v-slot:default="scope">
<el-input v-model="scope.row.webhook" placeholder="webhook地址"></el-input>
</template>
</el-table-column>
<el-table-column :label="$t('commons.operating')" min-width="20%" prop="result">
<template v-slot:default="scope">
<el-button
type="primary"
size="mini"
v-show="scope.row.result.showSave"
@click="handleAddTask(scope.$index,scope.row)"
>{{ $t('commons.add') }}
</el-button>
<el-button
size="mini"
v-show="scope.row.result.showCancel"
@click.native.prevent="removeRowTask(scope.$index,form.defectTask)"
>{{ $t('commons.cancel') }}
</el-button>
<el-button
type="danger"
icon="el-icon-delete"
size="mini"
v-show="scope.row.result.showDelete"
@click.native.prevent="deleteRowTask(scope.$index,form.defectTask)"
></el-button>
</template>
</el-table-column>
</el-table>
</el-col>
</el-row>
</el-form>
</div>
</template>
<script>
export default {
name: "TaskNotification",
data() {
return {
form: {
jenkinsTask: [{
taskType: "jenkinsTask",
events: [],
userIds: [],
type:[],
webhook: "",
result: {
showSave: true,
showCancel: true,
showDelete: false
},
identification:"",
}],
testPlanTask: [{
taskType: "testPlanTask",
events: [],
userIds: [],
type:[],
webhook: "",
result: {
showSave: true,
showCancel: true,
showDelete: false
},
identification:"",
}],
reviewTask: [{
taskType: "reviewTask",
events: [],
userIds: [],
type:[],
webhook: "",
result: {
showSave: true,
showCancel: true,
showDelete: false
},
identification:"",
}],
defectTask: [{
taskType: "defectTask",
events: [],
userIds: [],
type:[],
webhook: "",
result: {
showSave: true,
showCancel: true,
showDelete: false
},
identification:"",
}],
},
jenkinsEventOptions: [
{value: 'EXECUTE_SUCCESSFUL', label: this.$t('schedule.event_success')},
{value: 'EXECUTE_FAILED', label: this.$t('schedule.event_failed')}
],
jenkinsReceiverOptions: [],
receiveTypeOptions: [
{value: 'EMAIL', label: this.$t('organization.message.mail')},
{value: 'NAIL_ROBOT', label: this.$t('organization.message.nail_robot')},
{value: 'WECHAT_ROBOT', label: this.$t('organization.message.enterprise_wechat_robot')}
],
otherEventOptions: [
{value: 'CREATE', label: this.$t('commons.create')},
{value: 'UPDATE', label: this.$t('commons.update')},
{value: 'DELETE', label: this.$t('commons.delete')}
],
//
testPlanReceiverOptions: [],
//
reviewReceiverOptions: [],
//
defectReceiverOptions: [],
}
},
activated(){
this.initForm()
},
methods: {
initForm() {
this.result = this.$get('/notice/search/message', response => {
/*this.form=response.data*/
})
},
userList() {
this.result = this.$get('user/list', response => {
this.jenkinsReceiverOptions = response.data
})
},
reviewUerList() {
this.result = this.$get('user/list', response => {
this.reviewReceiverOptions = response.data
this.reviewReceiverOptions.unshift({id: 'Founder', name: this.$t('api_test.creator')},
{id: 'Executor', name: this.$t('test_track.plan_view.executor')},
{id: 'Maintainer', name: this.$t('test_track.case.maintainer')})
})
},
defectAndTestPlanUserList() {
this.result = this.$get('user/list', response => {
this.testPlanReceiverOptions = response.data
this.defectReceiverOptions = response.data
this.testPlanReceiverOptions.unshift({id: 'Founder', name: this.$t('api_test.creator')}, {
id: 'Executor',
name: this.$t('test_track.plan_view.executor')
})
})
},
handleAddTaskModel(type) {
let Task = {};
Task.result = {
showSave: true,
showCancel: true,
showDelete: false,
}
if (type === 'jenkinsTask') {
Task.taskType = 'jenkinsTask'
this.form.jenkinsTask.unshift(Task)
} else if (type === 'testPlanTask') {
Task.taskType = 'testPlanTask'
this.form.testPlanTask.unshift(Task)
} else if (type === 'reviewTask') {
Task.taskType = 'reviewTask'
this.form.reviewTask.unshift(Task)
} else {
Task.taskType = 'defectTask'
this.form.defectTask.unshift(Task)
}
},
handleAddTask(index, data) {
let list = []
list.push(data)
let param = {};
param.messageDetail = list
this.result = this.$post("/notice/save/message/task", param, () => {
data.result.showSave = false;
data.result.showCancel = false;
data.result.showDelete = true;
})
},
removeRowTask(index, data) { //
data.splice(index, 1)
},
deleteRowTask(index, data) { //
this.result = this.$get("/delete/message" + index, response => {
})
data.splice(index, 1)
},
}
}
</script>
<style scoped>
/deep/ .el-select__tags {
flex-wrap: unset;
overflow: auto;
}
.row {
margin-bottom: 30px;
}
</style>

View File

@ -48,6 +48,11 @@ export default {
component: () => import('@/business/components/settings/organization/ServiceIntegration'),
meta: {organization: true, title: 'organization.service_integration'}
},
/*{
path: 'messagesettings',
component: () => import('@/business/components/settings/organization/MessageSettings'),
meta: {organization: true, title: 'organization.message_settings'}
},*/
{
path: 'member',
component: () => import('@/business/components/settings/workspace/WorkspaceMember'),

View File

@ -102,7 +102,7 @@
size="small">
<el-form-item :label="$t('commons.member')" prop="userIds">
<el-select filterable v-model="memberForm.userIds" multiple :placeholder="$t('member.please_choose_member')"
class="select-width">
class="select-width" :filter-method="dataFilter">
<el-option
v-for="item in memberForm.userList"
:key="item.id"
@ -233,13 +233,7 @@ export default {
rule: {
name: [
{required: true, message: this.$t('organization.input_name'), trigger: 'blur'},
{min: 2, max: 25, message: this.$t('commons.input_limit', [2, 25]), trigger: 'blur'},
{
required: true,
pattern: /^[\u4e00-\u9fa5_a-zA-Z0-9.·-]+$/,
message: this.$t('organization.special_characters_are_not_supported'),
trigger: 'blur'
}
{min: 2, max: 25, message: this.$t('commons.input_limit', [2, 25]), trigger: 'blur'}
],
description: [
{max: 50, message: this.$t('commons.input_limit', [0, 50]), trigger: 'blur'}
@ -268,11 +262,23 @@ export default {
this.memberForm = {};
this.result = this.$get('/user/list/', response => {
this.$set(this.memberForm, "userList", response.data);
this.$set(this.memberForm, "copyUserList", response.data);
});
this.result = this.$get('/role/list/org', response => {
this.$set(this.memberForm, "roles", response.data);
})
},
dataFilter(val) {
if (val) {
this.memberForm.userList = this.memberForm.copyUserList.filter((item) => {
if (!!~item.id.indexOf(val) || !!~item.id.toUpperCase().indexOf(val.toUpperCase())) {
return true
}
})
} else {
this.memberForm.userList = this.memberForm.copyUserList;
}
},
edit(row) {
this.dialogOrgUpdateVisible = true;
this.form = Object.assign({}, row);

View File

@ -28,7 +28,8 @@
</el-card>
<!-- add workspace dialog -->
<el-dialog :close-on-click-modal="false" :title="$t('workspace.create')" :visible.sync="dialogWsAddVisible" width="30%" @close="close">
<el-dialog :close-on-click-modal="false" :title="$t('workspace.create')" :visible.sync="dialogWsAddVisible"
width="30%" @close="close">
<el-form :model="form" :rules="rules" ref="form" label-position="right" label-width="100px" size="small">
<el-form-item :label="$t('commons.name')" prop="name">
<el-input v-model="form.name" autocomplete="off"/>
@ -56,7 +57,8 @@
</el-dialog>
<!-- update workspace dialog -->
<el-dialog :close-on-click-modal="false" :title="$t('workspace.update')" :visible.sync="dialogWsUpdateVisible" width="30%" @close="close">
<el-dialog :close-on-click-modal="false" :title="$t('workspace.update')" :visible.sync="dialogWsUpdateVisible"
width="30%" @close="close">
<el-form :model="form" :rules="rules" ref="updateForm" label-position="right" label-width="100px" size="small">
<el-form-item :label="$t('commons.name')" prop="name">
<el-input v-model="form.name" autocomplete="off"/>
@ -85,7 +87,8 @@
</el-dialog>
<!-- dialog of workspace member -->
<el-dialog :close-on-click-modal="false" :visible.sync="dialogWsMemberVisible" width="70%" :destroy-on-close="true" @close="closeWsMemberDialog" class="dialog-css">
<el-dialog :close-on-click-modal="false" :visible.sync="dialogWsMemberVisible" width="70%" :destroy-on-close="true"
@close="closeWsMemberDialog" class="dialog-css">
<ms-table-header :condition.sync="dialogCondition" @create="addMember" @search="dialogSearch"
:create-tip="$t('member.create')" :title="$t('commons.member')"/>
<!-- organization member table -->
@ -101,7 +104,8 @@
</el-table-column>
<el-table-column :label="$t('commons.operating')">
<template v-slot:default="scope">
<ms-table-operator :tip2="$t('commons.remove')" @editClick="editMember(scope.row)" @deleteClick="delMember(scope.row)"/>
<ms-table-operator :tip2="$t('commons.remove')" @editClick="editMember(scope.row)"
@deleteClick="delMember(scope.row)"/>
</template>
</el-table-column>
</el-table>
@ -111,14 +115,15 @@
</el-dialog>
<!-- add workspace member dialog -->
<el-dialog :close-on-click-modal="false" :title="$t('member.create')" :visible.sync="dialogWsMemberAddVisible" width="30%"
<el-dialog :close-on-click-modal="false" :title="$t('member.create')" :visible.sync="dialogWsMemberAddVisible"
width="30%"
:destroy-on-close="true"
@close="handleClose">
<el-form :model="memberForm" ref="form" :rules="wsMemberRule" label-position="right" label-width="100px"
size="small">
<el-form-item :label="$t('commons.member')" prop="userIds">
<el-select filterable v-model="memberForm.userIds" multiple :placeholder="$t('member.please_choose_member')"
class="select-width">
class="select-width" :filter-method="dataFilter">
<el-option
v-for="item in memberForm.userList"
:key="item.id"
@ -149,7 +154,8 @@
</el-dialog>
<!-- update workspace member dialog -->
<el-dialog :close-on-click-modal="false" :title="$t('member.modify')" :visible.sync="dialogWsMemberUpdateVisible" width="30%"
<el-dialog :close-on-click-modal="false" :title="$t('member.modify')" :visible.sync="dialogWsMemberUpdateVisible"
width="30%"
:destroy-on-close="true"
@close="handleClose">
<el-form :model="memberForm" label-position="right" label-width="100px" size="small" ref="updateUserForm">
@ -165,7 +171,8 @@
<el-form-item :label="$t('commons.phone')" prop="phone">
<el-input v-model="memberForm.phone" autocomplete="off" :disabled="true"/>
</el-form-item>
<el-form-item :label="$t('commons.role')" prop="roleIds" :rules="{required: true, message: $t('role.please_choose_role'), trigger: 'change'}">
<el-form-item :label="$t('commons.role')" prop="roleIds"
:rules="{required: true, message: $t('role.please_choose_role'), trigger: 'change'}">
<el-select filterable v-model="memberForm.roleIds" multiple :placeholder="$t('role.please_choose_role')"
class="select-width">
<el-option
@ -231,6 +238,17 @@
})
listenGoBack(this.close);
},
dataFilter(val) {
if (val) {
this.memberForm.userList = this.memberForm.copyUserList.filter((item) => {
if (!!~item.id.indexOf(val) || !!~item.id.toUpperCase().indexOf(val.toUpperCase())) {
return true
}
})
} else {
this.memberForm.userList = this.memberForm.copyUserList;
}
},
submit(formName) {
this.$refs[formName].validate((valid) => {
if (valid) {
@ -252,10 +270,12 @@
this.dialogWsMemberAddVisible = true;
this.result = this.$get('/user/list/', response => {
this.$set(this.memberForm, "userList", response.data);
this.$set(this.memberForm, "copyUserList", response.data);
});
this.result = this.$get('/role/list/test', response => {
this.$set(this.memberForm, "roles", response.data);
});
listenGoBack(this.handleClose);
},
cellClick(row) {

View File

@ -0,0 +1,25 @@
<template>
<span>
<ms-tag v-if="value === 'Prepare'" type="info" :content="$t('test_track.case.status_prepare')"/>
<ms-tag v-if="value === 'Pass'" type="success" :content="$t('test_track.case.status_pass')"/>
<ms-tag v-if="value === 'UnPass'" type="danger" :content="$t('test_track.case.status_un_pass')"/>
</span>
</template>
<script>
import MsTag from "@/business/components/common/components/MsTag";
export default {
name: "ReviewStatus",
components: {MsTag},
props: {
value: {
type: String
}
}
}
</script>
<style scoped>
</style>

View File

@ -2,7 +2,7 @@
<el-form :model="form" ref="caseFrom" v-loading="result.loading">
<el-row>
<el-col :span="8" :offset="1">
<el-col :span="10" :offset="1">
<el-form-item
:placeholder="$t('test_track.case.input_name')"
:label="$t('test_track.case.name')"
@ -12,7 +12,7 @@
</el-form-item>
</el-col>
<el-col :span="11" :offset="2">
<el-col :span="12">
<el-form-item :label="$t('test_track.case.module')" :label-width="formLabelWidth" prop="module">
<el-input class="case-name" :disabled="readOnly" v-model="testCase.nodePath"></el-input>
</el-form-item>
@ -59,14 +59,14 @@
</el-row>
<el-row v-if="testCase.method && testCase.method == 'auto'">
<el-col :span="9" :offset="1">
<el-col :span="10" :offset="1">
<el-form-item :label="$t('test_track.case.relate_test')" :label-width="formLabelWidth" prop="testId">
<el-select filterable :disabled="readOnly" v-model="testCase.testId"
:placeholder="$t('test_track.case.input_type')">
</el-select>
</el-form-item>
</el-col>
<el-col :span="9" :offset="1" v-if="testCase.testId=='other'">
<el-col :span="12" v-if="testCase.testId=='other'">
<el-form-item :label="$t('test_track.case.test_name')" :label-width="formLabelWidth" prop="testId">
<el-input v-model="testCase.otherTestName" :placeholder="$t('test_track.case.input_test_case')"
:disabled="readOnly"></el-input>
@ -74,10 +74,10 @@
</el-col>
</el-row>
<el-row style="margin-top: 15px;">
<el-col :offset="2">{{ $t('test_track.case.prerequisite') }}:</el-col>
<el-col :offset="1">{{ $t('test_track.case.prerequisite') }}:</el-col>
</el-row>
<el-row type="flex" justify="center" style="margin-top: 10px;">
<el-col :span="20">
<el-col :span="22">
<el-form-item prop="prerequisite">
<el-input :disabled="readOnly" v-model="testCase.prerequisite"
type="textarea"
@ -89,11 +89,11 @@
</el-row>
<el-row v-if="testCase.method && testCase.method != 'auto'" style="margin-bottom: 10px">
<el-col :offset="2">{{ $t('test_track.case.steps') }}:</el-col>
<el-col :offset="1">{{ $t('test_track.case.steps') }}:</el-col>
</el-row>
<el-row v-if="testCase.method && testCase.method != 'auto'" type="flex" justify="center">
<el-col :span="20">
<el-col :span="22">
<el-table
v-if="isStepTableAlive"
:data="JSON.parse(testCase.steps)"
@ -136,10 +136,10 @@
</el-row>
<el-row style="margin-top: 15px;margin-bottom: 10px">
<el-col :offset="2">{{ $t('commons.remark') }}:</el-col>
<el-col :offset="1">{{ $t('commons.remark') }}:</el-col>
</el-row>
<el-row type="flex" justify="center">
<el-col :span="20">
<el-col :span="22">
<el-form-item prop="remark">
<el-input v-model="testCase.remark"
:autosize="{ minRows: 2, maxRows: 4}"

View File

@ -209,6 +209,60 @@
</el-form-item>
</el-col>
</el-row>
<el-row style="margin-top: 15px;margin-bottom: 10px">
<el-col :offset="2" :span="20">附件:
<el-upload
accept=".jpg,.jpeg,.png,.xlsx,.doc,.pdf,.docx"
action=""
:show-file-list="false"
:before-upload="beforeUpload"
:http-request="handleUpload"
:on-exceed="handleExceed"
multiple
:limit="8"
:file-list="fileList">
<el-button icon="el-icon-plus" size="mini"></el-button>
<span slot="tip" class="el-upload__tip"> 只能上传jpgjpegpngdocxdocpdfxlsx文件 </span>
</el-upload>
</el-col>
</el-row>
<el-row type="flex" justify="center">
<el-col :span="20">
<el-table class="basic-config" :data="tableData">
<el-table-column
prop="name"
:label="$t('load_test.file_name')">
</el-table-column>
<el-table-column
prop="size"
:label="$t('load_test.file_size')">
</el-table-column>
<el-table-column
prop="type"
:label="$t('load_test.file_type')">
</el-table-column>
<el-table-column
:label="$t('load_test.last_modify_time')">
<template v-slot:default="scope">
<i class="el-icon-time"/>
<span class="last-modified">{{ scope.row.updateTime | timestampFormatDate }}</span>
</template>
</el-table-column>
<el-table-column
:label="$t('commons.operating')">
<template v-slot:default="scope">
<el-button @click="handleDownload(scope.row)" :disabled="!scope.row.id || readOnly" type="primary"
icon="el-icon-download"
size="mini" circle/>
<el-button :disabled="readOnly" @click="handleDelete(scope.row, scope.$index)" type="danger"
icon="el-icon-delete" size="mini"
circle/>
</template>
</el-table-column>
</el-table>
</el-col>
</el-row>
</el-form>
<template v-slot:footer>
@ -234,6 +288,7 @@ import {TokenKey, WORKSPACE_ID} from '../../../../../common/js/constants';
import MsDialogFooter from '../../../common/components/MsDialogFooter'
import {listenGoBack, removeGoBackListener} from "../../../../../common/js/utils";
import {LIST_CHANGE, TrackEvent} from "@/business/components/common/head/ListEvent";
import {Message} from "element-ui";
export default {
name: "TestCaseEdit",
@ -263,6 +318,9 @@ export default {
maintainerOptions: [],
testOptions: [],
workspaceId: '',
fileList: [],
tableData: [],
uploadList: [],
rules: {
name: [
{required: true, message: this.$t('test_track.case.input_name'), trigger: 'blur'},
@ -339,6 +397,7 @@ export default {
tmp.steps = JSON.parse(testCase.steps);
Object.assign(this.form, tmp);
this.form.module = testCase.nodeId;
this.getFileMetaData(testCase);
} else {
if (this.selectNode.data) {
this.form.module = this.selectNode.data.id;
@ -358,6 +417,24 @@ export default {
this.reload();
this.dialogFormVisible = true;
},
getFileMetaData(testCase) {
this.fileList = [];
this.tableData = [];
this.uploadList = [];
this.result = this.$get("test/case/file/metadata/" + testCase.id, response => {
let files = response.data;
if (!files) {
return;
}
// deep copy
this.fileList = JSON.parse(JSON.stringify(files));
this.tableData = JSON.parse(JSON.stringify(files));
this.tableData.map(f => {
f.size = f.size + ' Bytes';
});
})
},
handleAddStep(index, data) {
let step = {};
step.num = data.num + 1;
@ -400,7 +477,8 @@ export default {
if (valid) {
let param = this.buildParam();
if (this.validate(param)) {
this.result = this.$post('/test/case/' + this.operationType, param, () => {
let option = this.getOption(param);
this.result = this.$request(option, () => {
this.$success(this.$t('commons.save_success'));
if (this.operationType == 'add' && this.isCreateContinue) {
this.form.name = '';
@ -411,6 +489,9 @@ export default {
result: ''
}];
this.form.remark = '';
this.uploadList = [];
this.fileList = [];
this.tableData = [];
this.$emit("refresh");
return;
}
@ -444,6 +525,32 @@ export default {
}
return param;
},
getOption(param) {
let formData = new FormData();
let url = '/test/case/' + this.operationType;
this.uploadList.forEach(f => {
formData.append("file", f);
});
param.updatedFileList = this.fileList;
let requestJson = JSON.stringify(param, function (key, value) {
return key === "file" ? undefined : value
});
formData.append('request', new Blob([requestJson], {
type: "application/json"
}));
return {
method: 'POST',
url: url,
data: formData,
headers: {
'Content-Type': undefined
}
};
},
validate(param) {
for (let i = 0; i < param.steps.length; i++) {
if ((param.steps[i].desc && param.steps[i].desc.length > 300) ||
@ -524,10 +631,94 @@ export default {
desc: '',
result: ''
}];
this.uploadList = [];
this.fileList = [];
this.tableData = [];
return true;
});
}
}
},
handleExceed() {
this.$error(this.$t('load_test.file_size_limit'));
},
beforeUpload(file) {
if (!this.fileValidator(file)) {
/// todo:
return false;
}
if (this.tableData.filter(f => f.name === file.name).length > 0) {
this.$error(this.$t('load_test.delete_file'));
return false;
}
let type = file.name.substring(file.name.lastIndexOf(".") + 1);
this.tableData.push({
name: file.name,
size: file.size + ' Bytes', /// todo: ByteKBMB
type: type.toUpperCase(),
updateTime: file.lastModified,
});
return true;
},
handleUpload(uploadResources) {
this.uploadList.push(uploadResources.file);
},
handleDownload(file) {
let data = {
name: file.name,
id: file.id,
};
let config = {
url: '/test/case/file/download',
method: 'post',
data: data,
responseType: 'blob'
};
this.result = this.$request(config).then(response => {
const content = response.data;
const blob = new Blob([content]);
if ("download" in document.createElement("a")) {
// IE
// chrome/firefox
let aTag = document.createElement('a');
aTag.download = file.name;
aTag.href = URL.createObjectURL(blob);
aTag.click();
URL.revokeObjectURL(aTag.href)
} else {
// IE10+
navigator.msSaveBlob(blob, this.filename)
}
}).catch(e => {
Message.error({message: e.message, showClose: true});
});
},
handleDelete(file, index) {
this.$alert(this.$t('load_test.delete_file_confirm') + file.name + "", '', {
confirmButtonText: this.$t('commons.confirm'),
callback: (action) => {
if (action === 'confirm') {
this._handleDelete(file, index);
}
}
});
},
_handleDelete(file, index) {
this.fileList.splice(index, 1);
this.tableData.splice(index, 1);
let i = this.uploadList.findIndex(upLoadFile => upLoadFile.name === file.name);
if (i > -1) {
this.uploadList.splice(i, 1);
}
},
fileValidator(file) {
/// todo:
return file.size > 0;
},
}
}
</script>

View File

@ -66,7 +66,7 @@
trigger="hover"
>
<test-case-detail :test-case="scope.row"/>
<p slot="reference">{{ scope.row.name }}</p>
<span slot="reference">{{ scope.row.name }}</span>
</el-popover>
</template>
</el-table-column>
@ -107,7 +107,7 @@
:label="$t('test_track.case.status')">
<template v-slot:default="scope">
<span class="el-dropdown-link">
<status-table-item :value="scope.row.reviewStatus"/>
<review-status :value="scope.row.reviewStatus"/>
</span>
</template>
</el-table-column>
@ -174,6 +174,7 @@
import {LIST_CHANGE, TrackEvent} from "@/business/components/common/head/ListEvent";
import StatusTableItem from "@/business/components/track/common/tableItems/planview/StatusTableItem";
import TestCaseDetail from "./TestCaseDetail";
import ReviewStatus from "@/business/components/track/case/components/ReviewStatus";
export default {
name: "TestCaseList",
components: {
@ -192,7 +193,8 @@
ShowMoreBtn,
BatchEdit,
StatusTableItem,
TestCaseDetail
TestCaseDetail,
ReviewStatus
},
data() {
return {
@ -222,9 +224,9 @@
{text: this.$t('commons.api'), value: 'api'}
],
statusFilters: [
{text: this.$t('test_track.plan.plan_status_prepare'), value: 'Prepare'},
{text: this.$t('test_track.plan_view.pass'), value: 'Pass'},
{text: '未通过', value: 'UnPass'},
{text: this.$t('test_track.case.status_prepare'), value: 'Prepare'},
{text: this.$t('test_track.case.status_pass'), value: 'Pass'},
{text: this.$t('test_track.case.status_un_pass'), value: 'UnPass'},
],
showMore: false,
buttons: [

View File

@ -83,6 +83,7 @@
refresh() {
this.selectNodeIds = [];
this.selectParentNodes = [];
this.$refs.testCaseRelevance.search();
this.getNodeTreeByPlanId();
},
initData() {

View File

@ -1,7 +1,5 @@
<template>
<div>
<el-dialog :title="$t('test_track.plan_view.relevance_test_case')"
:visible.sync="dialogFormVisible"
@close="close"
@ -11,7 +9,9 @@
<el-container class="main-content">
<el-aside class="tree-aside" width="250px">
<el-link type="primary" class="project-link" @click="switchProject">{{projectName ? projectName : $t('test_track.switch_project') }}</el-link>
<el-link type="primary" class="project-link" @click="switchProject">{{projectName ? projectName :
$t('test_track.switch_project') }}
</el-link>
<node-tree class="node-tree"
@nodeSelectEvent="nodeChange"
@refresh="refresh"
@ -21,11 +21,13 @@
<el-container>
<el-main class="case-content">
<ms-table-header :condition.sync="condition" @search="getCaseNames" title="" :show-create="false"/>
<ms-table-header :condition.sync="condition" @search="search" title="" :show-create="false"/>
<el-table
:data="testCases"
@filter-change="filter"
row-key="id"
@mouseleave.passive="leave"
v-el-table-infinite-scroll="scrollLoading"
@select-all="handleSelectAll"
@select="handleSelectionChange"
height="50vh"
@ -63,7 +65,9 @@
</template>
</el-table-column>
</el-table>
<div style="text-align: center"> {{testCases.length}} </div>
<div v-if="!lineStatus" style="text-align: center">{{$t('test_track.review_view.last_page')}}</div>
<div style="text-align: center"> {{total}} </div>
</el-main>
</el-container>
</el-container>
@ -91,6 +95,7 @@
import MsTableHeader from "../../../../common/components/MsTableHeader";
import {TEST_CASE_CONFIGS} from "../../../../common/components/search/search-components";
import SwitchProject from "../../../case/components/SwitchProject";
import elTableInfiniteScroll from 'el-table-infinite-scroll';
export default {
name: "TestCaseRelevance",
@ -104,6 +109,9 @@
MsTableHeader,
SwitchProject
},
directives: {
'el-table-infinite-scroll': elTableInfiniteScroll
},
data() {
return {
result: {},
@ -117,6 +125,10 @@
projectId: '',
projectName: '',
projects: [],
pageSize: 50,
currentPage: 1,
total: 0,
lineStatus: true,
condition: {
components: TEST_CASE_CONFIGS
},
@ -140,12 +152,15 @@
},
watch: {
planId() {
this.initData();
this.condition.planId = this.planId;
},
selectNodeIds() {
this.getCaseNames();
if (this.dialogFormVisible) {
this.search();
}
},
projectId() {
this.condition.projectId = this.projectId;
this.getProjectNode();
}
},
@ -155,13 +170,17 @@
methods: {
openTestCaseRelevanceDialog() {
this.getProject();
this.initData();
this.dialogFormVisible = true;
},
saveCaseRelevance() {
let param = {};
param.planId = this.planId;
param.testCaseIds = [...this.selectIds];
param.projectId = this.projectId;
//
if (this.testCases.length === param.testCaseIds.length) {
param.testCaseIds = ['all'];
}
this.result = this.$post('/test/plan/relevance', param, () => {
this.selectIds.clear();
this.$success(this.$t('commons.save_success'));
@ -169,25 +188,34 @@
this.$emit('refresh');
});
},
getCaseNames() {
buildPagePath(path) {
return path + "/" + this.currentPage + "/" + this.pageSize;
},
search() {
this.currentPage = 1;
this.testCases = [];
this.getTestCases(true);
},
getTestCases(flag) {
if (this.planId) {
// param.planId = this.planId;
this.condition.planId = this.planId;
}
if (this.selectNodeIds && this.selectNodeIds.length > 0) {
// param.nodeIds = this.selectNodeIds;
this.condition.nodeIds = this.selectNodeIds;
} else {
this.condition.nodeIds = [];
}
if (this.projectId) {
this.condition.projectId = this.projectId;
this.result = this.$post('/test/case/name', this.condition, response => {
this.testCases = response.data;
this.testCases.forEach(item => {
this.result = this.$post(this.buildPagePath('/test/case/name'), this.condition, response => {
let data = response.data;
this.total = data.itemCount;
let tableData = data.listObject;
tableData.forEach(item => {
item.checked = false;
});
flag ? this.testCases = tableData : this.testCases = this.testCases.concat(tableData);
this.lineStatus = tableData.length === 50 && this.testCases.length < this.total;
});
}
@ -198,7 +226,6 @@
this.selectIds.add(item.id);
});
} else {
// this.selectIds.clear();
this.testCases.forEach(item => {
if (this.selectIds.has(item.id)) {
this.selectIds.delete(item.id);
@ -217,32 +244,35 @@
this.selectNodeIds = nodeIds;
this.selectNodeNames = nodeNames;
},
initData() {
this.getCaseNames();
this.getAllNodeTreeByPlanId();
},
refresh() {
this.close();
},
scrollLoading() {
if (this.dialogFormVisible && this.lineStatus) {
this.currentPage += 1;
this.getTestCases();
}
},
getAllNodeTreeByPlanId() {
if (this.planId) {
let param = {
testPlanId: this.planId,
projectId: this.projectId
};
this.result = this.$post("/case/node/list/all/plan", param , response => {
this.result = this.$post("/case/node/list/all/plan", param, response => {
this.treeNodes = response.data;
});
}
},
close() {
this.lineStatus = false;
this.selectIds.clear();
this.selectNodeIds = [];
this.selectNodeNames = [];
},
filter(filters) {
_filter(filters, this.condition);
this.initData();
this.search();
},
toggleSelection(rows) {
rows.forEach(row => {
@ -256,7 +286,7 @@
},
getProject() {
if (this.planId) {
this.$post("/test/plan/project/", {planId: this.planId},res => {
this.$post("/test/plan/project/", {planId: this.planId}, res => {
let data = res.data;
if (data) {
this.projects = data;
@ -267,7 +297,7 @@
}
},
switchProject() {
this.$refs.switchProject.open({id: this.planId, url: '/test/plan/project/',type: 'plan'});
this.$refs.switchProject.open({id: this.planId, url: '/test/plan/project/', type: 'plan'});
},
getProjectNode(projectId) {
const index = this.projects.findIndex(project => project.id === projectId);
@ -278,9 +308,9 @@
this.projectId = projectId;
}
this.result = this.$post("/case/node/list/all/plan",
{testPlanId: this.planId, projectId: this.projectId} , response => {
this.treeNodes = response.data;
});
{testPlanId: this.planId, projectId: this.projectId}, response => {
this.treeNodes = response.data;
});
this.selectNodeIds = [];
}

View File

@ -347,11 +347,7 @@ export default {
});
this.refreshTableAndPlan();
this.isTestManagerOrTestUser = checkoutTestManagerOrTestUser();
this.result = this.$get('user/list', response => {
this.executorFilters = response.data.map(u => {
return {text: u.name, value: u.id}
});
});
this.getMaintainerOptions();
},
beforeDestroy() {
hub.$off("openFailureTestCase");
@ -583,6 +579,9 @@ export default {
let workspaceId = localStorage.getItem(WORKSPACE_ID);
this.$post('/user/ws/member/tester/list', {workspaceId: workspaceId}, response => {
this.valueArr.executor = response.data;
this.executorFilters = response.data.map(u => {
return {text: u.name, value: u.id}
});
});
}
}

View File

@ -173,8 +173,9 @@ export default {
this.$warning(this.$t('test_track.plan.input_plan_name'));
return;
}
if (this.operationType === 'save') {
this.compareTime(new Date().getTime(), this.form.endTime);
if (!this.compareTime(new Date().getTime(), this.form.endTime)) {
return false;
}
if (this.operationType === 'edit') {
@ -254,14 +255,17 @@ export default {
}
},
endTimeChange(value) {
this.form.endTime = this.form.endTime.getTime();
this.compareTime(new Date().getTime(), value.getTime());
if (value) {
this.form.endTime = this.form.endTime.getTime();
this.compareTime(new Date().getTime(), value.getTime());
}
},
compareTime(ts1, ts2) {
if (ts1 > ts2) {
this.form.endTime = '';
this.$warning("截止时间不能早于当前时间!");
return false;
}
return true;
}
}
}

View File

@ -88,6 +88,7 @@ export default {
refresh() {
this.selectNodeIds = [];
this.selectParentNodes = [];
this.$refs.testReviewRelevance.search();
this.getNodeTreeByReviewId();
},
initData() {

View File

@ -1,39 +1,30 @@
<template>
<div>
<el-dialog :title="$t('test_track.review_view.relevance_case')"
:visible.sync="dialogFormVisible"
@close="close"
<el-dialog :title="$t('test_track.review_view.relevance_case')" :visible.sync="dialogFormVisible" @close="close"
width="60%" v-loading="result.loading"
:close-on-click-modal="false"
top="50px">
<el-container class="main-content">
<el-aside class="tree-aside" width="250px">
<el-link type="primary" class="project-link" @click="switchProject">{{projectName ? projectName : $t('test_track.switch_project') }}</el-link>
<node-tree class="node-tree"
@nodeSelectEvent="nodeChange"
@refresh="refresh"
:tree-nodes="treeNodes"
<el-link type="primary" class="project-link" @click="switchProject">{{projectName ? projectName :
$t('test_track.switch_project') }}
</el-link>
<node-tree class="node-tree" @nodeSelectEvent="nodeChange" @refresh="refresh" :tree-nodes="treeNodes"
ref="nodeTree"/>
</el-aside>
<el-container>
<el-main class="case-content">
<ms-table-header :condition.sync="condition" @search="getReviews" title="" :show-create="false"/>
<el-table
:data="testReviews"
@filter-change="filter"
row-key="id"
@select-all="handleSelectAll"
@select="handleSelectionChange"
height="50vh"
ref="table">
<el-table-column
type="selection"/>
<ms-table-header :condition.sync="condition" @search="search" title="" :show-create="false"/>
<el-table :data="testReviews" @mouseleave.passive="leave" v-el-table-infinite-scroll="scrollLoading"
@filter-change="filter" row-key="id"
@select-all="handleSelectAll"
@select="handleSelectionChange"
height="50vh"
ref="table">
<el-table-column type="selection"/>
<el-table-column
prop="name"
:label="$t('test_track.case.name')"
@ -42,6 +33,7 @@
{{scope.row.name}}
</template>
</el-table-column>
<el-table-column
prop="priority"
:filters="priorityFilters"
@ -52,6 +44,7 @@
<priority-table-item :value="scope.row.priority"/>
</template>
</el-table-column>
<el-table-column
prop="type"
:filters="typeFilters"
@ -62,17 +55,20 @@
<type-table-item :value="scope.row.type"/>
</template>
</el-table-column>
<el-table-column
:filters="statusFilters"
column-key="status"
:label="$t('test_track.case.status')"
show-overflow-tooltip>
<template v-slot:default="scope">
<status-table-item :value="scope.row.reviewStatus"/>
<review-status :value="scope.row.reviewStatus"/>
</template>
</el-table-column>
</el-table>
<div style="text-align: center"> {{testReviews.length}} </div>
<div v-if="!lineStatus" style="text-align: center">{{$t('test_track.review_view.last_page')}}</div>
<div style="text-align: center"> {{total}} </div>
</el-main>
</el-container>
</el-container>
@ -90,216 +86,248 @@
<script>
import NodeTree from "../../../common/NodeTree";
import MsDialogFooter from "../../../../common/components/MsDialogFooter";
import PriorityTableItem from "../../../common/tableItems/planview/PriorityTableItem";
import TypeTableItem from "../../../common/tableItems/planview/TypeTableItem";
import MsTableSearchBar from "../../../../common/components/MsTableSearchBar";
import MsTableAdvSearchBar from "../../../../common/components/search/MsTableAdvSearchBar";
import MsTableHeader from "../../../../common/components/MsTableHeader";
import SwitchProject from "../../../case/components/SwitchProject";
import {TEST_CASE_CONFIGS} from "../../../../common/components/search/search-components";
import {_filter} from "../../../../../../common/js/utils";
import StatusTableItem from "@/business/components/track/common/tableItems/planview/StatusTableItem";
import NodeTree from "../../../common/NodeTree";
import MsDialogFooter from "../../../../common/components/MsDialogFooter";
import PriorityTableItem from "../../../common/tableItems/planview/PriorityTableItem";
import TypeTableItem from "../../../common/tableItems/planview/TypeTableItem";
import MsTableSearchBar from "../../../../common/components/MsTableSearchBar";
import MsTableAdvSearchBar from "../../../../common/components/search/MsTableAdvSearchBar";
import MsTableHeader from "../../../../common/components/MsTableHeader";
import SwitchProject from "../../../case/components/SwitchProject";
import {TEST_CASE_CONFIGS} from "../../../../common/components/search/search-components";
import {_filter} from "../../../../../../common/js/utils";
import ReviewStatus from "@/business/components/track/case/components/ReviewStatus";
import elTableInfiniteScroll from 'el-table-infinite-scroll';
export default {
name: "TestReviewRelevance",
components: {
NodeTree,
MsDialogFooter,
PriorityTableItem,
TypeTableItem,
MsTableSearchBar,
MsTableAdvSearchBar,
MsTableHeader,
SwitchProject,
ReviewStatus
export default {
name: "TestReviewRelevance",
components: {
NodeTree,
MsDialogFooter,
PriorityTableItem,
TypeTableItem,
MsTableSearchBar,
MsTableAdvSearchBar,
MsTableHeader,
SwitchProject,
StatusTableItem
},
data() {
return {
result: {},
dialogFormVisible: false,
isCheckAll: false,
testReviews: [],
selectIds: new Set(),
treeNodes: [],
selectNodeIds: [],
selectNodeNames: [],
projectId: '',
projectName: '',
projects: [],
condition: {
components: TEST_CASE_CONFIGS
},
priorityFilters: [
{text: 'P0', value: 'P0'},
{text: 'P1', value: 'P1'},
{text: 'P2', value: 'P2'},
{text: 'P3', value: 'P3'}
],
typeFilters: [
{text: this.$t('commons.functional'), value: 'functional'},
{text: this.$t('commons.performance'), value: 'performance'},
{text: this.$t('commons.api'), value: 'api'}
],
statusFilters: [
{text: this.$t('test_track.case.status_prepare'), value: 'Prepare'},
{text: this.$t('test_track.case.status_pass'), value: 'Pass'},
{text: this.$t('test_track.case.status_un_pass'), value: 'UnPass'},
],
};
},
props: {
reviewId: {
type: String
}
},
watch: {
reviewId() {
this.initData();
},
selectNodeIds() {
this.getReviews();
directives: {
'el-table-infinite-scroll': elTableInfiniteScroll
},
projectId() {
this.getProjectNode();
}
},
updated() {
this.toggleSelection(this.testReviews);
},
methods: {
openTestReviewRelevanceDialog() {
this.getProject();
this.initData();
this.dialogFormVisible = true;
data() {
return {
result: {},
dialogFormVisible: false,
isCheckAll: false,
testReviews: [],
selectIds: new Set(),
treeNodes: [],
selectNodeIds: [],
selectNodeNames: [],
projectId: '',
projectName: '',
projects: [],
pageSize: 50,
currentPage: 1,
total: 0,
lineStatus: true,
condition: {
components: TEST_CASE_CONFIGS
},
priorityFilters: [
{text: 'P0', value: 'P0'},
{text: 'P1', value: 'P1'},
{text: 'P2', value: 'P2'},
{text: 'P3', value: 'P3'}
],
typeFilters: [
{text: this.$t('commons.functional'), value: 'functional'},
{text: this.$t('commons.performance'), value: 'performance'},
{text: this.$t('commons.api'), value: 'api'}
],
statusFilters: [
{text: this.$t('test_track.case.status_prepare'), value: 'Prepare'},
{text: this.$t('test_track.case.status_pass'), value: 'Pass'},
{text: this.$t('test_track.case.status_un_pass'), value: 'UnPass'},
],
};
},
saveReviewRelevance() {
let param = {};
param.reviewId = this.reviewId;
param.testCaseIds = [...this.selectIds];
this.result = this.$post('/test/case/review/relevance', param, () => {
this.selectIds.clear();
this.$success(this.$t('commons.save_success'));
this.dialogFormVisible = false;
this.$emit('refresh');
});
props: {
reviewId: {
type: String
}
},
getReviews() {
if (this.reviewId) {
watch: {
reviewId() {
this.condition.reviewId = this.reviewId;
}
if (this.selectNodeIds && this.selectNodeIds.length > 0) {
this.condition.nodeIds = this.selectNodeIds;
} else {
this.condition.nodeIds = [];
}
if (this.projectId) {
},
selectNodeIds() {
if (this.dialogFormVisible) {
this.search();
}
},
projectId() {
this.condition.projectId = this.projectId;
this.result = this.$post('/test/case/reviews/case', this.condition, response => {
this.testReviews = response.data;
this.testReviews.forEach(item => {
item.checked = false;
this.getProjectNode();
}
},
updated() {
this.toggleSelection(this.testReviews);
},
methods: {
openTestReviewRelevanceDialog() {
this.getProject();
this.dialogFormVisible = true;
},
saveReviewRelevance() {
let param = {};
param.reviewId = this.reviewId;
param.testCaseIds = [...this.selectIds];
param.projectId = this.projectId;
//
if (this.testReviews.length === param.testCaseIds.length) {
param.testCaseIds = ['all'];
}
this.result = this.$post('/test/case/review/relevance', param, () => {
this.selectIds.clear();
this.$success(this.$t('commons.save_success'));
this.dialogFormVisible = false;
this.$emit('refresh');
});
},
buildPagePath(path) {
return path + "/" + this.currentPage + "/" + this.pageSize;
},
getReviews(flag) {
if (this.reviewId) {
this.condition.reviewId = this.reviewId;
}
if (this.selectNodeIds && this.selectNodeIds.length > 0) {
this.condition.nodeIds = this.selectNodeIds;
} else {
this.condition.nodeIds = [];
}
if (this.projectId) {
this.condition.projectId = this.projectId;
this.result = this.$post(this.buildPagePath('/test/case/reviews/case'), this.condition, response => {
let data = response.data;
this.total = data.itemCount;
let tableData = data.listObject;
tableData.forEach(item => {
item.checked = false;
});
flag ? this.testReviews = tableData : this.testReviews = this.testReviews.concat(tableData);
this.lineStatus = tableData.length === 50 && this.testReviews.length < this.total;
});
});
}
}
},
handleSelectAll(selection) {
if (selection.length > 0) {
this.testReviews.forEach(item => {
this.selectIds.add(item.id);
});
} else {
// this.selectIds.clear();
this.testReviews.forEach(item => {
if (this.selectIds.has(item.id)) {
this.selectIds.delete(item.id);
}
});
}
},
handleSelectionChange(selection, row) {
if (this.selectIds.has(row.id)) {
this.selectIds.delete(row.id);
} else {
this.selectIds.add(row.id);
}
},
nodeChange(nodeIds, nodeNames) {
this.selectNodeIds = nodeIds;
this.selectNodeNames = nodeNames;
},
initData() {
this.getReviews();
this.getAllNodeTreeByPlanId();
},
refresh() {
this.close();
},
getAllNodeTreeByPlanId() {
if (this.reviewId) {
let param = {
reviewId: this.reviewId,
projectId: this.projectId
};
this.result = this.$post("/case/node/list/all/review", param , response => {
this.treeNodes = response.data;
});
}
},
close() {
this.selectIds.clear();
this.selectNodeIds = [];
this.selectNodeNames = [];
},
filter(filters) {
_filter(filters, this.condition);
this.initData();
},
toggleSelection(rows) {
rows.forEach(row => {
this.selectIds.forEach(id => {
if (row.id === id) {
// true
this.$refs.table.toggleRowSelection(row, true)
}
},
handleSelectAll(selection) {
if (selection.length > 0) {
this.testReviews.forEach(item => {
this.selectIds.add(item.id);
});
} else {
// this.selectIds.clear();
this.testReviews.forEach(item => {
if (this.selectIds.has(item.id)) {
this.selectIds.delete(item.id);
}
});
}
},
handleSelectionChange(selection, row) {
if (this.selectIds.has(row.id)) {
this.selectIds.delete(row.id);
} else {
this.selectIds.add(row.id);
}
},
nodeChange(nodeIds, nodeNames) {
this.selectNodeIds = nodeIds;
this.selectNodeNames = nodeNames;
},
refresh() {
this.close();
},
getAllNodeTreeByPlanId() {
if (this.reviewId) {
let param = {
reviewId: this.reviewId,
projectId: this.projectId
};
this.result = this.$post("/case/node/list/all/review", param, response => {
this.treeNodes = response.data;
});
}
},
close() {
this.lineStatus = false;
this.selectIds.clear();
this.selectNodeIds = [];
this.selectNodeNames = [];
},
filter(filters) {
_filter(filters, this.condition);
this.search();
},
toggleSelection(rows) {
rows.forEach(row => {
this.selectIds.forEach(id => {
if (row.id === id) {
// true
this.$refs.table.toggleRowSelection(row, true)
}
})
})
})
},
getProject() {
if (this.reviewId) {
this.$post("/test/case/review/projects", {reviewId: this.reviewId},res => {
let data = res.data;
if (data) {
this.projects = data;
this.projectId = data[0].id;
this.projectName = data[0].name;
}
})
}
},
switchProject() {
this.$refs.switchProject.open({id: this.reviewId, url : '/test/case/review/project/', type: 'review'});
},
getProjectNode(projectId) {
const index = this.projects.findIndex(project => project.id === projectId);
if (index !== -1) {
this.projectName = this.projects[index].name;
}
if (projectId) {
this.projectId = projectId;
}
this.result = this.$post("/case/node/list/all/review",
{reviewId: this.reviewId, projectId: this.projectId} , response => {
this.treeNodes = response.data;
});
},
getProject() {
if (this.reviewId) {
this.$post("/test/case/review/projects", {reviewId: this.reviewId}, res => {
let data = res.data;
if (data) {
this.projects = data;
this.projectId = data[0].id;
this.projectName = data[0].name;
}
})
}
},
switchProject() {
this.$refs.switchProject.open({id: this.reviewId, url: '/test/case/review/project/', type: 'review'});
},
scrollLoading() {
if (this.dialogFormVisible && this.lineStatus) {
this.currentPage += 1;
this.getReviews();
}
},
search() {
this.currentPage = 1;
this.testReviews = [];
this.getReviews(true);
},
this.selectNodeIds = [];
getProjectNode(projectId) {
const index = this.projects.findIndex(project => project.id === projectId);
if (index !== -1) {
this.projectName = this.projects[index].name;
}
if (projectId) {
this.projectId = projectId;
}
this.result = this.$post("/case/node/list/all/review",
{reviewId: this.reviewId, projectId: this.projectId}, response => {
this.treeNodes = response.data;
});
this.selectNodeIds = [];
}
}
}
}
</script>
<style scoped>

View File

@ -38,10 +38,12 @@
@click="handleNext()"/>
<el-divider direction="vertical"></el-divider>
<el-button type="success" size="mini" :disabled="isReadOnly" plain @click="saveCase('Pass')">
<el-button type="success" size="mini"
:disabled="isReadOnly" :plain="testCase.reviewStatus !== 'Pass'" @click="saveCase('Pass')">
{{ $t('test_track.review.pass') }}
</el-button>
<el-button type="danger" size="mini" :disabled="isReadOnly" plain @click="saveCase('UnPass')">
<el-button type="danger" size="mini"
:disabled="isReadOnly" :plain="testCase.reviewStatus !== 'UnPass'" @click="saveCase('UnPass')">
{{ $t('test_track.review.un_pass') }}
</el-button>
</el-col>
@ -290,6 +292,10 @@ export default {
this.$success(this.$t('commons.save_success'));
this.updateTestCases(param);
this.setReviewStatus(this.testCase.reviewId);
//
this.testCase.reviewStatus = status;
//
this.testCases[this.index].reviewStatus = status;
});
},
updateTestCases(param) {

View File

@ -109,7 +109,7 @@
:label="$t('test_track.review_view.execute_result')">
<template v-slot:default="scope">
<span class="el-dropdown-link">
<status-table-item :value="scope.row.reviewStatus"/>
<review-status :value="scope.row.reviewStatus"/>
</span>
</template>
</el-table-column>
@ -169,6 +169,7 @@ import {_filter, _sort, checkoutTestManagerOrTestUser, hasRoles} from "../../../
import {TEST_CASE_CONFIGS} from "../../../../common/components/search/search-components";
import {ROLE_TEST_MANAGER, ROLE_TEST_USER} from "../../../../../../common/js/constants";
import TestReviewTestCaseEdit from "./TestReviewTestCaseEdit";
import ReviewStatus from "@/business/components/track/case/components/ReviewStatus";
export default {
name: "TestReviewTestCaseList",
@ -176,7 +177,7 @@ export default {
MsTableOperatorButton, MsTableOperator, MethodTableItem, TypeTableItem,
StatusTableItem, PriorityTableItem, StatusEdit,
ExecutorEdit, MsTipButton, TestReviewTestCaseEdit, MsTableHeader,
NodeBreadcrumb, MsTableButton, ShowMoreBtn, BatchEdit, MsTablePagination
NodeBreadcrumb, MsTableButton, ShowMoreBtn, BatchEdit, MsTablePagination, ReviewStatus
},
data() {
return {

View File

@ -214,6 +214,20 @@ export default {
select: 'Select Organization',
service_integration: 'Service integration',
defect_manage: 'Defect management platform',
message_settings:'Message settings',
message:{
jenkins_task_notification:'Jenkins task notification',
test_plan_task_notification:'Test plan task notification',
test_review_task_notice:'Test review task notice',
defect_task_notification:'Defect task notification',
create_new_notification:'Create a new notification',
select_events:'Select event',
select_receiving_method:'Select receiving method',
mail:'mail',
nail_robot:'Nail robot',
enterprise_wechat_robot:'Enterprise wechat robot',
},
integration: {
select_defect_platform: 'Please select the defect management platform to be integrated:',
basic_auth_info: 'Basic Auth account information:',
@ -533,6 +547,7 @@ export default {
expect: "Expect Value",
expression: "Expression",
response_in_time: "Response in time",
ignore_status: "Ignore Status"
},
extract: {
label: "Extract from response",
@ -661,7 +676,7 @@ export default {
length_less_than: "The length less than",
recent_plan: "My recent plan",
recent_case: "My recent case",
recent_review: "Recent review",
recent_review: "My recent review",
pass_rate: "Pass rate",
execution_result: ": Please select the execution result",
actual_result: ": The actual result is empty",
@ -721,8 +736,8 @@ export default {
batch_delete_case: 'Batch delete',
batch_unlink: 'Batch Unlink',
project_name: "Project",
status: 'Status',
status_prepare: 'Prepare',
status: 'Review Status',
status_prepare: 'Not reviewed',
status_pass: 'Pass',
status_un_pass: 'UnPass',
cancel_relevance_project: "Disassociating the project will also cancel the associated test cases under the project",
@ -815,6 +830,7 @@ export default {
all_case: "All case",
start_review: "Start Review",
relevance_case: "Relevance Case",
last_page: "It's the end",
execute_result: "Result",
},
module: {

View File

@ -215,6 +215,22 @@ export default {
delete_warning: '删除该组织将同步删除该组织下所有相关工作空间和相关工作空间下的所有项目,以及项目中的所有用例、接口测试、性能测试等,确定要删除吗?',
service_integration: '服务集成',
defect_manage: '缺陷管理平台',
message_settings:'消息设置',
message:{
jenkins_task_notification:'Jenkins任务通知',
test_plan_task_notification:'测试计划任务通知',
test_review_task_notice:'测试评审任务通知',
create_new_notification:'创建新通知',
select_events:'选择事件',
defect_task_notification:'缺陷任务通知',
select_receiving_method:'选择接收方式',
mail:'邮件',
nail_robot:'钉钉机器人',
enterprise_wechat_robot:'企业微信机器人',
},
integration: {
select_defect_platform: '请选择要集成的缺陷管理平台:',
basic_auth_info: 'Basic Auth 账号信息:',
@ -534,6 +550,7 @@ export default {
expect: "期望值",
expression: "Perl型正则表达式",
response_in_time: "响应时间在...毫秒以内",
ignore_status: "忽略状态"
},
extract: {
label: "提取",
@ -663,7 +680,7 @@ export default {
length_less_than: "长度必须小于",
recent_plan: "我最近的计划",
recent_case: "我最近的用例",
recent_review: "最近的评审",
recent_review: "最近的评审",
pass_rate: "通过率",
execution_result: ": 请选择执行结果",
actual_result: ": 实际结果为空",
@ -723,8 +740,8 @@ export default {
batch_delete_case: '批量删除用例',
batch_unlink: '批量取消关联',
project_name: '所属项目',
status: '状态',
status_prepare: '未开始',
status: '评审状态',
status_prepare: '未评审',
status_pass: '通过',
status_un_pass: '未通过',
cancel_relevance_project: "取消项目关联会同时取消该项目下已关联的测试用例",
@ -817,6 +834,7 @@ export default {
all_case: "全部用例",
start_review: "开始评审",
relevance_case: "关联用例",
last_page: "已经到底了!",
execute_result: "评审结果",
},
module: {

View File

@ -215,6 +215,19 @@ export default {
delete_warning: '刪除該組織將同步刪除該組織下所有相關工作空間和相關工作空間下的所有項目,以及項目中的所有用例、接口測試、性能測試等,確定要刪除嗎?',
service_integration: '服務集成',
defect_manage: '缺陷管理平臺',
message_settings:'消息設定',
message:{
jenkins_task_notification:'Jenkins任務通知',
test_plan_task_notification:'測試計畫任務通知',
test_review_task_notice:'測試評審任務通知',
defect_task_notification:'缺陷任務通知',
create_new_notification:'創建新通知',
select_events:'選擇事件',
select_receiving_method:'選擇接收管道',
mail:'郵件',
nail_robot:'釘釘機器人',
enterprise_wechat_robot:'企業微信機器人',
},
integration: {
select_defect_platform: '請選擇要集成的缺陷管理平臺:',
basic_auth_info: 'Basic Auth 賬號信息:',
@ -237,7 +250,10 @@ export default {
successful_operation: '操作成功',
not_integrated: '未集成該平臺',
choose_platform: '請選擇集成的平臺',
verified: '驗證通過'
verified: '驗證通過',
mail:'郵件',
nail_robot:'釘釘機器人',
enterprise_wechat_robot:'企業微信機器人',
}
},
project: {
@ -534,6 +550,7 @@ export default {
expect: "期望值",
expression: "Perl型正則表達式",
response_in_time: "響應時間在...毫秒以內",
ignore_status: "忽略狀態"
},
extract: {
label: "提取",
@ -663,7 +680,7 @@ export default {
length_less_than: "長度必須小於",
recent_plan: "我最近的計劃",
recent_case: "我最近的用例",
recent_review: "最近的評審",
recent_review: "最近的評審",
pass_rate: "通過率",
execution_result: ": 請選擇執行結果",
actual_result: ": 實際結果為空",
@ -723,8 +740,8 @@ export default {
batch_delete_case: '批量刪除用例',
batch_unlink: '批量取消關聯',
project_name: '所屬項目',
status: '狀態',
status_prepare: '未開始',
status: '評審狀態',
status_prepare: '未評審',
status_pass: '通過',
status_un_pass: '未通過',
cancel_relevance_project: "取消項目關聯會同時取消該項目下已關聯的測試用例",
@ -817,6 +834,7 @@ export default {
all_case: "全部用例",
start_review: "開始評審",
relevance_case: "關聯用例",
last_page: "已經到底了!",
execute_result: "評審結果",
},
module: {