Commit 898e67f1 authored by Laura Montemayor's avatar Laura Montemayor Committed by Shinya Maeda

Adds status to jobs, stages, and groups

* Adds the specs
* Adds schema and docs
parent ac0af237
...@@ -7,22 +7,22 @@ module Types ...@@ -7,22 +7,22 @@ module Types
graphql_name 'DetailedStatus' graphql_name 'DetailedStatus'
field :group, GraphQL::STRING_TYPE, null: false, field :group, GraphQL::STRING_TYPE, null: false,
description: 'Group of the pipeline status' description: 'Group of the status'
field :icon, GraphQL::STRING_TYPE, null: false, field :icon, GraphQL::STRING_TYPE, null: false,
description: 'Icon of the pipeline status' description: 'Icon of the status'
field :favicon, GraphQL::STRING_TYPE, null: false, field :favicon, GraphQL::STRING_TYPE, null: false,
description: 'Favicon of the pipeline status' description: 'Favicon of the status'
field :details_path, GraphQL::STRING_TYPE, null: false, field :details_path, GraphQL::STRING_TYPE, null: true,
description: 'Path of the details for the pipeline status' description: 'Path of the details for the status'
field :has_details, GraphQL::BOOLEAN_TYPE, null: false, field :has_details, GraphQL::BOOLEAN_TYPE, null: false,
description: 'Indicates if the pipeline status has further details', description: 'Indicates if the status has further details',
method: :has_details? method: :has_details?
field :label, GraphQL::STRING_TYPE, null: false, field :label, GraphQL::STRING_TYPE, null: false,
description: 'Label of the pipeline status' description: 'Label of the status'
field :text, GraphQL::STRING_TYPE, null: false, field :text, GraphQL::STRING_TYPE, null: false,
description: 'Text of the pipeline status' description: 'Text of the status'
field :tooltip, GraphQL::STRING_TYPE, null: false, field :tooltip, GraphQL::STRING_TYPE, null: false,
description: 'Tooltip associated with the pipeline status', description: 'Tooltip associated with the 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',
......
...@@ -12,6 +12,9 @@ module Types ...@@ -12,6 +12,9 @@ module Types
description: 'Size of the group' description: 'Size of the group'
field :jobs, Ci::JobType.connection_type, null: true, field :jobs, Ci::JobType.connection_type, null: true,
description: 'Jobs in group' description: 'Jobs in group'
field :detailed_status, Types::Ci::DetailedStatusType, null: true,
description: 'Detailed status of the group',
resolve: -> (obj, _args, ctx) { obj.detailed_status(ctx[:current_user]) }
end end
end end
end end
...@@ -10,6 +10,9 @@ module Types ...@@ -10,6 +10,9 @@ module Types
description: 'Name of the job' description: 'Name of the job'
field :needs, JobType.connection_type, null: true, field :needs, JobType.connection_type, null: true,
description: 'Builds that must complete before the jobs run' description: 'Builds that must complete before the jobs run'
field :detailed_status, Types::Ci::DetailedStatusType, null: true,
description: 'Detailed status of the job',
resolve: -> (obj, _args, ctx) { obj.detailed_status(ctx[:current_user]) }
end end
end end
end end
...@@ -10,6 +10,9 @@ module Types ...@@ -10,6 +10,9 @@ module Types
description: 'Name of the stage' description: 'Name of the stage'
field :groups, Ci::GroupType.connection_type, null: true, field :groups, Ci::GroupType.connection_type, null: true,
description: 'Group of jobs for the stage' description: 'Group of jobs for the stage'
field :detailed_status, Types::Ci::DetailedStatusType, null: true,
description: 'Detailed status of the stage',
resolve: -> (obj, _args, ctx) { obj.detailed_status(ctx[:current_user]) }
end end
end end
end end
---
title: 'GrahphQL: Adds status to jobs, stages, and groups'
merge_request: 43069
author:
type: added
...@@ -2000,6 +2000,11 @@ type BurnupChartDailyTotals { ...@@ -2000,6 +2000,11 @@ type BurnupChartDailyTotals {
} }
type CiGroup { type CiGroup {
"""
Detailed status of the group
"""
detailedStatus: DetailedStatus
""" """
Jobs in group Jobs in group
""" """
...@@ -2072,6 +2077,11 @@ type CiGroupEdge { ...@@ -2072,6 +2077,11 @@ type CiGroupEdge {
} }
type CiJob { type CiJob {
"""
Detailed status of the job
"""
detailedStatus: DetailedStatus
""" """
Name of the job Name of the job
""" """
...@@ -2144,6 +2154,11 @@ Identifier of Ci::Pipeline ...@@ -2144,6 +2154,11 @@ Identifier of Ci::Pipeline
scalar CiPipelineID scalar CiPipelineID
type CiStage { type CiStage {
"""
Detailed status of the stage
"""
detailedStatus: DetailedStatus
""" """
Group of jobs for the stage Group of jobs for the stage
""" """
...@@ -5215,42 +5230,42 @@ type DetailedStatus { ...@@ -5215,42 +5230,42 @@ type DetailedStatus {
action: StatusAction action: StatusAction
""" """
Path of the details for the pipeline status Path of the details for the status
""" """
detailsPath: String! detailsPath: String
""" """
Favicon of the pipeline status Favicon of the status
""" """
favicon: String! favicon: String!
""" """
Group of the pipeline status Group of the status
""" """
group: String! group: String!
""" """
Indicates if the pipeline status has further details Indicates if the status has further details
""" """
hasDetails: Boolean! hasDetails: Boolean!
""" """
Icon of the pipeline status Icon of the status
""" """
icon: String! icon: String!
""" """
Label of the pipeline status Label of the status
""" """
label: String! label: String!
""" """
Text of the pipeline status Text of the status
""" """
text: String! text: String!
""" """
Tooltip associated with the pipeline status Tooltip associated with the status
""" """
tooltip: String! tooltip: String!
} }
......
...@@ -5343,6 +5343,20 @@ ...@@ -5343,6 +5343,20 @@
"name": "CiGroup", "name": "CiGroup",
"description": null, "description": null,
"fields": [ "fields": [
{
"name": "detailedStatus",
"description": "Detailed status of the group",
"args": [
],
"type": {
"kind": "OBJECT",
"name": "DetailedStatus",
"ofType": null
},
"isDeprecated": false,
"deprecationReason": null
},
{ {
"name": "jobs", "name": "jobs",
"description": "Jobs in group", "description": "Jobs in group",
...@@ -5549,6 +5563,20 @@ ...@@ -5549,6 +5563,20 @@
"name": "CiJob", "name": "CiJob",
"description": null, "description": null,
"fields": [ "fields": [
{
"name": "detailedStatus",
"description": "Detailed status of the job",
"args": [
],
"type": {
"kind": "OBJECT",
"name": "DetailedStatus",
"ofType": null
},
"isDeprecated": false,
"deprecationReason": null
},
{ {
"name": "name", "name": "name",
"description": "Name of the job", "description": "Name of the job",
...@@ -5751,6 +5779,20 @@ ...@@ -5751,6 +5779,20 @@
"name": "CiStage", "name": "CiStage",
"description": null, "description": null,
"fields": [ "fields": [
{
"name": "detailedStatus",
"description": "Detailed status of the stage",
"args": [
],
"type": {
"kind": "OBJECT",
"name": "DetailedStatus",
"ofType": null
},
"isDeprecated": false,
"deprecationReason": null
},
{ {
"name": "groups", "name": "groups",
"description": "Group of jobs for the stage", "description": "Group of jobs for the stage",
...@@ -14279,25 +14321,21 @@ ...@@ -14279,25 +14321,21 @@
}, },
{ {
"name": "detailsPath", "name": "detailsPath",
"description": "Path of the details for the pipeline status", "description": "Path of the details for the status",
"args": [ "args": [
], ],
"type": { "type": {
"kind": "NON_NULL", "kind": "SCALAR",
"name": null, "name": "String",
"ofType": { "ofType": null
"kind": "SCALAR",
"name": "String",
"ofType": null
}
}, },
"isDeprecated": false, "isDeprecated": false,
"deprecationReason": null "deprecationReason": null
}, },
{ {
"name": "favicon", "name": "favicon",
"description": "Favicon of the pipeline status", "description": "Favicon of the status",
"args": [ "args": [
], ],
...@@ -14315,7 +14353,7 @@ ...@@ -14315,7 +14353,7 @@
}, },
{ {
"name": "group", "name": "group",
"description": "Group of the pipeline status", "description": "Group of the status",
"args": [ "args": [
], ],
...@@ -14333,7 +14371,7 @@ ...@@ -14333,7 +14371,7 @@
}, },
{ {
"name": "hasDetails", "name": "hasDetails",
"description": "Indicates if the pipeline status has further details", "description": "Indicates if the status has further details",
"args": [ "args": [
], ],
...@@ -14351,7 +14389,7 @@ ...@@ -14351,7 +14389,7 @@
}, },
{ {
"name": "icon", "name": "icon",
"description": "Icon of the pipeline status", "description": "Icon of the status",
"args": [ "args": [
], ],
...@@ -14369,7 +14407,7 @@ ...@@ -14369,7 +14407,7 @@
}, },
{ {
"name": "label", "name": "label",
"description": "Label of the pipeline status", "description": "Label of the status",
"args": [ "args": [
], ],
...@@ -14387,7 +14425,7 @@ ...@@ -14387,7 +14425,7 @@
}, },
{ {
"name": "text", "name": "text",
"description": "Text of the pipeline status", "description": "Text of the status",
"args": [ "args": [
], ],
...@@ -14405,7 +14443,7 @@ ...@@ -14405,7 +14443,7 @@
}, },
{ {
"name": "tooltip", "name": "tooltip",
"description": "Tooltip associated with the pipeline status", "description": "Tooltip associated with the status",
"args": [ "args": [
], ],
...@@ -323,6 +323,7 @@ Represents the total number of issues and their weights for a particular day. ...@@ -323,6 +323,7 @@ Represents the total number of issues and their weights for a particular day.
| Field | Type | Description | | Field | Type | Description |
| ----- | ---- | ----------- | | ----- | ---- | ----------- |
| `detailedStatus` | DetailedStatus | Detailed status of the group |
| `name` | String | Name of the job group | | `name` | String | Name of the job group |
| `size` | Int | Size of the group | | `size` | Int | Size of the group |
...@@ -330,12 +331,14 @@ Represents the total number of issues and their weights for a particular day. ...@@ -330,12 +331,14 @@ Represents the total number of issues and their weights for a particular day.
| Field | Type | Description | | Field | Type | Description |
| ----- | ---- | ----------- | | ----- | ---- | ----------- |
| `detailedStatus` | DetailedStatus | Detailed status of the job |
| `name` | String | Name of the job | | `name` | String | Name of the job |
### CiStage ### CiStage
| Field | Type | Description | | Field | Type | Description |
| ----- | ---- | ----------- | | ----- | ---- | ----------- |
| `detailedStatus` | DetailedStatus | Detailed status of the stage |
| `name` | String | Name of the stage | | `name` | String | Name of the stage |
### ClusterAgent ### ClusterAgent
...@@ -840,14 +843,14 @@ Autogenerated return type of DestroySnippet. ...@@ -840,14 +843,14 @@ Autogenerated return type of DestroySnippet.
| Field | Type | Description | | Field | Type | Description |
| ----- | ---- | ----------- | | ----- | ---- | ----------- |
| `action` | StatusAction | Action information for the status. This includes method, button title, icon, path, and title | | `action` | StatusAction | Action information for the status. This includes method, button title, icon, path, and title |
| `detailsPath` | String! | Path of the details for the pipeline status | | `detailsPath` | String | Path of the details for the status |
| `favicon` | String! | Favicon of the pipeline status | | `favicon` | String! | Favicon of the status |
| `group` | String! | Group of the pipeline status | | `group` | String! | Group of the status |
| `hasDetails` | Boolean! | Indicates if the pipeline status has further details | | `hasDetails` | Boolean! | Indicates if the status has further details |
| `icon` | String! | Icon of the pipeline status | | `icon` | String! | Icon of the status |
| `label` | String! | Label of the pipeline status | | `label` | String! | Label of the status |
| `text` | String! | Text of the pipeline status | | `text` | String! | Text of the status |
| `tooltip` | String! | Tooltip associated with the pipeline status | | `tooltip` | String! | Tooltip associated with the status |
### DiffPosition ### DiffPosition
......
...@@ -19,6 +19,10 @@ module Gitlab ...@@ -19,6 +19,10 @@ module Gitlab
def favicon def favicon
'favicon_status_canceled' 'favicon_status_canceled'
end end
def details_path
nil
end
end end
end end
end end
......
...@@ -19,6 +19,10 @@ module Gitlab ...@@ -19,6 +19,10 @@ module Gitlab
def favicon def favicon
'favicon_status_created' 'favicon_status_created'
end end
def details_path
nil
end
end end
end end
end end
......
...@@ -19,6 +19,10 @@ module Gitlab ...@@ -19,6 +19,10 @@ module Gitlab
def favicon def favicon
'favicon_status_failed' 'favicon_status_failed'
end end
def details_path
nil
end
end end
end end
end end
......
...@@ -19,6 +19,10 @@ module Gitlab ...@@ -19,6 +19,10 @@ module Gitlab
def favicon def favicon
'favicon_status_manual' 'favicon_status_manual'
end end
def details_path
nil
end
end end
end end
end end
......
...@@ -19,6 +19,10 @@ module Gitlab ...@@ -19,6 +19,10 @@ module Gitlab
def favicon def favicon
'favicon_status_pending' 'favicon_status_pending'
end end
def details_path
nil
end
end end
end end
end end
......
...@@ -19,6 +19,10 @@ module Gitlab ...@@ -19,6 +19,10 @@ module Gitlab
def favicon def favicon
'favicon_status_preparing' 'favicon_status_preparing'
end end
def details_path
nil
end
end end
end end
end end
......
...@@ -19,6 +19,10 @@ module Gitlab ...@@ -19,6 +19,10 @@ module Gitlab
def favicon def favicon
'favicon_status_running' 'favicon_status_running'
end end
def details_path
nil
end
end end
end end
end end
......
...@@ -19,6 +19,10 @@ module Gitlab ...@@ -19,6 +19,10 @@ module Gitlab
def favicon def favicon
'favicon_status_scheduled' 'favicon_status_scheduled'
end end
def details_path
nil
end
end end
end end
end end
......
...@@ -19,6 +19,10 @@ module Gitlab ...@@ -19,6 +19,10 @@ module Gitlab
def favicon def favicon
'favicon_status_skipped' 'favicon_status_skipped'
end end
def details_path
nil
end
end end
end end
end end
......
...@@ -19,6 +19,10 @@ module Gitlab ...@@ -19,6 +19,10 @@ module Gitlab
def favicon def favicon
'favicon_status_success' 'favicon_status_success'
end end
def details_path
nil
end
end end
end end
end end
......
...@@ -23,6 +23,10 @@ module Gitlab ...@@ -23,6 +23,10 @@ module Gitlab
def group def group
'waiting-for-resource' 'waiting-for-resource'
end end
def details_path
nil
end
end end
end end
end end
......
...@@ -10,6 +10,7 @@ RSpec.describe Types::Ci::GroupType do ...@@ -10,6 +10,7 @@ RSpec.describe Types::Ci::GroupType do
name name
size size
jobs jobs
detailedStatus
] ]
expect(described_class).to have_graphql_fields(*expected_fields) expect(described_class).to have_graphql_fields(*expected_fields)
......
...@@ -9,6 +9,7 @@ RSpec.describe Types::Ci::JobType do ...@@ -9,6 +9,7 @@ RSpec.describe Types::Ci::JobType do
expected_fields = %i[ expected_fields = %i[
name name
needs needs
detailedStatus
] ]
expect(described_class).to have_graphql_fields(*expected_fields) expect(described_class).to have_graphql_fields(*expected_fields)
......
...@@ -9,6 +9,7 @@ RSpec.describe Types::Ci::StageType do ...@@ -9,6 +9,7 @@ RSpec.describe Types::Ci::StageType do
expected_fields = %i[ expected_fields = %i[
name name
groups groups
detailedStatus
] ]
expect(described_class).to have_graphql_fields(*expected_fields) expect(described_class).to have_graphql_fields(*expected_fields)
......
...@@ -26,4 +26,8 @@ RSpec.describe Gitlab::Ci::Status::Canceled do ...@@ -26,4 +26,8 @@ RSpec.describe Gitlab::Ci::Status::Canceled do
describe '#group' do describe '#group' do
it { expect(subject.group).to eq 'canceled' } it { expect(subject.group).to eq 'canceled' }
end end
describe '#details_path' do
it { expect(subject.details_path).to be_nil }
end
end end
...@@ -26,4 +26,8 @@ RSpec.describe Gitlab::Ci::Status::Created do ...@@ -26,4 +26,8 @@ RSpec.describe Gitlab::Ci::Status::Created do
describe '#group' do describe '#group' do
it { expect(subject.group).to eq 'created' } it { expect(subject.group).to eq 'created' }
end end
describe '#details_path' do
it { expect(subject.details_path).to be_nil }
end
end end
...@@ -26,4 +26,8 @@ RSpec.describe Gitlab::Ci::Status::Failed do ...@@ -26,4 +26,8 @@ RSpec.describe Gitlab::Ci::Status::Failed do
describe '#group' do describe '#group' do
it { expect(subject.group).to eq 'failed' } it { expect(subject.group).to eq 'failed' }
end end
describe '#details_path' do
it { expect(subject.details_path).to be_nil }
end
end end
...@@ -26,4 +26,8 @@ RSpec.describe Gitlab::Ci::Status::Pending do ...@@ -26,4 +26,8 @@ RSpec.describe Gitlab::Ci::Status::Pending do
describe '#group' do describe '#group' do
it { expect(subject.group).to eq 'pending' } it { expect(subject.group).to eq 'pending' }
end end
describe '#details_path' do
it { expect(subject.details_path).to be_nil }
end
end end
...@@ -26,4 +26,8 @@ RSpec.describe Gitlab::Ci::Status::Preparing do ...@@ -26,4 +26,8 @@ RSpec.describe Gitlab::Ci::Status::Preparing do
describe '#group' do describe '#group' do
it { expect(subject.group).to eq 'preparing' } it { expect(subject.group).to eq 'preparing' }
end end
describe '#details_path' do
it { expect(subject.details_path).to be_nil }
end
end end
...@@ -26,4 +26,8 @@ RSpec.describe Gitlab::Ci::Status::Running do ...@@ -26,4 +26,8 @@ RSpec.describe Gitlab::Ci::Status::Running do
describe '#group' do describe '#group' do
it { expect(subject.group).to eq 'running' } it { expect(subject.group).to eq 'running' }
end end
describe '#details_path' do
it { expect(subject.details_path).to be_nil }
end
end end
...@@ -26,4 +26,8 @@ RSpec.describe Gitlab::Ci::Status::Scheduled do ...@@ -26,4 +26,8 @@ RSpec.describe Gitlab::Ci::Status::Scheduled do
describe '#group' do describe '#group' do
it { expect(subject.group).to eq 'scheduled' } it { expect(subject.group).to eq 'scheduled' }
end end
describe '#details_path' do
it { expect(subject.details_path).to be_nil }
end
end end
...@@ -26,4 +26,8 @@ RSpec.describe Gitlab::Ci::Status::Skipped do ...@@ -26,4 +26,8 @@ RSpec.describe Gitlab::Ci::Status::Skipped do
describe '#group' do describe '#group' do
it { expect(subject.group).to eq 'skipped' } it { expect(subject.group).to eq 'skipped' }
end end
describe '#details_path' do
it { expect(subject.details_path).to be_nil }
end
end end
...@@ -26,4 +26,8 @@ RSpec.describe Gitlab::Ci::Status::Success do ...@@ -26,4 +26,8 @@ RSpec.describe Gitlab::Ci::Status::Success do
describe '#group' do describe '#group' do
it { expect(subject.group).to eq 'success' } it { expect(subject.group).to eq 'success' }
end end
describe '#details_path' do
it { expect(subject.details_path).to be_nil }
end
end end
...@@ -26,4 +26,8 @@ RSpec.describe Gitlab::Ci::Status::WaitingForResource do ...@@ -26,4 +26,8 @@ RSpec.describe Gitlab::Ci::Status::WaitingForResource do
describe '#group' do describe '#group' do
it { expect(subject.group).to eq 'waiting-for-resource' } it { expect(subject.group).to eq 'waiting-for-resource' }
end end
describe '#details_path' do
it { expect(subject.details_path).to be_nil }
end
end end
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