diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-02-18 03:09:20 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-02-18 03:09:20 +0300 |
commit | 72721699f11187199e89631ce0b5e3d2f7c167e9 (patch) | |
tree | b51a227be89d82aa24fc954e7b50e7b0933583cc /lib/gitlab | |
parent | 06be418a7cd98a1c87c41ba43cca1ce9acbe885e (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'lib/gitlab')
-rw-r--r-- | lib/gitlab/background_migration/fix_orphan_promoted_issues.rb | 13 | ||||
-rw-r--r-- | lib/gitlab/database.rb | 2 | ||||
-rw-r--r-- | lib/gitlab/gitaly_client/commit_service.rb | 2 | ||||
-rw-r--r-- | lib/gitlab/marginalia.rb | 2 | ||||
-rw-r--r-- | lib/gitlab/metrics/dashboard/stages/project_metrics_details_inserter.rb | 40 |
5 files changed, 56 insertions, 3 deletions
diff --git a/lib/gitlab/background_migration/fix_orphan_promoted_issues.rb b/lib/gitlab/background_migration/fix_orphan_promoted_issues.rb new file mode 100644 index 00000000000..d6ec56ae19e --- /dev/null +++ b/lib/gitlab/background_migration/fix_orphan_promoted_issues.rb @@ -0,0 +1,13 @@ +# frozen_string_literal: true + +module Gitlab + module BackgroundMigration + # No OP for CE + class FixOrphanPromotedIssues + def perform(note_id) + end + end + end +end + +Gitlab::BackgroundMigration::FixOrphanPromotedIssues.prepend_if_ee('EE::Gitlab::BackgroundMigration::FixOrphanPromotedIssues') diff --git a/lib/gitlab/database.rb b/lib/gitlab/database.rb index a614e68703c..02005be1f6a 100644 --- a/lib/gitlab/database.rb +++ b/lib/gitlab/database.rb @@ -233,7 +233,7 @@ module Gitlab end def self.cached_table_exists?(table_name) - connection.schema_cache.data_source_exists?(table_name) + exists? && connection.schema_cache.data_source_exists?(table_name) end def self.database_version diff --git a/lib/gitlab/gitaly_client/commit_service.rb b/lib/gitlab/gitaly_client/commit_service.rb index b981b9cf1bc..ac22f5bf419 100644 --- a/lib/gitlab/gitaly_client/commit_service.rb +++ b/lib/gitlab/gitaly_client/commit_service.rb @@ -324,7 +324,7 @@ module Gitlab request.after = GitalyClient.timestamp(options[:after]) if options[:after] request.before = GitalyClient.timestamp(options[:before]) if options[:before] request.revision = encode_binary(options[:ref]) if options[:ref] - request.order = options[:order].upcase if options[:order].present? + request.order = options[:order].upcase.sub('DEFAULT', 'NONE') if options[:order].present? request.paths = encode_repeated(Array(options[:path])) if options[:path].present? diff --git a/lib/gitlab/marginalia.rb b/lib/gitlab/marginalia.rb index b4b9896e6b9..24e21a1d512 100644 --- a/lib/gitlab/marginalia.rb +++ b/lib/gitlab/marginalia.rb @@ -22,7 +22,7 @@ module Gitlab def self.set_feature_cache # During db:create and db:bootstrap skip feature query as DB is not available yet. - return false unless ActiveRecord::Base.connected? && Gitlab::Database.cached_table_exists?('features') + return false unless Gitlab::Database.cached_table_exists?('features') self.enabled = Feature.enabled?(MARGINALIA_FEATURE_FLAG) end diff --git a/lib/gitlab/metrics/dashboard/stages/project_metrics_details_inserter.rb b/lib/gitlab/metrics/dashboard/stages/project_metrics_details_inserter.rb new file mode 100644 index 00000000000..a9d11f58255 --- /dev/null +++ b/lib/gitlab/metrics/dashboard/stages/project_metrics_details_inserter.rb @@ -0,0 +1,40 @@ +# frozen_string_literal: true + +module Gitlab + module Metrics + module Dashboard + module Stages + class ProjectMetricsDetailsInserter < BaseStage + def transform! + dashboard[:panel_groups].each do |panel_group| + next unless panel_group + + has_custom_metrics = custom_group_titles.include?(panel_group[:group]) + panel_group[:has_custom_metrics] = has_custom_metrics + + panel_group[:panels].each do |panel| + next unless panel + + panel[:metrics].each do |metric| + next unless metric + + metric[:edit_path] = has_custom_metrics ? edit_path(metric) : nil + end + end + end + end + + private + + def custom_group_titles + @custom_group_titles ||= PrometheusMetricEnums.custom_group_details.values.map { |group_details| group_details[:group_title] } + end + + def edit_path(metric) + Gitlab::Routing.url_helpers.edit_project_prometheus_metric_path(project, metric[:metric_id]) + end + end + end + end + end +end |