From 9b1b702f0fc3820e13fd3810bf096687d3378dc5 Mon Sep 17 00:00:00 2001 From: GitLab Bot Date: Wed, 13 Jan 2021 15:10:40 +0000 Subject: [PATCH] Add latest changes from gitlab-org/gitlab@master --- Gemfile | 2 +- Gemfile.lock | 8 +- .../blob/file_template_selector.js | 2 + .../template_selectors/license_selector.js | 1 + .../boards/components/board_card_layout.vue | 4 +- .../deprecated_jquery_dropdown/gl_dropdown.js | 1 + .../editor/extensions/editor_ci_schema_ext.js | 10 +- .../javascripts/ide/stores/actions/file.js | 21 ++- .../incidents_settings/constants.js | 2 +- .../javascripts/issue_show/components/app.vue | 7 +- .../fields/description_template.vue | 11 +- .../issue_show/components/form.vue | 11 +- app/assets/javascripts/issue_show/issue.js | 1 + .../javascripts/issue_show/stores/index.js | 2 +- .../components/lint/ci_lint.vue | 15 +- .../components/lint/ci_lint_results_value.vue | 2 +- .../mutations/lint_ci.mutation.graphql | 2 +- .../pipeline_editor/graphql/resolvers.js | 2 +- .../pipeline_editor/pipeline_editor_app.vue | 36 ++-- ...ipeline_stages_connection.fragment.graphql | 13 ++ .../templates/issuable_template_selector.js | 23 +-- .../page_bundles/oncall_schedules.scss | 8 +- .../projects/templates_controller.rb | 6 +- app/finders/license_template_finder.rb | 1 + app/helpers/blob_helper.rb | 2 +- .../issuables_description_templates_helper.rb | 66 +++++++ app/helpers/issuables_helper.rb | 48 +---- .../concerns/can_housekeep_repository.rb | 23 +++ app/models/license_template.rb | 21 ++- app/models/project.rb | 17 +- app/services/merge_requests/merge_service.rb | 8 +- .../projects/_service_desk_settings.html.haml | 2 +- app/views/projects/edit.html.haml | 11 +- .../form/_template_selector.html.haml | 4 +- .../shared/issuable/form/_title.html.haml | 2 +- app/workers/all_queues.yml | 4 +- ...daily_build_group_report_results_worker.rb | 2 + .../coverage_report_worker.rb | 2 + .../21686_persist_squash_commit_sha.yml | 5 + .../292498-webide-switch-before-closing.yml | 5 + .../track-ci-template-usage-by-default.yml | 5 + .../unreleased/yo-master-patch-52337.yml | 5 + ...persist_squash_commit_sha_for_squashes.yml | 8 - ...ata_track_ci_templates_unique_projects.yml | 2 +- danger/roulette/Dangerfile | 3 +- doc/development/feature_flags/process.md | 27 +++ doc/development/features_inside_dot_gitlab.md | 4 +- .../incident_management/incidents.md | 2 +- doc/user/group/index.md | 3 + doc/user/project/description_templates.md | 100 ++++++---- doc/user/project/issues/index.md | 2 +- doc/user/project/static_site_editor/index.md | 2 +- lib/api/project_templates.rb | 7 +- lib/gitlab/template/base_template.rb | 21 ++- lib/gitlab/template/issue_template.rb | 4 + lib/gitlab/template/merge_request_template.rb | 4 + locale/gitlab.pot | 12 +- scripts/verify-tff-mapping | 4 +- .../projects/templates_controller_spec.rb | 6 +- spec/features/issues/issue_state_spec.rb | 4 +- .../releases/user_creates_release_spec.rb | 2 +- .../editor/editor_ci_schema_ext_spec.js | 15 +- spec/frontend/ide/stores/actions/file_spec.js | 12 +- .../__snapshots__/alerts_form_spec.js.snap | 2 +- .../issue_show/components/app_spec.js | 4 +- .../fields/description_template_spec.js | 7 +- .../issue_show/components/form_spec.js | 7 +- spec/frontend/issue_show/mock_data.js | 1 + .../components/lint/ci_lint_spec.js | 15 ++ .../__snapshots__/resolvers_spec.js.snap | 4 +- spec/frontend/pipeline_editor/mock_data.js | 31 +++- .../pipeline_editor_app_spec.js | 94 ++++++---- ...ables_description_templates_helper_spec.rb | 43 +++++ spec/helpers/issuables_helper_spec.rb | 1 + spec/models/license_template_spec.rb | 2 +- spec/models/project_spec.rb | 53 +----- .../merge_requests/merge_service_spec.rb | 12 -- ...e_description_templates_shared_examples.rb | 49 +++++ ...an_housekeep_repository_shared_examples.rb | 45 +++++ .../lib/tooling/test_file_finder_spec.rb | 175 ------------------ tooling/lib/tooling/test_file_finder.rb | 94 ---------- 81 files changed, 691 insertions(+), 615 deletions(-) create mode 100644 app/helpers/issuables_description_templates_helper.rb create mode 100644 app/models/concerns/can_housekeep_repository.rb create mode 100644 changelogs/unreleased/21686_persist_squash_commit_sha.yml create mode 100644 changelogs/unreleased/292498-webide-switch-before-closing.yml create mode 100644 changelogs/unreleased/track-ci-template-usage-by-default.yml create mode 100644 changelogs/unreleased/yo-master-patch-52337.yml delete mode 100644 config/feature_flags/development/persist_squash_commit_sha_for_squashes.yml create mode 100644 spec/helpers/issuables_description_templates_helper_spec.rb create mode 100644 spec/support/shared_examples/helpers/issuable_description_templates_shared_examples.rb create mode 100644 spec/support/shared_examples/models/concerns/can_housekeep_repository_shared_examples.rb delete mode 100644 spec/tooling/lib/tooling/test_file_finder_spec.rb delete mode 100644 tooling/lib/tooling/test_file_finder.rb diff --git a/Gemfile b/Gemfile index 768d28fa9b2..d091e51f931 100644 --- a/Gemfile +++ b/Gemfile @@ -309,7 +309,7 @@ gem 'pg_query', '~> 1.3.0' gem 'premailer-rails', '~> 1.10.3' # LabKit: Tracing and Correlation -gem 'gitlab-labkit', '0.13.5' +gem 'gitlab-labkit', '0.14.0' # I18n gem 'ruby_parser', '~> 3.15', require: false diff --git a/Gemfile.lock b/Gemfile.lock index a39a504e34b..af8c1d5b50f 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -432,9 +432,9 @@ GEM fog-json (~> 1.2.0) mime-types ms_rest_azure (~> 0.12.0) - gitlab-labkit (0.13.5) - actionpack (>= 5.0.0, < 6.1.0) - activesupport (>= 5.0.0, < 6.1.0) + gitlab-labkit (0.14.0) + actionpack (>= 5.0.0, < 7.0.0) + activesupport (>= 5.0.0, < 7.0.0) gitlab-pg_query (~> 1.3) grpc (~> 1.19) jaeger-client (~> 1.1) @@ -1363,7 +1363,7 @@ DEPENDENCIES gitlab-chronic (~> 0.10.5) gitlab-experiment (~> 0.4.4) gitlab-fog-azure-rm (~> 1.0) - gitlab-labkit (= 0.13.5) + gitlab-labkit (= 0.14.0) gitlab-license (~> 1.0) gitlab-mail_room (~> 0.0.8) gitlab-markup (~> 1.7.1) diff --git a/app/assets/javascripts/blob/file_template_selector.js b/app/assets/javascripts/blob/file_template_selector.js index 2532aeea989..a5c8050b772 100644 --- a/app/assets/javascripts/blob/file_template_selector.js +++ b/app/assets/javascripts/blob/file_template_selector.js @@ -66,6 +66,8 @@ export default class FileTemplateSelector { reportSelectionName(options) { const opts = options; opts.query = options.selectedObj.name; + opts.data = options.selectedObj; + opts.data.source_template_project_id = options.selectedObj.project_id; this.reportSelection(opts); } diff --git a/app/assets/javascripts/blob/template_selectors/license_selector.js b/app/assets/javascripts/blob/template_selectors/license_selector.js index affa20997e9..7e32ede96df 100644 --- a/app/assets/javascripts/blob/template_selectors/license_selector.js +++ b/app/assets/javascripts/blob/template_selectors/license_selector.js @@ -30,6 +30,7 @@ export default class BlobLicenseSelector extends FileTemplateSelector { const data = { project: this.$dropdown.data('project'), fullname: this.$dropdown.data('fullname'), + source_template_project_id: query.project_id, }; this.reportSelection({ diff --git a/app/assets/javascripts/boards/components/board_card_layout.vue b/app/assets/javascripts/boards/components/board_card_layout.vue index 350d709abfd..8b0265237ba 100644 --- a/app/assets/javascripts/boards/components/board_card_layout.vue +++ b/app/assets/javascripts/boards/components/board_card_layout.vue @@ -4,7 +4,7 @@ import IssueCardInnerDeprecated from './issue_card_inner_deprecated.vue'; import boardsStore from '../stores/boards_store'; export default { - name: 'BoardsIssueCard', + name: 'BoardCardLayout', components: { IssueCardInner: gon.features?.graphqlBoardLists ? IssueCardInner : IssueCardInnerDeprecated, }, @@ -81,7 +81,7 @@ export default { :data-issue-iid="issue.iid" :data-issue-path="issue.referencePath" data-testid="board_card" - class="board-card p-3 rounded" + class="board-card gl-p-5 gl-rounded-base" @mousedown="mouseDown" @mousemove="mouseMove" @mouseup="showIssue($event)" diff --git a/app/assets/javascripts/deprecated_jquery_dropdown/gl_dropdown.js b/app/assets/javascripts/deprecated_jquery_dropdown/gl_dropdown.js index 99351231520..98858f20518 100644 --- a/app/assets/javascripts/deprecated_jquery_dropdown/gl_dropdown.js +++ b/app/assets/javascripts/deprecated_jquery_dropdown/gl_dropdown.js @@ -437,6 +437,7 @@ export class GitLabDropdown { groupName = el.data('group'); if (groupName) { selectedIndex = el.data('index'); + this.selectedIndex = selectedIndex; selectedObject = this.renderedData[groupName][selectedIndex]; } else { selectedIndex = el.closest('li').index(); diff --git a/app/assets/javascripts/editor/extensions/editor_ci_schema_ext.js b/app/assets/javascripts/editor/extensions/editor_ci_schema_ext.js index 05d938c57ce..eb47c20912e 100644 --- a/app/assets/javascripts/editor/extensions/editor_ci_schema_ext.js +++ b/app/assets/javascripts/editor/extensions/editor_ci_schema_ext.js @@ -17,15 +17,21 @@ export class CiSchemaExtension extends EditorLiteExtension { * @param {String?} opts.ref - Current ref. Defaults to master */ registerCiSchema({ projectNamespace, projectPath, ref = 'master' } = {}) { - const ciSchemaUri = Api.buildUrl(Api.projectFileSchemaPath) + const ciSchemaPath = Api.buildUrl(Api.projectFileSchemaPath) .replace(':namespace_path', projectNamespace) .replace(':project_path', projectPath) .replace(':ref', ref) .replace(':filename', EXTENSION_CI_SCHEMA_FILE_NAME_MATCH); + // In order for workers loaded from `data://` as the + // ones loaded by monaco editor, we use absolute URLs + // to fetch schema files, hence the `gon.gitlab_url` + // reference. This prevents error: + // "Failed to execute 'fetch' on 'WorkerGlobalScope'" + const absoluteSchemaUrl = gon.gitlab_url + ciSchemaPath; const modelFileName = this.getModel().uri.path.split('/').pop(); registerSchema({ - uri: ciSchemaUri, + uri: absoluteSchemaUrl, fileMatch: [modelFileName], }); } diff --git a/app/assets/javascripts/ide/stores/actions/file.js b/app/assets/javascripts/ide/stores/actions/file.js index 004e38b0a25..42668dec63a 100644 --- a/app/assets/javascripts/ide/stores/actions/file.js +++ b/app/assets/javascripts/ide/stores/actions/file.js @@ -17,15 +17,8 @@ export const closeFile = ({ commit, state, dispatch, getters }, file) => { const indexOfClosedFile = state.openFiles.findIndex((f) => f.key === file.key); const fileWasActive = file.active; - if (file.pending) { - commit(types.REMOVE_PENDING_TAB, file); - } else { - commit(types.TOGGLE_FILE_OPEN, path); - commit(types.SET_FILE_ACTIVE, { path, active: false }); - } - - if (state.openFiles.length > 0 && fileWasActive) { - const nextIndexToOpen = indexOfClosedFile === 0 ? 0 : indexOfClosedFile - 1; + if (state.openFiles.length > 1 && fileWasActive) { + const nextIndexToOpen = indexOfClosedFile === 0 ? 1 : indexOfClosedFile - 1; const nextFileToOpen = state.openFiles[nextIndexToOpen]; if (nextFileToOpen.pending) { @@ -35,14 +28,22 @@ export const closeFile = ({ commit, state, dispatch, getters }, file) => { keyPrefix: nextFileToOpen.staged ? 'staged' : 'unstaged', }); } else { + dispatch('setFileActive', nextFileToOpen.path); dispatch('router/push', getters.getUrlForPath(nextFileToOpen.path), { root: true }); } - } else if (!state.openFiles.length) { + } else if (state.openFiles.length === 1) { dispatch('router/push', `/project/${state.currentProjectId}/tree/${state.currentBranchId}/`, { root: true, }); } + if (file.pending) { + commit(types.REMOVE_PENDING_TAB, file); + } else { + commit(types.TOGGLE_FILE_OPEN, path); + commit(types.SET_FILE_ACTIVE, { path, active: false }); + } + eventHub.$emit(`editor.update.model.dispose.${file.key}`); }; diff --git a/app/assets/javascripts/incidents_settings/constants.js b/app/assets/javascripts/incidents_settings/constants.js index fcac9c519c2..818af4ecb90 100644 --- a/app/assets/javascripts/incidents_settings/constants.js +++ b/app/assets/javascripts/incidents_settings/constants.js @@ -51,7 +51,7 @@ export const NO_ISSUE_TEMPLATE_SELECTED = { key: '', name: __('No template selec export const TAKING_INCIDENT_ACTION_DOCS_LINK = '/help/operations/metrics/alerts#trigger-actions-from-alerts'; export const ISSUE_TEMPLATES_DOCS_LINK = - '/help/user/project/description_templates#creating-issue-templates'; + '/help/user/project/description_templates#create-an-issue-template'; /* PagerDuty integration settings constants */ diff --git a/app/assets/javascripts/issue_show/components/app.vue b/app/assets/javascripts/issue_show/components/app.vue index d569ad573a2..87dc31e6292 100644 --- a/app/assets/javascripts/issue_show/components/app.vue +++ b/app/assets/javascripts/issue_show/components/app.vue @@ -132,6 +132,10 @@ export default { type: String, required: true, }, + projectId: { + type: Number, + required: true, + }, projectNamespace: { type: String, required: true, @@ -303,7 +307,7 @@ export default { }); }, - updateAndShowForm(templates = []) { + updateAndShowForm(templates = {}) { if (!this.showForm) { this.showForm = true; this.store.setFormState({ @@ -419,6 +423,7 @@ export default { :markdown-docs-path="markdownDocsPath" :markdown-preview-path="markdownPreviewPath" :project-path="projectPath" + :project-id="projectId" :project-namespace="projectNamespace" :show-delete-button="showDeleteButton" :can-attach-file="canAttachFile" diff --git a/app/assets/javascripts/issue_show/components/fields/description_template.vue b/app/assets/javascripts/issue_show/components/fields/description_template.vue index 71299381aae..f23bb394683 100644 --- a/app/assets/javascripts/issue_show/components/fields/description_template.vue +++ b/app/assets/javascripts/issue_show/components/fields/description_template.vue @@ -13,14 +13,18 @@ export default { required: true, }, issuableTemplates: { - type: Array, + type: Object, required: false, - default: () => [], + default: () => {}, }, projectPath: { type: String, required: true, }, + projectId: { + type: Number, + required: true, + }, projectNamespace: { type: String, required: true, @@ -48,11 +52,12 @@ export default {