Class: Types::GroupType

Inherits:
NamespaceType show all
Defined in:
app/graphql/types/group_type.rb

Instance Method Summary collapse

Methods inherited from NamespaceType

#cross_project_pipeline_available?, #root_storage_statistics

Methods inherited from BaseObject

accepts, assignable?, authorization, authorize, authorized?, #current_user, #id

Methods included from Gitlab::Graphql::Present

#present, #unpresented

Instance Method Details

#avatar_urlObject


225
226
227
# File 'app/graphql/types/group_type.rb', line 225

def avatar_url
  object.avatar_url(only_path: false)
end

#container_repositories_countObject


233
234
235
# File 'app/graphql/types/group_type.rb', line 233

def container_repositories_count
  group.container_repositories.size
end

#dependency_proxy_blob_countObject


245
246
247
# File 'app/graphql/types/group_type.rb', line 245

def dependency_proxy_blob_count
  group.dependency_proxy_blobs.size
end

#dependency_proxy_image_countObject


241
242
243
# File 'app/graphql/types/group_type.rb', line 241

def dependency_proxy_image_count
  group.dependency_proxy_manifests.size
end

#dependency_proxy_manifestsObject


237
238
239
# File 'app/graphql/types/group_type.rb', line 237

def dependency_proxy_manifests
  group.dependency_proxy_manifests.order_id_desc
end

#dependency_proxy_settingObject


255
256
257
# File 'app/graphql/types/group_type.rb', line 255

def dependency_proxy_setting
  group.dependency_proxy_setting || group.create_dependency_proxy_setting
end

#dependency_proxy_total_sizeObject


249
250
251
252
253
# File 'app/graphql/types/group_type.rb', line 249

def dependency_proxy_total_size
  ActiveSupport::NumberHelper.number_to_human_size(
    group.dependency_proxy_manifests.sum(:size) + group.dependency_proxy_blobs.sum(:size)
  )
end

#label(title:) ⇒ Object


216
217
218
219
220
221
222
223
# File 'app/graphql/types/group_type.rb', line 216

def label(title:)
  BatchLoader::GraphQL.for(title).batch(key: group) do |titles, loader, args|
    LabelsFinder
      .new(current_user, group: args[:key], title: titles)
      .execute
      .each { |label| loader.call(label.title, label) }
  end
end

#parentObject


229
230
231
# File 'app/graphql/types/group_type.rb', line 229

def parent
  Gitlab::Graphql::Loaders::BatchModelLoader.new(Group, object.parent_id).find
end