From b1928c08f1642be0f66f6fa2587177b95a1cedc1 Mon Sep 17 00:00:00 2001 From: GitLab Bot Date: Thu, 13 Oct 2022 18:10:20 +0000 Subject: Add latest changes from gitlab-org/gitlab@master --- .gitlab-ci.yml | 8 + .gitlab/ci/_skip.yml | 2 +- .gitlab/ci/docs.gitlab-ci.yml | 2 +- .gitlab/ci/frontend.gitlab-ci.yml | 6 +- .gitlab/ci/global.gitlab-ci.yml | 2 +- .gitlab/ci/notify.gitlab-ci.yml | 2 +- .gitlab/ci/releases.gitlab-ci.yml | 2 +- .gitlab/ci/review-apps/main.gitlab-ci.yml | 2 +- .gitlab/ci/setup.gitlab-ci.yml | 6 +- .gitlab/ci/test-metadata.gitlab-ci.yml | 2 +- .gitlab/ci/workhorse.gitlab-ci.yml | 2 +- .../content_editor/extensions/suggestions.js | 10 +- .../pipeline_new/components/pipeline_new_form.vue | 252 ++++++++++----------- .../mutations/create_pipeline.mutation.graphql | 9 + .../graphql/queries/ci_config_variables.graphql | 11 + .../javascripts/pipeline_new/graphql/resolvers.js | 29 +++ app/assets/javascripts/pipeline_new/index.js | 14 +- .../components/pipeline_schedules.vue | 85 ++++++- .../table/cells/pipeline_schedule_actions.vue | 2 + .../components/table/pipeline_schedules_table.vue | 5 +- .../delete_pipeline_schedule.mutation.graphql | 6 + .../filtered_search_bar_root.vue | 5 + .../components/work_item_links/work_item_links.vue | 2 +- .../mutations/ci/project_ci_cd_settings_update.rb | 11 +- app/graphql/types/ci/ci_cd_setting_type.rb | 11 +- app/helpers/markup_helper.rb | 55 +---- app/models/members/member_role.rb | 11 +- app/views/projects/pipelines/new.html.haml | 1 + .../development/ci_inbound_job_token_scope.yml | 8 + ...task_note_rename_background_migration_values.rb | 72 ++++++ db/schema_migrations/20221006172302 | 1 + doc/api/graphql/reference/index.md | 9 +- doc/ci/pipelines/cicd_minutes.md | 2 + doc/development/pipelines.md | 24 +- doc/user/clusters/agent/work_with_agent.md | 4 +- lib/banzai/filter/truncate_visible_filter.rb | 69 ++++++ lib/banzai/pipeline/post_process_pipeline.rb | 1 + locale/gitlab.pot | 9 + .../components/pipeline_new_form_spec.js | 242 ++++++++++---------- spec/frontend/pipeline_new/mock_data.js | 59 +++++ .../components/pipeline_schedules_spec.js | 102 ++++++++- .../table/cells/pipeline_schedule_actions_spec.js | 15 +- spec/frontend/pipeline_schedules/mock_data.js | 11 + spec/helpers/markup_helper_spec.rb | 60 ----- .../banzai/filter/truncate_visible_filter_spec.rb | 128 +++++++++++ ...note_rename_background_migration_values_spec.rb | 143 ++++++++++++ spec/models/member_spec.rb | 8 +- spec/models/members/member_role_spec.rb | 34 ++- spec/policies/project_policy_spec.rb | 44 ++++ spec/requests/api/graphql/ci/ci_cd_setting_spec.rb | 2 + .../ci/project_ci_cd_settings_update_spec.rb | 47 +++- 51 files changed, 1226 insertions(+), 423 deletions(-) create mode 100644 app/assets/javascripts/pipeline_new/graphql/mutations/create_pipeline.mutation.graphql create mode 100644 app/assets/javascripts/pipeline_new/graphql/queries/ci_config_variables.graphql create mode 100644 app/assets/javascripts/pipeline_new/graphql/resolvers.js create mode 100644 app/assets/javascripts/pipeline_schedules/graphql/mutations/delete_pipeline_schedule.mutation.graphql create mode 100644 config/feature_flags/development/ci_inbound_job_token_scope.yml create mode 100644 db/post_migrate/20221006172302_adjust_task_note_rename_background_migration_values.rb create mode 100644 db/schema_migrations/20221006172302 create mode 100644 lib/banzai/filter/truncate_visible_filter.rb create mode 100644 spec/lib/banzai/filter/truncate_visible_filter_spec.rb create mode 100644 spec/migrations/adjust_task_note_rename_background_migration_values_spec.rb diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 2b3230cbb72..13531566631 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -56,6 +56,11 @@ workflow: NOTIFY_PIPELINE_FAILURE_CHANNEL: "f_ruby3" OMNIBUS_GITLAB_RUBY3_BUILD: "true" OMNIBUS_GITLAB_CACHE_EDITION: "GITLAB_RUBY3" + # This work around https://gitlab.com/gitlab-org/gitlab/-/issues/332411 whichs prevents usage of dependency proxy + # when pipeline is triggered by a project access token. + - if: '$CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH && $GITLAB_USER_LOGIN =~ /project_\d+_bot\d*/' + variables: + GITLAB_DEPENDENCY_PROXY_ADDRESS: "" # For `$CI_DEFAULT_BRANCH` branch, create a pipeline (this includes on schedules, pushes, merges, etc.). - if: '$CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH' # For tags, create a pipeline. @@ -71,6 +76,9 @@ workflow: variables: PG_VERSION: "12" DEFAULT_CI_IMAGE: "${REGISTRY_HOST}/${REGISTRY_GROUP}/gitlab-build-images/debian-${DEBIAN_VERSION}-ruby-${RUBY_VERSION}.patched-golang-${GO_VERSION}-node-16.14-postgresql-${PG_VERSION}:rubygems-3.2-git-2.36-lfs-2.9-chrome-${CHROME_VERSION}-yarn-1.22-graphicsmagick-1.3.36" + # We set $GITLAB_DEPENDENCY_PROXY to another variable (since it's set at the group level and has higher precedence than .gitlab-ci.yml) + # so that we can override $GITLAB_DEPENDENCY_PROXY_ADDRESS in workflow rules. + GITLAB_DEPENDENCY_PROXY_ADDRESS: "${GITLAB_DEPENDENCY_PROXY}" RAILS_ENV: "test" NODE_ENV: "test" BUNDLE_WITHOUT: "production:development" diff --git a/.gitlab/ci/_skip.yml b/.gitlab/ci/_skip.yml index 27a3ff5b836..9d3745cf2f1 100644 --- a/.gitlab/ci/_skip.yml +++ b/.gitlab/ci/_skip.yml @@ -1,7 +1,7 @@ # no-op pipeline template for skipping whole child pipeline execution no-op: - image: ${GITLAB_DEPENDENCY_PROXY}alpine:latest + image: ${GITLAB_DEPENDENCY_PROXY_ADDRESS}alpine:latest stage: test variables: GIT_STRATEGY: none diff --git a/.gitlab/ci/docs.gitlab-ci.yml b/.gitlab/ci/docs.gitlab-ci.yml index 7e157171183..022f1c17a93 100644 --- a/.gitlab/ci/docs.gitlab-ci.yml +++ b/.gitlab/ci/docs.gitlab-ci.yml @@ -2,7 +2,7 @@ extends: - .default-retry - .docs:rules:review-docs - image: ${GITLAB_DEPENDENCY_PROXY}ruby:${RUBY_VERSION}-alpine + image: ${GITLAB_DEPENDENCY_PROXY_ADDRESS}ruby:${RUBY_VERSION}-alpine stage: review needs: [] variables: diff --git a/.gitlab/ci/frontend.gitlab-ci.yml b/.gitlab/ci/frontend.gitlab-ci.yml index c64704d5d49..00ac68782e6 100644 --- a/.gitlab/ci/frontend.gitlab-ci.yml +++ b/.gitlab/ci/frontend.gitlab-ci.yml @@ -301,17 +301,17 @@ coverage-frontend: qa-frontend-node:14: extends: .qa-frontend-node - image: ${GITLAB_DEPENDENCY_PROXY}node:14 + image: ${GITLAB_DEPENDENCY_PROXY_ADDRESS}node:14 qa-frontend-node:16: extends: .qa-frontend-node - image: ${GITLAB_DEPENDENCY_PROXY}node:16 + image: ${GITLAB_DEPENDENCY_PROXY_ADDRESS}node:16 qa-frontend-node:latest: extends: - .qa-frontend-node - .frontend:rules:qa-frontend-node-latest - image: ${GITLAB_DEPENDENCY_PROXY}node:latest + image: ${GITLAB_DEPENDENCY_PROXY_ADDRESS}node:latest webpack-dev-server: extends: diff --git a/.gitlab/ci/global.gitlab-ci.yml b/.gitlab/ci/global.gitlab-ci.yml index 77e17b2147f..9be5eb7bcd7 100644 --- a/.gitlab/ci/global.gitlab-ci.yml +++ b/.gitlab/ci/global.gitlab-ci.yml @@ -342,7 +342,7 @@ FOSS_ONLY: '1' .use-docker-in-docker: - image: ${GITLAB_DEPENDENCY_PROXY}docker:${DOCKER_VERSION} + image: ${GITLAB_DEPENDENCY_PROXY_ADDRESS}docker:${DOCKER_VERSION} services: - docker:${DOCKER_VERSION}-dind variables: diff --git a/.gitlab/ci/notify.gitlab-ci.yml b/.gitlab/ci/notify.gitlab-ci.yml index 95318d5ce08..c945d4dc780 100644 --- a/.gitlab/ci/notify.gitlab-ci.yml +++ b/.gitlab/ci/notify.gitlab-ci.yml @@ -1,5 +1,5 @@ .notify-slack: - image: ${GITLAB_DEPENDENCY_PROXY}alpine + image: ${GITLAB_DEPENDENCY_PROXY_ADDRESS}alpine stage: notify dependencies: [] cache: {} diff --git a/.gitlab/ci/releases.gitlab-ci.yml b/.gitlab/ci/releases.gitlab-ci.yml index 77f23814f3c..df7b07f5545 100644 --- a/.gitlab/ci/releases.gitlab-ci.yml +++ b/.gitlab/ci/releases.gitlab-ci.yml @@ -4,7 +4,7 @@ .merge-train-sync: # We don't need/want any global before/after commands, so we overwrite these # settings. - image: ${GITLAB_DEPENDENCY_PROXY}alpine:edge + image: ${GITLAB_DEPENDENCY_PROXY_ADDRESS}alpine:edge stage: sync before_script: - apk add --no-cache --update curl bash jq diff --git a/.gitlab/ci/review-apps/main.gitlab-ci.yml b/.gitlab/ci/review-apps/main.gitlab-ci.yml index 201c32741f9..d3f5d014464 100644 --- a/.gitlab/ci/review-apps/main.gitlab-ci.yml +++ b/.gitlab/ci/review-apps/main.gitlab-ci.yml @@ -32,7 +32,7 @@ review-build-cng-env: extends: - .default-retry - .review:rules:review-build-cng - image: ${GITLAB_DEPENDENCY_PROXY}ruby:3.0-alpine3.13 + image: ${GITLAB_DEPENDENCY_PROXY_ADDRESS}ruby:3.0-alpine3.13 stage: prepare needs: [] before_script: diff --git a/.gitlab/ci/setup.gitlab-ci.yml b/.gitlab/ci/setup.gitlab-ci.yml index 7f9edd1650a..e417b054cd6 100644 --- a/.gitlab/ci/setup.gitlab-ci.yml +++ b/.gitlab/ci/setup.gitlab-ci.yml @@ -30,7 +30,7 @@ cache gems: .absolutely-minimal-job: extends: - .minimal-job - image: ${GITLAB_DEPENDENCY_PROXY}alpine:edge + image: ${GITLAB_DEPENDENCY_PROXY_ADDRESS}alpine:edge variables: GIT_STRATEGY: none @@ -79,7 +79,7 @@ verify-ruby-2.7: verify-tests-yml: extends: - .setup:rules:verify-tests-yml - image: ${GITLAB_DEPENDENCY_PROXY}ruby:${RUBY_VERSION}-alpine3.13 + image: ${GITLAB_DEPENDENCY_PROXY_ADDRESS}ruby:${RUBY_VERSION}-alpine3.13 stage: test needs: [] script: @@ -116,7 +116,7 @@ generate-frontend-fixtures-mapping: detect-tests: extends: .rails:rules:detect-tests - image: ${GITLAB_DEPENDENCY_PROXY}ruby:${RUBY_VERSION} + image: ${GITLAB_DEPENDENCY_PROXY_ADDRESS}ruby:${RUBY_VERSION} needs: [] stage: prepare variables: diff --git a/.gitlab/ci/test-metadata.gitlab-ci.yml b/.gitlab/ci/test-metadata.gitlab-ci.yml index f4fa39300b6..e147305e25a 100644 --- a/.gitlab/ci/test-metadata.gitlab-ci.yml +++ b/.gitlab/ci/test-metadata.gitlab-ci.yml @@ -1,5 +1,5 @@ .tests-metadata-state: - image: ${GITLAB_DEPENDENCY_PROXY}ruby:${RUBY_VERSION} + image: ${GITLAB_DEPENDENCY_PROXY_ADDRESS}ruby:${RUBY_VERSION} before_script: - source scripts/utils.sh artifacts: diff --git a/.gitlab/ci/workhorse.gitlab-ci.yml b/.gitlab/ci/workhorse.gitlab-ci.yml index 4ed674948cf..a11d5f000cf 100644 --- a/.gitlab/ci/workhorse.gitlab-ci.yml +++ b/.gitlab/ci/workhorse.gitlab-ci.yml @@ -1,6 +1,6 @@ workhorse:verify: extends: .workhorse:rules:workhorse - image: ${GITLAB_DEPENDENCY_PROXY}golang:${GO_VERSION} + image: ${GITLAB_DEPENDENCY_PROXY_ADDRESS}golang:${GO_VERSION} stage: test needs: [] script: diff --git a/app/assets/javascripts/content_editor/extensions/suggestions.js b/app/assets/javascripts/content_editor/extensions/suggestions.js index 1b345a36c7e..b6db7f9d358 100644 --- a/app/assets/javascripts/content_editor/extensions/suggestions.js +++ b/app/assets/javascripts/content_editor/extensions/suggestions.js @@ -3,7 +3,7 @@ import { VueRenderer } from '@tiptap/vue-2'; import tippy from 'tippy.js'; import Suggestion from '@tiptap/suggestion'; import { PluginKey } from 'prosemirror-state'; -import { isFunction, uniqueId } from 'lodash'; +import { isFunction, uniqueId, memoize } from 'lodash'; import axios from '~/lib/utils/axios_utils'; import { initEmojiMap, getAllEmoji } from '~/emoji'; import SuggestionsDropdown from '../components/suggestions_dropdown.vue'; @@ -21,6 +21,10 @@ function createSuggestionPlugin({ nodeType, nodeProps = {}, }) { + const fetchData = memoize( + isFunction(dataSource) ? dataSource : async () => (await axios.get(dataSource)).data, + ); + return Suggestion({ editor, char, @@ -38,9 +42,7 @@ function createSuggestionPlugin({ if (!dataSource) return []; try { - const items = isFunction(dataSource) - ? await dataSource() - : (await axios.get(dataSource)).data; + const items = await fetchData(); return items.filter(search(query)).slice(0, limit); } catch { 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 cd7cb7f8393..a9af1181027 100644 --- a/app/assets/javascripts/pipeline_new/components/pipeline_new_form.vue +++ b/app/assets/javascripts/pipeline_new/components/pipeline_new_form.vue @@ -17,17 +17,11 @@ import { import * as Sentry from '@sentry/browser'; import { uniqueId } from 'lodash'; import Vue from 'vue'; -import axios from '~/lib/utils/axios_utils'; -import { backOff } from '~/lib/utils/common_utils'; -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, - CC_VALIDATION_REQUIRED_ERROR, -} from '../constants'; +import { VARIABLE_TYPE, FILE_TYPE, CC_VALIDATION_REQUIRED_ERROR } from '../constants'; +import createPipelineMutation from '../graphql/mutations/create_pipeline.mutation.graphql'; +import ciConfigVariablesQuery from '../graphql/queries/ci_config_variables.graphql'; import filterVariables from '../utils/filter_variables'; import RefsDropdown from './refs_dropdown.vue'; @@ -76,10 +70,6 @@ export default { type: String, required: true, }, - configVariablesPath: { - type: String, - required: true, - }, defaultBranch: { type: String, required: true, @@ -97,6 +87,10 @@ export default { required: false, default: () => ({}), }, + projectPath: { + type: String, + required: true, + }, refParam: { type: String, required: false, @@ -116,19 +110,77 @@ export default { return { refValue: { shortName: this.refParam, + // this is needed until we add support for ref type in url query strings + // ensure default branch is called with full ref on load + // https://gitlab.com/gitlab-org/gitlab/-/issues/287815 + fullName: this.refParam === this.defaultBranch ? `refs/heads/${this.refParam}` : undefined, }, form: {}, errorTitle: null, error: null, + predefinedValueOptions: {}, warnings: [], totalWarnings: 0, isWarningDismissed: false, - isLoading: false, submitted: false, ccAlertDismissed: false, }; }, + apollo: { + ciConfigVariables: { + query: ciConfigVariablesQuery, + // Skip when variables already cached in `form` + skip() { + return Object.keys(this.form).includes(this.refFullName); + }, + variables() { + return { + fullPath: this.projectPath, + ref: this.refQueryParam, + }; + }, + update({ project }) { + return project?.ciConfigVariables || []; + }, + result({ data }) { + const predefinedVars = data?.project?.ciConfigVariables || []; + const params = {}; + const descriptions = {}; + + predefinedVars.forEach(({ description, key, value, valueOptions }) => { + if (description) { + params[key] = value; + descriptions[key] = description; + this.predefinedValueOptions[key] = valueOptions; + } + }); + + Vue.set(this.form, this.refFullName, { descriptions, variables: [] }); + + // Add default variables from yml + this.setVariableParams(this.refFullName, VARIABLE_TYPE, params); + + // Add/update variables, e.g. from query string + if (this.variableParams) { + this.setVariableParams(this.refFullName, VARIABLE_TYPE, this.variableParams); + } + + if (this.fileParams) { + this.setVariableParams(this.refFullName, FILE_TYPE, this.fileParams); + } + + // Adds empty var at the end of the form + this.addEmptyVariable(this.refFullName); + }, + error(error) { + Sentry.captureException(error); + }, + }, + }, computed: { + isLoading() { + return this.$apollo.queries.ciConfigVariables.loading; + }, overMaxWarningsLimit() { return this.totalWarnings > this.maxWarnings; }, @@ -147,6 +199,9 @@ export default { refFullName() { return this.refValue.fullName; }, + refQueryParam() { + return this.refFullName || this.refShortName; + }, variables() { return this.form[this.refFullName]?.variables ?? []; }, @@ -157,21 +212,6 @@ export default { return this.error === CC_VALIDATION_REQUIRED_ERROR && !this.ccAlertDismissed; }, }, - watch: { - refValue() { - this.loadConfigVariablesForm(); - }, - }, - created() { - // this is needed until we add support for ref type in url query strings - // ensure default branch is called with full ref on load - // https://gitlab.com/gitlab-org/gitlab/-/issues/287815 - if (this.refValue.shortName === this.defaultBranch) { - this.refValue.fullName = `refs/heads/${this.refValue.shortName}`; - } - - this.loadConfigVariablesForm(); - }, methods: { addEmptyVariable(refValue) { const { variables } = this.form[refValue]; @@ -204,132 +244,57 @@ export default { }); } }, - setVariableType(key, type) { + setVariableAttribute(key, attribute, value) { const { variables } = this.form[this.refFullName]; const variable = variables.find((v) => v.key === key); - variable.variable_type = type; + variable[attribute] = value; }, setVariableParams(refValue, type, paramsObj) { Object.entries(paramsObj).forEach(([key, value]) => { this.setVariable(refValue, type, key, value); }); }, + shouldShowValuesDropdown(key) { + return this.predefinedValueOptions[key]?.length > 1; + }, removeVariable(index) { this.variables.splice(index, 1); }, canRemove(index) { return index < this.variables.length - 1; }, - loadConfigVariablesForm() { - // Skip when variables already cached in `form` - if (this.form[this.refFullName]) { - return; - } - - this.fetchConfigVariables(this.refFullName || this.refShortName) - .then(({ descriptions, params }) => { - Vue.set(this.form, this.refFullName, { - variables: [], - descriptions, - }); - - // Add default variables from yml - this.setVariableParams(this.refFullName, VARIABLE_TYPE, params); - }) - .catch(() => { - Vue.set(this.form, this.refFullName, { - variables: [], - descriptions: {}, - }); - }) - .finally(() => { - // Add/update variables, e.g. from query string - if (this.variableParams) { - this.setVariableParams(this.refFullName, VARIABLE_TYPE, this.variableParams); - } - if (this.fileParams) { - this.setVariableParams(this.refFullName, FILE_TYPE, this.fileParams); - } - - // Adds empty var at the end of the form - this.addEmptyVariable(this.refFullName); - }); - }, - fetchConfigVariables(refValue) { - this.isLoading = true; - - return backOff((next, stop) => { - axios - .get(this.configVariablesPath, { - params: { - sha: refValue, - }, - }) - .then(({ data, status }) => { - if (status === httpStatusCodes.NO_CONTENT) { - next(); - } else { - this.isLoading = false; - stop(data); - } - }) - .catch((error) => { - stop(error); - }); - }, CONFIG_VARIABLES_TIMEOUT) - .then((data) => { - const params = {}; - const descriptions = {}; - - Object.entries(data).forEach(([key, { value, description }]) => { - if (description) { - params[key] = value; - descriptions[key] = description; - } - }); - - return { params, descriptions }; - }) - .catch((error) => { - this.isLoading = false; - - Sentry.captureException(error); - - return { params: {}, descriptions: {} }; - }); - }, - createPipeline() { + async createPipeline() { this.submitted = true; this.ccAlertDismissed = false; - return axios - .post(this.pipelinesPath, { + const { data } = await this.$apollo.mutate({ + mutation: createPipelineMutation, + variables: { + endpoint: 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: filterVariables(this.variables), - }) - .then(({ data }) => { - redirectTo(`${this.pipelinesPath}/${data.id}`); - }) - .catch((err) => { - // always re-enable submit button - this.submitted = false; + ref: this.refQueryParam, + variablesAttributes: filterVariables(this.variables), + }, + }); - const { - errors = [], - warnings = [], - total_warnings: totalWarnings = 0, - } = err.response.data; - const [error] = errors; + const { id, errors, totalWarnings, warnings } = data.createPipeline; - this.reportError({ - title: i18n.submitErrorTitle, - error, - warnings, - totalWarnings, - }); - }); + if (id) { + redirectTo(`${this.pipelinesPath}/${id}`); + return; + } + + // always re-enable submit button + this.submitted = false; + const [error] = errors; + + this.reportError({ + title: i18n.submitErrorTitle, + error, + warnings, + totalWarnings, + }); }, onRefsLoadingError(error) { this.reportError({ title: i18n.refsLoadingErrorTitle }); @@ -416,7 +381,7 @@ export default { {{ $options.typeOptions[type] }} @@ -429,7 +394,24 @@ export default { data-qa-selector="ci_variable_key_field" @change="addEmptyVariable(refFullName)" /> + + + {{ value }} + + { + return axios + .post(endpoint, { ref, variables_attributes: variablesAttributes }) + .then((response) => { + const { id } = response.data; + return { + id, + errors: [], + totalWarnings: 0, + warnings: [], + }; + }) + .catch((err) => { + const { errors = [], totalWarnings = 0, warnings = [] } = err.response.data; + + return { + id: null, + errors, + totalWarnings, + warnings, + }; + }); + }, + }, +}; diff --git a/app/assets/javascripts/pipeline_new/index.js b/app/assets/javascripts/pipeline_new/index.js index e3f363f4ada..60b4c93d1d5 100644 --- a/app/assets/javascripts/pipeline_new/index.js +++ b/app/assets/javascripts/pipeline_new/index.js @@ -1,6 +1,9 @@ import Vue from 'vue'; +import VueApollo from 'vue-apollo'; +import createDefaultClient from '~/lib/graphql'; import LegacyPipelineNewForm from './components/legacy_pipeline_new_form.vue'; import PipelineNewForm from './components/pipeline_new_form.vue'; +import { resolvers } from './graphql/resolvers'; const mountLegacyPipelineNewForm = (el) => { const { @@ -51,12 +54,12 @@ const mountPipelineNewForm = (el) => { projectRefsEndpoint, // props - configVariablesPath, defaultBranch, fileParam, maxWarnings, pipelinesPath, projectId, + projectPath, refParam, settingsLink, varParam, @@ -65,22 +68,27 @@ const mountPipelineNewForm = (el) => { const variableParams = JSON.parse(varParam); const fileParams = JSON.parse(fileParam); - // TODO: add apolloProvider + Vue.use(VueApollo); + + const apolloProvider = new VueApollo({ + defaultClient: createDefaultClient(resolvers), + }); return new Vue({ el, + apolloProvider, provide: { projectRefsEndpoint, }, render(createElement) { return createElement(PipelineNewForm, { props: { - configVariablesPath, defaultBranch, fileParams, maxWarnings: Number(maxWarnings), pipelinesPath, projectId, + projectPath, refParam, settingsLink, variableParams, diff --git a/app/assets/javascripts/pipeline_schedules/components/pipeline_schedules.vue b/app/assets/javascripts/pipeline_schedules/components/pipeline_schedules.vue index 3e49aeb808e..4a08a82275a 100644 --- a/app/assets/javascripts/pipeline_schedules/components/pipeline_schedules.vue +++ b/app/assets/javascripts/pipeline_schedules/components/pipeline_schedules.vue @@ -1,16 +1,35 @@