From 883554b670847635ffb13aff5a685c29e3810d27 Mon Sep 17 00:00:00 2001 From: CaptainB Date: Fri, 26 Nov 2021 14:15:05 +0800 Subject: [PATCH] =?UTF-8?q?refactor(=E6=B6=88=E6=81=AF=E9=80=9A=E7=9F=A5):?= =?UTF-8?q?=20=E5=8F=91=E9=80=81=E7=AB=99=E5=86=85=E4=BF=A1=E6=97=B6?= =?UTF-8?q?=E4=BF=9D=E7=95=99=E5=8F=82=E6=95=B0=E5=88=B0=E6=95=B0=E6=8D=AE?= =?UTF-8?q?=E5=BA=93?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../sender/impl/InSiteNoticeSender.java | 3 +- .../src/business/components/notice/util.js | 42 ++++++++++++++----- 2 files changed, 34 insertions(+), 11 deletions(-) diff --git a/backend/src/main/java/io/metersphere/notice/sender/impl/InSiteNoticeSender.java b/backend/src/main/java/io/metersphere/notice/sender/impl/InSiteNoticeSender.java index 91028b6fba..106761b0c4 100644 --- a/backend/src/main/java/io/metersphere/notice/sender/impl/InSiteNoticeSender.java +++ b/backend/src/main/java/io/metersphere/notice/sender/impl/InSiteNoticeSender.java @@ -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; @@ -38,7 +39,7 @@ public class InSiteNoticeSender extends AbstractNoticeSender { Map 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")); diff --git a/frontend/src/business/components/notice/util.js b/frontend/src/business/components/notice/util.js index 00ae186c29..5294edcb08 100644 --- a/frontend/src/business/components/notice/util.js +++ b/frontend/src/business/components/notice/util.js @@ -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;