Коммит 851d2c80 создал по автору Miranda Fluharty's avatar Miranda Fluharty
Просмотр файлов

Move masked variable regex warning to help text

In the variable settings modal,
instead of making the warning bold when masked is checked
show help text next to the variable value input

Changelog: changed
владелец 475fa4e8
...@@ -190,6 +190,9 @@ export default { ...@@ -190,6 +190,9 @@ export default {
variableValidationState() { variableValidationState() {
return this.variable.value === '' || (this.tokenValidationState && this.maskedState); return this.variable.value === '' || (this.tokenValidationState && this.maskedState);
}, },
variableValueHelpText() {
return this.variable.masked ? __('Must meet regular expression requirements.') : '';
},
}, },
watch: { watch: {
variable: { variable: {
...@@ -324,6 +327,7 @@ export default { ...@@ -324,6 +327,7 @@ export default {
:label="__('Value')" :label="__('Value')"
label-for="ci-variable-value" label-for="ci-variable-value"
:state="variableValidationState" :state="variableValidationState"
:description="variableValueHelpText"
:invalid-feedback="variableValidationFeedback" :invalid-feedback="variableValidationFeedback"
> >
<gl-form-textarea <gl-form-textarea
...@@ -424,13 +428,7 @@ export default { ...@@ -424,13 +428,7 @@ export default {
{{ __('Mask variable') }} {{ __('Mask variable') }}
<p class="gl-mt-2 text-secondary"> <p class="gl-mt-2 text-secondary">
{{ __('Variable will be masked in job logs.') }} {{ __('Variable will be masked in job logs.') }}
<span {{ __('Requires values to meet regular expression requirements.') }}
:class="{
'bold text-plain': displayMaskedError,
}"
>
{{ __('Requires values to meet regular expression requirements.') }}</span
>
<gl-link target="_blank" :href="maskedEnvironmentVariablesLink">{{ <gl-link target="_blank" :href="maskedEnvironmentVariablesLink">{{
__('Learn more.') __('Learn more.')
}}</gl-link> }}</gl-link>
......
...@@ -29443,6 +29443,9 @@ msgstr "" ...@@ -29443,6 +29443,9 @@ msgstr ""
msgid "Must be 90 days or more." msgid "Must be 90 days or more."
msgstr "" msgstr ""
   
msgid "Must meet regular expression requirements."
msgstr ""
msgid "My awesome group" msgid "My awesome group"
msgstr "" msgstr ""
   
...@@ -459,6 +459,7 @@ describe('Ci variable modal', () => { ...@@ -459,6 +459,7 @@ describe('Ci variable modal', () => {
describe('Validations', () => { describe('Validations', () => {
const maskError = 'This variable can not be masked.'; const maskError = 'This variable can not be masked.';
const helpText = 'Must meet regular expression requirements.';
describe('when the variable is raw', () => { describe('when the variable is raw', () => {
const [variable] = mockVariables; const [variable] = mockVariables;
...@@ -488,6 +489,10 @@ describe('Ci variable modal', () => { ...@@ -488,6 +489,10 @@ describe('Ci variable modal', () => {
expect(findModal().text()).toContain(maskError); expect(findModal().text()).toContain(maskError);
}); });
it('does not show the masked variable help text', () => {
expect(findModal().text()).not.toContain(helpText);
});
}); });
describe('when the mask state is invalid', () => { describe('when the mask state is invalid', () => {
...@@ -510,8 +515,9 @@ describe('Ci variable modal', () => { ...@@ -510,8 +515,9 @@ describe('Ci variable modal', () => {
expect(findAddorUpdateButton().attributes('disabled')).toBeDefined(); expect(findAddorUpdateButton().attributes('disabled')).toBeDefined();
}); });
it('shows the correct error text', () => { it('shows the correct error text and help text', () => {
expect(findModal().text()).toContain(maskError); expect(findModal().text()).toContain(maskError);
expect(findModal().text()).toContain(helpText);
}); });
it('sends the correct tracking event', () => { it('sends the correct tracking event', () => {
...@@ -578,6 +584,10 @@ describe('Ci variable modal', () => { ...@@ -578,6 +584,10 @@ describe('Ci variable modal', () => {
}); });
}); });
it('shows the help text', () => {
expect(findModal().text()).toContain(helpText);
});
it('does not disable the submit button', () => { it('does not disable the submit button', () => {
expect(findAddorUpdateButton().attributes('disabled')).toBeUndefined(); expect(findAddorUpdateButton().attributes('disabled')).toBeUndefined();
}); });
......
Поддерживает Markdown
0% или .
You are about to add 0 people to the discussion. Proceed with caution.
Сначала завершите редактирование этого сообщения!
Пожалуйста, зарегистрируйтесь или чтобы прокомментировать