diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2021-04-29 21:10:23 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2021-04-29 21:10:23 +0300 |
commit | 71dc16a12c2b0aaeee3a8fa55aa1ca880f5699b4 (patch) | |
tree | 1d6f3ebbcc4e0d799c2d55a3af7dc933cb8a829a /app/assets/javascripts/pipeline_new | |
parent | c5e4f06c597e7ef9b584595a55a82cb221804e4b (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app/assets/javascripts/pipeline_new')
-rw-r--r-- | app/assets/javascripts/pipeline_new/components/pipeline_new_form.vue | 10 | ||||
-rw-r--r-- | app/assets/javascripts/pipeline_new/utils/filter_variables.js | 13 |
2 files changed, 15 insertions, 8 deletions
diff --git a/app/assets/javascripts/pipeline_new/components/pipeline_new_form.vue b/app/assets/javascripts/pipeline_new/components/pipeline_new_form.vue index dae89c5f3d9..06ea9188113 100644 --- a/app/assets/javascripts/pipeline_new/components/pipeline_new_form.vue +++ b/app/assets/javascripts/pipeline_new/components/pipeline_new_form.vue @@ -22,6 +22,7 @@ import httpStatusCodes from '~/lib/utils/http_status'; import { redirectTo } from '~/lib/utils/url_utility'; import { s__, __, n__ } from '~/locale'; import { VARIABLE_TYPE, FILE_TYPE, CONFIG_VARIABLES_TIMEOUT } from '../constants'; +import filterVariables from '../utils/filter_variables'; import RefsDropdown from './refs_dropdown.vue'; const i18n = { @@ -281,20 +282,13 @@ export default { }, createPipeline() { this.submitted = true; - const filteredVariables = this.variables - .filter(({ key, value }) => key !== '' && value !== '') - .map(({ variable_type, key, value }) => ({ - variable_type, - key, - secret_value: value, - })); return axios .post(this.pipelinesPath, { // send shortName as fall back for query params // https://gitlab.com/gitlab-org/gitlab/-/issues/287815 ref: this.refValue.fullName || this.refShortName, - variables_attributes: filteredVariables, + variables_attributes: filterVariables(this.variables), }) .then(({ data }) => { redirectTo(`${this.pipelinesPath}/${data.id}`); diff --git a/app/assets/javascripts/pipeline_new/utils/filter_variables.js b/app/assets/javascripts/pipeline_new/utils/filter_variables.js new file mode 100644 index 00000000000..57ce3d13a9a --- /dev/null +++ b/app/assets/javascripts/pipeline_new/utils/filter_variables.js @@ -0,0 +1,13 @@ +// We need to filter out blank variables +// and filter out variables that have no key +// before sending to the API to create a pipeline. + +export default (variables) => { + return variables + .filter(({ key }) => key !== '') + .map(({ variable_type, key, value }) => ({ + variable_type, + key, + secret_value: value, + })); +}; |