Welcome to mirror list, hosted at ThFree Co, Russian Federation.

blob_viewer_type.rb « snippets « types « graphql « app - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 50d0b0522d6d40a640155c5c34e5bb681e7dbff4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
# frozen_string_literal: true

module Types
  module Snippets
    class BlobViewerType < BaseObject # rubocop:disable Graphql/AuthorizeTypes
      graphql_name 'SnippetBlobViewer'
      description 'Represents how the blob content should be displayed'

      field :type, Types::BlobViewers::TypeEnum,
            description: 'Type of blob viewer',
            null: false

      field :load_async, GraphQL::BOOLEAN_TYPE,
            description: 'Shows whether the blob content is loaded async',
            null: false

      field :collapsed, GraphQL::BOOLEAN_TYPE,
            description: 'Shows whether the blob should be displayed collapsed',
            method: :collapsed?,
            null: false,
            resolve: -> (viewer, _args, _ctx) { !!viewer&.collapsed? }

      field :too_large, GraphQL::BOOLEAN_TYPE,
            description: 'Shows whether the blob too large to be displayed',
            method: :too_large?,
            null: false,
            resolve: -> (viewer, _args, _ctx) { !!viewer&.too_large? }

      field :render_error, GraphQL::STRING_TYPE,
            description: 'Error rendering the blob content',
            null: true

      field :file_type, GraphQL::STRING_TYPE,
            description: 'Content file type',
            method: :partial_name,
            null: false

      field :loading_partial_name, GraphQL::STRING_TYPE,
            description: 'Loading partial name',
            null: false
    end
  end
end