summaryrefslogtreecommitdiff
path: root/app/controllers
diff options
context:
space:
mode:
authorsyasonik <syasonik@gitlab.com>2019-04-17 23:59:31 +0800
committersyasonik <syasonik@gitlab.com>2019-04-24 18:23:04 +0800
commit1edbf97e25018203e1a0ad6da7e50cadbda66337 (patch)
tree20dfa4d96122649ffa550ccabfdfa2cecd3dd058 /app/controllers
parented87159a71703111ffcedbd2e4248755057c1d8d (diff)
downloadgitlab-ce-1edbf97e25018203e1a0ad6da7e50cadbda66337.tar.gz
Try to reduce complexity again
Diffstat (limited to 'app/controllers')
-rw-r--r--app/controllers/projects/environments_controller.rb14
1 files changed, 4 insertions, 10 deletions
diff --git a/app/controllers/projects/environments_controller.rb b/app/controllers/projects/environments_controller.rb
index 1aa4ac6017c..145b0a6cade 100644
--- a/app/controllers/projects/environments_controller.rb
+++ b/app/controllers/projects/environments_controller.rb
@@ -158,22 +158,16 @@ class Projects::EnvironmentsController < Projects::ApplicationController
end
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|
format.json do
result = Gitlab::MetricsDashboard::Service.new(@project, @current_user, environment: environment).get_dashboard
- if result[:status] == :success
- status_code = :ok
- details = { dashboard: result[:dashboard] }
- else
- status_code = result[:http_status] || :bad_request
- details = { message: result[:message] }
- end
+ ok_status = :ok if result[:status] == :success
+ status = ok_status || result[:http_status] || :bad_request
- render status: status_code,
- json: { status: result[:status] }.merge(details)
+ render status: status, json: result
end
end
end