Commit 19bac884 authored by Grzegorz Bizon's avatar Grzegorz Bizon

Add route for environment folder and expose an API

parent d6ae01da
...@@ -28,6 +28,24 @@ class Projects::EnvironmentsController < Projects::ApplicationController ...@@ -28,6 +28,24 @@ class Projects::EnvironmentsController < Projects::ApplicationController
end end
end end
def folder
@environments = project.environments
.where(environment_type: params[:id])
.with_state(params[:scope] || :available)
respond_to do |format|
format.html
format.json do
render json: {
environments: EnvironmentSerializer
.new(project: @project, user: @current_user)
.with_pagination(request, response)
.represent(@environments),
}
end
end
end
def show def show
@deployments = environment.deployments.order(id: :desc).page(params[:page]) @deployments = environment.deployments.order(id: :desc).page(params[:page])
end end
......
...@@ -156,6 +156,10 @@ constraints(ProjectUrlConstrainer.new) do ...@@ -156,6 +156,10 @@ constraints(ProjectUrlConstrainer.new) do
get :terminal get :terminal
get '/terminal.ws/authorize', to: 'environments#terminal_websocket_authorize', constraints: { format: nil } get '/terminal.ws/authorize', to: 'environments#terminal_websocket_authorize', constraints: { format: nil }
end end
collection do
get :folder, path: 'folders/:id'
end
end end
resource :cycle_analytics, only: [:show] resource :cycle_analytics, only: [:show]
......
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