Commit 1edbf97e authored by syasonik's avatar syasonik

Try to reduce complexity again

parent ed87159a
...@@ -158,22 +158,16 @@ class Projects::EnvironmentsController < Projects::ApplicationController ...@@ -158,22 +158,16 @@ class Projects::EnvironmentsController < Projects::ApplicationController
end end
def metrics_dashboard def metrics_dashboard
render_403 && return unless Feature.enabled?(:environment_metrics_use_prometheus_endpoint, project) render_403 && return unless Feature.enabled?(:environment_metrics_use_prometheus_endpoint, @project)
respond_to do |format| respond_to do |format|
format.json do format.json do
result = Gitlab::MetricsDashboard::Service.new(@project, @current_user, environment: environment).get_dashboard result = Gitlab::MetricsDashboard::Service.new(@project, @current_user, environment: environment).get_dashboard
if result[:status] == :success ok_status = :ok if result[:status] == :success
status_code = :ok status = ok_status || result[:http_status] || :bad_request
details = { dashboard: result[:dashboard] }
else
status_code = result[:http_status] || :bad_request
details = { message: result[:message] }
end
render status: status_code, render status: status, json: result
json: { status: result[:status] }.merge(details)
end end
end end
end end
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment