Commit 312fa4c4 authored by David O'Regan's avatar David O'Regan Committed by Simon Knox

Feat(incidents): add issue state to alerts table

Show the current status of
an linked issue in the
alerts table
parent 1ece9271
......@@ -225,7 +225,7 @@ export default {
getIssueMeta({ issue: { iid, state } }) {
return {
state: state === 'closed' ? `(${this.$options.i18n.closed})` : '',
link: joinPaths('/', this.projectPath, '-', 'issues', iid),
link: joinPaths('/', this.projectPath, '-', 'issues/incident', iid),
};
},
tbodyTrClass(item) {
......
......@@ -222,7 +222,9 @@ export default {
});
},
incidentPath(issueId) {
return joinPaths(this.projectIssuesPath, issueId);
return this.isThreatMonitoringPage
? joinPaths(this.projectIssuesPath, issueId)
: joinPaths(this.projectIssuesPath, 'incident', issueId);
},
trackPageViews() {
const { category, action } = this.trackAlertsDetailsViewsOptions;
......
---
title: Allow alert to link to incidents
merge_request: 55426
author:
type: changed
......@@ -251,7 +251,7 @@ describe('AlertManagementTable', () => {
const tooltip = getBinding(issueField.element, 'gl-tooltip');
expect(issueField.text()).toBe(`#1 (closed)`);
expect(issueField.attributes('href')).toBe('/gitlab-org/gitlab/-/issues/1');
expect(issueField.attributes('href')).toBe('/gitlab-org/gitlab/-/issues/incident/1');
expect(issueField.attributes('title')).toBe('My test issue');
expect(tooltip).not.toBe(undefined);
});
......
......@@ -188,6 +188,18 @@ describe('AlertDetails', () => {
});
expect(findMetricsTab().exists()).toBe(false);
});
it('should display "View incident" button that links the issues page when incident exists', () => {
const iid = '3';
mountComponent({
data: { alert: { ...mockAlert, issue: { iid } }, sidebarStatus: false },
provide: { isThreatMonitoringPage: true },
});
expect(findViewIncidentBtn().exists()).toBe(true);
expect(findViewIncidentBtn().attributes('href')).toBe(joinPaths(projectIssuesPath, iid));
expect(findCreateIncidentBtn().exists()).toBe(false);
});
});
describe('Create incident from alert', () => {
......@@ -198,7 +210,9 @@ describe('AlertDetails', () => {
});
expect(findViewIncidentBtn().exists()).toBe(true);
expect(findViewIncidentBtn().attributes('href')).toBe(joinPaths(projectIssuesPath, iid));
expect(findViewIncidentBtn().attributes('href')).toBe(
joinPaths(projectIssuesPath, 'incident', iid),
);
expect(findCreateIncidentBtn().exists()).toBe(false);
});
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment