Commit 6450bc43 authored by samdbeckham's avatar samdbeckham

Rewords 'revert dismissal' on the GSD

Where GSD is the group security dashboard

Renames:
- the button text
- the tooltip text
- the test names
- the action and mutation names

It also updates the locale file for the newer wording.
parent f0fcec4f
......@@ -76,7 +76,7 @@ export default {
'fetchVulnerabilities',
'fetchVulnerabilitiesCount',
'fetchVulnerabilitiesHistory',
'revertDismissal',
'undoDismiss',
'setVulnerabilitiesCountEndpoint',
'setVulnerabilitiesEndpoint',
'setVulnerabilitiesHistoryEndpoint',
......@@ -104,7 +104,7 @@ export default {
:can-create-feedback-permission="canCreateFeedbackPermission"
@createNewIssue="createIssue({ vulnerability: modal.vulnerability })"
@dismissIssue="dismissVulnerability({ vulnerability: modal.vulnerability })"
@revertDismissIssue="revertDismissal({ vulnerability: modal.vulnerability })"
@revertDismissIssue="undoDismiss({ vulnerability: modal.vulnerability })"
/>
</div>
</template>
......@@ -42,7 +42,7 @@ export default {
'openModal',
'createIssue',
'dismissVulnerability',
'revertDismissal',
'undoDismiss',
]),
handleCreateIssue() {
const { vulnerability } = this;
......@@ -52,9 +52,9 @@ export default {
const { vulnerability } = this;
this.dismissVulnerability({ vulnerability, flashError: true });
},
handleRevertDismissal() {
handleUndoDismiss() {
const { vulnerability } = this;
this.revertDismissal({ vulnerability, flashError: true });
this.undoDismiss({ vulnerability, flashError: true });
},
},
};
......@@ -89,14 +89,14 @@ export default {
<template v-if="canDismissVulnerability">
<loading-button
v-if="isDismissed"
key="revert-dismissal"
key="undo-dismiss"
v-gl-tooltip
:aria-label="s__('Security Reports|Undo dismiss')"
:loading="isDismissingVulnerability"
:title="s__('Security Reports|Undo dismiss')"
container-class="btn btn-inverted btn-warning btn-border-color js-revert-dismissal"
container-class="btn btn-inverted btn-warning btn-border-color js-undo-dismiss"
type="button"
@click="handleRevertDismissal"
@click="handleUndoDismiss"
>
<icon name="repeat" />
</loading-button>
......
......@@ -172,33 +172,33 @@ export const receiveDismissVulnerabilityError = ({ commit }, { flashError }) =>
}
};
export const revertDismissal = ({ dispatch }, { vulnerability, flashError }) => {
export const undoDismiss = ({ dispatch }, { vulnerability, flashError }) => {
const { vulnerability_feedback_dismissal_path, dismissal_feedback } = vulnerability;
// eslint-disable-next-line camelcase
const url = `${vulnerability_feedback_dismissal_path}/${dismissal_feedback.id}`;
dispatch('requestRevertDismissal');
dispatch('requestUndoDismiss');
axios
.delete(url)
.then(() => {
const { id } = vulnerability;
dispatch('receiveRevertDismissalSuccess', { id });
dispatch('receiveUndoDismissSuccess', { id });
})
.catch(() => {
dispatch('receiveRevertDismissalError', { flashError });
dispatch('receiveUndoDismissError', { flashError });
});
};
export const requestRevertDismissal = ({ commit }) => {
export const requestUndoDismiss = ({ commit }) => {
commit(types.REQUEST_REVERT_DISMISSAL);
};
export const receiveRevertDismissalSuccess = ({ commit }, payload) => {
export const receiveUndoDismissSuccess = ({ commit }, payload) => {
commit(types.RECEIVE_REVERT_DISMISSAL_SUCCESS, payload);
};
export const receiveRevertDismissalError = ({ commit }, { flashError }) => {
export const receiveUndoDismissError = ({ commit }, { flashError }) => {
commit(types.RECEIVE_REVERT_DISMISSAL_ERROR);
if (flashError) {
createFlash(
......
......@@ -40,7 +40,7 @@ export default {
computed: {
revertTitle() {
return this.modal.vulnerability.isDismissed
? s__('ciReport|Revert dismissal')
? s__('ciReport|Undo dismiss')
: s__('ciReport|Dismiss vulnerability');
},
hasDismissedBy() {
......
---
title: Renames 'revert dismissal' to 'undo dismiss' on the Group security dashboard
merge_request: 9500
author:
type: other
......@@ -146,8 +146,8 @@ describe('Security Dashboard Action Buttons', () => {
expect(vm.$el.querySelector('.js-dismiss-vulnerability')).toBeNull();
});
it('should render the revert dismissal button', () => {
expect(vm.$el.querySelector('.js-revert-dismissal')).not.toBeNull();
it('should render the undo dismiss button', () => {
expect(vm.$el.querySelector('.js-undo-dismiss')).not.toBeNull();
});
});
});
......@@ -572,7 +572,7 @@ describe('vulnerability dismissal', () => {
});
describe('revert vulnerability dismissal', () => {
describe('revertDismissal', () => {
describe('undoDismiss', () => {
const vulnerability = mockDataVulnerabilities[2];
const url = `${vulnerability.vulnerability_feedback_dismissal_path}/${
vulnerability.dismissal_feedback.id
......@@ -594,13 +594,13 @@ describe('revert vulnerability dismissal', () => {
it('should dispatch the request and success actions', done => {
testAction(
actions.revertDismissal,
actions.undoDismiss,
{ vulnerability },
{},
[],
[
{ type: 'requestRevertDismissal' },
{ type: 'receiveRevertDismissalSuccess', payload: { id: vulnerability.id } },
{ type: 'requestUndoDismiss' },
{ type: 'receiveUndoDismissSuccess', payload: { id: vulnerability.id } },
],
done,
);
......@@ -616,13 +616,13 @@ describe('revert vulnerability dismissal', () => {
const flashError = false;
testAction(
actions.revertDismissal,
actions.undoDismiss,
{ vulnerability, flashError },
{},
[],
[
{ type: 'requestRevertDismissal' },
{ type: 'receiveRevertDismissalError', payload: { flashError: false } },
{ type: 'requestUndoDismiss' },
{ type: 'receiveUndoDismissError', payload: { flashError: false } },
],
done,
);
......@@ -630,13 +630,13 @@ describe('revert vulnerability dismissal', () => {
});
});
describe('receiveRevertDismissalSuccess', () => {
describe('receiveUndoDismissSuccess', () => {
it('should commit the success mutation', done => {
const state = initialState;
const data = mockDataVulnerabilities[0];
testAction(
actions.receiveRevertDismissalSuccess,
actions.receiveUndoDismissSuccess,
{ data },
state,
[
......@@ -651,12 +651,12 @@ describe('revert vulnerability dismissal', () => {
});
});
describe('receiveRevertDismissalError', () => {
describe('receiveUndoDismissError', () => {
it('should commit the error mutation', done => {
const state = initialState;
testAction(
actions.receiveRevertDismissalError,
actions.receiveUndoDismissError,
{},
state,
[{ type: types.RECEIVE_REVERT_DISMISSAL_ERROR }],
......@@ -666,12 +666,12 @@ describe('revert vulnerability dismissal', () => {
});
});
describe('requestRevertDismissal', () => {
describe('requestUndoDismiss', () => {
it('should commit the request mutation', done => {
const state = initialState;
testAction(
actions.requestRevertDismissal,
actions.requestUndoDismiss,
{},
state,
[{ type: types.REQUEST_REVERT_DISMISSAL }],
......
......@@ -33,13 +33,11 @@ describe('Security Reports modal', () => {
expect(vm.$el.textContent.trim()).toContain('#123');
});
it('renders button to revert dismissal', () => {
expect(vm.$el.querySelector('.js-dismiss-btn').textContent.trim()).toEqual(
'Revert dismissal',
);
it('renders button to undo dismiss', () => {
expect(vm.$el.querySelector('.js-dismiss-btn').textContent.trim()).toEqual('Undo dismiss');
});
it('emits revertDismissIssue when revert dismissal button is clicked', () => {
it('emits revertDismissIssue when undo dismiss button is clicked', () => {
spyOn(vm, '$emit');
const button = vm.$el.querySelector('.js-dismiss-btn');
......
......@@ -11189,9 +11189,6 @@ msgstr ""
msgid "ciReport|Performance metrics"
msgstr ""
msgid "ciReport|Revert dismissal"
msgstr ""
msgid "ciReport|SAST"
msgstr ""
......@@ -11231,6 +11228,9 @@ msgstr ""
msgid "ciReport|There was an error reverting the dismissal. Please try again."
msgstr ""
msgid "ciReport|Undo dismiss"
msgstr ""
msgid "ciReport|Upgrade %{name} from %{version} to %{fixed}."
msgstr ""
......
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