Skip to content

Commit

Permalink
refactor(消息通知): 发送站内信时保留参数到数据库
Browse files Browse the repository at this point in the history
  • Loading branch information
liuruibin committed Nov 26, 2021
1 parent 075b9c7 commit 883554b
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 11 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package io.metersphere.notice.sender.impl;

import com.alibaba.fastjson.JSON;
import io.metersphere.base.domain.Notification;
import io.metersphere.commons.constants.NotificationConstants;
import io.metersphere.commons.utils.LogUtil;
Expand Down Expand Up @@ -38,7 +39,7 @@ public void sendAnnouncement(MessageDetail messageDetail, NoticeModel noticeMode
Map<String, Object> paramMap = noticeModel.getParamMap();
Notification notification = new Notification();
notification.setTitle(noticeModel.getSubject());
notification.setContent(context);
notification.setContent(JSON.toJSONString(paramMap));
notification.setOperator(noticeModel.getOperator());
notification.setOperation(noticeModel.getEvent());
notification.setResourceId((String) paramMap.get("id"));
Expand Down
42 changes: 32 additions & 10 deletions frontend/src/business/components/notice/util.js
Original file line number Diff line number Diff line change
Expand Up @@ -125,17 +125,39 @@ export function getUrl(d) {
switch (d.resourceType) {
case "JENKINS_TASK" :
// jenkins 跳转需要特殊处理
if (d.content.indexOf("接口用例") > -1) {
url += "/api/definition?caseId=" + d.resourceId;
} else if (d.content.indexOf("性能测试") > -1) {
url += "/performance/test/edit/" + d.resourceId;
} else if (d.content.indexOf("接口测试") > -1) {
url += "/api/automation/report/view/" + d.resourceId;
} else if (d.content.indexOf("测试计划") > -1) {
url += "/track/plan/view/" + d.resourceId;
} else {
url += "/track/plan/all";
try {
let obj = JSON.parse(d.content);
// 接口自动化,性能测试
if (obj.reportUrl) {
let s = obj.reportUrl.indexOf('#');
url += obj.reportUrl.substring(s + 1);
}
// 接口用例
else if (obj.caseStatus) {
url += "/api/definition?caseId=" + d.resourceId;
}
// 测试计划
else if (obj.url) {
let s = obj.url.indexOf('#');
url += obj.url.substring(s + 1);
} else {
url += "/track/plan/all";
}
} catch (e) {
// jenkins 跳转需要特殊处理
if (d.content.indexOf("接口用例") > -1) {
url += "/api/definition?caseId=" + d.resourceId;
} else if (d.content.indexOf("性能测试") > -1) {
url += "/performance/test/edit/" + d.resourceId;
} else if (d.content.indexOf("接口测试") > -1) {
url += "/api/automation/report/view/" + d.resourceId;
} else if (d.content.indexOf("测试计划运行") > -1) {
url += "/track/plan/view/" + d.resourceId;
} else {
url += "/track/plan/all";
}
}

break;
case "TEST_PLAN_TASK" :
url += "/track/plan/view/" + d.resourceId;
Expand Down

0 comments on commit 883554b

Please sign in to comment.