2017-08-17 22:00:37 +05:30
|
|
|
class StatusEntity < Grape::Entity
|
|
|
|
include RequestAwareEntity
|
|
|
|
|
|
|
|
expose :icon, :text, :label, :group
|
2018-05-09 12:01:36 +05:30
|
|
|
expose :status_tooltip, as: :tooltip
|
2017-08-17 22:00:37 +05:30
|
|
|
expose :has_details?, as: :has_details
|
|
|
|
expose :details_path
|
|
|
|
|
|
|
|
expose :favicon do |status|
|
2018-05-09 12:01:36 +05:30
|
|
|
dir =
|
|
|
|
if Gitlab::Utils.to_boolean(ENV['CANARY'])
|
|
|
|
File.join('ci_favicons', 'canary')
|
|
|
|
elsif Rails.env.development?
|
|
|
|
File.join('ci_favicons', 'dev')
|
|
|
|
else
|
|
|
|
'ci_favicons'
|
|
|
|
end
|
2017-08-17 22:00:37 +05:30
|
|
|
|
|
|
|
ActionController::Base.helpers.image_path(File.join(dir, "#{status.favicon}.ico"))
|
|
|
|
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
|