Commit 9e2c3fc6 authored by lauraMon's avatar lauraMon

Moved method into a resolver instead

* Updates schema and docs
* Updates specs
parent 44af7813
......@@ -25,21 +25,20 @@ module Types
description: 'Tooltip associated with the pipeline status',
method: :status_tooltip
field :action, Types::Ci::StatusActionType, null: true,
description: 'Action information for the status. This includes method, button title, icon, path, and title'
def action
if object.has_action?
{
action_method: object.action_method,
button_title: object.action_button_title,
icon: object.action_icon,
path: object.action_path,
title: object.action_title
}
else
nil
end
end
description: 'Action information for the status. This includes method, button title, icon, path, and title',
resolve: -> (obj, _args, _ctx) {
if obj.has_action?
{
button_title: obj.action_button_title,
icon: obj.icon,
method: obj.action_method,
path: obj.action_path,
title: obj.action_title
}
else
nil
end
}
end
# rubocop: enable Graphql/AuthorizeTypes
end
......
......@@ -9,12 +9,17 @@ module Types
description: 'Title for the button, for example: Retry this job'
field :icon, GraphQL::STRING_TYPE, null: true,
description: 'Icon used in the action button'
field :action_method, GraphQL::STRING_TYPE, null: true,
description: 'Method for the action, for example: :post'
field :method, GraphQL::STRING_TYPE, null: true,
description: 'Method for the action, for example: :post',
resolver_method: :action_method
field :path, GraphQL::STRING_TYPE, null: true,
description: 'Path for the action'
field :title, GraphQL::STRING_TYPE, null: true,
description: 'Title for the action, for example: Retry'
def action_method
object[:method]
end
end
end
end
......@@ -17718,11 +17718,6 @@ enum Sort {
}
type StatusAction {
"""
Method for the action, for example: :post
"""
actionMethod: String
"""
Title for the button, for example: Retry this job
"""
......@@ -17733,6 +17728,11 @@ type StatusAction {
"""
icon: String
"""
Method for the action, for example: :post
"""
method: String
"""
Path for the action
"""
......
......@@ -51497,8 +51497,8 @@
"description": null,
"fields": [
{
"name": "actionMethod",
"description": "Method for the action, for example: :post",
"name": "buttonTitle",
"description": "Title for the button, for example: Retry this job",
"args": [
],
......@@ -51511,8 +51511,8 @@
"deprecationReason": null
},
{
"name": "buttonTitle",
"description": "Title for the button, for example: Retry this job",
"name": "icon",
"description": "Icon used in the action button",
"args": [
],
......@@ -51525,8 +51525,8 @@
"deprecationReason": null
},
{
"name": "icon",
"description": "Icon used in the action button",
"name": "method",
"description": "Method for the action, for example: :post",
"args": [
],
......@@ -2460,9 +2460,9 @@ Represents how the blob content should be displayed.
| Field | Type | Description |
| ----- | ---- | ----------- |
| `actionMethod` | String | Method for the action, for example: :post |
| `buttonTitle` | String | Title for the button, for example: Retry this job |
| `icon` | String | Icon used in the action button |
| `method` | String | Method for the action, for example: :post |
| `path` | String | Path for the action |
| `title` | String | Title for the action, for example: Retry |
......
......@@ -7,10 +7,10 @@ RSpec.describe Types::Ci::StatusActionType do
it 'exposes the expected fields' do
expected_fields = %i[
actionMethod
buttonTitle
icon
path
method
title
]
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment