diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-06-18 14:18:50 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-06-18 14:18:50 +0300 |
commit | 8c7f4e9d5f36cff46365a7f8c4b9c21578c1e781 (patch) | |
tree | a77e7fe7a93de11213032ed4ab1f33a3db51b738 /app/helpers/namespaces_helper.rb | |
parent | 00b35af3db1abfe813a778f643dad221aad51fca (diff) |
Add latest changes from gitlab-org/gitlab@13-1-stable-ee
Diffstat (limited to 'app/helpers/namespaces_helper.rb')
-rw-r--r-- | app/helpers/namespaces_helper.rb | 41 |
1 files changed, 40 insertions, 1 deletions
diff --git a/app/helpers/namespaces_helper.rb b/app/helpers/namespaces_helper.rb index 228dc2cc27f..b9f8d81bc4e 100644 --- a/app/helpers/namespaces_helper.rb +++ b/app/helpers/namespaces_helper.rb @@ -56,6 +56,45 @@ module NamespacesHelper namespaces_options(selected, options) end + def namespace_storage_alert(namespace) + return {} if current_user.nil? + + payload = Namespaces::CheckStorageSizeService.new(namespace, current_user).execute.payload + + return {} if payload.empty? + + alert_level = payload[:alert_level] + root_namespace = payload[:root_namespace] + + return {} if cookies["hide_storage_limit_alert_#{root_namespace.id}_#{alert_level}"] == 'true' + + payload + end + + def namespace_storage_alert_style(alert_level) + if alert_level == :error || alert_level == :alert + 'danger' + else + alert_level.to_s + end + end + + def namespace_storage_alert_icon(alert_level) + if alert_level == :error || alert_level == :alert + 'error' + elsif alert_level == :info + 'information-o' + else + alert_level.to_s + end + end + + def namespace_storage_usage_link(namespace) + # The usage quota page is only available in EE. This will be changed in + # the future, see https://gitlab.com/gitlab-org/gitlab/-/issues/220042. + nil + end + private # Many importers create a temporary Group, so use the real @@ -89,4 +128,4 @@ module NamespacesHelper end end -NamespacesHelper.include_if_ee('EE::NamespacesHelper') +NamespacesHelper.prepend_if_ee('EE::NamespacesHelper') |