diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2022-01-12 15:14:10 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2022-01-12 15:14:10 +0300 |
commit | da646aac6c559584f63d1fc06132d7351abcfac6 (patch) | |
tree | e6e17878b47c081dcd7e161e9bfc3bacd535c8a6 /app | |
parent | 612dd7d31ab927dd79968a6be7cb36599291bace (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app')
18 files changed, 109 insertions, 52 deletions
diff --git a/app/assets/javascripts/behaviors/markdown/render_sandboxed_mermaid.js b/app/assets/javascripts/behaviors/markdown/render_sandboxed_mermaid.js index 92cdd1c600f..b9e4c7b68b0 100644 --- a/app/assets/javascripts/behaviors/markdown/render_sandboxed_mermaid.js +++ b/app/assets/javascripts/behaviors/markdown/render_sandboxed_mermaid.js @@ -31,6 +31,7 @@ const MAX_CHAR_LIMIT = 2000; const MAX_MERMAID_BLOCK_LIMIT = 50; // Max # of `&` allowed in Chaining of links syntax const MAX_CHAINING_OF_LINKS_LIMIT = 30; +const BUFFER_IFRAME_HEIGHT = 10; // Keep a map of mermaid blocks we've already rendered. const elsProcessingMap = new WeakMap(); let renderedMermaidBlocks = 0; @@ -117,9 +118,9 @@ function renderMermaidEl(el, source) { if (event.origin !== 'null' || event.source !== iframeEl.contentWindow) { return; } - const { h, w } = event.data; - iframeEl.width = w; - iframeEl.height = h; + const { h } = event.data; + iframeEl.width = '100%'; + iframeEl.height = `${h + BUFFER_IFRAME_HEIGHT}px`; }, false, ); diff --git a/app/assets/javascripts/integrations/edit/components/dynamic_field.vue b/app/assets/javascripts/integrations/edit/components/dynamic_field.vue index 258cd1bf365..4b0579a5beb 100644 --- a/app/assets/javascripts/integrations/edit/components/dynamic_field.vue +++ b/app/assets/javascripts/integrations/edit/components/dynamic_field.vue @@ -153,7 +153,7 @@ export default { :invalid-feedback="__('This field is required.')" :state="valid" > - <template #description> + <template v-if="!isCheckbox" #description> <span v-safe-html:[$options.helpHtmlConfig]="help"></span> </template> @@ -161,6 +161,9 @@ export default { <input :name="fieldName" type="hidden" :value="model || false" /> <gl-form-checkbox :id="fieldId" v-model="model" :disabled="isInheriting"> {{ checkboxLabel || humanizedTitle }} + <template #help> + <span v-safe-html:[$options.helpHtmlConfig]="help"></span> + </template> </gl-form-checkbox> </template> <template v-else-if="isSelect"> diff --git a/app/assets/javascripts/main.js b/app/assets/javascripts/main.js index e221a54d9c6..376134afef0 100644 --- a/app/assets/javascripts/main.js +++ b/app/assets/javascripts/main.js @@ -101,6 +101,21 @@ function deferredInitialisation() { initFeatureHighlight(); initCopyCodeButton(); + const helpToggle = document.querySelector('.header-help-dropdown-toggle'); + if (helpToggle) { + helpToggle.addEventListener( + 'click', + () => { + import(/* webpackChunkName: 'versionCheck' */ './gitlab_version_check') + .then(({ default: initGitlabVersionCheck }) => { + initGitlabVersionCheck(); + }) + .catch(() => {}); + }, + { once: true }, + ); + } + const search = document.querySelector('#search'); if (search) { search.addEventListener( diff --git a/app/assets/javascripts/packages_and_registries/container_registry/explorer/components/details_page/details_header.vue b/app/assets/javascripts/packages_and_registries/container_registry/explorer/components/details_page/details_header.vue index d988ad8d8ca..29c181f04fb 100644 --- a/app/assets/javascripts/packages_and_registries/container_registry/explorer/components/details_page/details_header.vue +++ b/app/assets/javascripts/packages_and_registries/container_registry/explorer/components/details_page/details_header.vue @@ -143,6 +143,7 @@ export default { </template> <template #right-actions> <gl-dropdown + v-if="!deleteButtonDisabled" icon="ellipsis_v" text="More actions" :text-sr-only="true" @@ -150,11 +151,7 @@ export default { no-caret right > - <gl-dropdown-item - variant="danger" - :disabled="deleteButtonDisabled" - @click="$emit('delete')" - > + <gl-dropdown-item variant="danger" @click="$emit('delete')"> {{ __('Delete image repository') }} </gl-dropdown-item> </gl-dropdown> diff --git a/app/assets/javascripts/repository/components/blob_controls.vue b/app/assets/javascripts/repository/components/blob_controls.vue index 4041315f5ec..bde1b217ec9 100644 --- a/app/assets/javascripts/repository/components/blob_controls.vue +++ b/app/assets/javascripts/repository/components/blob_controls.vue @@ -63,19 +63,25 @@ export default { }, computed: { filePath() { - const { path } = this.$route.params; - updateElementsVisibility('.tree-controls', !path); - return path; + return this.$route.params.path; + }, + showBlobControls() { + return this.filePath && this.$route.name === 'blobPathDecoded'; }, blobInfo() { return this.project?.repository?.blobs?.nodes[0] || {}; }, }, + watch: { + showBlobControls(shouldShow) { + updateElementsVisibility('.tree-controls', !shouldShow); + }, + }, }; </script> <template> - <div v-if="filePath"> + <div v-if="showBlobControls"> <gl-button data-testid="find" :href="blobInfo.findFilePath" :class="$options.buttonClassList"> {{ $options.i18n.findFile }} </gl-button> diff --git a/app/assets/stylesheets/framework/header.scss b/app/assets/stylesheets/framework/header.scss index 44b099fc873..68535badd78 100644 --- a/app/assets/stylesheets/framework/header.scss +++ b/app/assets/stylesheets/framework/header.scss @@ -150,7 +150,7 @@ $top-nav-hover-bg: var(--indigo-900-alpha-008, $indigo-900-alpha-008) !important } li { - .badge.badge-pill:not(.merge-request-badge) { + .badge.badge-pill:not(.merge-request-badge):not(.version-check-badge) { box-shadow: none; font-weight: $gl-font-weight-bold; } @@ -417,7 +417,7 @@ $top-nav-hover-bg: var(--indigo-900-alpha-008, $indigo-900-alpha-008) !important .title-container, .navbar-nav { - .badge.badge-pill:not(.merge-request-badge) { + .badge.badge-pill:not(.merge-request-badge):not(.version-check-badge) { position: inherit; font-weight: $gl-font-weight-normal; margin-left: -6px; diff --git a/app/assets/stylesheets/startup/startup-dark.scss b/app/assets/stylesheets/startup/startup-dark.scss index fb96c23517c..96dee4a3da1 100644 --- a/app/assets/stylesheets/startup/startup-dark.scss +++ b/app/assets/stylesheets/startup/startup-dark.scss @@ -837,7 +837,7 @@ input { .container-fluid .navbar-nav li - .badge.badge-pill:not(.merge-request-badge) { + .badge.badge-pill:not(.merge-request-badge):not(.version-check-badge) { box-shadow: none; font-weight: 600; } @@ -920,8 +920,10 @@ input { line-height: 18px; margin: 4px 0 4px 2px; } -.title-container .badge.badge-pill:not(.merge-request-badge), -.navbar-nav .badge.badge-pill:not(.merge-request-badge) { +.title-container + .badge.badge-pill:not(.merge-request-badge):not(.version-check-badge), +.navbar-nav + .badge.badge-pill:not(.merge-request-badge):not(.version-check-badge) { position: inherit; font-weight: 400; margin-left: -6px; @@ -932,17 +934,22 @@ input { border-radius: 7px; box-shadow: 0 1px 0 rgba(76, 78, 84, 0.2); } -.title-container .badge.badge-pill:not(.merge-request-badge).green-badge, -.navbar-nav .badge.badge-pill:not(.merge-request-badge).green-badge { +.title-container + .badge.badge-pill:not(.merge-request-badge):not(.version-check-badge).green-badge, +.navbar-nav + .badge.badge-pill:not(.merge-request-badge):not(.version-check-badge).green-badge { background-color: var(--green-400, #108548); } .title-container - .badge.badge-pill:not(.merge-request-badge).merge-requests-count, -.navbar-nav .badge.badge-pill:not(.merge-request-badge).merge-requests-count { + .badge.badge-pill:not(.merge-request-badge):not(.version-check-badge).merge-requests-count, +.navbar-nav + .badge.badge-pill:not(.merge-request-badge):not(.version-check-badge).merge-requests-count { background-color: var(--orange-400, #ab6100); } -.title-container .badge.badge-pill:not(.merge-request-badge).todos-count, -.navbar-nav .badge.badge-pill:not(.merge-request-badge).todos-count { +.title-container + .badge.badge-pill:not(.merge-request-badge):not(.version-check-badge).todos-count, +.navbar-nav + .badge.badge-pill:not(.merge-request-badge):not(.version-check-badge).todos-count { background-color: var(--blue-400, #1f75cb); } .title-container .canary-badge .badge, diff --git a/app/assets/stylesheets/startup/startup-general.scss b/app/assets/stylesheets/startup/startup-general.scss index 8d3c0fbb485..2f79c86cdc6 100644 --- a/app/assets/stylesheets/startup/startup-general.scss +++ b/app/assets/stylesheets/startup/startup-general.scss @@ -818,7 +818,7 @@ input { .container-fluid .navbar-nav li - .badge.badge-pill:not(.merge-request-badge) { + .badge.badge-pill:not(.merge-request-badge):not(.version-check-badge) { box-shadow: none; font-weight: 600; } @@ -901,8 +901,10 @@ input { line-height: 18px; margin: 4px 0 4px 2px; } -.title-container .badge.badge-pill:not(.merge-request-badge), -.navbar-nav .badge.badge-pill:not(.merge-request-badge) { +.title-container + .badge.badge-pill:not(.merge-request-badge):not(.version-check-badge), +.navbar-nav + .badge.badge-pill:not(.merge-request-badge):not(.version-check-badge) { position: inherit; font-weight: 400; margin-left: -6px; @@ -913,17 +915,22 @@ input { border-radius: 7px; box-shadow: 0 1px 0 rgba(76, 78, 84, 0.2); } -.title-container .badge.badge-pill:not(.merge-request-badge).green-badge, -.navbar-nav .badge.badge-pill:not(.merge-request-badge).green-badge { +.title-container + .badge.badge-pill:not(.merge-request-badge):not(.version-check-badge).green-badge, +.navbar-nav + .badge.badge-pill:not(.merge-request-badge):not(.version-check-badge).green-badge { background-color: var(--green-400, #2da160); } .title-container - .badge.badge-pill:not(.merge-request-badge).merge-requests-count, -.navbar-nav .badge.badge-pill:not(.merge-request-badge).merge-requests-count { + .badge.badge-pill:not(.merge-request-badge):not(.version-check-badge).merge-requests-count, +.navbar-nav + .badge.badge-pill:not(.merge-request-badge):not(.version-check-badge).merge-requests-count { background-color: var(--orange-400, #c17d10); } -.title-container .badge.badge-pill:not(.merge-request-badge).todos-count, -.navbar-nav .badge.badge-pill:not(.merge-request-badge).todos-count { +.title-container + .badge.badge-pill:not(.merge-request-badge):not(.version-check-badge).todos-count, +.navbar-nav + .badge.badge-pill:not(.merge-request-badge):not(.version-check-badge).todos-count { background-color: var(--blue-400, #428fdc); } .title-container .canary-badge .badge, diff --git a/app/controllers/registrations_controller.rb b/app/controllers/registrations_controller.rb index bd7631c7e78..79c4f9a0260 100644 --- a/app/controllers/registrations_controller.rb +++ b/app/controllers/registrations_controller.rb @@ -13,6 +13,9 @@ class RegistrationsController < Devise::RegistrationsController before_action :ensure_destroy_prerequisites_met, only: [:destroy] before_action :load_recaptcha, only: :new before_action :set_invite_params, only: :new + before_action only: [:create] do + check_rate_limit!(:user_sign_up, scope: request.ip) if Feature.enabled?(:rate_limit_user_sign_up_endpoint, default_enabled: :yaml) + end feature_category :authentication_and_authorization diff --git a/app/helpers/commits_helper.rb b/app/helpers/commits_helper.rb index 4256a24bc16..43e727ac483 100644 --- a/app/helpers/commits_helper.rb +++ b/app/helpers/commits_helper.rb @@ -27,10 +27,12 @@ module CommitsHelper end def commit_to_html(commit, ref, project) - render 'projects/commits/commit.html', - commit: commit, - ref: ref, - project: project + render partial: 'projects/commits/commit', formats: :html, + locals: { + commit: commit, + ref: ref, + project: project + } end # Breadcrumb links for a Project and, if applicable, a tree path diff --git a/app/models/ci/build.rb b/app/models/ci/build.rb index 5bd2b4371da..fdcb877dcab 100644 --- a/app/models/ci/build.rb +++ b/app/models/ci/build.rb @@ -268,6 +268,10 @@ module Ci !build.any_unmet_prerequisites? # If false is returned, it stops the transition end + before_transition on: :enqueue do |build| + !build.waiting_for_deployment_approval? # If false is returned, it stops the transition + end + after_transition created: :scheduled do |build| build.run_after_commit do Ci::BuildScheduleWorker.perform_at(build.scheduled_at, build.id) @@ -424,7 +428,7 @@ module Ci end def playable? - action? && !archived? && (manual? || scheduled? || retryable?) + action? && !archived? && (manual? || scheduled? || retryable?) && !waiting_for_deployment_approval? end def waiting_for_deployment_approval? diff --git a/app/models/ci/pipeline.rb b/app/models/ci/pipeline.rb index b1568bbbb06..d11304e5285 100644 --- a/app/models/ci/pipeline.rb +++ b/app/models/ci/pipeline.rb @@ -467,15 +467,11 @@ module Ci end def tags_count - if tag_counts_enabled? - ActsAsTaggableOn::Tagging.where(taggable: builds).count - end + ActsAsTaggableOn::Tagging.where(taggable: builds).count end def distinct_tags_count - if tag_counts_enabled? - ActsAsTaggableOn::Tagging.where(taggable: builds).count('distinct(tag_id)') - end + ActsAsTaggableOn::Tagging.where(taggable: builds).count('distinct(tag_id)') end def stages_names @@ -1352,12 +1348,6 @@ module Ci ::Gitlab::Ci::PipelineObjectHierarchy .new(self.class.unscoped.where(id: id), options: options) end - - def tag_counts_enabled? - strong_memoize(:tag_counts_enabled) do - ::Feature.enabled?(:ci_pipeline_logger_tags_count, project, default_enabled: :yaml) - end - end end end diff --git a/app/models/deployment.rb b/app/models/deployment.rb index 453c6bce362..2f04d99f9f6 100644 --- a/app/models/deployment.rb +++ b/app/models/deployment.rb @@ -70,6 +70,10 @@ class Deployment < ApplicationRecord transition created: :blocked end + event :unblock do + transition blocked: :created + end + event :succeed do transition any - [:success] => :success end diff --git a/app/services/ci/pipelines/add_job_service.rb b/app/services/ci/pipelines/add_job_service.rb index 703bb22fb5d..fc852bc3edd 100644 --- a/app/services/ci/pipelines/add_job_service.rb +++ b/app/services/ci/pipelines/add_job_service.rb @@ -39,6 +39,12 @@ module Ci job.pipeline = pipeline job.project = pipeline.project job.ref = pipeline.ref + + # update metadata since it might have been lazily initialised before this call + # metadata is present on `Ci::Processable` + if job.respond_to?(:metadata) && job.metadata + job.metadata.project = pipeline.project + end end end end diff --git a/app/views/layouts/header/_gitlab_version.html.haml b/app/views/layouts/header/_gitlab_version.html.haml new file mode 100644 index 00000000000..125fbaa084c --- /dev/null +++ b/app/views/layouts/header/_gitlab_version.html.haml @@ -0,0 +1,11 @@ +- return unless show_version_check? + +.gl-display-flex.gl-flex-direction-column.gl-px-4.gl-py-3 + %span + = s_("VersionCheck|Your GitLab Version") + = emoji_icon('rocket') + %span + %span.gl-font-sm.gl-text-gray-500 + #{Gitlab.version_info.major}.#{Gitlab.version_info.minor} + %span.gl-ml-2 + .js-gitlab-version-check{ data: { "size": "sm" } } diff --git a/app/views/layouts/header/_help_dropdown.html.haml b/app/views/layouts/header/_help_dropdown.html.haml index e2c7781da54..738bca2f2cc 100644 --- a/app/views/layouts/header/_help_dropdown.html.haml +++ b/app/views/layouts/header/_help_dropdown.html.haml @@ -1,5 +1,6 @@ %ul - if current_user_menu?(:help) + = render 'layouts/header/gitlab_version' = render 'layouts/header/whats_new_dropdown_item' %li = link_to _("Help"), help_path diff --git a/app/workers/all_queues.yml b/app/workers/all_queues.yml index 0d4b92a5065..3180a0dfc81 100644 --- a/app/workers/all_queues.yml +++ b/app/workers/all_queues.yml @@ -1539,7 +1539,7 @@ :tags: [] - :name: pipeline_creation:ci_external_pull_requests_create_pipeline :worker_name: Ci::ExternalPullRequests::CreatePipelineWorker - :feature_category: :pipeline_authoring + :feature_category: :continuous_integration :has_external_dependencies: :urgency: :high :resource_boundary: :cpu diff --git a/app/workers/ci/external_pull_requests/create_pipeline_worker.rb b/app/workers/ci/external_pull_requests/create_pipeline_worker.rb index 211ea1f2990..334ff099ea2 100644 --- a/app/workers/ci/external_pull_requests/create_pipeline_worker.rb +++ b/app/workers/ci/external_pull_requests/create_pipeline_worker.rb @@ -7,7 +7,7 @@ module Ci data_consistency :always queue_namespace :pipeline_creation - feature_category :pipeline_authoring + feature_category :continuous_integration urgency :high worker_resource_boundary :cpu |