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-12-09 06:07:57 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2019-12-09 06:07:57 +0300
commit330eac18cef61a4f58b3601265f7b631d2311cd0 (patch)
tree87eec5d8c441581938ca908ce30199832e118b85 /app/controllers/projects/environments
parent3359a5a56337b93cd34b9914b6468395bfb6c514 (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.rb36
1 files changed, 18 insertions, 18 deletions
diff --git a/app/controllers/projects/environments/prometheus_api_controller.rb b/app/controllers/projects/environments/prometheus_api_controller.rb
index e902d218c75..98fcc594d6e 100644
--- a/app/controllers/projects/environments/prometheus_api_controller.rb
+++ b/app/controllers/projects/environments/prometheus_api_controller.rb
@@ -7,23 +7,34 @@ class Projects::Environments::PrometheusApiController < Projects::ApplicationCon
before_action :environment
def proxy
- result = Prometheus::ProxyService.new(
+ variable_substitution_result =
+ variable_substitution_service.new(environment, permit_params).execute
+
+ if variable_substitution_result[:status] == :error
+ return error_response(variable_substitution_result)
+ end
+
+ prometheus_result = Prometheus::ProxyService.new(
environment,
proxy_method,
proxy_path,
- proxy_params
+ variable_substitution_result[:params]
).execute
- return continue_polling_response if result.nil?
- return error_response(result) if result[:status] == :error
+ return continue_polling_response if prometheus_result.nil?
+ return error_response(prometheus_result) if prometheus_result[:status] == :error
- success_response(result)
+ success_response(prometheus_result)
end
private
- def query_context
- Gitlab::Prometheus::QueryVariables.call(environment)
+ def variable_substitution_service
+ Prometheus::ProxyVariableSubstitutionService
+ end
+
+ def permit_params
+ params.permit!
end
def environment
@@ -37,15 +48,4 @@ class Projects::Environments::PrometheusApiController < Projects::ApplicationCon
def proxy_path
params[:proxy_path]
end
-
- def proxy_params
- substitute_query_variables(params).permit!
- end
-
- def substitute_query_variables(params)
- query = params[:query]
- return params unless query
-
- params.merge(query: query % query_context)
- end
end