Commit 21cc60cb authored by David O'Regan's avatar David O'Regan

Merge branch 'fix-broken-alert-issue-link' into 'master'

Fix broken threat alert issue link

See merge request gitlab-org/gitlab!61705
parents 2a4886c8 c1c6ab38
......@@ -138,17 +138,8 @@ export default {
this.sort = `${sortingColumn}_${sortingDirection}`;
},
getIssueMeta({ issue: { iid, state } }) {
return {
state: state === 'closed' ? `(${this.$options.i18n.CLOSED})` : '',
link: joinPaths(
gon.relative_url_root || '/',
this.projectPath,
'-',
'issues/incident',
iid,
),
};
getIssueState({ issue: { state } }) {
return state === 'closed' ? `(${this.$options.i18n.CLOSED})` : '';
},
handleAlertDeselect() {
this.isAlertDrawerOpen = false;
......@@ -247,9 +238,9 @@ export default {
v-if="item.issue"
v-gl-tooltip
:title="item.issue.title"
:href="getIssueMeta(item).link"
:href="item.issue.webUrl"
>
#{{ item.issue.iid }} {{ getIssueMeta(item).state }}
#{{ item.issue.iid }} {{ getIssueState(item) }}
</gl-link>
<span v-else>-</span>
</div>
......
---
title: Fix broken threat alert issue link
merge_request: 61705
author:
type: fixed
......@@ -191,28 +191,12 @@ describe('AlertsList component', () => {
it.each`
description | id | text | link
${'when an issue is created and is open'} | ${0} | ${'#5'} | ${'/#/-/issues/incident/5'}
${'when an issue is created and is closed'} | ${1} | ${'#6 (closed)'} | ${'/#/-/issues/incident/6'}
${'when an issue is created and is open'} | ${0} | ${'#5'} | ${mockAlerts[0].issue.webUrl}
${'when an issue is created and is closed'} | ${1} | ${'#6 (closed)'} | ${mockAlerts[1].issue.webUrl}
`('displays the correct text $description', ({ id, text, link }) => {
expect(findIssueColumnAt(id).text()).toBe(text);
expect(findIssueColumnAt(id).find('a').attributes('href')).toBe(link);
});
describe('gon.relative_url_root', () => {
beforeAll(() => {
gon.relative_url_root = '/test';
});
afterEach(() => {
gon.relative_url_root = '';
});
it('creates the correct href when the gon.relative_url_root is set', () => {
expect(findIssueColumnAt(0).find('a').attributes('href')).toBe(
'/test/#/-/issues/incident/5',
);
});
});
});
describe('assignee column', () => {
......
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