summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorsyasonik <syasonik@gitlab.com>2019-04-17 20:53:32 +0800
committersyasonik <syasonik@gitlab.com>2019-04-24 18:23:03 +0800
commit57e0d474c24dec779c6794a29cd84f8cef38d9a7 (patch)
tree0baf2f3775c86d39cf1e1a241ec770a221d32040
parent9a9cb2534ca931bf02bae9f86201129bdb6fa3c3 (diff)
downloadgitlab-ce-57e0d474c24dec779c6794a29cd84f8cef38d9a7.tar.gz
Reduce congnitive complexity
-rw-r--r--app/controllers/projects/environments_controller.rb15
1 files changed, 7 insertions, 8 deletions
diff --git a/app/controllers/projects/environments_controller.rb b/app/controllers/projects/environments_controller.rb
index 52736bcf3f8..1aa4ac6017c 100644
--- a/app/controllers/projects/environments_controller.rb
+++ b/app/controllers/projects/environments_controller.rb
@@ -165,16 +165,15 @@ class Projects::EnvironmentsController < Projects::ApplicationController
result = Gitlab::MetricsDashboard::Service.new(@project, @current_user, environment: environment).get_dashboard
if result[:status] == :success
- render status: :ok, json: {
- status: :success,
- dashboard: result[:dashboard]
- }
+ status_code = :ok
+ details = { dashboard: result[:dashboard] }
else
- render status: result[:http_status] || :bad_request, json: {
- message: result[:message],
- status: result[:status]
- }
+ status_code = result[:http_status] || :bad_request
+ details = { message: result[:message] }
end
+
+ render status: status_code,
+ json: { status: result[:status] }.merge(details)
end
end
end