Merge branch 'master' into local-api-delimit

# Conflicts:
#	backend/src/main/java/io/metersphere/api/service/APITestService.java
#	backend/src/main/resources/i18n/messages_zh_TW.properties
#	frontend/src/business/components/api/report/components/ResponseText.vue
This commit is contained in:
fit2-zhao 2020-11-24 10:56:36 +08:00
commit 9408555bba
40 changed files with 400 additions and 180 deletions

View File

@ -8,20 +8,27 @@ import io.metersphere.api.dto.scenario.request.dubbo.RegistryCenter;
import io.metersphere.api.jmeter.JMeterService; import io.metersphere.api.jmeter.JMeterService;
import io.metersphere.api.parse.ApiImportParser; import io.metersphere.api.parse.ApiImportParser;
import io.metersphere.api.parse.ApiImportParserFactory; import io.metersphere.api.parse.ApiImportParserFactory;
import io.metersphere.api.parse.JmeterDocumentParser;
import io.metersphere.base.domain.*; import io.metersphere.base.domain.*;
import io.metersphere.base.mapper.ApiTestFileMapper; import io.metersphere.base.mapper.ApiTestFileMapper;
import io.metersphere.base.mapper.ApiTestMapper; import io.metersphere.base.mapper.ApiTestMapper;
import io.metersphere.base.mapper.ext.ExtApiTestMapper; import io.metersphere.base.mapper.ext.ExtApiTestMapper;
import io.metersphere.commons.constants.*; import io.metersphere.commons.constants.APITestStatus;
import io.metersphere.commons.constants.FileType;
import io.metersphere.commons.constants.ScheduleGroup;
import io.metersphere.commons.constants.ScheduleType;
import io.metersphere.commons.exception.MSException; import io.metersphere.commons.exception.MSException;
import io.metersphere.commons.utils.*; import io.metersphere.commons.utils.*;
import io.metersphere.controller.request.QueryScheduleRequest; import io.metersphere.controller.request.QueryScheduleRequest;
import io.metersphere.dto.ScheduleDao; import io.metersphere.dto.ScheduleDao;
import io.metersphere.i18n.Translator; import io.metersphere.i18n.Translator;
import io.metersphere.job.sechedule.ApiTestJob; import io.metersphere.job.sechedule.ApiTestJob;
import io.metersphere.notice.service.MailService;
import io.metersphere.notice.service.NoticeService;
import io.metersphere.service.FileService; import io.metersphere.service.FileService;
import io.metersphere.service.QuotaService; import io.metersphere.service.QuotaService;
import io.metersphere.service.ScheduleService; import io.metersphere.service.ScheduleService;
import io.metersphere.service.UserService;
import io.metersphere.track.service.TestCaseService; import io.metersphere.track.service.TestCaseService;
import org.apache.dubbo.common.URL; import org.apache.dubbo.common.URL;
import org.apache.dubbo.common.constants.CommonConstants; import org.apache.dubbo.common.constants.CommonConstants;
@ -39,6 +46,8 @@ import java.util.stream.Collectors;
@Service @Service
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public class APITestService { public class APITestService {
@Resource
private UserService userService;
@Resource @Resource
private ApiTestMapper apiTestMapper; private ApiTestMapper apiTestMapper;
@Resource @Resource
@ -55,6 +64,11 @@ public class APITestService {
private ScheduleService scheduleService; private ScheduleService scheduleService;
@Resource @Resource
private TestCaseService testCaseService; private TestCaseService testCaseService;
@Resource
private MailService mailService;
@Resource
private NoticeService noticeService;
private static final String BODY_FILE_DIR = "/opt/metersphere/data/body"; private static final String BODY_FILE_DIR = "/opt/metersphere/data/body";
@ -72,19 +86,33 @@ public class APITestService {
return extApiTestMapper.listByIds(request.getIds()); return extApiTestMapper.listByIds(request.getIds());
} }
public void create(SaveAPITestRequest request, List<MultipartFile> bodyFiles) { public void create(SaveAPITestRequest request, MultipartFile file, List<MultipartFile> bodyFiles) {
List<String> bodyUploadIds = new ArrayList<>(request.getBodyUploadIds()); List<String> bodyUploadIds = new ArrayList<>(request.getBodyUploadIds());
ApiTest test = createTest(request); ApiTest test = createTest(request, file);
createBodyFiles(test, bodyUploadIds, bodyFiles); createBodyFiles(test, bodyUploadIds, bodyFiles);
} }
private ApiTest createTest(SaveAPITestRequest request, MultipartFile file) {
if (file == null) {
throw new IllegalArgumentException(Translator.get("file_cannot_be_null"));
}
checkQuota();
request.setBodyUploadIds(null);
ApiTest test = createTest(request);
saveFile(test.getId(), file);
return test;
}
public void update(SaveAPITestRequest request, List<MultipartFile> bodyFiles) { public void update(SaveAPITestRequest request, MultipartFile file, List<MultipartFile> bodyFiles) {
if (file == null) {
throw new IllegalArgumentException(Translator.get("file_cannot_be_null"));
}
deleteFileByTestId(request.getId()); deleteFileByTestId(request.getId());
List<String> bodyUploadIds = new ArrayList<>(request.getBodyUploadIds()); List<String> bodyUploadIds = new ArrayList<>(request.getBodyUploadIds());
request.setBodyUploadIds(null); request.setBodyUploadIds(null);
ApiTest test = updateTest(request); ApiTest test = updateTest(request);
createBodyFiles(test, bodyUploadIds, bodyFiles); createBodyFiles(test, bodyUploadIds, bodyFiles);
saveFile(test.getId(), file);
} }
private void createBodyFiles(ApiTest test, List<String> bodyUploadIds, List<MultipartFile> bodyFiles) { private void createBodyFiles(ApiTest test, List<String> bodyUploadIds, List<MultipartFile> bodyFiles) {
@ -127,6 +155,14 @@ public class APITestService {
copy.setStatus(APITestStatus.Saved.name()); copy.setStatus(APITestStatus.Saved.name());
copy.setUserId(Objects.requireNonNull(SessionUtils.getUser()).getId()); copy.setUserId(Objects.requireNonNull(SessionUtils.getUser()).getId());
apiTestMapper.insert(copy); apiTestMapper.insert(copy);
// copy test file
ApiTestFile apiTestFile = getFileByTestId(request.getId());
if (apiTestFile != null) {
FileMetadata fileMetadata = fileService.copyFile(apiTestFile.getFileId());
apiTestFile.setTestId(copy.getId());
apiTestFile.setFileId(fileMetadata.getId());
apiTestFileMapper.insert(apiTestFile);
}
copyBodyFiles(copy.getId(), request.getId()); copyBodyFiles(copy.getId(), request.getId());
} }

View File

@ -9,4 +9,5 @@ import java.util.List;
public interface ExtWorkspaceMapper { public interface ExtWorkspaceMapper {
List<WorkspaceDTO> getWorkspaceWithOrg(@Param("request") WorkspaceRequest request); List<WorkspaceDTO> getWorkspaceWithOrg(@Param("request") WorkspaceRequest request);
List<String> getWorkspaceIdsByOrgId(@Param("orgId") String orgId);
} }

View File

@ -13,4 +13,9 @@
order by w.update_time desc order by w.update_time desc
</select> </select>
<select id="getWorkspaceIdsByOrgId" resultType="java.lang.String">
select id from workspace
where organization_id = #{orgId}
</select>
</mapper> </mapper>

View File

@ -12,6 +12,7 @@ import java.util.stream.Collectors;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.alibaba.fastjson.JSONPath; import com.alibaba.fastjson.JSONPath;
import org.apache.commons.lang3.StringUtils;
public class JsonPathUtils { public class JsonPathUtils {
@ -68,9 +69,26 @@ public class JsonPathUtils {
.compareTo( (String)b.get("json_path") ) .compareTo( (String)b.get("json_path") )
); );
// 正则特殊字符转义
allJsons.forEach(item -> {
item.put("regular_expression", escapeExprSpecialWord((String) item.get("json_value")));
});
return allJsons; return allJsons;
} }
public static String escapeExprSpecialWord(String keyword) {
if (StringUtils.isNotBlank(keyword)) {
String[] fbsArr = {"\\", "$", "(", ")", "*", "+", ".", "[", "]", "?", "^", "{", "}", "|"};
for (String key : fbsArr) {
if (keyword.contains(key)) {
keyword = keyword.replace(key, "\\" + key);
}
}
}
return keyword;
}
private static String formatJson(String json_path){ private static String formatJson(String json_path){
String ret=""; String ret="";
String reg = ".(\\d{1,3}).{0,1}"; String reg = ".(\\d{1,3}).{0,1}";

View File

@ -3,6 +3,7 @@ package io.metersphere.controller;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import io.metersphere.base.domain.User; import io.metersphere.base.domain.User;
import io.metersphere.commons.utils.SessionUtils; import io.metersphere.commons.utils.SessionUtils;
import io.metersphere.controller.handler.annotation.NoResultHolder;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile; import org.springframework.web.multipart.MultipartFile;
@ -34,6 +35,26 @@ public class TestController {
return jsonObject; return jsonObject;
} }
@NoResultHolder
@GetMapping(value = "/xml")
public String getXmlString() {
return "<?xml version=\"1.0\" encoding=\"ISO-8859-1\"?>\n" +
"\n" +
"<bookstore>\n" +
"\n" +
"<book>\n" +
" <title lang=\"eng\">Harry Potter</title>\n" +
" <price>29.99</price>\n" +
"</book>\n" +
"\n" +
"<book>\n" +
" <title lang=\"eng\">Learning XML</title>\n" +
" <price>39.95</price>\n" +
"</book>\n" +
"\n" +
"</bookstore>";
}
@GetMapping(value = "/{str}") @GetMapping(value = "/{str}")
public Object getString(@PathVariable String str) throws InterruptedException { public Object getString(@PathVariable String str) throws InterruptedException {
if (StringUtils.equals("error", str)) { if (StringUtils.equals("error", str)) {

View File

@ -2,6 +2,7 @@ package io.metersphere.controller.handler;
import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSON;
import io.metersphere.controller.ResultHolder; import io.metersphere.controller.ResultHolder;
import io.metersphere.controller.handler.annotation.NoResultHolder;
import org.springframework.core.MethodParameter; import org.springframework.core.MethodParameter;
import org.springframework.http.MediaType; import org.springframework.http.MediaType;
import org.springframework.http.converter.HttpMessageConverter; import org.springframework.http.converter.HttpMessageConverter;
@ -30,6 +31,10 @@ public class ResultResponseBodyAdvice implements ResponseBodyAdvice<Object> {
return null; return null;
} }
if (methodParameter.hasMethodAnnotation(NoResultHolder.class)) {
return o;
}
if (!(o instanceof ResultHolder)) { if (!(o instanceof ResultHolder)) {
if (o instanceof String) { if (o instanceof String) {
return JSON.toJSONString(ResultHolder.success(o)); return JSON.toJSONString(ResultHolder.success(o));

View File

@ -0,0 +1,15 @@
package io.metersphere.controller.handler.annotation;
import java.lang.annotation.Documented;
import java.lang.annotation.ElementType;
import java.lang.annotation.Inherited;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
@Documented
@Inherited
@Target(ElementType.METHOD)
@Retention(RetentionPolicy.RUNTIME)
public @interface NoResultHolder {
}

View File

@ -19,6 +19,7 @@ import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource; import javax.annotation.Resource;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.stream.Collectors;
@Service @Service
@Transactional(propagation = Propagation.NOT_SUPPORTED) @Transactional(propagation = Propagation.NOT_SUPPORTED)
@ -57,7 +58,9 @@ public class DingTaskService {
list.forEach(u -> { list.forEach(u -> {
phoneList.add(u.getPhone()); phoneList.add(u.getPhone());
}); });
at.setAtMobiles(phoneList); LogUtil.info("收件人地址" + phoneList);
List<String> phoneLists = phoneList.stream().distinct().collect(Collectors.toList());
at.setAtMobiles(phoneLists);
request.setAt(at); request.setAt(at);
OapiRobotSendResponse response = null; OapiRobotSendResponse response = null;
try { try {

View File

@ -37,6 +37,7 @@ import javax.mail.internet.MimeMessage;
import java.nio.charset.StandardCharsets; import java.nio.charset.StandardCharsets;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
import java.util.*; import java.util.*;
import java.util.stream.Collectors;
@Service @Service
@Transactional(propagation = Propagation.NOT_SUPPORTED) @Transactional(propagation = Propagation.NOT_SUPPORTED)
@ -111,7 +112,9 @@ public class MailService {
list.forEach(u -> { list.forEach(u -> {
emails.add(u.getEmail()); emails.add(u.getEmail());
}); });
users = emails.toArray(new String[0]); List<String> email = emails.stream().distinct().collect(Collectors.toList());
users = email.toArray(new String[0]);
LogUtil.info("收件人地址" + users);
helper.setText(getContent(Template, context), true); helper.setText(getContent(Template, context), true);
helper.setTo(users); helper.setTo(users);
try { try {
@ -143,9 +146,10 @@ public class MailService {
} }
public void sendCommentNotice(MessageDetail messageDetail, List<String> userIds, SaveCommentRequest request, TestCaseWithBLOBs testCaseWithBLOBs, String eventType) { public void sendCommentNotice(MessageDetail messageDetail, List<String> userIds, SaveCommentRequest request, TestCaseWithBLOBs testCaseWithBLOBs, String eventType) {
User user = userMapper.selectByPrimaryKey(testCaseWithBLOBs.getMaintainer());
BaseSystemConfigDTO baseSystemConfigDTO = systemParameterService.getBaseInfo(); BaseSystemConfigDTO baseSystemConfigDTO = systemParameterService.getBaseInfo();
Map<String, String> context = new HashMap<>(); Map<String, String> context = new HashMap<>();
context.put("maintainer", testCaseWithBLOBs.getMaintainer()); context.put("maintainer", user.getName());
context.put("testCaseName", testCaseWithBLOBs.getName()); context.put("testCaseName", testCaseWithBLOBs.getName());
context.put("description", request.getDescription()); context.put("description", request.getDescription());
context.put("url", baseSystemConfigDTO.getUrl()); context.put("url", baseSystemConfigDTO.getUrl());
@ -183,7 +187,9 @@ public class MailService {
list.forEach(u -> { list.forEach(u -> {
emails.add(u.getEmail()); emails.add(u.getEmail());
}); });
users = emails.toArray(new String[0]); List<String> email = emails.stream().distinct().collect(Collectors.toList());
users = email.toArray(new String[0]);
LogUtil.info("收件人地址" + users);
helper.setText(getContent(Template, context), true); helper.setText(getContent(Template, context), true);
helper.setTo(users); helper.setTo(users);
if (users.length > 0) { if (users.length > 0) {
@ -195,7 +201,8 @@ public class MailService {
public void sendTestPlanStartNotice(MessageDetail messageDetail, List<String> userIds, AddTestPlanRequest testPlan, String eventType) { public void sendTestPlanStartNotice(MessageDetail messageDetail, List<String> userIds, AddTestPlanRequest testPlan, String eventType) {
Map<String, String> context = getTestPlanContext(testPlan); Map<String, String> context = getTestPlanContext(testPlan);
context.put("creator", testPlan.getCreator()); User user = userMapper.selectByPrimaryKey(testPlan.getCreator());
context.put("creator", user.getName());
try { try {
String endTemplate = IOUtils.toString(this.getClass().getResource("/mail/TestPlanStart.html"), StandardCharsets.UTF_8); String endTemplate = IOUtils.toString(this.getClass().getResource("/mail/TestPlanStart.html"), StandardCharsets.UTF_8);
sendTestPlanNotice(addresseeIdList(messageDetail, userIds, eventType), context, endTemplate); sendTestPlanNotice(addresseeIdList(messageDetail, userIds, eventType), context, endTemplate);
@ -205,8 +212,9 @@ public class MailService {
} }
public void sendTestPlanEndNotice(MessageDetail messageDetail, List<String> userIds, AddTestPlanRequest testPlan, String eventType) { public void sendTestPlanEndNotice(MessageDetail messageDetail, List<String> userIds, AddTestPlanRequest testPlan, String eventType) {
User user = userMapper.selectByPrimaryKey(testPlan.getCreator());
Map<String, String> context = getTestPlanContext(testPlan); Map<String, String> context = getTestPlanContext(testPlan);
context.put("creator", userIds.toString()); context.put("creator", user.getName());
try { try {
String endTemplate = IOUtils.toString(this.getClass().getResource("/mail/TestPlanEnd.html"), StandardCharsets.UTF_8); String endTemplate = IOUtils.toString(this.getClass().getResource("/mail/TestPlanEnd.html"), StandardCharsets.UTF_8);
sendTestPlanNotice(addresseeIdList(messageDetail, userIds, eventType), context, endTemplate); sendTestPlanNotice(addresseeIdList(messageDetail, userIds, eventType), context, endTemplate);
@ -216,8 +224,9 @@ public class MailService {
} }
public void sendTestPlanDeleteNotice(MessageDetail messageDetail, List<String> userIds, AddTestPlanRequest testPlan, String eventType) { public void sendTestPlanDeleteNotice(MessageDetail messageDetail, List<String> userIds, AddTestPlanRequest testPlan, String eventType) {
User user = userMapper.selectByPrimaryKey(testPlan.getCreator());
Map<String, String> context = getTestPlanContext(testPlan); Map<String, String> context = getTestPlanContext(testPlan);
context.put("creator", userIds.toString()); context.put("creator", user.getName());
try { try {
String endTemplate = IOUtils.toString(this.getClass().getResource("/mail/TestPlanDelete.html"), StandardCharsets.UTF_8); String endTemplate = IOUtils.toString(this.getClass().getResource("/mail/TestPlanDelete.html"), StandardCharsets.UTF_8);
sendTestPlanNotice(addresseeIdList(messageDetail, userIds, eventType), context, endTemplate); sendTestPlanNotice(addresseeIdList(messageDetail, userIds, eventType), context, endTemplate);
@ -241,7 +250,9 @@ public class MailService {
list.forEach(u -> { list.forEach(u -> {
emails.add(u.getEmail()); emails.add(u.getEmail());
}); });
users = emails.toArray(new String[0]); List<String> email = emails.stream().distinct().collect(Collectors.toList());
users = email.toArray(new String[0]);
LogUtil.info("收件人地址" + users);
helper.setText(getContent(Template, context), true); helper.setText(getContent(Template, context), true);
helper.setTo(users); helper.setTo(users);
javaMailSender.send(mimeMessage); javaMailSender.send(mimeMessage);
@ -276,7 +287,9 @@ public class MailService {
list.forEach(u -> { list.forEach(u -> {
emails.add(u.getEmail()); emails.add(u.getEmail());
}); });
users = emails.toArray(new String[0]); List<String> email = emails.stream().distinct().collect(Collectors.toList());
users = email.toArray(new String[0]);
LogUtil.info("收件人地址" + users);
helper.setText(getContent(Template, context), true); helper.setText(getContent(Template, context), true);
helper.setTo(users); helper.setTo(users);
javaMailSender.send(mimeMessage); javaMailSender.send(mimeMessage);
@ -381,7 +394,7 @@ public class MailService {
if (StringUtils.isNotBlank(context.get(k))) { if (StringUtils.isNotBlank(context.get(k))) {
template = RegExUtils.replaceAll(template, "\\$\\{" + k + "}", context.get(k)); template = RegExUtils.replaceAll(template, "\\$\\{" + k + "}", context.get(k));
} else { } else {
template = RegExUtils.replaceAll(template, "\\$\\{" + k + "}", ""); template = RegExUtils.replaceAll(template, "\\$\\{" + k + "}", "未设置");
} }
} }
} }

View File

@ -5,8 +5,10 @@ import io.metersphere.base.domain.MessageTaskExample;
import io.metersphere.base.mapper.MessageTaskMapper; import io.metersphere.base.mapper.MessageTaskMapper;
import io.metersphere.base.mapper.ext.ExtMessageMapper; import io.metersphere.base.mapper.ext.ExtMessageMapper;
import io.metersphere.commons.constants.NoticeConstants; import io.metersphere.commons.constants.NoticeConstants;
import io.metersphere.commons.exception.MSException;
import io.metersphere.commons.user.SessionUser; import io.metersphere.commons.user.SessionUser;
import io.metersphere.commons.utils.SessionUtils; import io.metersphere.commons.utils.SessionUtils;
import io.metersphere.i18n.Translator;
import io.metersphere.notice.controller.request.MessageRequest; import io.metersphere.notice.controller.request.MessageRequest;
import io.metersphere.notice.domain.MessageDetail; import io.metersphere.notice.domain.MessageDetail;
import io.metersphere.notice.domain.MessageSettingDetail; import io.metersphere.notice.domain.MessageSettingDetail;
@ -49,6 +51,7 @@ public class NoticeService {
long time = System.currentTimeMillis(); long time = System.currentTimeMillis();
String identification = UUID.randomUUID().toString(); String identification = UUID.randomUUID().toString();
list.getUserIds().forEach(m -> { list.getUserIds().forEach(m -> {
checkUserIdExist(m, list);
MessageTask message = new MessageTask(); MessageTask message = new MessageTask();
message.setId(UUID.randomUUID().toString()); message.setId(UUID.randomUUID().toString());
message.setEvent(list.getEvent()); message.setEvent(list.getEvent());
@ -57,7 +60,7 @@ public class NoticeService {
message.setType(list.getType()); message.setType(list.getType());
message.setWebhook(list.getWebhook()); message.setWebhook(list.getWebhook());
message.setIdentification(identification); message.setIdentification(identification);
message.setIsSet(list.getIsSet()); message.setIsSet(false);
message.setOrganizationId(orgId); message.setOrganizationId(orgId);
message.setTestId(list.getTestId()); message.setTestId(list.getTestId());
message.setCreateTime(time); message.setCreateTime(time);
@ -65,6 +68,14 @@ public class NoticeService {
}); });
} }
private void checkUserIdExist(String userId, MessageDetail list) {
MessageTaskExample example = new MessageTaskExample();
example.createCriteria().andUserIdEqualTo(userId).andEventEqualTo(list.getEvent()).andTypeEqualTo(list.getType()).andTaskTypeEqualTo(list.getTaskType()).andWebhookEqualTo(list.getWebhook());
if (messageTaskMapper.countByExample(example) > 0) {
MSException.throwException(Translator.get("message_task_already_exists"));
}
}
public List<MessageDetail> searchMessageSchedule(String testId) { public List<MessageDetail> searchMessageSchedule(String testId) {
List<MessageTask> messageTaskLists = extMessageMapper.searchMessageByTestId(testId); List<MessageTask> messageTaskLists = extMessageMapper.searchMessageByTestId(testId);
List<MessageDetail> scheduleMessageTask = new ArrayList<>(); List<MessageDetail> scheduleMessageTask = new ArrayList<>();
@ -116,10 +127,14 @@ public class NoticeService {
messageDetail.setUserIds(new ArrayList<String>(userIds)); messageDetail.setUserIds(new ArrayList<String>(userIds));
MessageDetailList.add(messageDetail); MessageDetailList.add(messageDetail);
}); });
List<MessageDetail> jenkinsTask = MessageDetailList.stream().filter(a -> a.getTaskType().equals(NoticeConstants.JENKINS_TASK)).sorted(Comparator.comparing(MessageDetail::getCreateTime, Comparator.nullsLast(Long::compareTo)).reversed()).collect(Collectors.toList()); List<MessageDetail> jenkinsTask = (MessageDetailList.stream().filter(a -> a.getTaskType().equals(NoticeConstants.JENKINS_TASK)).sorted(Comparator.comparing(
List<MessageDetail> testCasePlanTask = MessageDetailList.stream().filter(a -> a.getTaskType().equals(NoticeConstants.TEST_PLAN_TASK)).sorted(Comparator.comparing(MessageDetail::getCreateTime, Comparator.nullsLast(Long::compareTo)).reversed()).collect(Collectors.toList()); MessageDetail::getCreateTime, Comparator.nullsLast(Long::compareTo)).reversed()).collect(Collectors.toList())).stream().distinct().collect(Collectors.toList());
List<MessageDetail> reviewTask = MessageDetailList.stream().filter(a -> a.getTaskType().equals(NoticeConstants.REVIEW_TASK)).sorted(Comparator.comparing(MessageDetail::getCreateTime, Comparator.nullsLast(Long::compareTo)).reversed()).collect(Collectors.toList()); List<MessageDetail> testCasePlanTask = (MessageDetailList.stream().filter(a -> a.getTaskType().equals(NoticeConstants.TEST_PLAN_TASK)).sorted(Comparator.comparing(
List<MessageDetail> defectTask = MessageDetailList.stream().filter(a -> a.getTaskType().equals(NoticeConstants.DEFECT_TASK)).sorted(Comparator.comparing(MessageDetail::getCreateTime, Comparator.nullsLast(Long::compareTo)).reversed()).collect(Collectors.toList()); MessageDetail::getCreateTime, Comparator.nullsLast(Long::compareTo)).reversed()).collect(Collectors.toList())).stream().distinct().collect(Collectors.toList());
List<MessageDetail> reviewTask = (MessageDetailList.stream().filter(a -> a.getTaskType().equals(NoticeConstants.REVIEW_TASK)).sorted(Comparator.comparing(
MessageDetail::getCreateTime, Comparator.nullsLast(Long::compareTo)).reversed()).collect(Collectors.toList())).stream().distinct().collect(Collectors.toList());
List<MessageDetail> defectTask = (MessageDetailList.stream().filter(a -> a.getTaskType().equals(NoticeConstants.DEFECT_TASK)).sorted(Comparator.comparing(
MessageDetail::getCreateTime, Comparator.nullsLast(Long::compareTo)).reversed()).collect(Collectors.toList())).stream().distinct().collect(Collectors.toList());
messageSettingDetail.setJenkinsTask(jenkinsTask); messageSettingDetail.setJenkinsTask(jenkinsTask);
messageSettingDetail.setTestCasePlanTask(testCasePlanTask); messageSettingDetail.setTestCasePlanTask(testCasePlanTask);
messageSettingDetail.setReviewTask(reviewTask); messageSettingDetail.setReviewTask(reviewTask);

View File

@ -18,6 +18,7 @@ import javax.annotation.Resource;
import java.io.IOException; import java.io.IOException;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.stream.Collectors;
@Service @Service
@Transactional(propagation = Propagation.NOT_SUPPORTED) @Transactional(propagation = Propagation.NOT_SUPPORTED)
@ -50,7 +51,9 @@ public class WxChatTaskService {
list.forEach(u -> { list.forEach(u -> {
phoneList.add(u.getPhone()); phoneList.add(u.getPhone());
}); });
mentionedMobileList.addAll(phoneList); LogUtil.info("收件人地址" + phoneList);
List<String> phoneLists = phoneList.stream().distinct().collect(Collectors.toList());
mentionedMobileList.addAll(phoneLists);
message.setMentionedMobileList(mentionedMobileList); message.setMentionedMobileList(mentionedMobileList);
try { try {
SendResult result = WxChatbotClient.send(Webhook, message); SendResult result = WxChatbotClient.send(Webhook, message);

View File

@ -7,6 +7,7 @@ import io.metersphere.base.mapper.ext.ExtSystemParameterMapper;
import io.metersphere.commons.constants.ParamConstants; import io.metersphere.commons.constants.ParamConstants;
import io.metersphere.commons.exception.MSException; import io.metersphere.commons.exception.MSException;
import io.metersphere.commons.utils.EncryptUtils; import io.metersphere.commons.utils.EncryptUtils;
import io.metersphere.commons.utils.LogUtil;
import io.metersphere.dto.BaseSystemConfigDTO; import io.metersphere.dto.BaseSystemConfigDTO;
import io.metersphere.i18n.Translator; import io.metersphere.i18n.Translator;
import io.metersphere.ldap.domain.LdapInfo; import io.metersphere.ldap.domain.LdapInfo;
@ -99,6 +100,7 @@ public class SystemParameterService {
try { try {
javaMailSender.testConnection(); javaMailSender.testConnection();
} catch (MessagingException e) { } catch (MessagingException e) {
LogUtil.error(e);
MSException.throwException(Translator.get("connection_failed")); MSException.throwException(Translator.get("connection_failed"));
} }
} }

View File

@ -318,6 +318,17 @@ public class UserService {
} }
public void updateUser(User user) { public void updateUser(User user) {
// todo 提取重复代码
if (StringUtils.isNotBlank(user.getEmail())) {
UserExample example = new UserExample();
UserExample.Criteria criteria = example.createCriteria();
criteria.andEmailEqualTo(user.getEmail());
criteria.andIdNotEqualTo(user.getId());
if (userMapper.countByExample(example) > 0) {
MSException.throwException(Translator.get("user_email_already_exists"));
}
}
user.setUpdateTime(System.currentTimeMillis()); user.setUpdateTime(System.currentTimeMillis());
userMapper.updateByPrimaryKeySelective(user); userMapper.updateByPrimaryKeySelective(user);
// 禁用用户之后剔除在线用户 // 禁用用户之后剔除在线用户
@ -424,8 +435,12 @@ public class UserService {
} }
public void delOrganizationMember(String organizationId, String userId) { public void delOrganizationMember(String organizationId, String userId) {
List<String> resourceIds = workspaceService.getWorkspaceIdsOrgId(organizationId);
resourceIds.add(organizationId);
UserRoleExample userRoleExample = new UserRoleExample(); UserRoleExample userRoleExample = new UserRoleExample();
userRoleExample.createCriteria().andRoleIdLike("%org%").andUserIdEqualTo(userId).andSourceIdEqualTo(organizationId); userRoleExample.createCriteria().andUserIdEqualTo(userId).andSourceIdIn(resourceIds);
User user = userMapper.selectByPrimaryKey(userId); User user = userMapper.selectByPrimaryKey(userId);
if (StringUtils.equals(organizationId, user.getLastOrganizationId())) { if (StringUtils.equals(organizationId, user.getLastOrganizationId())) {

View File

@ -202,6 +202,10 @@ public class WorkspaceService {
return resultWorkspaceList; return resultWorkspaceList;
} }
public List<String> getWorkspaceIdsOrgId(String orgId) {
return extWorkspaceMapper.getWorkspaceIdsByOrgId(orgId);
}
public void updateWorkspaceMember(WorkspaceMemberDTO memberDTO) { public void updateWorkspaceMember(WorkspaceMemberDTO memberDTO) {
String workspaceId = memberDTO.getWorkspaceId(); String workspaceId = memberDTO.getWorkspaceId();
String userId = memberDTO.getId(); String userId = memberDTO.getId();

View File

@ -3,8 +3,10 @@ package io.metersphere.track.service;
import io.metersphere.base.domain.TestCaseComment; import io.metersphere.base.domain.TestCaseComment;
import io.metersphere.base.domain.TestCaseCommentExample; import io.metersphere.base.domain.TestCaseCommentExample;
import io.metersphere.base.domain.TestCaseWithBLOBs; import io.metersphere.base.domain.TestCaseWithBLOBs;
import io.metersphere.base.domain.User;
import io.metersphere.base.mapper.TestCaseCommentMapper; import io.metersphere.base.mapper.TestCaseCommentMapper;
import io.metersphere.base.mapper.TestCaseMapper; import io.metersphere.base.mapper.TestCaseMapper;
import io.metersphere.base.mapper.UserMapper;
import io.metersphere.base.mapper.ext.ExtTestCaseCommentMapper; import io.metersphere.base.mapper.ext.ExtTestCaseCommentMapper;
import io.metersphere.commons.constants.NoticeConstants; import io.metersphere.commons.constants.NoticeConstants;
import io.metersphere.commons.exception.MSException; import io.metersphere.commons.exception.MSException;
@ -48,7 +50,8 @@ public class TestCaseCommentService {
private NoticeService noticeService; private NoticeService noticeService;
@Resource @Resource
private ExtTestCaseCommentMapper extTestCaseCommentMapper; private ExtTestCaseCommentMapper extTestCaseCommentMapper;
@Resource
private UserMapper userMapper;
public void saveComment(SaveCommentRequest request) { public void saveComment(SaveCommentRequest request) {
TestCaseComment testCaseComment = new TestCaseComment(); TestCaseComment testCaseComment = new TestCaseComment();
@ -97,6 +100,7 @@ public class TestCaseCommentService {
} }
private String getReviewContext(TestCaseComment testCaseComment, TestCaseWithBLOBs testCaseWithBLOBs) { private String getReviewContext(TestCaseComment testCaseComment, TestCaseWithBLOBs testCaseWithBLOBs) {
User user = userMapper.selectByPrimaryKey(testCaseComment.getAuthor());
Long startTime = testCaseComment.getCreateTime(); Long startTime = testCaseComment.getCreateTime();
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
String start = null; String start = null;
@ -105,7 +109,7 @@ public class TestCaseCommentService {
start = sdf.format(new Date(Long.parseLong(sTime))); start = sdf.format(new Date(Long.parseLong(sTime)));
} }
String context = ""; String context = "";
context = "测试评审任务通知:" + testCaseComment.getAuthor() + "" + start + "" + "'" + testCaseWithBLOBs.getName() + "'" + "添加评论:" + testCaseComment.getDescription(); context = "测试评审任务通知:" + user.getName() + "" + start + "" + "'" + testCaseWithBLOBs.getName() + "'" + "添加评论:" + testCaseComment.getDescription();
return context; return context;
} }

View File

@ -572,10 +572,14 @@ public class TestCaseReviewService {
String eTime = String.valueOf(endTime); String eTime = String.valueOf(endTime);
if (!sTime.equals("null")) { if (!sTime.equals("null")) {
start = sdf.format(new Date(Long.parseLong(sTime))); start = sdf.format(new Date(Long.parseLong(sTime)));
} else {
start = "未设置";
} }
String end = null; String end = null;
if (!eTime.equals("null")) { if (!eTime.equals("null")) {
end = sdf.format(new Date(Long.parseLong(eTime))); end = sdf.format(new Date(Long.parseLong(eTime)));
} else {
start = "未设置";
} }
String context = ""; String context = "";
if (StringUtils.equals(NoticeConstants.CREATE, type)) { if (StringUtils.equals(NoticeConstants.CREATE, type)) {

View File

@ -141,7 +141,7 @@ public class TestPlanService {
} }
} }
public List<TestPlan> getTestPlanByName(String name) { public synchronized List<TestPlan> getTestPlanByName(String name) {
TestPlanExample example = new TestPlanExample(); TestPlanExample example = new TestPlanExample();
example.createCriteria().andWorkspaceIdEqualTo(SessionUtils.getCurrentWorkspaceId()) example.createCriteria().andWorkspaceIdEqualTo(SessionUtils.getCurrentWorkspaceId())
.andNameEqualTo(name); .andNameEqualTo(name);
@ -547,13 +547,13 @@ public class TestPlanService {
if (!sTime.equals("null")) { if (!sTime.equals("null")) {
start = sdf.format(new Date(Long.parseLong(sTime))); start = sdf.format(new Date(Long.parseLong(sTime)));
} else { } else {
start = ""; start = "未设置";
} }
String end = null; String end = null;
if (!eTime.equals("null")) { if (!eTime.equals("null")) {
end = sdf.format(new Date(Long.parseLong(eTime))); end = sdf.format(new Date(Long.parseLong(eTime)));
} else { } else {
end = ""; end = "未设置";
} }
String context = ""; String context = "";
if (StringUtils.equals(NoticeConstants.CREATE, type)) { if (StringUtils.equals(NoticeConstants.CREATE, type)) {

View File

@ -171,6 +171,7 @@ task_notification_=Timing task result notification
api_definition_url_not_repeating=The interface request address already exists api_definition_url_not_repeating=The interface request address already exists
task_notification_jenkins=Jenkins Task notification task_notification_jenkins=Jenkins Task notification
task_notification=Result notification task_notification=Result notification
message_task_already_exists=Task recipient already exists

View File

@ -172,3 +172,4 @@ task_notification_=定时任务结果通知
api_definition_url_not_repeating=接口请求地址已经存在 api_definition_url_not_repeating=接口请求地址已经存在
task_notification_jenkins=jenkins任务通知 task_notification_jenkins=jenkins任务通知
task_notification=任务通知 task_notification=任务通知
message_task_already_exists=任务接收人已经存在

View File

@ -173,3 +173,5 @@ task_notification_jenkins=jenkins任務通知
task_notification=任務通知 task_notification=任務通知
task_notification_=定時任務通知 task_notification_=定時任務通知
api_definition_url_not_repeating=接口請求地址已經存在 api_definition_url_not_repeating=接口請求地址已經存在
message_task_already_exists=任務接收人已經存在

View File

@ -21,9 +21,10 @@
<pre>{{response.vars}}</pre> <pre>{{response.vars}}</pre>
</el-tab-pane> </el-tab-pane>
<el-tab-pane v-if="activeName == 'body' && !isSqlType" :disabled="true" name="mode" class="pane assertions"> <el-tab-pane v-if="activeName == 'body'" :disabled="true" name="mode" class="pane assertions">
<template v-slot:label> <template v-slot:label>
<ms-dropdown :commands="modes" :default-command="mode" @command="modeChange"/> <ms-dropdown v-if="!isSqlType" :commands="modes" :default-command="mode" @command="modeChange"/>
<ms-dropdown v-if="isSqlType" :commands="sqlModes" :default-command="mode" @command="sqlModeChange"/>
</template> </template>
</el-tab-pane> </el-tab-pane>
@ -33,13 +34,13 @@
</template> </template>
<script> <script>
import MsAssertionResults from "./AssertionResults"; import MsAssertionResults from "./AssertionResults";
import MsCodeEdit from "../../../common/components/MsCodeEdit"; import MsCodeEdit from "../../../common/components/MsCodeEdit";
import MsDropdown from "../../../common/components/MsDropdown"; import MsDropdown from "../../../common/components/MsDropdown";
import {BODY_FORMAT, RequestFactory, Request, SqlRequest} from "../../test/model/ScenarioModel"; import {BODY_FORMAT, RequestFactory, Request, SqlRequest} from "../../test/model/ScenarioModel";
import MsSqlResultTable from "./SqlResultTable"; import MsSqlResultTable from "./SqlResultTable";
export default { export default {
name: "MsResponseText", name: "MsResponseText",
components: { components: {
@ -59,6 +60,7 @@
isActive: true, isActive: true,
activeName: "body", activeName: "body",
modes: ['text', 'json', 'xml', 'html'], modes: ['text', 'json', 'xml', 'html'],
sqlModes: ['text', 'table'],
mode: BODY_FORMAT.TEXT mode: BODY_FORMAT.TEXT
} }
}, },
@ -69,6 +71,9 @@
}, },
modeChange(mode) { modeChange(mode) {
this.mode = mode; this.mode = mode;
},
sqlModeChange(mode) {
this.mode = mode;
} }
}, },
@ -86,7 +91,7 @@
return (this.requestType === RequestFactory.TYPES.SQL && this.response.responseCode === '200'); return (this.requestType === RequestFactory.TYPES.SQL && this.response.responseCode === '200');
} }
} }
} }
</script> </script>
<style scoped> <style scoped>

View File

@ -1,10 +1,13 @@
<template> <template>
<div>
<el-table <el-table
:data="tableData" v-for="(table, index) in tables"
:key="index"
:data="table.tableData"
border border
size="mini" size="mini"
highlight-current-row> highlight-current-row>
<el-table-column v-for="(title, index) in titles" :key="index" :label="title" min-width="15%"> <el-table-column v-for="(title, index) in table.titles" :key="index" :label="title" min-width="150px">
<template v-slot:default="scope"> <template v-slot:default="scope">
<el-popover <el-popover
placement="top" placement="top"
@ -17,6 +20,7 @@
</template> </template>
</el-table-column> </el-table-column>
</el-table> </el-table>
</div>
</template> </template>
<script> <script>
@ -24,7 +28,7 @@
name: "MsSqlResultTable", name: "MsSqlResultTable",
data() { data() {
return { return {
tableData: [], tables: [],
titles: [] titles: []
} }
}, },
@ -36,29 +40,71 @@
return; return;
} }
let rowArry = this.body.split("\n"); let rowArry = this.body.split("\n");
let title; this.getTableData(rowArry);
if (this.tables.length > 1) {
for (let i = 0; i < this.tables.length; i++) {
if (this.tables[i].titles.length === 1 && i < this.tables.length - 1) {
this.tables[i].tableData.splice(this.tables[i].tableData.length - 1, 1);
}
}
let lastTable = this.tables[this.tables.length - 1];
if (lastTable.titles.length === 1) {
if (lastTable.tableData.length > 4) {
lastTable.tableData.splice(lastTable.tableData.length - 4, 4);
} else {
this.tables.splice(this.tables.length - 1, 1);
}
} else {
this.tables.splice(this.tables.length - 1, 1);
}
} else {
let table = this.tables[0];
table.tableData.splice(table.tableData.length - 4, 4);
}
},
methods: {
getTableData(rowArry) {
let titles;
let result = []; let result = [];
for (let i = 0; i < rowArry.length; i++) { for (let i = 0; i < rowArry.length; i++) {
let colArray = rowArry[i].split("\t"); let colArray = rowArry[i].split("\t");
if (i === 0) { if (i === 0) {
title = colArray; titles = colArray;
} else {
if (colArray.length != titles.length) {
//
if (colArray.length === 1 && colArray[0] === '') {
this.getTableData(rowArry.slice(i + 1));
} else {
this.getTableData(rowArry.slice(i));
}
break;
} else { } else {
let item = {}; let item = {};
for (let j = 0; j < colArray.length; j++) { for (let j = 0; j < colArray.length; j++) {
item[title[j]] = (colArray[j] ? colArray[j] : ""); item[titles[j]] = (colArray[j] ? colArray[j] : "");
} }
result.push(item); result.push(item);
} }
} }
this.titles = title; }
this.tableData = result;
this.tableData.splice(this.tableData.length - 3, 3); this.tables.splice(0, 0, {
titles: titles,
tableData: result
});
}
} }
} }
</script> </script>
<style scoped> <style scoped>
.el-table {
margin-bottom: 20px;
}
.el-table >>> .cell { .el-table >>> .cell {
white-space: nowrap; white-space: nowrap;
} }

View File

@ -107,7 +107,7 @@ export default {
jsonPathList.forEach(jsonPath => { jsonPathList.forEach(jsonPath => {
let jsonItem = new JSONPath(); let jsonItem = new JSONPath();
jsonItem.expression = jsonPath.json_path; jsonItem.expression = jsonPath.json_path;
jsonItem.expect = jsonPath.json_value; jsonItem.expect = jsonPath.regular_expression;
jsonItem.setJSONPathDescription(); jsonItem.setJSONPathDescription();
this.assertions.jsonPath.push(jsonItem); this.assertions.jsonPath.push(jsonItem);
}); });

View File

@ -217,7 +217,7 @@
}) })
}, },
del(row) { del(row) {
this.$confirm(this.$t('member.remove_member'), '', { this.$confirm(this.$t('member.org_remove_member'), '', {
confirmButtonText: this.$t('commons.confirm'), confirmButtonText: this.$t('commons.confirm'),
cancelButtonText: this.$t('commons.cancel'), cancelButtonText: this.$t('commons.cancel'),
type: 'warning' type: 'warning'

View File

@ -145,26 +145,26 @@ export default {
data.isReadOnly = true; data.isReadOnly = true;
if (data.type === 'EMAIL') { if (data.type === 'EMAIL') {
data.isReadOnly = !data.isReadOnly data.isReadOnly = !data.isReadOnly
data.webhook = "" data.webhook = '';
} }
}, },
handleEditTask(index,data) { handleEditTask(index,data) {
data.isSet = true data.isSet = true
if (data.type === 'EMAIL') { if (data.type === 'EMAIL') {
data.isReadOnly = false data.isReadOnly = false;
data.webhook = "" data.webhook = '';
} else { } else {
data.isReadOnly = true data.isReadOnly = true;
} }
}, },
handleAddTaskModel(type) { handleAddTaskModel(type) {
let Task = {}; let Task = {};
Task.event = []; Task.event = [];
Task.userIds = []; Task.userIds = [];
Task.type = ""; Task.type = '';
Task.webhook = ""; Task.webhook = '';
Task.isSet = true; Task.isSet = true;
Task.identification = ""; Task.identification = '';
if (type === 'jenkinsTask') { if (type === 'jenkinsTask') {
Task.taskType = 'JENKINS_TASK' Task.taskType = 'JENKINS_TASK'
this.form.jenkinsTask.push(Task) this.form.jenkinsTask.push(Task)

View File

@ -146,18 +146,18 @@ export default {
handleEdit(index, data) { handleEdit(index, data) {
data.isReadOnly = true; data.isReadOnly = true;
if (data.type === 'EMAIL') { if (data.type === 'EMAIL') {
data.isReadOnly = !data.isReadOnly data.isReadOnly = !data.isReadOnly;
data.webhook = "" data.webhook = '';
} }
}, },
handleAddTaskModel(type) { handleAddTaskModel(type) {
let Task = {}; let Task = {};
Task.event = []; Task.event = [];
Task.userIds = []; Task.userIds = [];
Task.type = ""; Task.type = '';
Task.webhook = ""; Task.webhook = '';
Task.isSet = true; Task.isSet = true;
Task.identification = ""; Task.identification = '';
if (type === 'jenkinsTask') { if (type === 'jenkinsTask') {
Task.taskType = 'JENKINS_TASK' Task.taskType = 'JENKINS_TASK'
this.form.jenkinsTask.push(Task) this.form.jenkinsTask.push(Task)
@ -194,21 +194,20 @@ export default {
handleEditTask(index,data) { handleEditTask(index,data) {
data.isSet = true data.isSet = true
if (data.type === 'EMAIL') { if (data.type === 'EMAIL') {
data.isReadOnly = false data.isReadOnly = false;
data.webhook = "" data.webhook = '';
} else { } else {
data.isReadOnly = true data.isReadOnly = true;
} }
}, },
addTask(data) { addTask(data) {
let list = [] let list = [];
data.isSet = false list.push(data);
list.push(data)
let param = {}; let param = {};
param.messageDetail = list param.messageDetail = list;
this.result = this.$post("/notice/save/message/task", param, () => { this.result = this.$post("/notice/save/message/task", param, () => {
this.initForm() this.initForm();
this.$success(this.$t('commons.save_success')); this.$success(this.$t('commons.save_success'));
}) })
}, },
@ -216,7 +215,7 @@ export default {
if (!data[index].identification) { if (!data[index].identification) {
data.splice(index, 1) data.splice(index, 1)
} else { } else {
data[index].isSet = false data[parseInt(index)].isSet = false;
} }
}, },

View File

@ -147,32 +147,32 @@ export default {
handleEdit(index, data) { handleEdit(index, data) {
data.isReadOnly = true; data.isReadOnly = true;
if (data.type === 'EMAIL') { if (data.type === 'EMAIL') {
data.isReadOnly = !data.isReadOnly data.isReadOnly = !data.isReadOnly;
data.webhook = "" data.webhook = '';
} }
}, },
handleAddTaskModel(type) { handleAddTaskModel(type) {
let Task = {}; let Task = {};
Task.event = []; Task.event = [];
Task.userIds = []; Task.userIds = [];
Task.type = ""; Task.type = '';
Task.webhook = ""; Task.webhook = '';
Task.isSet = true; Task.isSet = true;
Task.identification = ""; Task.identification = '';
if (type === 'scheduleTask') { if (type === 'scheduleTask') {
Task.taskType = 'SCHEDULE_TASK' Task.taskType = 'SCHEDULE_TASK';
Task.testId=this.testId Task.testId=this.testId;
this.form.scheduleTask.push(Task) this.form.scheduleTask.push(Task);
} }
}, },
handleEditTask(index,data) { handleEditTask(index,data) {
data.isSet = true data.isSet = true;
data.testId = this.testId data.testId = this.testId;
if (data.type === 'EMAIL') { if (data.type === 'EMAIL') {
data.isReadOnly = false data.isReadOnly = false;
data.webhook = "" data.webhook = '';
} else { } else {
data.isReadOnly = true data.isReadOnly = true;
} }
}, },
handleAddTask(index, data) { handleAddTask(index, data) {
@ -192,11 +192,11 @@ export default {
} }
}, },
addTask(data) { addTask(data) {
let list = [] let list = [];
data.isSet = false data.isSet = false;
list.push(data) list.push(data);
let param = {}; let param = {};
param.messageDetail = list param.messageDetail = list;
this.result = this.$post("/notice/save/message/task", param, () => { this.result = this.$post("/notice/save/message/task", param, () => {
this.initForm() this.initForm()
this.$success(this.$t('commons.save_success')); this.$success(this.$t('commons.save_success'));
@ -206,7 +206,7 @@ export default {
if (!data[index].identification) { if (!data[index].identification) {
data.splice(index, 1) data.splice(index, 1)
} else { } else {
data[index].isSet = false data[index].isSet = false;
} }
}, },
deleteRowTask(index, data) { // deleteRowTask(index, data) { //

View File

@ -151,26 +151,26 @@ export default {
data.isReadOnly = true; data.isReadOnly = true;
if (data.type === 'EMAIL') { if (data.type === 'EMAIL') {
data.isReadOnly = !data.isReadOnly data.isReadOnly = !data.isReadOnly
data.webhook = "" data.webhook = '';
} }
}, },
handleEditTask(index,data) { handleEditTask(index,data) {
data.isSet = true data.isSet = true
if (data.type === 'EMAIL') { if (data.type === 'EMAIL') {
data.isReadOnly = false data.isReadOnly = false;
data.webhook = "" data.webhook = '';
} else { } else {
data.isReadOnly = true data.isReadOnly = true;
} }
}, },
handleAddTaskModel(type) { handleAddTaskModel(type) {
let Task = {}; let Task = {};
Task.event = []; Task.event = [];
Task.userIds = []; Task.userIds = [];
Task.type = ""; Task.type = '';
Task.webhook = ""; Task.webhook = '';
Task.isSet = true; Task.isSet = true;
Task.identification = ""; Task.identification = '';
if (type === 'jenkinsTask') { if (type === 'jenkinsTask') {
Task.taskType = 'JENKINS_TASK' Task.taskType = 'JENKINS_TASK'
this.form.jenkinsTask.push(Task) this.form.jenkinsTask.push(Task)

View File

@ -151,27 +151,27 @@ export default {
handleEdit(index, data) { handleEdit(index, data) {
data.isReadOnly = true; data.isReadOnly = true;
if (data.type === 'EMAIL') { if (data.type === 'EMAIL') {
data.isReadOnly = !data.isReadOnly data.isReadOnly = !data.isReadOnly;
data.webhook = "" data.webhook = '';
} }
}, },
handleEditTask(index,data) { handleEditTask(index,data) {
data.isSet = true data.isSet = true;
if (data.type === 'EMAIL') { if (data.type === 'EMAIL') {
data.isReadOnly = false data.isReadOnly = false;
data.webhook = "" data.webhook = '';
} else { } else {
data.isReadOnly = true data.isReadOnly = true;
} }
}, },
handleAddTaskModel(type) { handleAddTaskModel(type) {
let Task = {}; let Task = {};
Task.event = []; Task.event = [];
Task.userIds = []; Task.userIds = [];
Task.type = ""; Task.type = '';
Task.webhook = ""; Task.webhook = '';
Task.isSet = true; Task.isSet = true;
Task.identification = ""; Task.identification = '';
if (type === 'jenkinsTask') { if (type === 'jenkinsTask') {
Task.taskType = 'JENKINS_TASK' Task.taskType = 'JENKINS_TASK'
this.form.jenkinsTask.push(Task) this.form.jenkinsTask.push(Task)
@ -207,13 +207,13 @@ export default {
} }
}, },
addTask(data) { addTask(data) {
let list = [] let list = [];
data.isSet = false data.isSet = false;
list.push(data) list.push(data);
let param = {}; let param = {};
param.messageDetail = list param.messageDetail = list;
this.result = this.$post("/notice/save/message/task", param, () => { this.result = this.$post("/notice/save/message/task", param, () => {
this.initForm() this.initForm();
this.$success(this.$t('commons.save_success')); this.$success(this.$t('commons.save_success'));
}) })
}, },
@ -221,7 +221,7 @@ export default {
if (!data[index].identification) { if (!data[index].identification) {
data.splice(index, 1) data.splice(index, 1)
} else { } else {
data[index].isSet = false data[index].isSet = false;
} }
}, },
deleteRowTask(index, data) { // deleteRowTask(index, data) { //

View File

@ -58,11 +58,8 @@
<el-form-item :label="$t('test_track.plan.plan_stage')" :label-width="formLabelWidth" prop="stage"> <el-form-item :label="$t('test_track.plan.plan_stage')" :label-width="formLabelWidth" prop="stage">
<el-select v-model="form.stage" clearable :placeholder="$t('test_track.plan.input_plan_stage')"> <el-select v-model="form.stage" clearable :placeholder="$t('test_track.plan.input_plan_stage')">
<el-option :label="$t('test_track.plan.smoke_test')" value="smoke"></el-option> <el-option :label="$t('test_track.plan.smoke_test')" value="smoke"></el-option>
<!--<el-option :label="$t('test_track.plan.functional_test')" value="functional"></el-option>-->
<!--<el-option :label="$t('test_track.plan.integration_testing')" value="integration"></el-option>-->
<el-option :label="$t('test_track.plan.system_test')" value="system"></el-option> <el-option :label="$t('test_track.plan.system_test')" value="system"></el-option>
<el-option :label="$t('test_track.plan.regression_test')" value="regression"></el-option> <el-option :label="$t('test_track.plan.regression_test')" value="regression"></el-option>
<!--<el-option :label="$t('test_track.plan.version_validation')" value="version"></el-option>-->
</el-select> </el-select>
</el-form-item> </el-form-item>
</el-col> </el-col>

View File

@ -208,11 +208,9 @@ export default {
methods: { methods: {
initTableData() { initTableData() {
if (this.planId) { if (this.planId) {
// param.planId = this.planId;
this.condition.planId = this.planId; this.condition.planId = this.planId;
} }
if (this.selectNodeIds && this.selectNodeIds.length > 0) { if (this.selectNodeIds && this.selectNodeIds.length > 0) {
// param.nodeIds = this.selectNodeIds;
this.condition.nodeIds = this.selectNodeIds; this.condition.nodeIds = this.selectNodeIds;
} }
this.result = this.$post(this.buildPagePath(this.queryPath), this.condition, response => { this.result = this.$post(this.buildPagePath(this.queryPath), this.condition, response => {

View File

@ -293,6 +293,8 @@
this.projectId = data[0].id; this.projectId = data[0].id;
this.projectName = data[0].name; this.projectName = data[0].name;
this.search(); this.search();
//
this.getProjectNode(this.projectId)
} }
}) })
} }

View File

@ -129,6 +129,10 @@ export default {
pre { pre {
margin: 0 0; margin: 0 0;
white-space: pre-wrap;
word-wrap: break-word;
width: 100%;
line-height: 20px;
} }
.comment-delete { .comment-delete {

View File

@ -231,7 +231,6 @@
this.selectIds.add(item.id); this.selectIds.add(item.id);
}); });
} else { } else {
// this.selectIds.clear();
this.testReviews.forEach(item => { this.testReviews.forEach(item => {
if (this.selectIds.has(item.id)) { if (this.selectIds.has(item.id)) {
this.selectIds.delete(item.id); this.selectIds.delete(item.id);

View File

@ -389,7 +389,7 @@ export default {
this.saveReport(reportId); this.saveReport(reportId);
}, },
saveReport(reportId) { saveReport(reportId) {
// this.$post('/test/plan/case/edit', {id: this.testCase.id, reportId: reportId});
}, },
getComments(testCase) { getComments(testCase) {
let id = ''; let id = '';

View File

@ -301,7 +301,6 @@ export default {
return path + "/" + this.currentPage + "/" + this.pageSize; return path + "/" + this.currentPage + "/" + this.pageSize;
}, },
handleEdit(testCase, index) { handleEdit(testCase, index) {
// console.log(testCase)
this.isReadOnly = false; this.isReadOnly = false;
if (!checkoutTestManagerOrTestUser()) { if (!checkoutTestManagerOrTestUser()) {
this.isReadOnly = true; this.isReadOnly = true;

View File

@ -314,6 +314,7 @@ export default {
repeat_password: 'Repeat', repeat_password: 'Repeat',
inconsistent_passwords: 'The two passwords entered are inconsistent', inconsistent_passwords: 'The two passwords entered are inconsistent',
remove_member: 'Are you sure you want to remove this member', remove_member: 'Are you sure you want to remove this member',
org_remove_member: 'Removing the user from the organization will also remove permissions from all workspaces under the organization. Are you sure you want to remove the member ?',
input_id_or_email: 'Please enter user ID, or user Email', input_id_or_email: 'Please enter user ID, or user Email',
no_such_user: 'Without this user information, please enter the correct user ID or user Email!', no_such_user: 'Without this user information, please enter the correct user ID or user Email!',
}, },

View File

@ -313,6 +313,7 @@ export default {
repeat_password: '确认密码', repeat_password: '确认密码',
inconsistent_passwords: '两次输入的密码不一致', inconsistent_passwords: '两次输入的密码不一致',
remove_member: '确定要移除该成员吗', remove_member: '确定要移除该成员吗',
org_remove_member: '将该用户从组织中移除,将同时移除该组织下所有工作空间的权限,确定要移除该成员吗?',
input_id_or_email: '请输入用户 ID, 或者 用户邮箱', input_id_or_email: '请输入用户 ID, 或者 用户邮箱',
no_such_user: '无此用户信息, 请输入正确的用户 ID 或者 用户邮箱!', no_such_user: '无此用户信息, 请输入正确的用户 ID 或者 用户邮箱!',
}, },

View File

@ -313,6 +313,7 @@ export default {
repeat_password: '確認密碼', repeat_password: '確認密碼',
inconsistent_passwords: '兩次輸入的密碼不壹致', inconsistent_passwords: '兩次輸入的密碼不壹致',
remove_member: '確定要移除該成員嗎', remove_member: '確定要移除該成員嗎',
org_remove_member: '將該用戶從組織中移除,將同時移除該組織下所有工作空間的權限,確定要移除該成員嗎?',
input_id_or_email: '請輸入用戶 ID, 或者 用戶郵箱', input_id_or_email: '請輸入用戶 ID, 或者 用戶郵箱',
no_such_user: '無此用戶信息, 請輸入正確的用戶 ID 或者 用戶郵箱!', no_such_user: '無此用戶信息, 請輸入正確的用戶 ID 或者 用戶郵箱!',
}, },