diff options
Diffstat (limited to 'app/presenters')
-rw-r--r-- | app/presenters/blob_presenter.rb | 4 | ||||
-rw-r--r-- | app/presenters/ci/build_runner_presenter.rb | 2 | ||||
-rw-r--r-- | app/presenters/commit_status_presenter.rb | 3 | ||||
-rw-r--r-- | app/presenters/dev_ops_report/metric_presenter.rb | 2 | ||||
-rw-r--r-- | app/presenters/gitlab/blame_presenter.rb | 2 | ||||
-rw-r--r-- | app/presenters/merge_request_presenter.rb | 4 | ||||
-rw-r--r-- | app/presenters/packages/helm/index_presenter.rb | 53 | ||||
-rw-r--r-- | app/presenters/packages/nuget/presenter_helpers.rb | 3 | ||||
-rw-r--r-- | app/presenters/packages/nuget/service_index_presenter.rb | 10 | ||||
-rw-r--r-- | app/presenters/project_presenter.rb | 4 | ||||
-rw-r--r-- | app/presenters/search_service_presenter.rb | 2 | ||||
-rw-r--r-- | app/presenters/snippet_blob_presenter.rb | 4 |
12 files changed, 80 insertions, 13 deletions
diff --git a/app/presenters/blob_presenter.rb b/app/presenters/blob_presenter.rb index 56dd056b9bc..ecc16e2840c 100644 --- a/app/presenters/blob_presenter.rb +++ b/app/presenters/blob_presenter.rb @@ -26,6 +26,10 @@ class BlobPresenter < Gitlab::View::Presenter::Delegated highlight(plain: false) end + def raw_plain_data + blob.data unless blob.binary? + end + def web_url url_helpers.project_blob_url(project, ref_qualified_path) end diff --git a/app/presenters/ci/build_runner_presenter.rb b/app/presenters/ci/build_runner_presenter.rb index 5b233ad89ec..52f4a4e71a1 100644 --- a/app/presenters/ci/build_runner_presenter.rb +++ b/app/presenters/ci/build_runner_presenter.rb @@ -82,7 +82,7 @@ module Ci expire_in: artifacts[:expire_in] } - if artifacts.dig(:exclude).present? && ::Gitlab::Ci::Features.artifacts_exclude_enabled? + if artifacts.dig(:exclude).present? archive.merge(exclude: artifacts[:exclude]) else archive diff --git a/app/presenters/commit_status_presenter.rb b/app/presenters/commit_status_presenter.rb index e62e2fac835..5f5bbf13f92 100644 --- a/app/presenters/commit_status_presenter.rb +++ b/app/presenters/commit_status_presenter.rb @@ -26,7 +26,8 @@ class CommitStatusPresenter < Gitlab::View::Presenter::Delegated project_deleted: 'The job belongs to a deleted project', user_blocked: 'The user who created this job is blocked', ci_quota_exceeded: 'No more CI minutes available', - no_matching_runner: 'No matching runner available' + no_matching_runner: 'No matching runner available', + trace_size_exceeded: 'The job log size limit was reached' }.freeze private_constant :CALLOUT_FAILURE_MESSAGES diff --git a/app/presenters/dev_ops_report/metric_presenter.rb b/app/presenters/dev_ops_report/metric_presenter.rb index 46b580d1f2a..4d7ac1cd3ec 100644 --- a/app/presenters/dev_ops_report/metric_presenter.rb +++ b/app/presenters/dev_ops_report/metric_presenter.rb @@ -50,7 +50,7 @@ module DevOpsReport description: 'created per active user', feature: 'ci_pipelines', blog: 'https://martinfowler.com/bliki/ContinuousDelivery.html', - docs: help_page_path('ci/README') + docs: help_page_path('ci/index') ), Card.new( metric: subject, diff --git a/app/presenters/gitlab/blame_presenter.rb b/app/presenters/gitlab/blame_presenter.rb index 3c581d4b115..26c78384144 100644 --- a/app/presenters/gitlab/blame_presenter.rb +++ b/app/presenters/gitlab/blame_presenter.rb @@ -50,7 +50,7 @@ module Gitlab def get_commit_data(commit) CommitData.new.tap do |data| - data.author_avatar = author_avatar(commit, size: 36, has_tooltip: false) + data.author_avatar = author_avatar(commit, size: 36, has_tooltip: false, lazy: true) data.age_map_class = age_map_class(commit.committed_date, project_duration) data.commit_link = link_to commit.title, project_commit_path(project, commit.id), class: "cdark", title: commit.title data.commit_author_link = commit_author_link(commit, avatar: false) diff --git a/app/presenters/merge_request_presenter.rb b/app/presenters/merge_request_presenter.rb index 7d0fa9e2f8a..6bf5e0bd1b0 100644 --- a/app/presenters/merge_request_presenter.rb +++ b/app/presenters/merge_request_presenter.rb @@ -19,8 +19,8 @@ class MergeRequestPresenter < Gitlab::View::Presenter::Delegated status || "preparing" else - ci_service = source_project.try(:ci_service) - ci_service&.commit_status(diff_head_sha, source_branch) + ci_integration = source_project.try(:ci_integration) + ci_integration&.commit_status(diff_head_sha, source_branch) end end diff --git a/app/presenters/packages/helm/index_presenter.rb b/app/presenters/packages/helm/index_presenter.rb new file mode 100644 index 00000000000..a6cfc61c94d --- /dev/null +++ b/app/presenters/packages/helm/index_presenter.rb @@ -0,0 +1,53 @@ +# frozen_string_literal: true + +module Packages + module Helm + class IndexPresenter + include API::Helpers::RelatedResourcesHelpers + + API_VERSION = 'v1' + CHANNEL = 'channel' + INDEX_YAML_SUFFIX = "/#{CHANNEL}/index.yaml" + + def initialize(project, project_id_param, package_files) + @project = project + @project_id_param = project_id_param + @package_files = package_files + end + + def api_version + API_VERSION + end + + def entries + files = @package_files.preload_helm_file_metadata + result = Hash.new { |h, k| h[k] = [] } + + files.find_each do |package_file| + name = package_file.helm_metadata['name'] + result[name] << package_file.helm_metadata.merge({ + 'created' => package_file.created_at.utc.strftime('%Y-%m-%dT%H:%M:%S.%NZ'), + 'digest' => package_file.file_sha256, + 'urls' => ["charts/#{package_file.file_name}"] + }) + end + + result + end + + def generated + Time.zone.now.utc.strftime('%Y-%m-%dT%H:%M:%S.%NZ') + end + + def server_info + path = api_v4_projects_packages_helm_index_yaml_path( + id: ERB::Util.url_encode(@project_id_param), + channel: CHANNEL + ) + { + 'contextPath' => path.delete_suffix(INDEX_YAML_SUFFIX) + } + end + end + end +end diff --git a/app/presenters/packages/nuget/presenter_helpers.rb b/app/presenters/packages/nuget/presenter_helpers.rb index cc7e8619220..09bf1e009a6 100644 --- a/app/presenters/packages/nuget/presenter_helpers.rb +++ b/app/presenters/packages/nuget/presenter_helpers.rb @@ -8,6 +8,7 @@ module Packages BLANK_STRING = '' PACKAGE_DEPENDENCY_GROUP = 'PackageDependencyGroup' PACKAGE_DEPENDENCY = 'PackageDependency' + NUGET_PACKAGE_FORMAT = 'nupkg' private @@ -31,7 +32,7 @@ module Packages id: package.project_id, package_name: package.name, package_version: package.version, - package_filename: package.package_files.last&.file_name + package_filename: package.package_files.with_format(NUGET_PACKAGE_FORMAT).last&.file_name }, true ) diff --git a/app/presenters/packages/nuget/service_index_presenter.rb b/app/presenters/packages/nuget/service_index_presenter.rb index b3cc912b811..033a1845c1c 100644 --- a/app/presenters/packages/nuget/service_index_presenter.rb +++ b/app/presenters/packages/nuget/service_index_presenter.rb @@ -8,6 +8,7 @@ module Packages SERVICE_VERSIONS = { download: %w[PackageBaseAddress/3.0.0], search: %w[SearchQueryService SearchQueryService/3.0.0-beta SearchQueryService/3.0.0-rc], + symbol: %w[SymbolPackagePublish/4.9.0], publish: %w[PackagePublish/2.0.0], metadata: %w[RegistrationsBaseUrl RegistrationsBaseUrl/3.0.0-beta RegistrationsBaseUrl/3.0.0-rc] }.freeze @@ -15,13 +16,14 @@ module Packages SERVICE_COMMENTS = { download: 'Get package content (.nupkg).', search: 'Filter and search for packages by keyword.', + symbol: 'Push symbol packages.', publish: 'Push and delete (or unlist) packages.', metadata: 'Get package metadata.' }.freeze VERSION = '3.0.0' - PROJECT_LEVEL_SERVICES = %i[download publish].freeze + PROJECT_LEVEL_SERVICES = %i[download publish symbol].freeze GROUP_LEVEL_SERVICES = %i[search metadata].freeze def initialize(project_or_group) @@ -63,6 +65,8 @@ module Packages download_service_url when :search search_service_url + when :symbol + symbol_service_url when :metadata metadata_service_url when :publish @@ -124,6 +128,10 @@ module Packages def publish_service_url api_v4_projects_packages_nuget_path(id: @project_or_group.id) end + + def symbol_service_url + api_v4_projects_packages_nuget_symbolpackage_path(id: @project_or_group.id) + end end end end diff --git a/app/presenters/project_presenter.rb b/app/presenters/project_presenter.rb index fcd3189296a..0d038d19af3 100644 --- a/app/presenters/project_presenter.rb +++ b/app/presenters/project_presenter.rb @@ -135,10 +135,6 @@ class ProjectPresenter < Gitlab::View::Presenter::Delegated ide_edit_path(project, default_branch_or_main, 'README.md') end - def add_ci_yml_path - add_special_file_path(file_name: ci_config_path_or_default) - end - def add_code_quality_ci_yml_path add_special_file_path( file_name: ci_config_path_or_default, diff --git a/app/presenters/search_service_presenter.rb b/app/presenters/search_service_presenter.rb index e14446bb2f7..ab43800b9f2 100644 --- a/app/presenters/search_service_presenter.rb +++ b/app/presenters/search_service_presenter.rb @@ -16,7 +16,7 @@ class SearchServicePresenter < Gitlab::View::Presenter::Delegated blobs: :with_web_entity_associations }.freeze - SORT_ENABLED_SCOPES = %w(issues merge_requests).freeze + SORT_ENABLED_SCOPES = %w(issues merge_requests epics).freeze def search_objects @search_objects ||= begin diff --git a/app/presenters/snippet_blob_presenter.rb b/app/presenters/snippet_blob_presenter.rb index e9c710e4a0f..0003a13a7bc 100644 --- a/app/presenters/snippet_blob_presenter.rb +++ b/app/presenters/snippet_blob_presenter.rb @@ -17,6 +17,10 @@ class SnippetBlobPresenter < BlobPresenter snippet_blob_raw_route end + def raw_plain_data + blob.data unless blob.binary? + end + private def snippet |