Commit 85259e28 authored by Natalia Tepluhina's avatar Natalia Tepluhina

Merge branch '351866-rephrase-error-messages' into 'master'

Rephrase error messages

See merge request gitlab-org/gitlab!80601
parents 9e4bb02b 66be0f23
import { __ } from '~/locale';
import { s__ } from '~/locale';
export const REQUIRED_FIELD = __('This field is required.');
export const ERROR_NAME = s__('VulnerabilityManagement|Enter a name');
export const ERROR_SEVERITY = s__('VulnerabilityManagement|Select a severity level');
export const ERROR_STATUS = s__('VulnerabilityManagement|Select a status');
export const ERROR_IDENTIFIER_CODE = s__('VulnerabilityManagement|Enter the CVE or CWE code');
export const ERROR_IDENTIFIER_URL = s__(
'VulnerabilityManagement|Enter the CVE or CWE identifier URL',
);
......@@ -108,7 +108,8 @@ export default {
critical: [9.0, 10.0],
},
i18n: {
requiredField: i18n.REQUIRED_FIELD,
errorSeverity: i18n.ERROR_SEVERITY,
errorStatus: i18n.ERROR_STATUS,
title: s__('Vulnerability|Details'),
description: s__(
'Vulnerability|Information related how the vulnerability was discovered and its impact to the system.',
......@@ -164,7 +165,7 @@ export default {
<gl-form-group
:label="$options.i18n.severity.label"
:state="validationState.severity"
:invalid-feedback="$options.i18n.requiredField"
:invalid-feedback="$options.i18n.errorSeverity"
label-for="form-severity"
class="gl-mr-6 gl-mb-0"
>
......@@ -191,7 +192,7 @@ export default {
<gl-form-group
:label="$options.i18n.status.label"
:state="validationState.status"
:invalid-feedback="$options.i18n.requiredField"
:invalid-feedback="$options.i18n.errorStatus"
>
<p>{{ $options.i18n.status.description }}</p>
<gl-form-radio-group :checked="statusId" @change="emitChanges">
......
......@@ -54,7 +54,8 @@ export default {
},
},
i18n: {
requiredField: i18n.REQUIRED_FIELD,
errorIdentifierCode: i18n.ERROR_IDENTIFIER_CODE,
errorIdentifierUrl: i18n.ERROR_IDENTIFIER_URL,
title: s__('Vulnerability|Identifiers'),
description: s__(
'Vulnerability|Enter the associated CVE or CWE entries for this vulnerability.',
......@@ -87,7 +88,7 @@ export default {
:label="$options.i18n.identifierCode"
:label-for="`form-identifier-code-${index}`"
:state="validationStateIdentifierCode(index)"
:invalid-feedback="$options.i18n.requiredField"
:invalid-feedback="$options.i18n.errorIdentifierCode"
class="gl-mr-6 gl-mb-0"
>
<gl-form-input
......@@ -101,7 +102,7 @@ export default {
<gl-form-group
:label="$options.i18n.identifierUrl"
:state="validationStateIdentifierUrl(index)"
:invalid-feedback="$options.i18n.requiredField"
:invalid-feedback="$options.i18n.errorIdentifierUrl"
:label-for="`form-identifier-url-${index}`"
class="gl-flex-grow-1 gl-mb-0"
>
......
......@@ -35,7 +35,7 @@ export default {
},
},
i18n: {
requiredField: i18n.REQUIRED_FIELD,
errorName: i18n.ERROR_NAME,
vulnerabilityName: {
label: __('Name'),
description: s__(
......@@ -57,7 +57,7 @@ export default {
:label="$options.i18n.vulnerabilityName.label"
:description="$options.i18n.vulnerabilityName.description"
:state="validationState.name"
:invalid-feedback="$options.i18n.requiredField"
:invalid-feedback="$options.i18n.errorName"
label-for="form-vulnerability-name"
class="gl-mb-6"
>
......
......@@ -97,11 +97,11 @@ describe('New vulnerability - Section Details', () => {
await nextTick();
// severity input
expect(wrapper.findAllByRole('alert').at(0).text()).toBe('This field is required.');
expect(wrapper.findAllByRole('alert').at(0).text()).toBe('Select a severity level');
expect(findFormGroup(1).attributes('aria-invalid')).toBe('true');
// status input
expect(wrapper.findAllByRole('alert').at(1).text()).toBe('This field is required.');
expect(wrapper.findAllByRole('alert').at(1).text()).toBe('Select a status');
expect(findFormGroup(2).attributes('aria-invalid')).toBe('true');
});
});
......@@ -50,10 +50,10 @@ describe('New vulnerability - Section Identifiers', () => {
await nextTick();
expect(findFormGroup(0).attributes('aria-invalid')).toBe('true');
expect(wrapper.findAllByRole('alert').at(0).text()).toBe('This field is required.');
expect(wrapper.findAllByRole('alert').at(0).text()).toBe('Enter the CVE or CWE code');
expect(findFormGroup(1).attributes('aria-invalid')).toBe('true');
expect(wrapper.findAllByRole('alert').at(1).text()).toBe('This field is required.');
expect(wrapper.findAllByRole('alert').at(1).text()).toBe('Enter the CVE or CWE identifier URL');
});
it('emits change event when input changes', () => {
......
......@@ -79,7 +79,7 @@ describe('New vulnerability - Section Name', () => {
await nextTick();
expect(wrapper.findByRole('alert').text()).toBe('This field is required.');
expect(wrapper.findByRole('alert').text()).toBe('Enter a name');
expect(findFormGroup(0).attributes('aria-invalid')).toBe('true');
});
});
......@@ -40308,6 +40308,15 @@ msgstr ""
msgid "VulnerabilityManagement|Create Jira issue"
msgstr ""
msgid "VulnerabilityManagement|Enter a name"
msgstr ""
msgid "VulnerabilityManagement|Enter the CVE or CWE code"
msgstr ""
msgid "VulnerabilityManagement|Enter the CVE or CWE identifier URL"
msgstr ""
msgid "VulnerabilityManagement|Fetching linked Jira issues"
msgstr ""
......@@ -40332,6 +40341,12 @@ msgstr ""
msgid "VulnerabilityManagement|Select a method"
msgstr ""
msgid "VulnerabilityManagement|Select a severity level"
msgstr ""
msgid "VulnerabilityManagement|Select a status"
msgstr ""
msgid "VulnerabilityManagement|Severity is a required field"
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