Files
gitlab-foss/lib/gitlab/performance_bar/with_top_level_warnings.rb
Sean McGivern 9bfb012a56 Add top-level warnings key to performance bar response
This key is useful to reduce the amount of logic needed on the frontend:
if `has_warnings` is true, then the frontend knows that the request in
question has warnings for some metric.
2019-08-28 16:39:33 +01:00

20 lines
366 B
Ruby

# frozen_string_literal: true
module Gitlab
module PerformanceBar
module WithTopLevelWarnings
def results
results = super
results.merge(has_warnings: has_warnings?(results))
end
def has_warnings?(results)
results[:data].any? do |_, value|
value[:warnings].present?
end
end
end
end
end