diff options
Diffstat (limited to 'app/serializers/detailed_status_entity.rb')
-rw-r--r-- | app/serializers/detailed_status_entity.rb | 37 |
1 files changed, 26 insertions, 11 deletions
diff --git a/app/serializers/detailed_status_entity.rb b/app/serializers/detailed_status_entity.rb index 4f23ef0ed82..ed8ac9f40f7 100644 --- a/app/serializers/detailed_status_entity.rb +++ b/app/serializers/detailed_status_entity.rb @@ -3,12 +3,25 @@ class DetailedStatusEntity < Grape::Entity include RequestAwareEntity - expose :icon, :text, :label, :group - expose :status_tooltip, as: :tooltip - expose :has_details?, as: :has_details - expose :details_path + expose :icon, documentation: { type: 'string', example: 'status_success' } + expose :text, documentation: { type: 'string', example: 'passed' } + expose :label, documentation: { type: 'string', example: 'passed' } + expose :group, documentation: { type: 'string', example: 'success' } + expose :status_tooltip, as: :tooltip, documentation: { type: 'string', example: 'passed' } + expose :has_details?, as: :has_details, documentation: { type: 'boolean', example: true } + expose :details_path, documentation: { type: 'string', example: '/test-group/test-project/-/pipelines/287' } - expose :illustration do |status| + expose :illustration, documentation: { + type: 'object', + example: <<~JSON + { + "image": "illustrations/job_not_triggered.svg", + "size": "svg-306", + "title": "This job has not been triggered yet", + "content": "This job depends on upstream jobs that need to succeed in order for this job to be triggered" + } + JSON + } do |status| illustration = { image: ActionController::Base.helpers.image_path(status.illustration[:image]) } @@ -19,15 +32,17 @@ class DetailedStatusEntity < Grape::Entity # ignored end - expose :favicon do |status| + expose :favicon, + documentation: { type: 'string', + example: '/assets/ci_favicons/favicon_status_success.png' } do |status| Gitlab::Favicon.status_overlay(status.favicon) end expose :action, if: -> (status, _) { status.has_action? } do - expose :action_icon, as: :icon - expose :action_title, as: :title - expose :action_path, as: :path - expose :action_method, as: :method - expose :action_button_title, as: :button_title + expose :action_icon, as: :icon, documentation: { type: 'string', example: 'cancel' } + expose :action_title, as: :title, documentation: { type: 'string', example: 'Cancel' } + expose :action_path, as: :path, documentation: { type: 'string', example: '/namespace1/project1/-/jobs/2/cancel' } + expose :action_method, as: :method, documentation: { type: 'string', example: 'post' } + expose :action_button_title, as: :button_title, documentation: { type: 'string', example: 'Cancel this job' } end end |