Add route for environment folder and expose an API
This commit is contained in:
parent
d6ae01da55
commit
19bac884c6
2 changed files with 22 additions and 0 deletions
|
@ -28,6 +28,24 @@ class Projects::EnvironmentsController < Projects::ApplicationController
|
|||
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
|
||||
@deployments = environment.deployments.order(id: :desc).page(params[:page])
|
||||
end
|
||||
|
|
|
@ -156,6 +156,10 @@ constraints(ProjectUrlConstrainer.new) do
|
|||
get :terminal
|
||||
get '/terminal.ws/authorize', to: 'environments#terminal_websocket_authorize', constraints: { format: nil }
|
||||
end
|
||||
|
||||
collection do
|
||||
get :folder, path: 'folders/:id'
|
||||
end
|
||||
end
|
||||
|
||||
resource :cycle_analytics, only: [:show]
|
||||
|
|
Loading…
Reference in a new issue