diff options
author | Z.J. van de Weg <git@zjvandeweg.nl> | 2017-02-15 19:59:30 +0100 |
---|---|---|
committer | Z.J. van de Weg <git@zjvandeweg.nl> | 2017-02-15 19:59:30 +0100 |
commit | a254dcf0edfb6aa4ea93fd0bfdb992565d6e8422 (patch) | |
tree | c58d86ce32402e84c7e9f209f63643e90ae41724 /app/controllers | |
parent | b8dbebce1d7e0ad4edf2ab09135457ade69c240c (diff) | |
download | gitlab-ce-a254dcf0edfb6aa4ea93fd0bfdb992565d6e8422.tar.gz |
Add count keys to response JSONfe-paginated-environments-api
Diffstat (limited to 'app/controllers')
-rw-r--r-- | app/controllers/projects/environments_controller.rb | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/app/controllers/projects/environments_controller.rb b/app/controllers/projects/environments_controller.rb index 3b7240d8469..fed75396d6e 100644 --- a/app/controllers/projects/environments_controller.rb +++ b/app/controllers/projects/environments_controller.rb @@ -29,9 +29,8 @@ class Projects::EnvironmentsController < Projects::ApplicationController end def folder - @environments = project.environments - .where(environment_type: params[:id]) - .with_state(params[:scope] || :available) + folder_environments = project.environments.where(environment_type: params[:id]) + @environments = folder_environments.with_state(params[:scope] || :available) respond_to do |format| format.html @@ -41,6 +40,8 @@ class Projects::EnvironmentsController < Projects::ApplicationController .new(project: @project, user: @current_user) .with_pagination(request, response) .represent(@environments), + available_count: folder_environments.available.count, + stopped_count: folder_environments.stopped.count } end end |