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

status_action_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: 15e5344e1308469c593fca8a26d8fe7c46b00255 (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
# frozen_string_literal: true
module Types
  module Ci
    # rubocop: disable Graphql/AuthorizeTypes
    class StatusActionType < BaseObject
      graphql_name 'StatusAction'

      field :id, GraphQL::Types::String, null: false,
            description: 'ID for a status action.',
            extras: [:parent]
      field :button_title, GraphQL::Types::String, null: true,
            description: 'Title for the button, for example: Retry this job.'
      field :icon, GraphQL::Types::String, null: true,
            description: 'Icon used in the action button.'
      field :method, GraphQL::Types::String, null: true,
            description: 'Method for the action, for example: :post.',
            resolver_method: :action_method
      field :path, GraphQL::Types::String, null: true,
            description: 'Path for the action.'
      field :title, GraphQL::Types::String, null: true,
            description: 'Title for the action, for example: Retry.'

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

      def action_method
        object[:method]
      end
    end
  end
end