Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorsyasonik <syasonik@gitlab.com>2019-04-17 15:53:32 +0300
committersyasonik <syasonik@gitlab.com>2019-04-24 13:23:03 +0300
commit57e0d474c24dec779c6794a29cd84f8cef38d9a7 (patch)
tree0baf2f3775c86d39cf1e1a241ec770a221d32040 /app/controllers/projects
parent9a9cb2534ca931bf02bae9f86201129bdb6fa3c3 (diff)
Reduce congnitive complexity
Diffstat (limited to 'app/controllers/projects')
-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