diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2022-06-20 14:10:13 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2022-06-20 14:10:13 +0300 |
commit | 0ea3fcec397b69815975647f5e2aa5fe944a8486 (patch) | |
tree | 7979381b89d26011bcf9bdc989a40fcc2f1ed4ff /app/models/namespace | |
parent | 72123183a20411a36d607d70b12d57c484394c8e (diff) |
Add latest changes from gitlab-org/gitlab@15-1-stable-eev15.1.0-rc42
Diffstat (limited to 'app/models/namespace')
-rw-r--r-- | app/models/namespace/root_storage_statistics.rb | 31 |
1 files changed, 25 insertions, 6 deletions
diff --git a/app/models/namespace/root_storage_statistics.rb b/app/models/namespace/root_storage_statistics.rb index 96715863892..77974a0f36b 100644 --- a/app/models/namespace/root_storage_statistics.rb +++ b/app/models/namespace/root_storage_statistics.rb @@ -44,15 +44,26 @@ class Namespace::RootStorageStatistics < ApplicationRecord def merged_attributes attributes_from_project_statistics.merge!( attributes_from_personal_snippets, - attributes_from_namespace_statistics + attributes_from_namespace_statistics, + attributes_for_container_registry_size ) { |key, v1, v2| v1 + v2 } end + def attributes_for_container_registry_size + container_registry_size = namespace.container_repositories_size || 0 + + { + storage_size: container_registry_size, + container_registry_size: container_registry_size + }.with_indifferent_access + end + def attributes_from_project_statistics from_project_statistics - .take - .attributes - .slice(*STATISTICS_ATTRIBUTES) + .take + .attributes + .slice(*STATISTICS_ATTRIBUTES) + .with_indifferent_access end def from_project_statistics @@ -74,7 +85,10 @@ class Namespace::RootStorageStatistics < ApplicationRecord def attributes_from_personal_snippets return {} unless namespace.user_namespace? - from_personal_snippets.take.slice(SNIPPETS_SIZE_STAT_NAME) + from_personal_snippets + .take + .slice(SNIPPETS_SIZE_STAT_NAME) + .with_indifferent_access end def from_personal_snippets @@ -102,7 +116,12 @@ class Namespace::RootStorageStatistics < ApplicationRecord # guard clause. return {} unless namespace.group_namespace? - from_namespace_statistics.take.slice(*self.class.namespace_statistics_attributes) + from_namespace_statistics + .take + .slice( + *self.class.namespace_statistics_attributes + ) + .with_indifferent_access end end |