Commit d7f51165 authored by Alexander Turinske's avatar Alexander Turinske

Refactor header to abstract out reusable strings

- move state string to constant
- update test name
- move changelog to ee
parent ddd9651c
...@@ -82,7 +82,9 @@ export default { ...@@ -82,7 +82,9 @@ export default {
}, },
canDownloadPatch() { canDownloadPatch() {
return ( return (
this.vulnerability.state !== 'resolved' && !this.vulnerability.hasMr && this.hasRemediation this.vulnerability.state !== VULNERABILITY_STATE_OBJECTS.resolved.state &&
!this.vulnerability.hasMr &&
this.hasRemediation
); );
}, },
hasIssue() { hasIssue() {
...@@ -105,7 +107,8 @@ export default { ...@@ -105,7 +107,8 @@ export default {
}, },
showResolutionAlert() { showResolutionAlert() {
return ( return (
this.vulnerability.resolved_on_default_branch && this.vulnerability.state !== 'resolved' this.vulnerability.resolved_on_default_branch &&
this.vulnerability.state !== VULNERABILITY_STATE_OBJECTS.resolved.state
); );
}, },
}, },
......
...@@ -3,18 +3,21 @@ import { s__ } from '~/locale'; ...@@ -3,18 +3,21 @@ import { s__ } from '~/locale';
export const VULNERABILITY_STATE_OBJECTS = { export const VULNERABILITY_STATE_OBJECTS = {
dismissed: { dismissed: {
action: 'dismiss', action: 'dismiss',
state: 'dismissed',
statusBoxStyle: 'upcoming', statusBoxStyle: 'upcoming',
displayName: s__('VulnerabilityManagement|Dismiss'), displayName: s__('VulnerabilityManagement|Dismiss'),
description: s__('VulnerabilityManagement|Will not fix or a false-positive'), description: s__('VulnerabilityManagement|Will not fix or a false-positive'),
}, },
confirmed: { confirmed: {
action: 'confirm', action: 'confirm',
state: 'confirmed',
statusBoxStyle: 'closed', statusBoxStyle: 'closed',
displayName: s__('VulnerabilityManagement|Confirm'), displayName: s__('VulnerabilityManagement|Confirm'),
description: s__('VulnerabilityManagement|A true-positive and will fix'), description: s__('VulnerabilityManagement|A true-positive and will fix'),
}, },
resolved: { resolved: {
action: 'resolve', action: 'resolve',
state: 'resolved',
statusBoxStyle: 'open', statusBoxStyle: 'open',
displayName: s__('VulnerabilityManagement|Resolved'), displayName: s__('VulnerabilityManagement|Resolved'),
description: s__('VulnerabilityManagement|Verified as fixed or mitigated'), description: s__('VulnerabilityManagement|Verified as fixed or mitigated'),
......
...@@ -287,7 +287,7 @@ describe('Vulnerability Header', () => { ...@@ -287,7 +287,7 @@ describe('Vulnerability Header', () => {
}); });
}); });
describe('can download download patch', () => { describe('can download patch', () => {
beforeEach(() => { beforeEach(() => {
createWrapper({ createWrapper({
finding: getFinding({ shouldShowMergeRequestButton: true }), finding: getFinding({ shouldShowMergeRequestButton: true }),
...@@ -302,7 +302,6 @@ describe('Vulnerability Header', () => { ...@@ -302,7 +302,6 @@ describe('Vulnerability Header', () => {
it('emits downloadPatch when download patch button is clicked', () => { it('emits downloadPatch when download patch button is clicked', () => {
const glDeprecatedButton = findGlDeprecatedButton(); const glDeprecatedButton = findGlDeprecatedButton();
expect(glDeprecatedButton.exists()).toBe(true);
glDeprecatedButton.vm.$emit('click'); glDeprecatedButton.vm.$emit('click');
return wrapper.vm.$nextTick().then(() => { return wrapper.vm.$nextTick().then(() => {
expect(download).toHaveBeenCalledWith({ fileData: diff, fileName: `remediation.patch` }); expect(download).toHaveBeenCalledWith({ fileData: diff, fileName: `remediation.patch` });
......
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