summaryrefslogtreecommitdiff
path: root/app/helpers/packages_helper.rb
diff options
context:
space:
mode:
Diffstat (limited to 'app/helpers/packages_helper.rb')
-rw-r--r--app/helpers/packages_helper.rb27
1 files changed, 26 insertions, 1 deletions
diff --git a/app/helpers/packages_helper.rb b/app/helpers/packages_helper.rb
index fe41c041b4f..50984415aa5 100644
--- a/app/helpers/packages_helper.rb
+++ b/app/helpers/packages_helper.rb
@@ -57,10 +57,35 @@ module PackagesHelper
def show_cleanup_policy_on_alert(project)
Gitlab.com? &&
Gitlab.config.registry.enabled &&
- project.container_registry_enabled &&
+ project.feature_available?(:container_registry, current_user) &&
!Gitlab::CurrentSettings.container_expiration_policies_enable_historic_entries &&
Feature.enabled?(:container_expiration_policies_historic_entry, project) &&
project.container_expiration_policy.nil? &&
project.container_repositories.exists?
end
+
+ def package_details_data(project, package = nil)
+ {
+ package: package ? package_from_presenter(package) : nil,
+ can_delete: can?(current_user, :destroy_package, project).to_s,
+ svg_path: image_path('illustrations/no-packages.svg'),
+ npm_path: package_registry_instance_url(:npm),
+ npm_help_path: help_page_path('user/packages/npm_registry/index'),
+ maven_path: package_registry_project_url(project.id, :maven),
+ maven_help_path: help_page_path('user/packages/maven_repository/index'),
+ conan_path: package_registry_project_url(project.id, :conan),
+ conan_help_path: help_page_path('user/packages/conan_repository/index'),
+ nuget_path: nuget_package_registry_url(project.id),
+ nuget_help_path: help_page_path('user/packages/nuget_repository/index'),
+ pypi_path: pypi_registry_url(project.id),
+ pypi_setup_path: package_registry_project_url(project.id, :pypi),
+ pypi_help_path: help_page_path('user/packages/pypi_repository/index'),
+ composer_path: composer_registry_url(project&.group&.id),
+ composer_help_path: help_page_path('user/packages/composer_repository/index'),
+ project_name: project.name,
+ project_list_url: project_packages_path(project),
+ group_list_url: project.group ? group_packages_path(project.group) : '',
+ composer_config_repository_name: composer_config_repository_name(project.group&.id)
+ }
+ end
end