Commit 5d867627 authored by David O'Regan's avatar David O'Regan Committed by Simon Knox

Allow alerts to open on new tab

parent 151c7fc7
...@@ -267,8 +267,8 @@ export default { ...@@ -267,8 +267,8 @@ export default {
this.searchTerm = trimmedInput; this.searchTerm = trimmedInput;
} }
}, 500), }, 500),
navigateToAlertDetails({ iid }) { navigateToAlertDetails({ iid }, index, { metaKey }) {
return visitUrl(joinPaths(window.location.pathname, iid, 'details')); return visitUrl(joinPaths(window.location.pathname, iid, 'details'), metaKey);
}, },
trackPageViews() { trackPageViews() {
const { category, action } = trackAlertListViewsOptions; const { category, action } = trackAlertListViewsOptions;
......
---
title: Allow alerts to open on new tab
merge_request: 42691
author:
type: changed
...@@ -295,10 +295,30 @@ describe('AlertManagementTable', () => { ...@@ -295,10 +295,30 @@ describe('AlertManagementTable', () => {
loading: false, loading: false,
}); });
expect(visitUrl).not.toHaveBeenCalled();
findAlerts() findAlerts()
.at(0) .at(0)
.trigger('click'); .trigger('click');
expect(visitUrl).toHaveBeenCalledWith('/1527542/details'); expect(visitUrl).toHaveBeenCalledWith('/1527542/details', false);
});
it('navigates to the detail page in new tab when alert row is clicked with the metaKey', () => {
mountComponent({
props: { alertManagementEnabled: true, userCanEnableAlertManagement: true },
data: { alerts: { list: mockAlerts }, alertsCount, hasError: false },
loading: false,
});
expect(visitUrl).not.toHaveBeenCalled();
findAlerts()
.at(0)
.trigger('click', {
metaKey: true,
});
expect(visitUrl).toHaveBeenCalledWith('/1527542/details', true);
}); });
describe('alert issue links', () => { describe('alert issue links', () => {
......
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