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:
authorGitLab Bot <gitlab-bot@gitlab.com>2019-10-10 15:06:19 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2019-10-10 15:06:19 +0300
commit69849c280c5525d132ebaddb1200c390a42ecc06 (patch)
tree2c6ffc6fd6dc4fa719305f25b475391730389747 /app/controllers/projects/environments
parentc157f963db87a40a3ba7b94b339530ee83194bc8 (diff)
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app/controllers/projects/environments')
-rw-r--r--app/controllers/projects/environments/prometheus_api_controller.rb21
1 files changed, 6 insertions, 15 deletions
diff --git a/app/controllers/projects/environments/prometheus_api_controller.rb b/app/controllers/projects/environments/prometheus_api_controller.rb
index 9c6c6513a78..e902d218c75 100644
--- a/app/controllers/projects/environments/prometheus_api_controller.rb
+++ b/app/controllers/projects/environments/prometheus_api_controller.rb
@@ -1,6 +1,8 @@
# frozen_string_literal: true
class Projects::Environments::PrometheusApiController < Projects::ApplicationController
+ include RenderServiceResults
+
before_action :authorize_read_prometheus!
before_action :environment
@@ -12,21 +14,10 @@ class Projects::Environments::PrometheusApiController < Projects::ApplicationCon
proxy_params
).execute
- if result.nil?
- return render status: :no_content, json: {
- status: _('processing'),
- message: _('Not ready yet. Try again later.')
- }
- end
-
- if result[:status] == :success
- render status: result[:http_status], json: result[:body]
- else
- render(
- status: result[:http_status] || :bad_request,
- json: { status: result[:status], message: result[:message] }
- )
- end
+ return continue_polling_response if result.nil?
+ return error_response(result) if result[:status] == :error
+
+ success_response(result)
end
private