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, #timelog_categories

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



291
292
293
# File 'app/graphql/types/group_type.rb', line 291

def avatar_url
  object.avatar_url(only_path: false)
end

#container_repositories_countObject



299
300
301
# File 'app/graphql/types/group_type.rb', line 299

def container_repositories_count
  group.container_repositories.size
end

#custom_emojiObject



333
334
335
# File 'app/graphql/types/group_type.rb', line 333

def custom_emoji
  object.custom_emoji if Feature.enabled?(:custom_emoji)
end

#dependency_proxy_blob_countObject



311
312
313
# File 'app/graphql/types/group_type.rb', line 311

def dependency_proxy_blob_count
  group.dependency_proxy_blobs.size
end

#dependency_proxy_image_countObject



307
308
309
# File 'app/graphql/types/group_type.rb', line 307

def dependency_proxy_image_count
  group.dependency_proxy_manifests.size
end

#dependency_proxy_manifestsObject



303
304
305
# File 'app/graphql/types/group_type.rb', line 303

def dependency_proxy_manifests
  group.dependency_proxy_manifests.order_id_desc
end

#dependency_proxy_settingObject



329
330
331
# File 'app/graphql/types/group_type.rb', line 329

def dependency_proxy_setting
  group.dependency_proxy_setting || group.create_dependency_proxy_setting
end

#dependency_proxy_total_sizeObject



315
316
317
318
319
# File 'app/graphql/types/group_type.rb', line 315

def dependency_proxy_total_size
  ActiveSupport::NumberHelper.number_to_human_size(
    dependency_proxy_total_size_in_bytes
  )
end

#dependency_proxy_total_size_bytesObject



325
326
327
# File 'app/graphql/types/group_type.rb', line 325

def dependency_proxy_total_size_bytes
  group.dependency_proxy_manifests.sum(:size) + group.dependency_proxy_blobs.sum(:size)
end

#dependency_proxy_total_size_in_bytesObject



321
322
323
# File 'app/graphql/types/group_type.rb', line 321

def dependency_proxy_total_size_in_bytes
  dependency_proxy_total_size_bytes
end

#label(title:) ⇒ Object



282
283
284
285
286
287
288
289
# File 'app/graphql/types/group_type.rb', line 282

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



295
296
297
# File 'app/graphql/types/group_type.rb', line 295

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