diff options
author | Steve Azzopardi <sazzopardi@gitlab.com> | 2018-09-11 20:13:24 +0300 |
---|---|---|
committer | Kamil TrzciĆski <ayufan@ayufan.eu> | 2018-09-11 20:13:24 +0300 |
commit | e254da811fcdde1e89d4cf9b1129537225505e68 (patch) | |
tree | 15cc32f5f1bdeff59e4aa90c774229267fccfc98 /app/serializers/detailed_status_entity.rb | |
parent | 7dd8d37984efb93c58f0f56fe7394ff5d90fbe11 (diff) |
Add empty state illustration information in job API
Diffstat (limited to 'app/serializers/detailed_status_entity.rb')
-rw-r--r-- | app/serializers/detailed_status_entity.rb | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/app/serializers/detailed_status_entity.rb b/app/serializers/detailed_status_entity.rb new file mode 100644 index 00000000000..c772c807f76 --- /dev/null +++ b/app/serializers/detailed_status_entity.rb @@ -0,0 +1,29 @@ +# frozen_string_literal: true + +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 :illustration do |status| + begin + status.illustration + rescue NotImplementedError + # ignored + end + end + + expose :favicon 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 + end +end |