2018-07-19 14:43:13 -04:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2018-09-11 13:13:24 -04:00
|
|
|
class DetailedStatusEntity < Grape::Entity
|
2016-12-07 10:46:37 -05:00
|
|
|
include RequestAwareEntity
|
|
|
|
|
2017-04-13 06:09:20 -04:00
|
|
|
expose :icon, :text, :label, :group
|
2018-04-05 17:04:42 -04:00
|
|
|
expose :status_tooltip, as: :tooltip
|
2016-12-07 10:46:37 -05:00
|
|
|
expose :has_details?, as: :has_details
|
|
|
|
expose :details_path
|
2017-04-13 06:09:20 -04:00
|
|
|
|
2018-09-11 13:13:24 -04:00
|
|
|
expose :illustration do |status|
|
2019-03-13 09:42:43 -04:00
|
|
|
illustration = {
|
|
|
|
image: ActionController::Base.helpers.image_path(status.illustration[:image])
|
|
|
|
}
|
|
|
|
illustration = status.illustration.merge(illustration)
|
2018-10-04 08:59:57 -04:00
|
|
|
|
2019-03-13 09:42:43 -04:00
|
|
|
illustration
|
|
|
|
rescue NotImplementedError
|
|
|
|
# ignored
|
2018-09-11 13:13:24 -04:00
|
|
|
end
|
|
|
|
|
2017-04-13 07:14:31 -04:00
|
|
|
expose :favicon do |status|
|
2017-12-06 15:04:53 -05:00
|
|
|
Gitlab::Favicon.status_overlay(status.favicon)
|
2017-04-13 07:14:31 -04:00
|
|
|
end
|
2017-05-06 12:45:46 -04:00
|
|
|
|
|
|
|
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
|
2018-10-04 08:59:57 -04:00
|
|
|
expose :action_button_title, as: :button_title
|
2017-05-06 12:45:46 -04:00
|
|
|
end
|
2016-12-07 10:46:37 -05:00
|
|
|
end
|