Commit 6483bc8c authored by Filipa Lacerda's avatar Filipa Lacerda

Merge branch 'fe-paginated-environments-api' into fe-paginated-environments-api-add-pagination

* fe-paginated-environments-api:
  Add count keys to response JSON
parents c2fe699a a254dcf0
...@@ -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