blob: 368e16f972c78b67884c67c6c48dc2d5c3c0b1c3 (
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
|
# frozen_string_literal: true
module Types
module Ci
# rubocop: disable Graphql/AuthorizeTypes
class RunnerWebUrlEdge < ::Types::BaseEdge
include FindClosest
field :web_url, GraphQL::Types::String, null: true,
description: 'Web URL of the runner. The value depends on where you put this field in the query. You can use it for projects or groups.',
extras: [:parent]
def initialize(node, connection)
super
@runner = node.node
end
def web_url(parent:)
owner = closest_parent([::Types::ProjectType, ::Types::GroupType], parent)
case owner
when ::Group
Gitlab::Routing.url_helpers.group_runner_url(owner, @runner)
when ::Project
Gitlab::Routing.url_helpers.project_runner_url(owner, @runner)
end
end
end
end
end
|