Commit 3aa32bf7 authored by David O'Regan's avatar David O'Regan Committed by Martin Wortschack

Use visitUrl in Alert management

parent e4d0c250
......@@ -13,7 +13,7 @@ import {
} from '@gitlab/ui';
import createFlash from '~/flash';
import { s__ } from '~/locale';
import { joinPaths } from '~/lib/utils/url_utility';
import { joinPaths, visitUrl } from '~/lib/utils/url_utility';
import TimeAgo from '~/vue_shared/components/time_ago_tooltip.vue';
import getAlerts from '../graphql/queries/getAlerts.query.graphql';
import { ALERTS_STATUS, ALERTS_STATUS_TABS, ALERTS_SEVERITY_LABELS } from '../constants';
......@@ -173,8 +173,8 @@ export default {
);
});
},
handleRowClick({ iid }) {
window.location.assign(joinPaths(window.location.pathname, iid, 'details'));
navigateToAlertDetails({ iid }) {
return visitUrl(joinPaths(window.location.pathname, iid, 'details'));
},
},
};
......@@ -209,7 +209,7 @@ export default {
:busy="loading"
stacked="md"
:tbody-tr-class="$options.bodyTrClass"
@row-clicked="handleRowClick"
@row-clicked="navigateToAlertDetails"
>
<template #cell(severity)="{ item }">
<div
......
---
title: Use visitUrl in Alert management
merge_request: 32414
author:
type: other
......@@ -9,6 +9,7 @@ import {
GlIcon,
GlTab,
} from '@gitlab/ui';
import { visitUrl } from '~/lib/utils/url_utility';
import TimeAgo from '~/vue_shared/components/time_ago_tooltip.vue';
import createFlash from '~/flash';
import AlertManagementList from '~/alert_management/components/alert_management_list.vue';
......@@ -18,6 +19,11 @@ import mockAlerts from '../mocks/alerts.json';
jest.mock('~/flash');
jest.mock('~/lib/utils/url_utility', () => ({
visitUrl: jest.fn().mockName('visitUrlMock'),
joinPaths: jest.requireActual('~/lib/utils/url_utility').joinPaths,
}));
describe('AlertManagementList', () => {
let wrapper;
......@@ -220,12 +226,10 @@ describe('AlertManagementList', () => {
loading: false,
});
window.location.assign = jest.fn();
findAlerts()
.at(0)
.trigger('click');
expect(window.location.assign).toHaveBeenCalledWith('/1527542/details');
expect(visitUrl).toHaveBeenCalledWith('/1527542/details');
});
describe('handle date fields', () => {
......
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