Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/api/commits.rb2
-rw-r--r--lib/gitlab/background_migration/fix_orphan_promoted_issues.rb13
-rw-r--r--lib/gitlab/database.rb2
-rw-r--r--lib/gitlab/gitaly_client/commit_service.rb2
-rw-r--r--lib/gitlab/marginalia.rb2
-rw-r--r--lib/gitlab/metrics/dashboard/stages/project_metrics_details_inserter.rb40
6 files changed, 57 insertions, 4 deletions
diff --git a/lib/api/commits.rb b/lib/api/commits.rb
index 4e04a99e97c..dfb0066ceb0 100644
--- a/lib/api/commits.rb
+++ b/lib/api/commits.rb
@@ -38,7 +38,7 @@ module API
optional :all, type: Boolean, desc: 'Every commit will be returned'
optional :with_stats, type: Boolean, desc: 'Stats about each commit will be added to the response'
optional :first_parent, type: Boolean, desc: 'Only include the first parent of merges'
- optional :order, type: String, desc: 'List commits in order', values: %w[topo]
+ optional :order, type: String, desc: 'List commits in order', default: 'default', values: %w[default topo]
use :pagination
end
get ':id/repository/commits' do
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