Commit a254dcf0 authored by Z.J. van de Weg's avatar Z.J. van de Weg

Add count keys to response JSON

parent b8dbebce
...@@ -29,9 +29,8 @@ class Projects::EnvironmentsController < Projects::ApplicationController ...@@ -29,9 +29,8 @@ class Projects::EnvironmentsController < Projects::ApplicationController
end end
def folder def folder
@environments = project.environments folder_environments = project.environments.where(environment_type: params[:id])
.where(environment_type: params[:id]) @environments = folder_environments.with_state(params[:scope] || :available)
.with_state(params[:scope] || :available)
respond_to do |format| respond_to do |format|
format.html format.html
...@@ -41,6 +40,8 @@ class Projects::EnvironmentsController < Projects::ApplicationController ...@@ -41,6 +40,8 @@ class Projects::EnvironmentsController < Projects::ApplicationController
.new(project: @project, user: @current_user) .new(project: @project, user: @current_user)
.with_pagination(request, response) .with_pagination(request, response)
.represent(@environments), .represent(@environments),
available_count: folder_environments.available.count,
stopped_count: folder_environments.stopped.count
} }
end end
end end
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment