summaryrefslogtreecommitdiff
path: root/app/graphql/types/ci
diff options
context:
space:
mode:
Diffstat (limited to 'app/graphql/types/ci')
-rw-r--r--app/graphql/types/ci/detailed_status_type.rb47
-rw-r--r--app/graphql/types/ci/group_type.rb3
-rw-r--r--app/graphql/types/ci/job_type.rb5
-rw-r--r--app/graphql/types/ci/runner_architecture_type.rb15
-rw-r--r--app/graphql/types/ci/runner_platform_type.rb17
-rw-r--r--app/graphql/types/ci/stage_type.rb3
-rw-r--r--app/graphql/types/ci/status_action_type.rb25
7 files changed, 99 insertions, 16 deletions
diff --git a/app/graphql/types/ci/detailed_status_type.rb b/app/graphql/types/ci/detailed_status_type.rb
index 90b5283fc9a..f4a50115ee6 100644
--- a/app/graphql/types/ci/detailed_status_type.rb
+++ b/app/graphql/types/ci/detailed_status_type.rb
@@ -6,24 +6,39 @@ module Types
class DetailedStatusType < BaseObject
graphql_name 'DetailedStatus'
- field :group, GraphQL::STRING_TYPE, null: false,
- description: 'Group of the pipeline status'
- field :icon, GraphQL::STRING_TYPE, null: false,
- description: 'Icon of the pipeline status'
- field :favicon, GraphQL::STRING_TYPE, null: false,
- description: 'Favicon of the pipeline status'
- field :details_path, GraphQL::STRING_TYPE, null: false,
- description: 'Path of the details for the pipeline status'
- field :has_details, GraphQL::BOOLEAN_TYPE, null: false,
- description: 'Indicates if the pipeline status has further details',
+ field :group, GraphQL::STRING_TYPE, null: true,
+ description: 'Group of the status'
+ field :icon, GraphQL::STRING_TYPE, null: true,
+ description: 'Icon of the status'
+ field :favicon, GraphQL::STRING_TYPE, null: true,
+ description: 'Favicon of the status'
+ field :details_path, GraphQL::STRING_TYPE, null: true,
+ description: 'Path of the details for the status'
+ field :has_details, GraphQL::BOOLEAN_TYPE, null: true,
+ description: 'Indicates if the status has further details',
method: :has_details?
- field :label, GraphQL::STRING_TYPE, null: false,
- description: 'Label of the pipeline status'
- field :text, GraphQL::STRING_TYPE, null: false,
- description: 'Text of the pipeline status'
- field :tooltip, GraphQL::STRING_TYPE, null: false,
- description: 'Tooltip associated with the pipeline status',
+ field :label, GraphQL::STRING_TYPE, null: true,
+ description: 'Label of the status'
+ field :text, GraphQL::STRING_TYPE, null: true,
+ description: 'Text of the status'
+ field :tooltip, GraphQL::STRING_TYPE, null: true,
+ description: 'Tooltip associated with the 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',
+ 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
diff --git a/app/graphql/types/ci/group_type.rb b/app/graphql/types/ci/group_type.rb
index 04c0eb93068..d930ae311b7 100644
--- a/app/graphql/types/ci/group_type.rb
+++ b/app/graphql/types/ci/group_type.rb
@@ -12,6 +12,9 @@ module Types
description: 'Size of the group'
field :jobs, Ci::JobType.connection_type, null: true,
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
diff --git a/app/graphql/types/ci/job_type.rb b/app/graphql/types/ci/job_type.rb
index 4c18f3ffd52..0ee1ad47b62 100644
--- a/app/graphql/types/ci/job_type.rb
+++ b/app/graphql/types/ci/job_type.rb
@@ -10,6 +10,11 @@ module Types
description: 'Name of the job'
field :needs, JobType.connection_type, null: true,
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]) }
+ field :scheduled_at, Types::TimeType, null: true,
+ description: 'Schedule for the build'
end
end
end
diff --git a/app/graphql/types/ci/runner_architecture_type.rb b/app/graphql/types/ci/runner_architecture_type.rb
new file mode 100644
index 00000000000..526348abd9d
--- /dev/null
+++ b/app/graphql/types/ci/runner_architecture_type.rb
@@ -0,0 +1,15 @@
+# frozen_string_literal: true
+
+module Types
+ module Ci
+ # rubocop: disable Graphql/AuthorizeTypes
+ class RunnerArchitectureType < BaseObject
+ graphql_name 'RunnerArchitecture'
+
+ field :name, GraphQL::STRING_TYPE, null: false,
+ description: 'Name of the runner platform architecture'
+ field :download_location, GraphQL::STRING_TYPE, null: false,
+ description: 'Download location for the runner for the platform architecture'
+ end
+ end
+end
diff --git a/app/graphql/types/ci/runner_platform_type.rb b/app/graphql/types/ci/runner_platform_type.rb
new file mode 100644
index 00000000000..64719bc4908
--- /dev/null
+++ b/app/graphql/types/ci/runner_platform_type.rb
@@ -0,0 +1,17 @@
+# frozen_string_literal: true
+
+module Types
+ module Ci
+ # rubocop: disable Graphql/AuthorizeTypes
+ class RunnerPlatformType < BaseObject
+ graphql_name 'RunnerPlatform'
+
+ field :name, GraphQL::STRING_TYPE, null: false,
+ description: 'Name slug of the runner platform'
+ field :human_readable_name, GraphQL::STRING_TYPE, null: false,
+ description: 'Human readable name of the runner platform'
+ field :architectures, Types::Ci::RunnerArchitectureType.connection_type, null: true,
+ description: 'Runner architectures supported for the platform'
+ end
+ end
+end
diff --git a/app/graphql/types/ci/stage_type.rb b/app/graphql/types/ci/stage_type.rb
index 278c4d4d748..fc2c72d0d06 100644
--- a/app/graphql/types/ci/stage_type.rb
+++ b/app/graphql/types/ci/stage_type.rb
@@ -10,6 +10,9 @@ module Types
description: 'Name of the stage'
field :groups, Ci::GroupType.connection_type, null: true,
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
diff --git a/app/graphql/types/ci/status_action_type.rb b/app/graphql/types/ci/status_action_type.rb
new file mode 100644
index 00000000000..08cbb6d3b59
--- /dev/null
+++ b/app/graphql/types/ci/status_action_type.rb
@@ -0,0 +1,25 @@
+# frozen_string_literal: true
+module Types
+ module Ci
+ # rubocop: disable Graphql/AuthorizeTypes
+ class StatusActionType < BaseObject
+ graphql_name 'StatusAction'
+
+ field :button_title, GraphQL::STRING_TYPE, null: true,
+ 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 :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