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:
authorAlessio Caiazza <acaiazza@gitlab.com>2019-08-23 01:08:28 +0300
committerMayra Cabrera <mcabrera@gitlab.com>2019-08-23 01:08:28 +0300
commit606a1d2d31aff69ddabe7e3794f61f3e778da3e8 (patch)
treebfaee792fd551070a3581c77bc52164610f03b2a /app/models/namespace
parentc65ea080ba8637f0e83ea97b091e4ab3ebbce635 (diff)
Expose namespace storage statistics with GraphQL
Root namespaces have storage statistics. This commit allows namespace owners to get those stats via GraphQL queries like the following one { namespace(fullPath: "a_namespace_path") { rootStorageStatistics { storageSize repositorySize lfsObjectsSize buildArtifactsSize packagesSize wikiSize } } }
Diffstat (limited to 'app/models/namespace')
-rw-r--r--app/models/namespace/root_storage_statistics.rb2
1 files changed, 2 insertions, 0 deletions
diff --git a/app/models/namespace/root_storage_statistics.rb b/app/models/namespace/root_storage_statistics.rb
index 56c430013ee..ae9b2f14343 100644
--- a/app/models/namespace/root_storage_statistics.rb
+++ b/app/models/namespace/root_storage_statistics.rb
@@ -8,6 +8,8 @@ class Namespace::RootStorageStatistics < ApplicationRecord
belongs_to :namespace
has_one :route, through: :namespace
+ scope :for_namespace_ids, ->(namespace_ids) { where(namespace_id: namespace_ids) }
+
delegate :all_projects, to: :namespace
def recalculate!