Commit f0d19068 authored by Andrew Fontaine's avatar Andrew Fontaine

Merge branch 'KeremYalcinkaya/gitlab-Post-bulk-update' into 'master'

Kerem yalcinkaya/gitlab post bulk update

See merge request gitlab-org/gitlab!80616
parents 186d5e70 1bd3800b
......@@ -82,7 +82,7 @@ export default {
this.isSubmitting = false;
if (fulfilledCount > 0) {
toast(this.$options.i18n.vulnerabilitiesUpdated(fulfilledCount));
toast(this.$options.i18n.statusChanged(this.selectedStatus, fulfilledCount));
eventHub.$emit('vulnerabilities-updated', this);
}
......@@ -98,8 +98,29 @@ export default {
cancel: __('Cancel'),
selected: __('Selected'),
changeStatus: s__('SecurityReports|Change status'),
vulnerabilitiesUpdated: (count) =>
n__('%d vulnerability updated', '%d vulnerabilities updated', count),
statusChanged: (status, count) =>
({
confirm: n__(
'%d vulnerability set to confirmed',
'%d vulnerabilities set to confirmed',
count,
),
resolve: n__(
'%d vulnerability set to resolved',
'%d vulnerabilities set to resolved',
count,
),
dismiss: n__(
'%d vulnerability set to dismissed',
'%d vulnerabilities set to dismissed',
count,
),
revert: n__(
'%d vulnerability set to needs triage',
'%d vulnerabilities set to needs triage',
count,
),
}[status]),
vulnerabilitiesUpdateFailed: (vulnIds) =>
s__(`SecurityReports|Failed updating vulnerabilities with the following IDs: ${vulnIds}`),
},
......
......@@ -95,12 +95,12 @@ describe('Selection Summary component', () => {
});
describe.each`
action | queryName | payload | expected
${'dismiss'} | ${'vulnerabilityDismiss'} | ${undefined} | ${'dismissed'}
${'confirm'} | ${'vulnerabilityConfirm'} | ${undefined} | ${'confirmed'}
${'resolve'} | ${'vulnerabilityResolve'} | ${undefined} | ${'resolved'}
${'revert'} | ${'vulnerabilityRevertToDetected'} | ${'Needs triage'} | ${'detected'}
`('state dropdown change', ({ action, queryName, payload, expected }) => {
action | queryName | payload | expected | successMessage
${'dismiss'} | ${'vulnerabilityDismiss'} | ${undefined} | ${'dismissed'} | ${'set to dismissed'}
${'confirm'} | ${'vulnerabilityConfirm'} | ${undefined} | ${'confirmed'} | ${'set to confirmed'}
${'resolve'} | ${'vulnerabilityResolve'} | ${undefined} | ${'resolved'} | ${'set to resolved'}
${'revert'} | ${'vulnerabilityRevertToDetected'} | ${'Needs triage'} | ${'detected'} | ${'set to needs triage'}
`('state dropdown change', ({ action, queryName, payload, expected, successMessage }) => {
const selectedVulnerabilities = [
{ id: 'gid://gitlab/Vulnerability/54' },
{ id: 'gid://gitlab/Vulnerability/56' },
......@@ -179,7 +179,7 @@ describe('Selection Summary component', () => {
it(`calls the toaster - ${action}`, async () => {
await submitForm();
expect(toast).toHaveBeenLastCalledWith('3 vulnerabilities updated');
expect(toast).toHaveBeenLastCalledWith(`3 vulnerabilities ${successMessage}`);
});
it(`the submit button is unclickable during form submission - ${action}`, async () => {
......
......@@ -426,8 +426,23 @@ msgid_plural "%d vulnerabilities dismissed"
msgstr[0] ""
msgstr[1] ""
msgid "%d vulnerability updated"
msgid_plural "%d vulnerabilities updated"
msgid "%d vulnerability set to confirmed"
msgid_plural "%d vulnerabilities set to confirmed"
msgstr[0] ""
msgstr[1] ""
msgid "%d vulnerability set to dismissed"
msgid_plural "%d vulnerabilities set to dismissed"
msgstr[0] ""
msgstr[1] ""
msgid "%d vulnerability set to needs triage"
msgid_plural "%d vulnerabilities set to needs triage"
msgstr[0] ""
msgstr[1] ""
msgid "%d vulnerability set to resolved"
msgid_plural "%d vulnerabilities set to resolved"
msgstr[0] ""
msgstr[1] ""
......
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