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 ...@@ -25,21 +25,20 @@ module Types
description: 'Tooltip associated with the pipeline status', description: 'Tooltip associated with the pipeline status',
method: :status_tooltip method: :status_tooltip
field :action, Types::Ci::StatusActionType, null: true, field :action, Types::Ci::StatusActionType, null: true,
description: 'Action information for the status. This includes method, button title, icon, path, and title' description: 'Action information for the status. This includes method, button title, icon, path, and title',
resolve: -> (obj, _args, _ctx) {
def action if obj.has_action?
if object.has_action? {
{ button_title: obj.action_button_title,
action_method: object.action_method, icon: obj.icon,
button_title: object.action_button_title, method: obj.action_method,
icon: object.action_icon, path: obj.action_path,
path: object.action_path, title: obj.action_title
title: object.action_title }
} else
else nil
nil end
end }
end
end end
# rubocop: enable Graphql/AuthorizeTypes # rubocop: enable Graphql/AuthorizeTypes
end end
......
...@@ -9,12 +9,17 @@ module Types ...@@ -9,12 +9,17 @@ module Types
description: 'Title for the button, for example: Retry this job' description: 'Title for the button, for example: Retry this job'
field :icon, GraphQL::STRING_TYPE, null: true, field :icon, GraphQL::STRING_TYPE, null: true,
description: 'Icon used in the action button' description: 'Icon used in the action button'
field :action_method, GraphQL::STRING_TYPE, null: true, field :method, GraphQL::STRING_TYPE, null: true,
description: 'Method for the action, for example: :post' description: 'Method for the action, for example: :post',
resolver_method: :action_method
field :path, GraphQL::STRING_TYPE, null: true, field :path, GraphQL::STRING_TYPE, null: true,
description: 'Path for the action' description: 'Path for the action'
field :title, GraphQL::STRING_TYPE, null: true, field :title, GraphQL::STRING_TYPE, null: true,
description: 'Title for the action, for example: Retry' description: 'Title for the action, for example: Retry'
def action_method
object[:method]
end
end end
end end
end end
...@@ -17718,11 +17718,6 @@ enum Sort { ...@@ -17718,11 +17718,6 @@ enum Sort {
} }
type StatusAction { type StatusAction {
"""
Method for the action, for example: :post
"""
actionMethod: String
""" """
Title for the button, for example: Retry this job Title for the button, for example: Retry this job
""" """
...@@ -17733,6 +17728,11 @@ type StatusAction { ...@@ -17733,6 +17728,11 @@ type StatusAction {
""" """
icon: String icon: String
"""
Method for the action, for example: :post
"""
method: String
""" """
Path for the action Path for the action
""" """
......
...@@ -51497,8 +51497,8 @@ ...@@ -51497,8 +51497,8 @@
"description": null, "description": null,
"fields": [ "fields": [
{ {
"name": "actionMethod", "name": "buttonTitle",
"description": "Method for the action, for example: :post", "description": "Title for the button, for example: Retry this job",
"args": [ "args": [
], ],
...@@ -51511,8 +51511,8 @@ ...@@ -51511,8 +51511,8 @@
"deprecationReason": null "deprecationReason": null
}, },
{ {
"name": "buttonTitle", "name": "icon",
"description": "Title for the button, for example: Retry this job", "description": "Icon used in the action button",
"args": [ "args": [
], ],
...@@ -51525,8 +51525,8 @@ ...@@ -51525,8 +51525,8 @@
"deprecationReason": null "deprecationReason": null
}, },
{ {
"name": "icon", "name": "method",
"description": "Icon used in the action button", "description": "Method for the action, for example: :post",
"args": [ "args": [
], ],
...@@ -2460,9 +2460,9 @@ Represents how the blob content should be displayed. ...@@ -2460,9 +2460,9 @@ Represents how the blob content should be displayed.
| Field | Type | Description | | Field | Type | Description |
| ----- | ---- | ----------- | | ----- | ---- | ----------- |
| `actionMethod` | String | Method for the action, for example: :post |
| `buttonTitle` | String | Title for the button, for example: Retry this job | | `buttonTitle` | String | Title for the button, for example: Retry this job |
| `icon` | String | Icon used in the action button | | `icon` | String | Icon used in the action button |
| `method` | String | Method for the action, for example: :post |
| `path` | String | Path for the action | | `path` | String | Path for the action |
| `title` | String | Title for the action, for example: Retry | | `title` | String | Title for the action, for example: Retry |
......
...@@ -7,10 +7,10 @@ RSpec.describe Types::Ci::StatusActionType do ...@@ -7,10 +7,10 @@ RSpec.describe Types::Ci::StatusActionType do
it 'exposes the expected fields' do it 'exposes the expected fields' do
expected_fields = %i[ expected_fields = %i[
actionMethod
buttonTitle buttonTitle
icon icon
path path
method
title 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