Commit 1b4d8322 authored by Daniel Tian's avatar Daniel Tian

Remove unused refetch vulnerabilities code

parent 653e3b2e
......@@ -112,9 +112,6 @@ export default {
});
}
},
refetchVulnerabilities() {
this.$apollo.queries.vulnerabilities.refetch();
},
handleSortChange({ sortBy, sortDesc }) {
this.sortDirection = sortDesc ? 'desc' : 'asc';
this.sortBy = sortBy;
......@@ -144,7 +141,6 @@ export default {
:filters="filters"
:vulnerabilities="vulnerabilities"
:security-scanners="securityScanners"
@refetch-vulnerabilities="refetchVulnerabilities"
@sort-changed="handleSortChange"
/>
<gl-intersection-observer
......
......@@ -3,7 +3,7 @@ import { GlButton, GlFormSelect } from '@gitlab/ui';
import { s__, n__ } from '~/locale';
import toast from '~/vue_shared/plugins/global_toast';
import { deprecatedCreateFlash as createFlash } from '~/flash';
import dismissVulnerability from '../graphql/dismissVulnerability.graphql';
import vulnerabilityDismiss from '../graphql/vulnerability_dismiss.mutation.graphql';
const REASON_NONE = s__('SecurityReports|[No reason]');
const REASON_WONT_FIX = s__("SecurityReports|Won't fix / Accept risk");
......@@ -42,13 +42,6 @@ export default {
},
},
methods: {
dismissalSuccessMessage() {
return n__(
'%d vulnerability dismissed',
'%d vulnerabilities dismissed',
this.selectedVulnerabilities.length,
);
},
handleDismiss() {
if (!this.canDismissVulnerability) return;
......@@ -57,14 +50,21 @@ export default {
dismissSelectedVulnerabilities() {
const promises = this.selectedVulnerabilities.map(vulnerability =>
this.$apollo.mutate({
mutation: dismissVulnerability,
mutation: vulnerabilityDismiss,
variables: { id: vulnerability.id, comment: this.dismissalReason },
}),
);
Promise.all(promises)
.then(() => {
toast(this.dismissalSuccessMessage());
toast(
n__(
'%d vulnerability dismissed',
'%d vulnerabilities dismissed',
this.selectedVulnerabilities.length,
),
);
this.$emit('deselect-all-vulnerabilities');
})
.catch(() => {
......@@ -72,9 +72,6 @@ export default {
s__('SecurityReports|There was an error dismissing the vulnerabilities.'),
'alert',
);
})
.finally(() => {
this.$emit('refetch-vulnerabilities');
});
},
},
......
......@@ -296,7 +296,6 @@ export default {
v-if="shouldShowSelectionSummary"
:selected-vulnerabilities="Object.values(selectedVulnerabilities)"
@deselect-all-vulnerabilities="deselectAllVulnerabilities"
@refetch-vulnerabilities="$emit('refetch-vulnerabilities')"
/>
<gl-table
:busy="isLoading"
......
mutation($id: ID!, $comment: String!) {
dismissVulnerability(input: { id: $id, comment: $comment }) {
vulnerabilityDismiss(input: { id: $id, comment: $comment }) {
errors
vulnerability {
id
......
......@@ -124,22 +124,6 @@ describe('Selection Summary component', () => {
);
});
});
it('should emit an event to refetch the vulnerabilities when the request is successful', () => {
dismissButton().trigger('submit');
return waitForPromises().then(() => {
expect(wrapper.emitted('deselect-all-vulnerabilities')).toEqual([[]]);
expect(wrapper.emitted('refetch-vulnerabilities')).toEqual([[]]);
});
});
it('should still emit an event to refetch the vulnerabilities when the request fails', () => {
mutateMock.mockRejectedValue();
dismissButton().trigger('submit');
return waitForPromises().then(() => {
expect(wrapper.emitted('refetch-vulnerabilities')).toEqual([[]]);
});
});
});
describe('when vulnerabilities are not selected', () => {
......
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