Commit 7f2b4ff1 authored by Miguel Rincon's avatar Miguel Rincon

Merge branch 'pb-move-pipeline-new-input-to-textarea' into 'master'

Support multi-line strings when running pipeline with variables

See merge request gitlab-org/gitlab!53292
parents 3b72786b bbe21c26
...@@ -9,6 +9,7 @@ import { ...@@ -9,6 +9,7 @@ import {
GlFormGroup, GlFormGroup,
GlFormInput, GlFormInput,
GlFormSelect, GlFormSelect,
GlFormTextarea,
GlLink, GlLink,
GlDropdown, GlDropdown,
GlDropdownItem, GlDropdownItem,
...@@ -38,6 +39,9 @@ export default { ...@@ -38,6 +39,9 @@ export default {
errorTitle: __('Pipeline cannot be run.'), errorTitle: __('Pipeline cannot be run.'),
warningTitle: __('The form contains the following warning:'), warningTitle: __('The form contains the following warning:'),
maxWarningsSummary: __('%{total} warnings found: showing first %{warningsDisplayed}'), maxWarningsSummary: __('%{total} warnings found: showing first %{warningsDisplayed}'),
// this height value is used inline on the textarea to match the input field height
// it's used to prevent the overwrite if 'gl-h-7' or 'gl-h-7!' were used
textAreaStyle: { height: '32px' },
components: { components: {
GlAlert, GlAlert,
GlIcon, GlIcon,
...@@ -46,6 +50,7 @@ export default { ...@@ -46,6 +50,7 @@ export default {
GlFormGroup, GlFormGroup,
GlFormInput, GlFormInput,
GlFormSelect, GlFormSelect,
GlFormTextarea,
GlLink, GlLink,
GlDropdown, GlDropdown,
GlDropdownItem, GlDropdownItem,
...@@ -426,10 +431,12 @@ export default { ...@@ -426,10 +431,12 @@ export default {
data-testid="pipeline-form-ci-variable-key" data-testid="pipeline-form-ci-variable-key"
@change="addEmptyVariable(refFullName)" @change="addEmptyVariable(refFullName)"
/> />
<gl-form-input <gl-form-textarea
v-model="variable.value" v-model="variable.value"
:placeholder="s__('CiVariables|Input variable value')" :placeholder="s__('CiVariables|Input variable value')"
class="gl-mb-3" class="gl-mb-3"
:style="$options.textAreaStyle"
:no-resize="false"
data-testid="pipeline-form-ci-variable-value" data-testid="pipeline-form-ci-variable-value"
/> />
......
---
title: Support multi-line string variable values when running a manual pipeline in
the UI.
merge_request: 53292
author:
type: fixed
...@@ -242,6 +242,9 @@ describe('Pipeline New Form', () => { ...@@ -242,6 +242,9 @@ describe('Pipeline New Form', () => {
describe('when yml defines a variable', () => { describe('when yml defines a variable', () => {
const mockYmlKey = 'yml_var'; const mockYmlKey = 'yml_var';
const mockYmlValue = 'yml_var_val'; const mockYmlValue = 'yml_var_val';
const mockYmlMultiLineValue = `A value
with multiple
lines`;
const mockYmlDesc = 'A var from yml.'; const mockYmlDesc = 'A var from yml.';
it('loading icon is shown when content is requested and hidden when received', async () => { it('loading icon is shown when content is requested and hidden when received', async () => {
...@@ -261,6 +264,21 @@ describe('Pipeline New Form', () => { ...@@ -261,6 +264,21 @@ describe('Pipeline New Form', () => {
expect(findLoadingIcon().exists()).toBe(false); expect(findLoadingIcon().exists()).toBe(false);
}); });
it('multi-line strings are added to the value field without removing line breaks', async () => {
createComponent('', mockParams, mount);
mock.onGet(configVariablesPath).reply(httpStatusCodes.OK, {
[mockYmlKey]: {
value: mockYmlMultiLineValue,
description: mockYmlDesc,
},
});
await waitForPromises();
expect(findValueInputs().at(0).element.value).toBe(mockYmlMultiLineValue);
});
describe('with description', () => { describe('with description', () => {
beforeEach(async () => { beforeEach(async () => {
createComponent('', mockParams, mount); createComponent('', mockParams, mount);
......
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