diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2019-12-20 12:24:38 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2019-12-20 12:24:38 +0300 |
commit | 898e2cc1dfa88b4ac39cb4b35011f61b37f57b51 (patch) | |
tree | c6524edb6c9a43cccf93be05c36883fde1a53ee4 /app | |
parent | b5571e6e22cdacc81f78eff5943d68c8ba220fbb (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app')
25 files changed, 88 insertions, 33 deletions
diff --git a/app/assets/javascripts/awards_handler.js b/app/assets/javascripts/awards_handler.js index 2fc8b9efc1b..de10d5397df 100644 --- a/app/assets/javascripts/awards_handler.js +++ b/app/assets/javascripts/awards_handler.js @@ -506,6 +506,8 @@ export class AwardsHandler { const options = { scrollTop: $('.awards').offset().top - 110, }; + + // eslint-disable-next-line no-jquery/no-animate return $('body, html').animate(options, 200); } diff --git a/app/assets/javascripts/clusters/components/application_row.vue b/app/assets/javascripts/clusters/components/application_row.vue index ab1e5f92698..7db9898396b 100644 --- a/app/assets/javascripts/clusters/components/application_row.vue +++ b/app/assets/javascripts/clusters/components/application_row.vue @@ -290,6 +290,7 @@ export default { disabled && 'cluster-application-disabled', ]" class="cluster-application-row gl-responsive-table-row gl-responsive-table-row-col-span" + :data-qa-selector="id" > <div class="gl-responsive-table-row-layout" role="row"> <div class="table-section append-right-8 section-align-top" role="gridcell"> @@ -381,12 +382,16 @@ export default { :disabled="disabled || installButtonDisabled" :label="installButtonLabel" class="js-cluster-application-install-button" + data-qa-selector="install_button" + :data-qa-application="id" @click="installClicked" /> <uninstall-application-button v-if="displayUninstallButton" v-gl-modal-directive="'uninstall-' + id" :status="status" + data-qa-selector="uninstall_button" + :data-qa-application="id" class="js-cluster-application-uninstall-button" /> <uninstall-application-confirmation-modal diff --git a/app/assets/javascripts/lib/utils/common_utils.js b/app/assets/javascripts/lib/utils/common_utils.js index e4001e94478..71f73cd5420 100644 --- a/app/assets/javascripts/lib/utils/common_utils.js +++ b/app/assets/javascripts/lib/utils/common_utils.js @@ -135,7 +135,9 @@ export const handleLocationHash = () => { adjustment -= topPadding; } - window.scrollBy(0, adjustment); + setTimeout(() => { + window.scrollBy(0, adjustment); + }); }; // Check if element scrolled into viewport from above or below @@ -247,6 +249,7 @@ export const scrollToElement = element => { } const { top } = $el.offset(); + // eslint-disable-next-line no-jquery/no-animate return $('body, html').animate( { scrollTop: top - contentTop(), diff --git a/app/assets/javascripts/monitoring/components/shared/prometheus_header.vue b/app/assets/javascripts/monitoring/components/shared/prometheus_header.vue index 153c8f389db..ceeec51ee65 100644 --- a/app/assets/javascripts/monitoring/components/shared/prometheus_header.vue +++ b/app/assets/javascripts/monitoring/components/shared/prometheus_header.vue @@ -10,6 +10,6 @@ export default { </script> <template> <div class="prometheus-graph-header"> - <h5 class="prometheus-graph-title js-graph-title">{{ graphTitle }}</h5> + <h5 ref="title" class="prometheus-graph-title">{{ graphTitle }}</h5> </div> </template> diff --git a/app/assets/javascripts/pages/admin/admin.js b/app/assets/javascripts/pages/admin/admin.js index 4616a075729..88967d82b2f 100644 --- a/app/assets/javascripts/pages/admin/admin.js +++ b/app/assets/javascripts/pages/admin/admin.js @@ -36,6 +36,8 @@ export default function adminInit() { $('.log-bottom').on('click', e => { e.preventDefault(); const $visibleLog = $('.file-content:visible'); + + // eslint-disable-next-line no-jquery/no-animate $visibleLog.animate( { scrollTop: $visibleLog.find('ol').height(), diff --git a/app/assets/stylesheets/framework/files.scss b/app/assets/stylesheets/framework/files.scss index 8e0314bc6da..1a017f03ebb 100644 --- a/app/assets/stylesheets/framework/files.scss +++ b/app/assets/stylesheets/framework/files.scss @@ -207,6 +207,14 @@ border-left-color: mix($blame-gray, $blame-cyan, $i / 4 * 100%); } } + + .doc-versions { + color: $gray-600; + + &:hover { + color: $gray-900; + } + } } &.logs { diff --git a/app/assets/stylesheets/pages/boards.scss b/app/assets/stylesheets/pages/boards.scss index 90c2e369ccd..c4c1bb0bcc1 100644 --- a/app/assets/stylesheets/pages/boards.scss +++ b/app/assets/stylesheets/pages/boards.scss @@ -133,6 +133,7 @@ .issue-count-badge { border: 0; white-space: nowrap; + padding: 0; } .board-title-text > span, diff --git a/app/controllers/admin/system_info_controller.rb b/app/controllers/admin/system_info_controller.rb index 244fc2b31bb..657aa177ecf 100644 --- a/app/controllers/admin/system_info_controller.rb +++ b/app/controllers/admin/system_info_controller.rb @@ -1,10 +1,10 @@ # frozen_string_literal: true class Admin::SystemInfoController < Admin::ApplicationController - EXCLUDED_MOUNT_OPTIONS = [ - 'nobrowse', - 'read-only', - 'ro' + EXCLUDED_MOUNT_OPTIONS = %w[ + nobrowse + read-only + ro ].freeze EXCLUDED_MOUNT_TYPES = [ diff --git a/app/controllers/omniauth_callbacks_controller.rb b/app/controllers/omniauth_callbacks_controller.rb index 92f36c031f1..1f1c01c8fcc 100644 --- a/app/controllers/omniauth_callbacks_controller.rb +++ b/app/controllers/omniauth_callbacks_controller.rb @@ -31,7 +31,7 @@ class OmniauthCallbacksController < Devise::OmniauthCallbacksController # Extend the standard message generation to accept our custom exception def failure_message exception = request.env["omniauth.error"] - error = exception.error_reason if exception.respond_to?(:error_reason) + error = exception.error_reason if exception.respond_to?(:error_reason) error ||= exception.error if exception.respond_to?(:error) error ||= exception.message if exception.respond_to?(:message) error ||= request.env["omniauth.error.type"].to_s diff --git a/app/controllers/projects/pages_controller.rb b/app/controllers/projects/pages_controller.rb index f1e591ea1ec..18a171700e9 100644 --- a/app/controllers/projects/pages_controller.rb +++ b/app/controllers/projects/pages_controller.rb @@ -34,7 +34,7 @@ class Projects::PagesController < Projects::ApplicationController if result[:status] == :success flash[:notice] = 'Your changes have been saved' else - flash[:alert] = 'Something went wrong on our end' + flash[:alert] = result[:message] end redirect_to project_pages_path(@project) @@ -45,6 +45,12 @@ class Projects::PagesController < Projects::ApplicationController private def project_params - params.require(:project).permit(:pages_https_only) + params.require(:project).permit(project_params_attributes) + end + + def project_params_attributes + %i[pages_https_only] end end + +Projects::PagesController.prepend_if_ee('EE::Projects::PagesController') diff --git a/app/controllers/projects/starrers_controller.rb b/app/controllers/projects/starrers_controller.rb index 4efe956e973..d9654f4f72a 100644 --- a/app/controllers/projects/starrers_controller.rb +++ b/app/controllers/projects/starrers_controller.rb @@ -7,8 +7,8 @@ class Projects::StarrersController < Projects::ApplicationController @starrers = UsersStarProjectsFinder.new(@project, params, current_user: @current_user).execute @sort = params[:sort].presence || sort_value_name @starrers = @starrers.preload_users.sort_by_attribute(@sort).page(params[:page]) - @public_count = @project.starrers.with_public_profile.size - @total_count = @project.starrers.size + @public_count = @project.starrers.with_public_profile.size + @total_count = @project.starrers.size @private_count = @total_count - @public_count end diff --git a/app/graphql/types/ci/pipeline_type.rb b/app/graphql/types/ci/pipeline_type.rb index e786add6359..d77b2a2ba32 100644 --- a/app/graphql/types/ci/pipeline_type.rb +++ b/app/graphql/types/ci/pipeline_type.rb @@ -17,16 +17,16 @@ module Types field :sha, GraphQL::STRING_TYPE, null: false, description: "SHA of the pipeline's commit" field :before_sha, GraphQL::STRING_TYPE, null: true, - description: "Base SHA of the source branch" + description: 'Base SHA of the source branch' field :status, PipelineStatusEnum, null: false, description: "Status of the pipeline (#{::Ci::Pipeline.all_state_names.compact.join(', ').upcase})" field :detailed_status, Types::Ci::DetailedStatusType, null: false, description: 'Detailed status of the pipeline', resolve: -> (obj, _args, ctx) { obj.detailed_status(ctx[:current_user]) } field :duration, GraphQL::INT_TYPE, null: true, - description: "Duration of the pipeline in seconds" + description: 'Duration of the pipeline in seconds' field :coverage, GraphQL::FLOAT_TYPE, null: true, - description: "Coverage percentage" + description: 'Coverage percentage' field :created_at, Types::TimeType, null: false, description: "Timestamp of the pipeline's creation" field :updated_at, Types::TimeType, null: false, diff --git a/app/helpers/container_expiration_policies_helper.rb b/app/helpers/container_expiration_policies_helper.rb index 17791e7b0ff..5fb7b5afa6e 100644 --- a/app/helpers/container_expiration_policies_helper.rb +++ b/app/helpers/container_expiration_policies_helper.rb @@ -3,19 +3,25 @@ module ContainerExpirationPoliciesHelper def cadence_options ContainerExpirationPolicy.cadence_options.map do |key, val| - { key: key.to_s, label: val } + { key: key.to_s, label: val }.tap do |base| + base[:default] = true if key.to_s == '1d' + end end end def keep_n_options ContainerExpirationPolicy.keep_n_options.map do |key, val| - { key: key, label: val } + { key: key, label: val }.tap do |base| + base[:default] = true if key == 10 + end end end def older_than_options ContainerExpirationPolicy.older_than_options.map do |key, val| - { key: key.to_s, label: val } + { key: key.to_s, label: val }.tap do |base| + base[:default] = true if key.to_s == '30d' + end end end end diff --git a/app/helpers/dashboard_helper.rb b/app/helpers/dashboard_helper.rb index 99ede8c3557..b38feb0fb6c 100644 --- a/app/helpers/dashboard_helper.rb +++ b/app/helpers/dashboard_helper.rb @@ -35,7 +35,7 @@ module DashboardHelper tag.p(aria: { label: label }) do concat(link_or_title) - concat(tag.span(class: ['light', 'float-right']) do + concat(tag.span(class: %w[light float-right]) do boolean_to_icon(enabled) end) diff --git a/app/helpers/snippets_helper.rb b/app/helpers/snippets_helper.rb index 1c7690f30d2..fd7e58826b5 100644 --- a/app/helpers/snippets_helper.rb +++ b/app/helpers/snippets_helper.rb @@ -127,7 +127,7 @@ module SnippetsHelper return unless attrs = snippet_badge_attributes(snippet) css_class, text = attrs - tag.span(class: ['badge', 'badge-gray']) do + tag.span(class: %w[badge badge-gray]) do concat(tag.i(class: ['fa', css_class])) concat(' ') concat(text) diff --git a/app/models/application_setting.rb b/app/models/application_setting.rb index 456b6430088..3858adfc71f 100644 --- a/app/models/application_setting.rb +++ b/app/models/application_setting.rb @@ -121,6 +121,11 @@ class ApplicationSetting < ApplicationRecord presence: true, numericality: { only_integer: true, greater_than: 0 } + validates :max_pages_size, + presence: true, + numericality: { only_integer: true, greater_than: 0, + less_than: ::Gitlab::Pages::MAX_SIZE / 1.megabyte } + validates :default_artifacts_expire_in, presence: true, duration: true validates :container_registry_token_expire_delay, diff --git a/app/models/clusters/applications/prometheus.rb b/app/models/clusters/applications/prometheus.rb index 4ac33d4e3be..5716614b8ac 100644 --- a/app/models/clusters/applications/prometheus.rb +++ b/app/models/clusters/applications/prometheus.rb @@ -5,7 +5,7 @@ module Clusters class Prometheus < ApplicationRecord include PrometheusAdapter - VERSION = '6.7.3' + VERSION = '9.5.2' self.table_name = 'clusters_applications_prometheus' diff --git a/app/models/error_tracking/project_error_tracking_setting.rb b/app/models/error_tracking/project_error_tracking_setting.rb index 6a9986e806b..bbafcaed46e 100644 --- a/app/models/error_tracking/project_error_tracking_setting.rb +++ b/app/models/error_tracking/project_error_tracking_setting.rb @@ -122,6 +122,9 @@ module ErrorTracking { error: e.message, error_type: SENTRY_API_ERROR_INVALID_SIZE } rescue Sentry::Client::BadRequestError => e { error: e.message, error_type: SENTRY_API_ERROR_TYPE_BAD_REQUEST } + rescue StandardError => e + Gitlab::ErrorTracking.track_exception(e) + { error: 'Unexpected Error' } end # http://HOST/api/0/projects/ORG/PROJECT diff --git a/app/models/namespace.rb b/app/models/namespace.rb index d5a7c172fec..74774a22a37 100644 --- a/app/models/namespace.rb +++ b/app/models/namespace.rb @@ -46,6 +46,8 @@ class Namespace < ApplicationRecord length: { maximum: 255 }, namespace_path: true + validates :max_artifacts_size, numericality: { only_integer: true, greater_than: 0, allow_nil: true } + validate :nesting_level_allowed validates_associated :runners diff --git a/app/models/project.rb b/app/models/project.rb index 1a84827b5ec..9062377943f 100644 --- a/app/models/project.rb +++ b/app/models/project.rb @@ -375,6 +375,7 @@ class Project < ApplicationRecord inclusion: { in: ->(_object) { Gitlab.config.repositories.storages.keys } } validates :variables, variable_duplicates: { scope: :environment_scope } validates :bfg_object_map, file_size: { maximum: :max_attachment_size } + validates :max_artifacts_size, numericality: { only_integer: true, greater_than: 0, allow_nil: true } # Scopes scope :pending_delete, -> { where(pending_delete: true) } diff --git a/app/presenters/clusters/cluster_presenter.rb b/app/presenters/clusters/cluster_presenter.rb index 97771d84031..3ace27c72d5 100644 --- a/app/presenters/clusters/cluster_presenter.rb +++ b/app/presenters/clusters/cluster_presenter.rb @@ -10,11 +10,11 @@ module Clusters # We do not want to show the group path for clusters belonging to the # clusterable, only for the ancestor clusters. - def item_link(clusterable_presenter) + def item_link(clusterable_presenter, *html_options) if cluster.group_type? && clusterable != clusterable_presenter.subject contracted_group_name(cluster.group) + ' / ' + link_to_cluster else - link_to_cluster + link_to_cluster(*html_options) end end @@ -84,8 +84,8 @@ module Clusters sprite_icon('ellipsis_h', size: 12, css_class: 'vertical-align-middle') end - def link_to_cluster - link_to_if(can_read_cluster?, cluster.name, show_path) + def link_to_cluster(html_options: {}) + link_to_if(can_read_cluster?, cluster.name, show_path, html_options) end end end diff --git a/app/services/projects/update_pages_service.rb b/app/services/projects/update_pages_service.rb index e8a87fc4320..8b23f610ad1 100644 --- a/app/services/projects/update_pages_service.rb +++ b/app/services/projects/update_pages_service.rb @@ -6,7 +6,6 @@ module Projects FailedToExtractError = Class.new(StandardError) BLOCK_SIZE = 32.kilobytes - MAX_SIZE = 1.terabyte PUBLIC_DIR = 'public' # this has to be invalid group name, @@ -130,12 +129,16 @@ module Projects 1 + max_size / BLOCK_SIZE end + def max_size_from_settings + Gitlab::CurrentSettings.max_pages_size.megabytes + end + def max_size - max_pages_size = Gitlab::CurrentSettings.max_pages_size.megabytes + max_pages_size = max_size_from_settings - return MAX_SIZE if max_pages_size.zero? + return ::Gitlab::Pages::MAX_SIZE if max_pages_size.zero? - [max_pages_size, MAX_SIZE].min + max_pages_size end def tmp_path @@ -200,3 +203,5 @@ module Projects end end end + +Projects::UpdatePagesService.prepend_if_ee('EE::Projects::UpdatePagesService') diff --git a/app/views/clusters/clusters/_cluster.html.haml b/app/views/clusters/clusters/_cluster.html.haml index b89789e9915..04afc38a056 100644 --- a/app/views/clusters/clusters/_cluster.html.haml +++ b/app/views/clusters/clusters/_cluster.html.haml @@ -3,7 +3,7 @@ .table-section.section-60 .table-mobile-header{ role: "rowheader" }= s_("ClusterIntegration|Kubernetes cluster") .table-mobile-content - = cluster.item_link(clusterable) + = cluster.item_link(clusterable, html_options: { data: { qa_selector: 'cluster', qa_cluster_name: cluster.name } }) - unless cluster.enabled? %span.badge.badge-danger Connection disabled .table-section.section-25 diff --git a/app/views/clusters/clusters/aws/_new.html.haml b/app/views/clusters/clusters/aws/_new.html.haml index d89e6965dac..5bbdadf83f3 100644 --- a/app/views/clusters/clusters/aws/_new.html.haml +++ b/app/views/clusters/clusters/aws/_new.html.haml @@ -11,6 +11,6 @@ 'role-arn' => @aws_role.role_arn, 'instance-types' => @instance_types, 'kubernetes-integration-help-path' => help_page_path('user/project/clusters/index'), - 'account-and-external-ids-help-path' => help_page_path('user/project/clusters/add_remove_clusters.md', anchor: 'eks-cluster'), - 'create-role-arn-help-path' => help_page_path('user/project/clusters/add_remove_clusters.md', anchor: 'eks-cluster'), + 'account-and-external-ids-help-path' => help_page_path('user/project/clusters/add_remove_clusters.md', anchor: 'new-eks-cluster'), + 'create-role-arn-help-path' => help_page_path('user/project/clusters/add_remove_clusters.md', anchor: 'new-eks-cluster'), 'external-link-icon' => icon('external-link') } } diff --git a/app/views/projects/blame/show.html.haml b/app/views/projects/blame/show.html.haml index 30fe5622ebd..b17207c0da6 100644 --- a/app/views/projects/blame/show.html.haml +++ b/app/views/projects/blame/show.html.haml @@ -20,8 +20,14 @@ .commit-row-title %span.item-title.str-truncated-100 = link_to commit.title, project_commit_path(@project, commit.id), class: "cdark", title: commit.title - .float-right - = link_to commit.short_id, project_commit_path(@project, commit), class: "commit-sha" + %span + - previous_commit_id = commit.parent_id + - if previous_commit_id + = link_to project_blame_path(@project, tree_join(previous_commit_id, @path)), + title: _('View blame prior to this change'), + aria: { label: _('View blame prior to this change') }, + data: { toggle: 'tooltip', placement: 'right', container: 'body' } do + = sprite_icon('doc-versions', size: 16, css_class: 'doc-versions align-text-bottom') .light = commit_author_link(commit, avatar: false) |