Skip to content

Commit

Permalink
Merge branch 'dev' into 432/Show-vSphere-Path-in-VMs-show
Browse files Browse the repository at this point in the history
  • Loading branch information
chrisma committed Mar 18, 2019
2 parents 23075e0 + 4ea3cdb commit ea23c04
Showing 1 changed file with 68 additions and 46 deletions.
114 changes: 68 additions & 46 deletions config/routes.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,60 +2,82 @@

# For details on the DSL available within this file, see http://guides.rubyonrails.org/routing.html
Rails.application.routes.draw do
resources :app_settings, only: %i[update edit]
resources :operating_systems, path: '/vms/requests/operating_systems', except: :show
# You can specify what Rails should route '/' to with the root method
# https://guides.rubyonrails.org/routing.html#using-root
root 'landing#index'

resources :request_templates, path: '/vms/request_templates', except: :show
patch '/vms/requests/reject', to: 'requests#reject', as: 'reject'
resources :requests, path: '/vms/requests' do
post :push_to_git, on: :member
end
# '/dashboard'
get '/dashboard' => 'dashboard#index', as: :dashboard
# '/app_settings/...'
resources :app_settings, only: %i[update edit]
# '/projects/...'
resources :projects, except: :destroy
# '/servers/...'
resources :servers
# '/hosts/...'
resources :hosts, only: %i[index show], constraints: { id: /.*/ }

# '/notifications/...'
resources :notifications, only: %i[index new create destroy] do
get :mark_as_read, on: :member
member do
get :mark_as_read
delete :destroy_and_redirect
end
get :has_any, on: :collection, to: 'notifications#any?'
delete :destroy_and_redirect, on: :member
end

get '/dashboard' => 'dashboard#index', as: :dashboard
root to: 'landing#index'

get '/hosts/:id' => 'hosts#show', constraints: { id: /.*/ }

get '/vms/configs/:id' => 'vms#edit_config', constraints: { id: /.*/ }, as: :edit_config
patch '/vms/configs/:id' => 'vms#update_config', constraints: { id: /.*/ }, as: :update_config

# move all vm actions under /vms/vm because a VM named requests might otherwise lead to issues!
post '/vms/vm/:id/change_power_state' => 'vms#change_power_state', constraints: { id: /.*/ }
post '/vms/vm/:id/suspend_vm' => 'vms#suspend_vm', constraints: { id: /.*/ }
post '/vms/vm/:id/shutdown_guest_os' => 'vms#shutdown_guest_os', constraints: { id: /.*/ }
post '/vms/vm/:id/reboot_guest_os' => 'vms#reboot_guest_os', constraints: { id: /.*/ }
post '/vms/vm/:id/reset_vm' => 'vms#reset_vm', constraints: { id: /.*/ }
post '/vms/vm/:id/request_vm_archivation' => 'vms#request_vm_archivation', constraints: { id: /.*/ }
post '/vms/vm/:id/archive_vm' => 'vms#archive_vm', constraints: { id: /.*/ }
post '/vms/vm/:id/request_vm_revive' => 'vms#request_vm_revive', constraints: { id: /.*/ }
post '/vms/vm/:id/revive_vm' => 'vms#revive_vm', constraints: { id: /.*/ }
post '/vms/vm/:id/stop_archiving' => 'vms#stop_archiving', constraints: { id: /.*/ }
resources :vms, except: %i[new create], path: 'vms/vm'

get 'slack/new' => 'slack#new', as: :new_slack
get 'slack/auth' => 'slack#update', as: :update_slack

devise_for :users,
path: 'users',
controllers: {
registrations: 'users/registrations',
omniauth_callbacks: 'users/omniauth_callbacks'
}
# '/slack/...'
scope 'slack' do
get 'new' => 'slack#new', as: :new_slack
get 'auth' => 'slack#update', as: :update_slack
end

resources :hosts, :servers
resources :users do
member do
patch :update_role
# https://guides.rubyonrails.org/routing.html#prefixing-the-named-route-helpers
# '/vms/...'
scope 'vms' do
# '/vms/request_templates/...'
resources :request_templates, except: :show
# '/vms/requests/operating_systems/...'
# Order matters here, as routes are matched from top to bottom
# If 'resources :requests' is first, it will attempt to match that
resources :operating_systems, path: 'requests/operating_systems', except: :show
# '/vms/requests/...'
resources :requests do
post :push_to_git, on: :member
patch :reject, on: :collection
end
# '/vms/configs/:id'
scope 'configs' do
get ':id' => 'vms#edit_config', constraints: { id: /.*/ }, as: :edit_config
patch ':id' => 'vms#update_config', constraints: { id: /.*/ }, as: :update_config
end
# '/vms/vm'
# move all vm actions under /vms/vm because a VM named requests might otherwise lead to issues!
resources :vms, except: %i[new create], path: 'vm', constraints: { id: /.*/ } do
# https://guides.rubyonrails.org/routing.html#adding-member-routes
member do
post 'change_power_state'
post 'suspend_vm'
post 'shutdown_guest_os'
post 'reboot_guest_os'
post 'reset_vm'
post 'request_vm_archivation'
post 'archive_vm'
post 'request_vm_revive'
post 'revive_vm'
post 'stop_archiving'
end
end
end

resources :projects, only: %i[index show new edit create update]

root 'landing#index'
# '/users/...'
# https://github.com/plataformatec/devise#configuring-routes
devise_for :users, path: 'users',
controllers: {
registrations: 'users/registrations',
omniauth_callbacks: 'users/omniauth_callbacks'
}
resources :users do
patch :update_role, on: :member
end
end

0 comments on commit ea23c04

Please sign in to comment.