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
diff options
context:
space:
mode:
Diffstat (limited to 'app/presenters')
-rw-r--r--app/presenters/blob_presenter.rb2
-rw-r--r--app/presenters/ci/build_runner_presenter.rb10
-rw-r--r--app/presenters/dev_ops_report/metric_presenter.rb20
-rw-r--r--app/presenters/event_presenter.rb25
-rw-r--r--app/presenters/gitlab/blame_presenter.rb16
-rw-r--r--app/presenters/issue_presenter.rb3
-rw-r--r--app/presenters/projects/security/configuration_presenter.rb8
-rw-r--r--app/presenters/search_service_presenter.rb2
8 files changed, 72 insertions, 14 deletions
diff --git a/app/presenters/blob_presenter.rb b/app/presenters/blob_presenter.rb
index bc12d210334..6f32f4de62c 100644
--- a/app/presenters/blob_presenter.rb
+++ b/app/presenters/blob_presenter.rb
@@ -76,7 +76,7 @@ class BlobPresenter < Gitlab::View::Presenter::Delegated
end
def pipeline_editor_path
- project_ci_pipeline_editor_path(project, branch_name: blob.commit_id) if can_collaborate_with_project?(project) && blob.path == project.ci_config_path_or_default
+ project_ci_pipeline_editor_path(project, branch_name: commit_id) if can_collaborate_with_project?(project) && blob.path == project.ci_config_path_or_default
end
def gitpod_blob_url
diff --git a/app/presenters/ci/build_runner_presenter.rb b/app/presenters/ci/build_runner_presenter.rb
index 79c1946f3d2..838196e96ac 100644
--- a/app/presenters/ci/build_runner_presenter.rb
+++ b/app/presenters/ci/build_runner_presenter.rb
@@ -61,6 +61,16 @@ module Ci
end
# rubocop: enable CodeReuse/ActiveRecord
+ def project_jobs_running_on_instance_runners_count
+ # if not instance runner we don't care about that value and present `+Inf` as a placeholder for Prometheus
+ return '+Inf' unless runner.instance_type?
+
+ return project.instance_runner_running_jobs_count.to_s if
+ project.instance_runner_running_jobs_count < Project::INSTANCE_RUNNER_RUNNING_JOBS_MAX_BUCKET
+
+ "#{Project::INSTANCE_RUNNER_RUNNING_JOBS_MAX_BUCKET}+"
+ end
+
private
def create_archive(artifacts)
diff --git a/app/presenters/dev_ops_report/metric_presenter.rb b/app/presenters/dev_ops_report/metric_presenter.rb
index 1a5b12fa408..75dbbb63f76 100644
--- a/app/presenters/dev_ops_report/metric_presenter.rb
+++ b/app/presenters/dev_ops_report/metric_presenter.rb
@@ -93,52 +93,52 @@ module DevOpsReport
IdeaToProductionStep.new(
metric: metric,
title: 'Idea',
- features: %w(issues)
+ features: %w[issues]
),
IdeaToProductionStep.new(
metric: metric,
title: 'Issue',
- features: %w(issues notes)
+ features: %w[issues notes]
),
IdeaToProductionStep.new(
metric: metric,
title: 'Plan',
- features: %w(milestones boards)
+ features: %w[milestones boards]
),
IdeaToProductionStep.new(
metric: metric,
title: 'Code',
- features: %w(merge_requests)
+ features: %w[merge_requests]
),
IdeaToProductionStep.new(
metric: metric,
title: 'Commit',
- features: %w(merge_requests)
+ features: %w[merge_requests]
),
IdeaToProductionStep.new(
metric: metric,
title: 'Test',
- features: %w(ci_pipelines)
+ features: %w[ci_pipelines]
),
IdeaToProductionStep.new(
metric: metric,
title: 'Review',
- features: %w(ci_pipelines environments)
+ features: %w[ci_pipelines environments]
),
IdeaToProductionStep.new(
metric: metric,
title: 'Staging',
- features: %w(environments deployments)
+ features: %w[environments deployments]
),
IdeaToProductionStep.new(
metric: metric,
title: 'Production',
- features: %w(deployments)
+ features: %w[deployments]
),
IdeaToProductionStep.new(
metric: metric,
title: 'Feedback',
- features: %w(projects_prometheus_active service_desk_issues)
+ features: %w[projects_prometheus_active service_desk_issues]
)
]
end
diff --git a/app/presenters/event_presenter.rb b/app/presenters/event_presenter.rb
index a098db7fbbc..8f7b2d5868e 100644
--- a/app/presenters/event_presenter.rb
+++ b/app/presenters/event_presenter.rb
@@ -54,4 +54,29 @@ class EventPresenter < Gitlab::View::Presenter::Delegated
target.noteable_type.titleize
end.downcase
end
+
+ def push_activity_description
+ return unless push_action?
+
+ if batch_push?
+ "#{action_name} #{ref_count} #{ref_type.pluralize(ref_count)}"
+ else
+ "#{action_name} #{ref_type}"
+ end
+ end
+
+ def batch_push?
+ push_action? && ref_count.to_i > 0
+ end
+
+ def linked_to_reference?
+ return false unless push_action?
+ return false if event.project.nil?
+
+ if tag?
+ project.repository.tag_exists?(ref_name)
+ else
+ project.repository.branch_exists?(ref_name)
+ end
+ end
end
diff --git a/app/presenters/gitlab/blame_presenter.rb b/app/presenters/gitlab/blame_presenter.rb
index 6230e61d2be..0a2738bea5f 100644
--- a/app/presenters/gitlab/blame_presenter.rb
+++ b/app/presenters/gitlab/blame_presenter.rb
@@ -40,6 +40,10 @@ module Gitlab
@commits[commit.id] ||= get_commit_data(commit, previous_path)
end
+ def groups_commit_data
+ groups.each { |group| group[:commit_data] = commit_data(group[:commit]) }
+ end
+
private
# Huge source files with a high churn rate (e.g. 'locale/gitlab.pot') could have
@@ -86,5 +90,17 @@ module Gitlab
def mail_to(*args, &block)
ActionController::Base.helpers.mail_to(*args, &block)
end
+
+ def project
+ return super.project if defined?(super.project)
+
+ blame.commit.repository.project
+ end
+
+ def page
+ return super.page if defined?(super.page)
+
+ nil
+ end
end
end
diff --git a/app/presenters/issue_presenter.rb b/app/presenters/issue_presenter.rb
index 42ecbc9988e..9403dd0814b 100644
--- a/app/presenters/issue_presenter.rb
+++ b/app/presenters/issue_presenter.rb
@@ -28,6 +28,9 @@ class IssuePresenter < Gitlab::View::Presenter::Delegated
Gitlab::Utils::Email.obfuscated_email(super, deform: true)
end
+ delegator_override :external_author
+ alias_method :external_author, :service_desk_reply_to
+
delegator_override :issue_email_participants
def issue_email_participants
issue.issue_email_participants.present(current_user: current_user)
diff --git a/app/presenters/projects/security/configuration_presenter.rb b/app/presenters/projects/security/configuration_presenter.rb
index 8a6569e7bf3..f248652befc 100644
--- a/app/presenters/projects/security/configuration_presenter.rb
+++ b/app/presenters/projects/security/configuration_presenter.rb
@@ -25,7 +25,8 @@ module Projects
auto_fix_enabled: autofix_enabled,
can_toggle_auto_fix_settings: can_toggle_autofix,
auto_fix_user_path: auto_fix_user_path,
- security_training_enabled: project.security_training_available?
+ security_training_enabled: project.security_training_available?,
+ continuous_vulnerability_scans_enabled: continuous_vulnerability_scans_enabled
}
end
@@ -83,7 +84,8 @@ module Projects
configuration_path: scan.configuration_path,
available: scan.available?,
can_enable_by_merge_request: scan.can_enable_by_merge_request?,
- meta_info_path: scan.meta_info_path
+ meta_info_path: scan.meta_info_path,
+ on_demand_available: scan.on_demand_available?
}
end
@@ -94,6 +96,8 @@ module Projects
def project_settings
project.security_setting
end
+
+ def continuous_vulnerability_scans_enabled; end
end
end
end
diff --git a/app/presenters/search_service_presenter.rb b/app/presenters/search_service_presenter.rb
index 91e67c379c4..d79736a6e52 100644
--- a/app/presenters/search_service_presenter.rb
+++ b/app/presenters/search_service_presenter.rb
@@ -17,7 +17,7 @@ class SearchServicePresenter < Gitlab::View::Presenter::Delegated
blobs: :with_web_entity_associations
}.freeze
- SORT_ENABLED_SCOPES = %w(issues merge_requests epics).freeze
+ SORT_ENABLED_SCOPES = %w[issues merge_requests epics].freeze
delegator_override :search_objects
def search_objects