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

detailed_status_type.rb « ci « types « graphql « app - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: e3413551a3f63d3d6f836fb4cbce535d0f4992bd (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
44
45
46
47
48
49
50
51
52
53
54
55
# frozen_string_literal: true
module Types
  module Ci
    # rubocop: disable Graphql/AuthorizeTypes
    # This is presented through `PipelineType` that has its own authorization
    class DetailedStatusType < BaseObject
      graphql_name 'DetailedStatus'

      field :action, Types::Ci::StatusActionType, null: true,
            calls_gitaly: true,
            description: 'Action information for the status. This includes method, button title, icon, path, and title.'
      field :details_path, GraphQL::Types::String, null: true,
            description: 'Path of the details for the status.'
      field :favicon, GraphQL::Types::String, null: true,
            description: 'Favicon of the status.'
      field :group, GraphQL::Types::String, null: true,
            description: 'Group of the status.'
      field :has_details, GraphQL::Types::Boolean, null: true,
            description: 'Indicates if the status has further details.',
            method: :has_details?
      field :icon, GraphQL::Types::String, null: true,
            description: 'Icon of the status.'
      field :id, GraphQL::Types::String, null: false,
            description: 'ID for a detailed status.',
            extras: [:parent]
      field :label, GraphQL::Types::String, null: true,
            calls_gitaly: true,
            description: 'Label of the status.'
      field :text, GraphQL::Types::String, null: true,
            description: 'Text of the status.'
      field :tooltip, GraphQL::Types::String, null: true,
            description: 'Tooltip associated with the status.',
            method: :status_tooltip

      def id(parent:)
        "#{object.id}-#{parent.object.object.id}"
      end

      def action
        if object.has_action?
          {
            button_title: object.action_button_title,
            icon: object.action_icon,
            method: object.action_method,
            path: object.action_path,
            title: object.action_title
          }
        else
          nil
        end
      end
    end
    # rubocop: enable Graphql/AuthorizeTypes
  end
end