BigW Consortium Gitlab

Commit 6483bc8c by 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
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
......
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