diff options
Diffstat (limited to 'app/graphql/types/ci/runner_web_url_edge.rb')
-rw-r--r-- | app/graphql/types/ci/runner_web_url_edge.rb | 19 |
1 files changed, 17 insertions, 2 deletions
diff --git a/app/graphql/types/ci/runner_web_url_edge.rb b/app/graphql/types/ci/runner_web_url_edge.rb index 368e16f972c..035d75c22c6 100644 --- a/app/graphql/types/ci/runner_web_url_edge.rb +++ b/app/graphql/types/ci/runner_web_url_edge.rb @@ -6,6 +6,9 @@ module Types class RunnerWebUrlEdge < ::Types::BaseEdge include FindClosest + field :edit_url, GraphQL::Types::String, null: true, + description: 'Web URL of the runner edit page. The value depends on where you put this field in the query. You can use it for projects or groups.', + extras: [:parent] 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] @@ -16,14 +19,26 @@ module Types @runner = node.node end + def edit_url(parent:) + runner_url(parent: parent, url_type: :edit_url) + end + def web_url(parent:) + runner_url(parent: parent, url_type: :default) + end + + private + + def runner_url(parent:, url_type: :default) owner = closest_parent([::Types::ProjectType, ::Types::GroupType], parent) + # Only ::Group is supported at the moment, future iterations will include ::Project. + # See https://gitlab.com/gitlab-org/gitlab/-/issues/16338 case owner when ::Group + return Gitlab::Routing.url_helpers.edit_group_runner_url(owner, @runner) if url_type == :edit_url + Gitlab::Routing.url_helpers.group_runner_url(owner, @runner) - when ::Project - Gitlab::Routing.url_helpers.project_runner_url(owner, @runner) end end end |