Commit c1c6ab38 authored by Alexander Turinske's avatar Alexander Turinske Committed by David O'Regan

Fix broken threat alert issue link

- before we built the link on the FE
- now we get the link from the BE

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