feat: 站内通知跳转 (#5999)
* feat: 站内通知跳转 Co-authored-by: Captain.B <bin@fit2cloud.com>
This commit is contained in:
parent
3657683c0e
commit
99261a56c4
|
@ -160,7 +160,6 @@ public class ApiDefinitionExecResultService {
|
||||||
.failedMailTemplate("api/CaseResult")
|
.failedMailTemplate("api/CaseResult")
|
||||||
.paramMap(paramMap)
|
.paramMap(paramMap)
|
||||||
.event(event)
|
.event(event)
|
||||||
.excludeSelf(true)
|
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
String taskType = NoticeConstants.TaskType.API_DEFINITION_TASK;
|
String taskType = NoticeConstants.TaskType.API_DEFINITION_TASK;
|
||||||
|
|
|
@ -643,7 +643,6 @@ public class ApiScenarioReportService {
|
||||||
.failedMailTemplate("api/ScenarioResult")
|
.failedMailTemplate("api/ScenarioResult")
|
||||||
.paramMap(paramMap)
|
.paramMap(paramMap)
|
||||||
.event(event)
|
.event(event)
|
||||||
.excludeSelf(true)
|
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
String taskType = NoticeConstants.TaskType.API_AUTOMATION_TASK;
|
String taskType = NoticeConstants.TaskType.API_AUTOMATION_TASK;
|
||||||
|
|
|
@ -29,7 +29,9 @@ public interface ExtProjectMapper {
|
||||||
@MapKey("id")
|
@MapKey("id")
|
||||||
Map<String, Project> queryNameByIds(@Param("ids") List<String> ids);
|
Map<String, Project> queryNameByIds(@Param("ids") List<String> ids);
|
||||||
|
|
||||||
Organization getOrganizationByProjectId(@Param("projectId")String projectId);
|
Organization getOrganizationByProjectId(@Param("projectId") String projectId);
|
||||||
|
|
||||||
List<Integer> selectTcpPorts();
|
List<Integer> selectTcpPorts();
|
||||||
|
|
||||||
|
Project selectProjectByResourceId(@Param("resourceId") String resourceId);
|
||||||
}
|
}
|
||||||
|
|
|
@ -32,13 +32,29 @@
|
||||||
</sql>
|
</sql>
|
||||||
|
|
||||||
<select id="getProjectWithWorkspace" resultType="io.metersphere.dto.ProjectDTO">
|
<select id="getProjectWithWorkspace" resultType="io.metersphere.dto.ProjectDTO">
|
||||||
select p.id, p.workspace_id, p.name, p.description, p.update_time, p.issue_template_id, p.case_template_id,
|
SELECT p.id,
|
||||||
p.create_time, w.id as workspaceId, w.name as workspaceName, p.tapd_id, p.jira_key, p.zentao_id,p.azure_devops_id,p.repeatable, p.custom_num,
|
p.workspace_id,
|
||||||
user.name as createUserName,p.mock_tcp_port AS mockTcpPort,p.is_mock_tcp_open AS isMockTcpOpen,
|
p.name,
|
||||||
p.scenario_custom_num
|
p.description,
|
||||||
from project p
|
p.update_time,
|
||||||
join workspace w on p.workspace_id = w.id
|
p.issue_template_id,
|
||||||
left join user on user.id = p.create_user
|
p.case_template_id,
|
||||||
|
p.create_time,
|
||||||
|
w.id AS workspaceId,
|
||||||
|
w.name AS workspaceName,
|
||||||
|
p.tapd_id,
|
||||||
|
p.jira_key,
|
||||||
|
p.zentao_id,
|
||||||
|
p.azure_devops_id,
|
||||||
|
p.repeatable,
|
||||||
|
p.custom_num,
|
||||||
|
user.name AS createUserName,
|
||||||
|
p.mock_tcp_port AS mockTcpPort,
|
||||||
|
p.is_mock_tcp_open AS isMockTcpOpen,
|
||||||
|
p.scenario_custom_num
|
||||||
|
FROM project p
|
||||||
|
JOIN workspace w ON p.workspace_id = w.id
|
||||||
|
LEFT JOIN user ON user.id = p.create_user
|
||||||
<where>
|
<where>
|
||||||
<if test="proRequest.combine != null">
|
<if test="proRequest.combine != null">
|
||||||
<include refid="combine">
|
<include refid="combine">
|
||||||
|
@ -73,54 +89,61 @@
|
||||||
</foreach>
|
</foreach>
|
||||||
</if>
|
</if>
|
||||||
<if test="proRequest.name != null and proRequest.name != ''">
|
<if test="proRequest.name != null and proRequest.name != ''">
|
||||||
and p.name like #{proRequest.name, jdbcType=VARCHAR}
|
AND p.name LIKE #{proRequest.name, jdbcType=VARCHAR}
|
||||||
</if>
|
</if>
|
||||||
<if test="proRequest.workspaceId != null">
|
<if test="proRequest.workspaceId != null">
|
||||||
and w.id = #{proRequest.workspaceId}
|
AND w.id = #{proRequest.workspaceId}
|
||||||
</if>
|
</if>
|
||||||
<if test="proRequest.projectId != null">
|
<if test="proRequest.projectId != null">
|
||||||
and p.id = #{proRequest.projectId}
|
AND p.id = #{proRequest.projectId}
|
||||||
</if>
|
</if>
|
||||||
</where>
|
</where>
|
||||||
<if test="proRequest.orders != null and proRequest.orders.size() > 0">
|
<if test="proRequest.orders != null and proRequest.orders.size() > 0">
|
||||||
order by
|
ORDER BY
|
||||||
<foreach collection="proRequest.orders" separator="," item="order">
|
<foreach collection="proRequest.orders" separator="," item="order">
|
||||||
p.${order.name} ${order.type}
|
p.${order.name} ${order.type}
|
||||||
</foreach>
|
</foreach>
|
||||||
</if>
|
</if>
|
||||||
</select>
|
</select>
|
||||||
<select id="getProjectIdByWorkspaceId" resultType="java.lang.String">
|
<select id="getProjectIdByWorkspaceId" resultType="java.lang.String">
|
||||||
select id
|
SELECT id
|
||||||
from project
|
FROM project
|
||||||
where workspace_id = #{workspaceId}
|
WHERE workspace_id = #{workspaceId}
|
||||||
</select>
|
</select>
|
||||||
<select id="getUserProject" resultType="io.metersphere.dto.ProjectDTO">
|
<select id="getUserProject" resultType="io.metersphere.dto.ProjectDTO">
|
||||||
select distinct p.* from `group` g join user_group ug on g.id = ug.group_id
|
SELECT DISTINCT p.*
|
||||||
join project p on p.id = ug.source_id
|
FROM `group` g
|
||||||
|
JOIN user_group ug ON g.id = ug.group_id
|
||||||
|
JOIN project p ON p.id = ug.source_id
|
||||||
<where>
|
<where>
|
||||||
g.type = 'PROJECT' and ug.user_id = #{proRequest.userId}
|
g.type = 'PROJECT'
|
||||||
|
AND ug.user_id = #{proRequest.userId}
|
||||||
<if test="proRequest.workspaceId != null and proRequest.workspaceId != ''">
|
<if test="proRequest.workspaceId != null and proRequest.workspaceId != ''">
|
||||||
and p.workspace_id = #{proRequest.workspaceId}
|
AND p.workspace_id = #{proRequest.workspaceId}
|
||||||
</if>
|
</if>
|
||||||
<if test="proRequest.name != null and proRequest.name != ''">
|
<if test="proRequest.name != null and proRequest.name != ''">
|
||||||
and p.name like #{proRequest.name, jdbcType=VARCHAR}
|
AND p.name LIKE #{proRequest.name, jdbcType=VARCHAR}
|
||||||
</if>
|
</if>
|
||||||
</where>
|
</where>
|
||||||
</select>
|
</select>
|
||||||
<select id="getSystemIdByProjectId" resultType="java.lang.String">
|
<select id="getSystemIdByProjectId" resultType="java.lang.String">
|
||||||
SELECT system_id FROM project WHERE id = #{0}
|
SELECT system_id
|
||||||
|
FROM project
|
||||||
|
WHERE id = #{0}
|
||||||
</select>
|
</select>
|
||||||
<select id="getProjectIds" resultType="java.lang.String">
|
<select id="getProjectIds" resultType="java.lang.String">
|
||||||
select id from project;
|
SELECT id
|
||||||
|
FROM project;
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<select id="getMaxSystemId" resultType="java.lang.String">
|
<select id="getMaxSystemId" resultType="java.lang.String">
|
||||||
SELECT max(system_id) FROM project
|
SELECT MAX(system_id)
|
||||||
|
FROM project
|
||||||
</select>
|
</select>
|
||||||
<select id="queryNameByIds" resultType="io.metersphere.base.domain.Project">
|
<select id="queryNameByIds" resultType="io.metersphere.base.domain.Project">
|
||||||
select id, name, custom_num
|
SELECT id, name, custom_num
|
||||||
from project
|
FROM project
|
||||||
WHERE id IN
|
WHERE id IN
|
||||||
<foreach collection="ids" item="id" index="index"
|
<foreach collection="ids" item="id" index="index"
|
||||||
open="(" close=")" separator=",">
|
open="(" close=")" separator=",">
|
||||||
#{id}
|
#{id}
|
||||||
|
@ -128,27 +151,31 @@
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<update id="removeIssuePlatform">
|
<update id="removeIssuePlatform">
|
||||||
update project
|
UPDATE project
|
||||||
<set>
|
<set>
|
||||||
<if test="platform == 'Jira'">
|
<if test="platform == 'Jira'">
|
||||||
jira_key = null
|
jira_key = NULL
|
||||||
</if>
|
</if>
|
||||||
<if test="platform == 'Tapd'">
|
<if test="platform == 'Tapd'">
|
||||||
tapd_id = null
|
tapd_id = NULL
|
||||||
|
|
||||||
</if>
|
</if>
|
||||||
<if test="platform == 'Zentao'">
|
<if test="platform == 'Zentao'">
|
||||||
zentao_id = null
|
|
||||||
|
zentao_id = NULL
|
||||||
|
|
||||||
</if>
|
</if>
|
||||||
<if test="platform == 'AzureDevops'">
|
<if test="platform == 'AzureDevops'">
|
||||||
azure_devops_id = null
|
|
||||||
|
azure_devops_id = NULL
|
||||||
</if>
|
</if>
|
||||||
</set>
|
</set>
|
||||||
where project.id in (select id from (select id
|
WHERE project.id IN (SELECT id FROM (SELECT id
|
||||||
from project
|
FROM project
|
||||||
where workspace_id in
|
WHERE workspace_id IN
|
||||||
(select workspace.id
|
(SELECT workspace.id
|
||||||
from workspace
|
FROM workspace
|
||||||
where organization_id = #{orgId})) as a)
|
WHERE organization_id = #{orgId})) AS a)
|
||||||
</update>
|
</update>
|
||||||
|
|
||||||
<select id="getOrganizationByProjectId" resultType="io.metersphere.base.domain.Organization">
|
<select id="getOrganizationByProjectId" resultType="io.metersphere.base.domain.Organization">
|
||||||
|
@ -162,7 +189,62 @@
|
||||||
<select id="selectTcpPorts" resultType="java.lang.Integer">
|
<select id="selectTcpPorts" resultType="java.lang.Integer">
|
||||||
SELECT mock_tcp_port
|
SELECT mock_tcp_port
|
||||||
FROM project
|
FROM project
|
||||||
WHERE mock_tcp_port is not null and mock_tcp_port != 0
|
WHERE mock_tcp_port IS NOT NULL
|
||||||
|
AND mock_tcp_port != 0
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
<select id="selectProjectByResourceId" resultType="io.metersphere.base.domain.Project">
|
||||||
|
SELECT *
|
||||||
|
FROM project
|
||||||
|
WHERE id IN (
|
||||||
|
SELECT project_id
|
||||||
|
FROM test_plan
|
||||||
|
WHERE id = #{resourceId}
|
||||||
|
UNION
|
||||||
|
SELECT project_id
|
||||||
|
FROM test_case_review
|
||||||
|
WHERE id = #{resourceId}
|
||||||
|
UNION
|
||||||
|
SELECT project_id
|
||||||
|
FROM issues
|
||||||
|
WHERE id = #{resourceId}
|
||||||
|
UNION
|
||||||
|
SELECT project_id
|
||||||
|
FROM test_plan_report
|
||||||
|
JOIN test_plan tp ON tp.id = test_plan_report.test_plan_id
|
||||||
|
WHERE test_plan_report.id = #{resourceId}
|
||||||
|
UNION
|
||||||
|
SELECT project_id
|
||||||
|
FROM test_case
|
||||||
|
WHERE id = #{resourceId}
|
||||||
|
UNION
|
||||||
|
SELECT project_id
|
||||||
|
FROM swagger_url_project
|
||||||
|
WHERE id = #{resourceId}
|
||||||
|
UNION
|
||||||
|
SELECT project_id
|
||||||
|
FROM api_scenario
|
||||||
|
WHERE id = #{resourceId}
|
||||||
|
UNION
|
||||||
|
SELECT project_id
|
||||||
|
FROM api_definition
|
||||||
|
WHERE id = #{resourceId}
|
||||||
|
UNION
|
||||||
|
SELECT project_id
|
||||||
|
FROM api_test_case
|
||||||
|
WHERE id = #{resourceId}
|
||||||
|
UNION
|
||||||
|
SELECT project_id
|
||||||
|
FROM api_scenario_report
|
||||||
|
WHERE id = #{resourceId}
|
||||||
|
UNION
|
||||||
|
SELECT project_id
|
||||||
|
FROM load_test
|
||||||
|
WHERE id = #{resourceId}
|
||||||
|
UNION
|
||||||
|
SELECT project_id
|
||||||
|
FROM load_test_report
|
||||||
|
WHERE id = #{resourceId})
|
||||||
|
LIMIT 1
|
||||||
|
</select>
|
||||||
</mapper>
|
</mapper>
|
||||||
|
|
|
@ -5,7 +5,6 @@ import com.github.pagehelper.PageHelper;
|
||||||
import io.metersphere.base.domain.User;
|
import io.metersphere.base.domain.User;
|
||||||
import io.metersphere.commons.constants.OperLogConstants;
|
import io.metersphere.commons.constants.OperLogConstants;
|
||||||
import io.metersphere.commons.exception.MSException;
|
import io.metersphere.commons.exception.MSException;
|
||||||
import io.metersphere.commons.user.SessionUser;
|
|
||||||
import io.metersphere.commons.utils.PageUtils;
|
import io.metersphere.commons.utils.PageUtils;
|
||||||
import io.metersphere.commons.utils.Pager;
|
import io.metersphere.commons.utils.Pager;
|
||||||
import io.metersphere.commons.utils.SessionUtils;
|
import io.metersphere.commons.utils.SessionUtils;
|
||||||
|
@ -20,7 +19,6 @@ import io.metersphere.dto.*;
|
||||||
import io.metersphere.excel.domain.ExcelResponse;
|
import io.metersphere.excel.domain.ExcelResponse;
|
||||||
import io.metersphere.i18n.Translator;
|
import io.metersphere.i18n.Translator;
|
||||||
import io.metersphere.log.annotation.MsAuditLog;
|
import io.metersphere.log.annotation.MsAuditLog;
|
||||||
import io.metersphere.service.CheckPermissionService;
|
|
||||||
import io.metersphere.service.OrganizationService;
|
import io.metersphere.service.OrganizationService;
|
||||||
import io.metersphere.service.UserService;
|
import io.metersphere.service.UserService;
|
||||||
import io.metersphere.service.WorkspaceService;
|
import io.metersphere.service.WorkspaceService;
|
||||||
|
@ -46,8 +44,6 @@ public class UserController {
|
||||||
private OrganizationService organizationService;
|
private OrganizationService organizationService;
|
||||||
@Resource
|
@Resource
|
||||||
private WorkspaceService workspaceService;
|
private WorkspaceService workspaceService;
|
||||||
@Resource
|
|
||||||
private CheckPermissionService checkPermissionService;
|
|
||||||
|
|
||||||
@PostMapping("/special/add")
|
@PostMapping("/special/add")
|
||||||
@MsAuditLog(module = "system_user", type = OperLogConstants.CREATE, content = "#msClass.getLogDetails(#user)", msClass = UserService.class)
|
@MsAuditLog(module = "system_user", type = OperLogConstants.CREATE, content = "#msClass.getLogDetails(#user)", msClass = UserService.class)
|
||||||
|
@ -148,6 +144,11 @@ public class UserController {
|
||||||
return userService.updateCurrentUser(user);
|
return userService.updateCurrentUser(user);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@GetMapping("/update/currentByResourceId/{resourceId}")
|
||||||
|
public void updateCurrentUserByResourceId(@PathVariable String resourceId) {
|
||||||
|
userService.updateCurrentUserByResourceId(resourceId);
|
||||||
|
}
|
||||||
|
|
||||||
@PostMapping("/switch/source/org/{sourceId}")
|
@PostMapping("/switch/source/org/{sourceId}")
|
||||||
public UserDTO switchOrganization(@PathVariable(value = "sourceId") String sourceId) {
|
public UserDTO switchOrganization(@PathVariable(value = "sourceId") String sourceId) {
|
||||||
userService.switchUserRole("organization", sourceId);
|
userService.switchUserRole("organization", sourceId);
|
||||||
|
|
|
@ -101,7 +101,6 @@ public class PerformanceNoticeEvent implements LoadTestFinishEvent {
|
||||||
.subject(subject)
|
.subject(subject)
|
||||||
.event(NoticeConstants.Event.EXECUTE_COMPLETED)
|
.event(NoticeConstants.Event.EXECUTE_COMPLETED)
|
||||||
.paramMap(paramMap)
|
.paramMap(paramMap)
|
||||||
.excludeSelf(true)
|
|
||||||
.build();
|
.build();
|
||||||
noticeSendService.send(organization, NoticeConstants.TaskType.PERFORMANCE_TEST_TASK, noticeModel2);
|
noticeSendService.send(organization, NoticeConstants.TaskType.PERFORMANCE_TEST_TASK, noticeModel2);
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,10 +5,7 @@ import com.alibaba.fastjson.JSON;
|
||||||
import com.alibaba.fastjson.JSONObject;
|
import com.alibaba.fastjson.JSONObject;
|
||||||
import io.metersphere.base.domain.*;
|
import io.metersphere.base.domain.*;
|
||||||
import io.metersphere.base.mapper.*;
|
import io.metersphere.base.mapper.*;
|
||||||
import io.metersphere.base.mapper.ext.ExtOrganizationMapper;
|
import io.metersphere.base.mapper.ext.*;
|
||||||
import io.metersphere.base.mapper.ext.ExtUserGroupMapper;
|
|
||||||
import io.metersphere.base.mapper.ext.ExtUserMapper;
|
|
||||||
import io.metersphere.base.mapper.ext.ExtUserRoleMapper;
|
|
||||||
import io.metersphere.commons.constants.*;
|
import io.metersphere.commons.constants.*;
|
||||||
import io.metersphere.commons.exception.MSException;
|
import io.metersphere.commons.exception.MSException;
|
||||||
import io.metersphere.commons.user.SessionUser;
|
import io.metersphere.commons.user.SessionUser;
|
||||||
|
@ -97,6 +94,8 @@ public class UserService {
|
||||||
private ExtUserGroupMapper extUserGroupMapper;
|
private ExtUserGroupMapper extUserGroupMapper;
|
||||||
@Resource
|
@Resource
|
||||||
private ProjectMapper projectMapper;
|
private ProjectMapper projectMapper;
|
||||||
|
@Resource
|
||||||
|
private ExtProjectMapper extProjectMapper;
|
||||||
|
|
||||||
public List<UserDetail> queryTypeByIds(List<String> userIds) {
|
public List<UserDetail> queryTypeByIds(List<String> userIds) {
|
||||||
return extUserMapper.queryTypeByIds(userIds);
|
return extUserMapper.queryTypeByIds(userIds);
|
||||||
|
@ -1451,7 +1450,7 @@ public class UserService {
|
||||||
User user = userMapper.selectByPrimaryKey(SessionUtils.getUserId());
|
User user = userMapper.selectByPrimaryKey(SessionUtils.getUserId());
|
||||||
String platformInfoStr = user.getPlatformInfo();
|
String platformInfoStr = user.getPlatformInfo();
|
||||||
if (StringUtils.isBlank(orgId) || StringUtils.isBlank(platformInfoStr)) {
|
if (StringUtils.isBlank(orgId) || StringUtils.isBlank(platformInfoStr)) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
JSONObject platformInfos = JSONObject.parseObject(platformInfoStr);
|
JSONObject platformInfos = JSONObject.parseObject(platformInfoStr);
|
||||||
JSONObject platformInfo = platformInfos.getJSONObject(orgId);
|
JSONObject platformInfo = platformInfos.getJSONObject(orgId);
|
||||||
|
@ -1460,4 +1459,17 @@ public class UserService {
|
||||||
}
|
}
|
||||||
return JSONObject.parseObject(JSONObject.toJSONString(platformInfo), UserDTO.PlatformInfo.class);
|
return JSONObject.parseObject(JSONObject.toJSONString(platformInfo), UserDTO.PlatformInfo.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void updateCurrentUserByResourceId(String resourceId) {
|
||||||
|
Project project = extProjectMapper.selectProjectByResourceId(resourceId);
|
||||||
|
if (project == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
Workspace workspace = workspaceMapper.selectByPrimaryKey(project.getWorkspaceId());
|
||||||
|
SessionUser user = SessionUtils.getUser();
|
||||||
|
user.setLastProjectId(project.getId());
|
||||||
|
user.setLastWorkspaceId(project.getWorkspaceId());
|
||||||
|
user.setLastOrganizationId(workspace.getOrganizationId());
|
||||||
|
userMapper.updateByPrimaryKeySelective(user);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -30,7 +30,10 @@
|
||||||
</div>
|
</div>
|
||||||
<span class="username">{{ item.user.name }}</span>
|
<span class="username">{{ item.user.name }}</span>
|
||||||
<span class="operation">
|
<span class="operation">
|
||||||
{{ getOperation(item.operation) }}{{ getResource(item) }}: {{ item.resourceName }}
|
{{ getOperation(item.operation) }}{{ getResource(item) }}:
|
||||||
|
<span v-if="item.resourceId && item.operation.indexOf('DELETE') < 0"
|
||||||
|
@click="clickResource(item)" style="color: #783887; cursor: pointer;">{{ item.resourceName }}</span>
|
||||||
|
<span v-else>{{ item.resourceName }}</span>
|
||||||
</span>
|
</span>
|
||||||
</el-row>
|
</el-row>
|
||||||
</el-card>
|
</el-card>
|
||||||
|
@ -43,7 +46,7 @@
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import {getOperation, getResource} from "@/business/components/notice/util";
|
import {getOperation, getResource, getUrl} from "@/business/components/notice/util";
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: "MentionedMeData",
|
name: "MentionedMeData",
|
||||||
|
@ -101,6 +104,29 @@ export default {
|
||||||
this.goPage++;
|
this.goPage++;
|
||||||
}
|
}
|
||||||
this.init();
|
this.init();
|
||||||
|
},
|
||||||
|
clickResource(resource) {
|
||||||
|
let resourceId = resource.resourceId;
|
||||||
|
if (!resourceId) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
let uri = getUrl(resource);
|
||||||
|
|
||||||
|
this.$get('/user/update/currentByResourceId/' + resourceId, () => {
|
||||||
|
this.toPage(uri);
|
||||||
|
});
|
||||||
|
},
|
||||||
|
toPage(uri) {
|
||||||
|
let id = "new_a";
|
||||||
|
let a = document.createElement("a");
|
||||||
|
a.setAttribute("href", uri);
|
||||||
|
a.setAttribute("target", "_blank");
|
||||||
|
a.setAttribute("id", id);
|
||||||
|
document.body.appendChild(a);
|
||||||
|
a.click();
|
||||||
|
|
||||||
|
let element = document.getElementById(id);
|
||||||
|
element.parentNode.removeChild(element);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
|
@ -30,7 +30,10 @@
|
||||||
</div>
|
</div>
|
||||||
<span class="username">{{ item.user.name }}</span>
|
<span class="username">{{ item.user.name }}</span>
|
||||||
<span class="operation">
|
<span class="operation">
|
||||||
{{ getOperation(item.operation) }}{{ getResource(item) }}: {{ item.resourceName }}
|
{{ getOperation(item.operation) }}{{ getResource(item) }}:
|
||||||
|
<span v-if="item.resourceId && item.operation.indexOf('DELETE') < 0"
|
||||||
|
@click="clickResource(item)" style="color: #783887; cursor: pointer;">{{ item.resourceName }}</span>
|
||||||
|
<span v-else>{{ item.resourceName }}</span>
|
||||||
</span>
|
</span>
|
||||||
</el-row>
|
</el-row>
|
||||||
</el-card>
|
</el-card>
|
||||||
|
@ -43,7 +46,7 @@
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import {getOperation, getResource} from "@/business/components/notice/util";
|
import {getOperation, getResource, getUrl} from "@/business/components/notice/util";
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: "SystemNoticeData",
|
name: "SystemNoticeData",
|
||||||
|
@ -100,6 +103,29 @@ export default {
|
||||||
this.goPage++;
|
this.goPage++;
|
||||||
}
|
}
|
||||||
this.init();
|
this.init();
|
||||||
|
},
|
||||||
|
clickResource(resource) {
|
||||||
|
let resourceId = resource.resourceId;
|
||||||
|
if (!resourceId) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
let uri = getUrl(resource);
|
||||||
|
|
||||||
|
this.$get('/user/update/currentByResourceId/' + resourceId, () => {
|
||||||
|
this.toPage(uri);
|
||||||
|
});
|
||||||
|
},
|
||||||
|
toPage(uri) {
|
||||||
|
let id = "new_a";
|
||||||
|
let a = document.createElement("a");
|
||||||
|
a.setAttribute("href", uri);
|
||||||
|
a.setAttribute("target", "_blank");
|
||||||
|
a.setAttribute("id", id);
|
||||||
|
document.body.appendChild(a);
|
||||||
|
a.click();
|
||||||
|
|
||||||
|
let element = document.getElementById(id);
|
||||||
|
element.parentNode.removeChild(element);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
|
@ -110,3 +110,54 @@ export function getResource(d) {
|
||||||
}
|
}
|
||||||
return resourceType;
|
return resourceType;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export function getUrl(d) {
|
||||||
|
let url = "/#";
|
||||||
|
switch (d.resourceType) {
|
||||||
|
case "JENKINS_TASK" :
|
||||||
|
url += "/track/plan/all";
|
||||||
|
break;
|
||||||
|
case "TEST_PLAN_TASK" :
|
||||||
|
url += "/track/plan/all";
|
||||||
|
break;
|
||||||
|
case "REVIEW_TASK" :
|
||||||
|
url += "/track/review/all";
|
||||||
|
break;
|
||||||
|
case "DEFECT_TASK" :
|
||||||
|
url += "/track/issue";
|
||||||
|
break;
|
||||||
|
case "SWAGGER_TASK" :
|
||||||
|
url += "/api/definition";
|
||||||
|
break;
|
||||||
|
case "API_AUTOMATION_TASK" :
|
||||||
|
url += "/api/automation";
|
||||||
|
break;
|
||||||
|
case "API_DEFINITION_TASK" :
|
||||||
|
url += "/api/definition";
|
||||||
|
break;
|
||||||
|
case "API_HOME_TASK" :
|
||||||
|
url += "/api/home";
|
||||||
|
break;
|
||||||
|
case "API_REPORT_TASK" :
|
||||||
|
url += "/api/automation/report";
|
||||||
|
break;
|
||||||
|
case "PERFORMANCE_REPORT_TASK" :
|
||||||
|
url += "/performance/report/all";
|
||||||
|
break;
|
||||||
|
case "PERFORMANCE_TEST_TASK" :
|
||||||
|
url += "/performance/test/all";
|
||||||
|
break;
|
||||||
|
case "TRACK_TEST_CASE_TASK" :
|
||||||
|
url += "/track/case/all";
|
||||||
|
break;
|
||||||
|
case "TRACK_HOME_TASK" :
|
||||||
|
url += "/track/home";
|
||||||
|
break;
|
||||||
|
case "TRACK_REPORT_TASK" :
|
||||||
|
url += "/track/testPlan/reportList";
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
return url;
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in New Issue