diff options
author | syasonik <syasonik@gitlab.com> | 2019-04-18 15:41:34 +0800 |
---|---|---|
committer | syasonik <syasonik@gitlab.com> | 2019-04-24 18:23:04 +0800 |
commit | 655fae4242e88d71756578970d19c3db42ed63e1 (patch) | |
tree | 7bfc7dfeaa8cbc21c54e181336763531432c2c25 | |
parent | 1edbf97e25018203e1a0ad6da7e50cadbda66337 (diff) | |
download | gitlab-ce-655fae4242e88d71756578970d19c3db42ed63e1.tar.gz |
Reduce cognitivty complexity more
-rw-r--r-- | app/controllers/projects/environments_controller.rb | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/app/controllers/projects/environments_controller.rb b/app/controllers/projects/environments_controller.rb index 145b0a6cade..3f345204241 100644 --- a/app/controllers/projects/environments_controller.rb +++ b/app/controllers/projects/environments_controller.rb @@ -164,10 +164,7 @@ class Projects::EnvironmentsController < Projects::ApplicationController format.json do result = Gitlab::MetricsDashboard::Service.new(@project, @current_user, environment: environment).get_dashboard - ok_status = :ok if result[:status] == :success - status = ok_status || result[:http_status] || :bad_request - - render status: status, json: result + render_metrics_dashboard_response(result) end end end @@ -212,6 +209,13 @@ class Projects::EnvironmentsController < Projects::ApplicationController params.require([:start, :end]) end + def render_metrics_dashboard_response(result) + ok_status = :ok if result[:status] == :success + status = ok_status || result[:http_status] || :bad_request + + render status: status, json: result + end + def search_environment_names return [] unless params[:query] |