scinote-web/config/routes.rb

981 lines
36 KiB
Ruby
Raw Normal View History

2016-02-12 23:52:43 +08:00
Rails.application.routes.draw do
2018-08-17 17:59:47 +08:00
use_doorkeeper do
skip_controllers :applications, :authorized_applications, :token_info
end
2017-10-04 15:16:17 +08:00
post 'access_tokens/revoke', to: 'doorkeeper/access_tokens#revoke'
2019-09-17 22:11:40 +08:00
# Addons
2017-10-04 15:16:17 +08:00
def draw(routes_name)
instance_eval(File.read(Rails.root.join("config/routes/#{routes_name}.rb")))
end
2017-01-03 16:49:18 +08:00
constraints UserSubdomain do
2019-09-12 23:21:48 +08:00
devise_for :users, controllers: { registrations: 'users/registrations',
sessions: 'users/sessions',
invitations: 'users/invitations',
confirmations: 'users/confirmations',
omniauth_callbacks: 'users/omniauth_callbacks',
passwords: 'users/passwords' }
2020-02-13 20:51:49 +08:00
root 'dashboards#show'
2016-02-12 23:52:43 +08:00
resources :navigations, only: [] do
collection do
get :top_menu
2023-04-14 17:38:28 +08:00
post :navigator_state
end
end
get '/jobs/:id/status', to: 'active_jobs#status'
get 'forbidden', to: 'application#forbidden', as: 'forbidden'
get 'not_found', to: 'application#not_found', as: 'not_found'
get 'unprocessable_entity', to: 'application#respond_422', as: 'unprocessable_entity'
2016-02-12 23:52:43 +08:00
# JS backend helpers
get 'helpers/to_user_date_format',
to: 'application#to_user_date_format',
as: 'to_user_date_format',
defaults: { format: 'json' }
2017-01-03 16:49:18 +08:00
# Settings
2017-07-28 21:37:28 +08:00
resources :users, only: :index # needed for testing signup
# needed for testing edit passowrd
get '/users/password', to: 'devise_password#edit'
2017-07-28 21:37:28 +08:00
get 'users/settings/account/preferences',
to: 'users/settings/account/preferences#index',
2017-01-03 16:49:18 +08:00
as: 'preferences'
get 'users/settings/account/addons',
to: 'users/settings/account/addons#index',
as: 'addons'
2021-07-23 19:52:28 +08:00
resources :label_templates, only: %i(index show update create) do
member do
post :set_default
end
collection do
post :duplicate
post :delete
get :datatable
get :template_tags
2022-08-24 20:10:51 +08:00
get :zpl_preview
post :sync_fluics_templates
get :actions_toolbar
end
end
2021-07-23 20:56:21 +08:00
resources :label_printers, except: :show, path: 'users/settings/account/addons/label_printers' do
post :create_fluics, on: :collection
end
get 'users/settings/account/addons/label_printers/settings_zebra',
to: 'label_printers#index_zebra',
as: 'zebra_settings'
resources :label_printers, only: [] do
post :print, on: :member
get :update_progress_modal, on: :member
2021-07-23 20:56:21 +08:00
end
2021-07-23 19:52:28 +08:00
get 'users/settings/account/connected_accounts',
to: 'users/settings/account/connected_accounts#index',
as: 'connected_accounts'
delete 'users/settings/account/connected_accounts',
to: 'users/settings/account/connected_accounts#destroy',
as: 'unlink_connected_account'
put 'users/settings/account/preferences',
to: 'users/settings/account/preferences#update',
2017-01-03 16:49:18 +08:00
as: 'update_preferences'
post 'users/settings/account/preferences/togglable_settings',
to: 'users/settings/account/preferences#update_togglable_settings',
as: 'update_togglable_settings',
defaults: { format: 'json' }
get 'users/settings/teams',
to: 'users/settings/teams#index',
as: 'teams'
post 'users/settings/teams/datatable',
to: 'users/settings/teams#datatable',
as: 'teams_datatable'
get 'users/settings/teams/new',
to: 'users/settings/teams#new',
as: 'new_team'
post 'users/settings/teams',
to: 'users/settings/teams#create',
as: 'create_team'
get 'users/settings/teams/:id',
to: 'users/settings/teams#show',
as: 'team'
post 'users/settings/teams/:id/users_datatable',
to: 'users/settings/teams#users_datatable',
as: 'team_users_datatable'
get 'users/settings/teams/:id/name_html',
to: 'users/settings/teams#name_html',
as: 'team_name'
get 'users/settings/teams/:id/description_html',
to: 'users/settings/teams#description_html',
as: 'team_description'
put 'users/settings/teams/:id',
to: 'users/settings/teams#update',
as: 'update_team'
delete 'users/settings/teams/:id',
to: 'users/settings/teams#destroy',
as: 'destroy_team'
put 'users/settings/user_teams/:id',
to: 'users/settings/user_teams#update',
as: 'update_user_team'
get 'users/settings/user_teams/:id/leave_html',
to: 'users/settings/user_teams#leave_html',
as: 'leave_user_team_html'
get 'users/settings/user_teams/:id/destroy_html',
to: 'users/settings/user_teams#destroy_html',
as: 'destroy_user_team_html'
delete 'users/settings/user_teams/:id',
to: 'users/settings/user_teams#destroy',
as: 'destroy_user_team'
2016-02-12 23:52:43 +08:00
namespace :users do
namespace :settings do
resources :teams, only: [] do
collection do
post :switch
end
end
resources :webhooks, only: %i(index create update destroy) do
collection do
post :destroy_filter
get :filter_info
end
end
end
end
# Invite users
devise_scope :user do
post '/invite',
to: 'users/invitations#invite_users',
as: 'invite_users'
get '/invitable_teams',
to: 'users/invitations#invitable_teams',
as: 'invitable_teams'
end
2016-09-29 20:49:58 +08:00
resources :user_notifications, only: :index do
collection do
get :unseen_counter
end
end
2016-10-03 20:40:15 +08:00
2017-03-21 23:15:11 +08:00
# Get Zip Export
get 'zip_exports/download/:id',
to: 'zip_exports#download',
as: 'zip_exports_download'
2017-03-24 19:42:50 +08:00
# Get Team Zip Export
get 'zip_exports/download_export_all_zip/:id',
to: 'zip_exports#download_export_all_zip',
as: 'zip_exports_download_export_all'
2017-03-27 16:38:28 +08:00
get 'zip_exports/file_expired',
to: 'zip_exports#file_expired',
as: 'file_expired'
resources :teams do
2017-05-24 15:29:44 +08:00
resources :repositories, only: %i(index create destroy update) do
collection do
post 'archive', to: 'repositories#archive',
defaults: { format: 'json' }
post 'restore', to: 'repositories#restore',
defaults: { format: 'json' }
2017-06-06 21:50:43 +08:00
get 'create_modal', to: 'repositories#create_modal',
2017-05-24 15:29:44 +08:00
defaults: { format: 'json' }
get 'actions_toolbar'
get 'export_modal'
2017-05-24 15:29:44 +08:00
end
get 'destroy_modal', to: 'repositories#destroy_modal',
defaults: { format: 'json' }
get 'rename_modal', to: 'repositories#rename_modal',
defaults: { format: 'json' }
2017-06-08 00:43:48 +08:00
get 'copy_modal', to: 'repositories#copy_modal',
defaults: { format: 'json' }
post 'copy', to: 'repositories#copy',
defaults: { format: 'json' }
2019-08-05 19:07:29 +08:00
get :share_modal
post 'hide_reminders', to: 'repositories#hide_reminders'
resources :team_repositories, only: %i(destroy) do
collection do
post 'update'
end
end
end
2017-01-03 16:49:18 +08:00
member do
post 'parse_sheet', defaults: { format: 'json' }
2017-06-06 22:12:34 +08:00
post 'export_repository', to: 'repositories#export_repository'
post 'export_repositories', to: 'repositories#export_repositories'
post 'export_projects'
get 'sidebar'
get 'export_projects_modal'
# Used for atwho (smart annotations)
get 'atwho_users', to: 'at_who#users'
2020-09-04 22:48:53 +08:00
get 'atwho_menu', to: 'at_who#menu'
get 'atwho_rep_items', to: 'at_who#rep_items'
get 'atwho_projects', to: 'at_who#projects'
get 'atwho_experiments', to: 'at_who#experiments'
get 'atwho_my_modules', to: 'at_who#my_modules'
get 'atwho_menu_items', to: 'at_who#menu_items'
2017-01-03 16:49:18 +08:00
end
2019-06-13 14:49:03 +08:00
# External protocols routes
get 'list_external_protocol', to: 'external_protocols#index'
2019-06-13 17:17:08 +08:00
get 'show_external_protocol', to: 'external_protocols#show'
get 'build_external_protocol', to: 'external_protocols#new'
post 'import_external_protocol', to: 'external_protocols#create'
2019-06-13 14:49:03 +08:00
2017-01-03 16:49:18 +08:00
match '*path',
to: 'teams#routing_error',
2017-01-03 16:49:18 +08:00
via: [:get, :post, :put, :patch]
end
2016-02-12 23:52:43 +08:00
resources :reports, only: [:index, :new, :create, :update] do
member do
get :document_preview
get :save_pdf_to_inventory_modal, defaults: { format: 'json' }
post :save_pdf_to_inventory_item, defaults: { format: 'json' }
end
2021-04-06 21:27:12 +08:00
collection do
get :project_contents
get 'actions_toolbar'
2021-04-06 21:27:12 +08:00
end
end
get 'reports/datatable', to: 'reports#datatable'
get 'reports/new_template_values', to: 'reports#new_template_values', defaults: { format: 'json' }
post 'reports/available_repositories', to: 'reports#available_repositories',
defaults: { format: 'json' }
2018-05-17 17:21:34 +08:00
post 'available_asset_type_columns',
to: 'repository_columns#available_asset_type_columns',
defaults: { format: 'json' }
post 'reports/destroy', to: 'reports#destroy'
2020-02-13 20:50:29 +08:00
resource :dashboard, only: :show do
2020-02-14 19:07:40 +08:00
resource :current_tasks, module: 'dashboard', only: :show do
2020-02-17 17:47:10 +08:00
get :project_filter
get :experiment_filter
2020-02-14 19:07:40 +08:00
end
2020-02-25 00:09:10 +08:00
namespace :quick_start, module: :dashboard, controller: :quick_start do
get :project_filter
get :experiment_filter
2020-02-25 00:09:10 +08:00
post :create_task
end
2020-02-21 00:02:38 +08:00
resource :calendar, module: 'dashboard', only: [:show] do
get :day
end
2020-03-06 20:51:18 +08:00
resource :recent_works, module: 'dashboard', only: [:show]
2020-02-13 20:50:29 +08:00
end
namespace :access_permissions do
resources :projects, defaults: { format: 'json' } do
put :update_default_public_user_role, on: :member
end
2023-02-23 21:57:38 +08:00
resources :protocols, defaults: { format: 'json' } do
put :update_default_public_user_role, on: :member
end
resources :experiments, only: %i(show update edit)
resources :my_modules, only: %i(show update edit)
end
2023-04-21 21:25:52 +08:00
namespace :navigator do
resources :project_folders, only: %i(show) do
member do
get :tree
end
end
resources :projects, only: %i(show index) do
member do
get :tree
end
end
resources :experiments, only: %i(show) do
member do
get :tree
end
end
resources :my_modules, only: %i(show) do
member do
get :tree
end
end
end
resources :projects, except: [:destroy] do
2017-01-03 16:49:18 +08:00
resources :project_comments,
path: '/comments',
only: %i(create index update destroy)
2017-01-03 16:49:18 +08:00
# Activities popup (JSON) for individual project in projects index,
# as well as all activities page for single project (HTML)
resources :project_activities, path: '/activities', only: [:index]
2017-01-03 16:49:18 +08:00
resources :tags, only: [:create, :update, :destroy]
post :create_tag
2017-01-03 16:49:18 +08:00
resources :reports,
path: '/reports',
only: %i(edit update create) do
member do
post 'generate_pdf', to: 'reports#generate_pdf'
post 'generate_docx', to: 'reports#generate_docx'
get 'status', to: 'reports#status', format: %w(json)
end
2017-01-03 16:49:18 +08:00
collection do
2021-06-10 16:59:34 +08:00
get 'new', to: 'reports#new'
2017-01-03 16:49:18 +08:00
end
end
resources :experiments, only: %i(new create), defaults: { format: 'json' } do
collection do
post 'archive_group' # archive group of experiments
post 'restore_group' # restore group of experiments
end
end
2017-01-03 16:49:18 +08:00
member do
# Notifications popup for individual project in projects index
get 'notifications'
get 'permissions'
get 'experiments_cards'
get 'sidebar'
get 'actions_dropdown'
put 'view_type'
2017-01-03 16:49:18 +08:00
end
2020-10-26 23:17:39 +08:00
collection do
get 'inventory_assigning_project_filter'
get 'cards', to: 'projects#cards'
get 'users_filter'
post 'archive_group'
post 'restore_group'
put 'view_type', to: 'teams#view_type'
get 'actions_toolbar'
2020-10-26 23:17:39 +08:00
end
2016-02-12 23:52:43 +08:00
end
resources :project_folders, only: %i(create new update edit) do
2020-11-20 18:06:19 +08:00
get 'cards', to: 'projects#cards'
2021-01-06 22:02:26 +08:00
collection do
post 'move_to', to: 'project_folders#move_to', defaults: { format: 'json' }
2021-01-06 22:02:26 +08:00
get 'move_to_modal', to: 'project_folders#move_to_modal', defaults: { format: 'json' }
post 'destroy', to: 'project_folders#destroy', as: 'destroy', defaults: { format: 'json' }
get 'destroy_modal', to: 'project_folders#destroy_modal', defaults: { format: 'json' }
end
2020-11-20 18:06:19 +08:00
end
get 'project_folders/:project_folder_id', to: 'projects#index', as: :project_folder_projects
2020-11-20 18:06:19 +08:00
resources :experiments, only: %i(show edit update) do
collection do
get 'inventory_assigning_experiment_filter'
get 'edit', action: :edit
get 'clone_modal', action: :clone_modal
get 'move_modal', action: :move_modal
get 'actions_toolbar'
end
2017-01-03 16:49:18 +08:00
member do
get 'permissions'
get 'actions_dropdown'
put :view_type
2022-10-20 16:42:38 +08:00
get :table
get :load_table
get :move_modules_modal
post :move_modules
get :my_modules
2017-01-03 16:49:18 +08:00
get 'canvas' # Overview/structure for single experiment
# AJAX-loaded canvas edit mode (from canvas)
get 'canvas/edit', to: 'canvas#edit'
get 'canvas/full_zoom', to: 'canvas#full_zoom' # AJAX-loaded canvas zoom
# AJAX-loaded canvas zoom
get 'canvas/medium_zoom', to: 'canvas#medium_zoom'
get 'canvas/small_zoom', to: 'canvas#small_zoom' # AJAX-loaded canvas zoom
2017-01-03 16:49:18 +08:00
post 'canvas', to: 'canvas#update' # Save updated canvas action
get 'module_archive' # Module archive for single experiment
get 'my_module_tags', to: 'my_module_tags#canvas_index'
post 'archive' # archive experiment
2017-01-03 16:49:18 +08:00
get 'clone_modal' # return modal with clone options
post 'clone' # clone experiment
get 'move_modal' # return modal with move options
post 'move' # move experiment
get 'fetch_workflow_img' # Get updated workflow img
get 'modules/new', to: 'my_modules#new'
post 'modules', to: 'my_modules#create'
post 'restore_my_modules', to: 'my_modules#restore_group'
get 'sidebar'
get :assigned_users_to_tasks
post :archive_my_modules
post :batch_clone_my_modules
get :search_tags
2016-02-12 23:52:43 +08:00
end
end
2017-01-03 16:49:18 +08:00
# Show action is a popup (JSON) for individual module in full-zoom canvas,
# as well as 'module info' page for single module (HTML)
resources :my_modules, path: '/modules', only: [:show, :update] do
post 'save_table_state', on: :collection, defaults: { format: 'json' }
2022-12-06 23:58:59 +08:00
collection do
get 'actions_toolbar'
get 'inventory_assigning_my_module_filter'
end
member do
get :permissions
get :actions_dropdown
get :provisioning_status
end
resources :my_module_tags, path: '/tags', only: [:index, :create, :destroy] do
collection do
get :search_tags
end
member do
post :destroy_by_tag_id
end
end
resources :user_my_modules, path: '/users', only: %i(index create destroy) do
collection do
2023-03-21 18:29:23 +08:00
get :designated_users
end
member do
get :search
end
end
2020-07-22 15:45:56 +08:00
resource :status_flow, controller: :my_module_status_flow, only: :show
2017-01-03 16:49:18 +08:00
resources :my_module_comments,
path: '/comments',
only: %i(create index update destroy)
2020-04-07 01:52:41 +08:00
2020-04-29 01:12:17 +08:00
get :repositories_dropdown_list, controller: :my_module_repositories
get :repositories_list_html, controller: :my_module_repositories
resources :repositories, controller: :my_module_repositories, only: %i(update create) do
2020-04-08 03:02:16 +08:00
member do
get :full_view_table
post :index_dt, defaults: { format: 'json' }
2020-07-17 21:17:09 +08:00
post :export_repository
get :assign_repository_records_modal, as: :assign_modal
get :update_repository_records_modal, as: :update_modal
get :consume_modal
post :update_consumption
2020-04-08 03:02:16 +08:00
end
end
resources :repository_snapshots, controller: :my_module_repository_snapshots, only: %i(destroy show) do
member do
get :full_view_table
post :index_dt, defaults: { format: 'json' }
post :export_repository_snapshot
get :status
2020-04-09 21:14:55 +08:00
end
collection do
get ':repository_id/full_view_sidebar',
to: 'my_module_repository_snapshots#full_view_sidebar',
as: :full_view_sidebar
post ':repository_id', to: 'my_module_repository_snapshots#create', as: ''
end
2020-04-08 03:02:16 +08:00
end
2020-04-07 01:52:41 +08:00
post :select_default_snapshot, to: 'my_module_repository_snapshots#select'
2017-01-03 16:49:18 +08:00
resources :result_texts, only: [:new, :create]
resources :result_assets, only: [:new, :create]
resources :result_tables, only: [:new, :create]
member do
# AJAX popup accessed from full-zoom canvas for single module,
# as well as full activities view (HTML) for single module
get 'description'
get 'canvas_dropdown_menu'
2017-01-03 16:49:18 +08:00
get 'activities'
post 'activities'
2017-01-03 16:49:18 +08:00
get 'activities_tab' # Activities in tab view for single module
get 'due_date'
get 'status_state'
patch 'description',
to: 'my_modules#update_description',
as: 'update_description'
patch 'protocol_description',
to: 'my_modules#update_protocol_description',
as: 'update_protocol_description'
patch 'state', to: 'my_modules#update_state', as: 'update_state'
2017-01-03 16:49:18 +08:00
get 'protocols' # Protocols view for single module
get 'protocol', to: 'my_modules#protocol', as: 'protocol'
patch 'protocol', to: 'my_modules#update_protocol', as: 'update_protocol'
2017-01-03 16:49:18 +08:00
get 'results' # Results view for single module
get 'archive' # Archive view for single module
end
2016-02-12 23:52:43 +08:00
# Those routes are defined outside of member block
# to preserve original id parameters in URL.
2017-01-03 16:49:18 +08:00
get 'tags/edit', to: 'my_module_tags#index_edit'
get 'users/edit', to: 'user_my_modules#index_edit'
2016-07-28 17:30:34 +08:00
end
2022-10-24 19:07:10 +08:00
resources :steps, only: %i(index update destroy show) do
resources :step_orderable_elements do
post :reorder, on: :collection
end
2017-01-03 16:49:18 +08:00
resources :step_comments,
path: '/comments',
only: %i(create index update destroy)
resources :tables, controller: 'step_elements/tables', only: %i(create destroy update) do
member do
post :duplicate
end
end
resources :texts, controller: 'step_elements/texts', only: %i(create destroy update) do
member do
post :duplicate
end
end
resources :checklists, controller: 'step_elements/checklists', only: %i(create destroy update) do
member do
post :duplicate
end
resources :checklist_items, controller: 'step_elements/checklist_items', only: %i(create update destroy) do
patch :toggle, on: :member
post :reorder, on: :collection
end
end
2017-01-03 16:49:18 +08:00
member do
get 'elements'
get 'attachments'
2022-05-19 14:51:39 +08:00
post 'upload_attachment'
2017-01-03 16:49:18 +08:00
post 'toggle_step_state'
post 'update_view_state'
post 'update_asset_view_mode'
2022-08-23 23:54:33 +08:00
post 'duplicate'
2017-01-03 16:49:18 +08:00
end
2016-02-12 23:52:43 +08:00
end
# System notifications routes
resources :system_notifications, only: %i(show) do
collection do
post 'mark_as_seen'
get 'unseen_counter'
end
member do
post 'mark_as_read'
end
end
# tinyMCE image uploader endpoint
2019-07-16 19:40:54 +08:00
resources :tiny_mce_assets, only: [:create] do
member do
get :download
get :marvinjs, to: 'tiny_mce_assets#marvinjs_show'
put :marvinjs, to: 'tiny_mce_assets#marvinjs_update'
end
collection do
post :marvinjs, to: 'tiny_mce_assets#marvinjs_create'
2019-07-16 19:40:54 +08:00
end
end
2017-01-03 16:49:18 +08:00
resources :results, only: [:update, :destroy] do
resources :result_comments,
path: '/comments',
only: %i(create index update destroy)
2016-02-12 23:52:43 +08:00
end
2017-01-03 16:49:18 +08:00
resources :result_texts, only: [:edit, :update, :destroy]
get 'result_texts/:id/download' => 'result_texts#download',
as: :result_text_download
2017-01-03 16:49:18 +08:00
resources :result_assets, only: [:edit, :update, :destroy]
resources :result_tables, only: [:edit, :update, :destroy]
get 'result_tables/:id/download' => 'result_tables#download',
as: :result_table_download
2016-02-12 23:52:43 +08:00
resources :protocols, only: %i(index show edit create update) do
2022-10-24 19:07:10 +08:00
resources :steps, only: [:create] do
post :reorder, on: :collection
end
2017-01-03 16:49:18 +08:00
member do
post :publish
post :destroy_draft
2023-02-22 21:59:48 +08:00
post :save_as_draft
get 'version_comment', to: 'protocols#version_comment'
get 'print', to: 'protocols#print'
2017-01-03 16:49:18 +08:00
get 'linked_children', to: 'protocols#linked_children'
post 'linked_children_datatable',
to: 'protocols#linked_children_datatable'
get 'versions_modal', to: 'protocols#versions_modal'
patch 'description', to: 'protocols#update_description'
2023-01-05 18:42:59 +08:00
put 'name', to: 'protocols#update_name'
patch 'authors', to: 'protocols#update_authors'
2017-01-03 16:49:18 +08:00
patch 'keywords', to: 'protocols#update_keywords'
get 'unlink_modal', to: 'protocols#unlink_modal'
post 'unlink', to: 'protocols#unlink'
get 'revert_modal', to: 'protocols#revert_modal'
post 'revert', to: 'protocols#revert'
get 'update_parent_modal', to: 'protocols#update_parent_modal'
post 'update_parent', to: 'protocols#update_parent'
get 'update_from_parent_modal', to: 'protocols#update_from_parent_modal'
post 'update_from_parent', to: 'protocols#update_from_parent'
post 'load_from_repository_datatable',
to: 'protocols#load_from_repository_datatable'
get 'load_from_repository_modal',
to: 'protocols#load_from_repository_modal'
post 'load_from_repository', to: 'protocols#load_from_repository'
post 'load_from_file', to: 'protocols#load_from_file'
2017-01-03 16:49:18 +08:00
get 'copy_to_repository_modal', to: 'protocols#copy_to_repository_modal'
post 'copy_to_repository', to: 'protocols#copy_to_repository'
get 'protocol_status_bar', to: 'protocols#protocol_status_bar'
get 'updated_at_label', to: 'protocols#updated_at_label'
2022-06-24 17:21:47 +08:00
post 'delete_steps'
get :permissions
put :update_version_comment
2017-01-03 16:49:18 +08:00
end
collection do
post 'datatable', to: 'protocols#datatable'
post 'archive', to: 'protocols#archive'
post 'restore', to: 'protocols#restore'
post 'clone', to: 'protocols#clone'
2017-01-03 16:49:18 +08:00
post 'import', to: 'protocols#import'
post 'protocolsio_import_create',
to: 'protocols#protocolsio_import_create'
post 'protocolsio_import_save', to: 'protocols#protocolsio_import_save'
2017-01-03 16:49:18 +08:00
get 'export', to: 'protocols#export'
get 'protocolsio', to: 'protocols#protocolsio_index'
get 'actions_toolbar', to: 'protocols#actions_toolbar'
2017-01-03 16:49:18 +08:00
end
2016-02-12 23:52:43 +08:00
end
2020-11-21 03:25:28 +08:00
resources :comments, only: %i(index create update destroy)
2020-11-20 19:29:40 +08:00
resources :repository_rows, only: %i() do
collection do
get :rows_to_print
post :print
get :print_zpl
post :validate_label_template_columns
end
collection do
get :actions_toolbar
end
end
2017-06-06 23:35:29 +08:00
resources :repositories do
post 'repository_index',
to: 'repository_rows#index',
2017-06-06 23:35:29 +08:00
as: 'table_index',
defaults: { format: 'json' }
member do
get :assigned_my_modules
get :repository_users
get :load_table
end
2017-06-06 23:35:29 +08:00
# Save repository table state
post 'state_save',
to: 'user_repositories#save_table_state',
as: 'save_table_state',
defaults: { format: 'json' }
# Load repository table state
post 'state_load',
to: 'user_repositories#load_table_state',
as: 'load_table_state',
defaults: { format: 'json' }
# Delete records from repository
post 'delete_records',
to: 'repository_rows#delete_records',
as: 'delete_records',
defaults: { format: 'json' }
post 'copy_records',
to: 'repository_rows#copy_records',
defaults: { format: 'json' }
post 'archive_records',
to: 'repository_rows#archive_records',
defaults: { format: 'json' }
post 'restore_records',
to: 'repository_rows#restore_records',
defaults: { format: 'json' }
get 'repository_columns/:id/destroy_html',
to: 'repository_columns#destroy_html',
as: 'columns_destroy_html'
get 'available_columns',
to: 'repository_columns#available_columns',
as: 'available_columns',
defaults: { format: 'json' }
get :table_toolbar
get :status
2017-06-06 23:35:29 +08:00
resources :repository_columns, only: %i(index new edit destroy) do
collection do
get :describe_all
end
end
resources :repository_table_filters, only: %i(index show create update destroy)
resources :repository_rows, only: %i(create show update) do
member do
get :assigned_task_list
get :active_reminder_repository_cells
end
member do
get 'repository_stock_value/new', to: 'repository_stock_values#new', as: 'new_repository_stock'
get 'repository_stock_value/edit', to: 'repository_stock_values#edit', as: 'edit_repository_stock'
post 'repository_stock_value', to: 'repository_stock_values#create_or_update', as: 'update_repository_stock'
end
resources :repository_stock_values, only: %i(new create edit update)
resources :repository_cells, only: :hide_reminder do
post :hide_reminder, to: 'hidden_repository_cell_reminders#create'
end
end
collection do
2020-06-04 20:39:56 +08:00
get :sidebar
post 'available_rows', to: 'repository_rows#available_rows', defaults: { format: 'json' }
end
2017-06-06 23:35:29 +08:00
2017-06-13 14:10:10 +08:00
member do
post 'parse_sheet', defaults: { format: 'json' }
2017-06-13 14:10:10 +08:00
post 'import_records'
end
2019-10-11 01:03:41 +08:00
namespace :repository_columns do
resources :text_columns, only: %i(create update)
resources :number_columns, only: %i(create update)
resources :asset_columns, only: %i(create update)
resources :date_columns, only: %i(create update)
resources :date_time_columns, only: %i(create update)
resources :list_columns, only: %i(create update) do
member do
get 'items'
end
end
resources :checklist_columns, only: %i(create update) do
member do
get 'items'
end
end
resources :stock_columns, only: %i(create update) do
member do
get 'items'
end
end
resources :status_columns, only: %i(create update) do
2019-12-23 21:34:11 +08:00
member do
get 'items'
end
end
2019-10-11 01:03:41 +08:00
end
2017-06-06 23:35:29 +08:00
end
resources :connected_devices, controller: 'users/connected_devices', only: %i(destroy)
2017-01-03 16:49:18 +08:00
get 'search' => 'search#index'
get 'search/new' => 'search#new', as: :new_search
2016-07-21 19:11:15 +08:00
2017-01-03 16:49:18 +08:00
# We cannot use 'resources :assets' because assets is a reserved route
# in Rails (assets pipeline) and causes funky behavior
2018-03-30 17:50:28 +08:00
get 'files/:id/preview',
to: 'assets#file_preview',
as: 'asset_file_preview'
get 'files/:id/pdf_preview', to: 'assets#pdf_preview', as: 'asset_pdf_preview'
2017-01-03 16:49:18 +08:00
get 'files/:id/view', to: 'assets#view', as: 'view_asset'
get 'files/:id/file_url', to: 'assets#file_url', as: 'asset_file_url'
get 'files/:id/download', to: 'assets#download', as: 'asset_download'
2017-01-03 16:49:18 +08:00
get 'files/:id/edit', to: 'assets#edit', as: 'edit_asset'
patch 'files/:id/toggle_view_mode', to: 'assets#toggle_view_mode', as: 'toggle_view_mode'
get 'files/:id/load_asset', to: 'assets#load_asset', as: 'load_asset'
2018-10-19 16:00:58 +08:00
post 'files/:id/update_image', to: 'assets#update_image',
as: 'update_asset_image'
2020-11-04 20:08:40 +08:00
delete 'files/:id/', to: 'assets#destroy', as: 'asset_destroy'
2019-03-16 03:59:15 +08:00
post 'files/create_wopi_file',
to: 'assets#create_wopi_file',
as: 'create_wopi_file'
2019-06-19 21:19:47 +08:00
post 'files/:id/start_edit_image', to: 'assets#create_start_edit_image_activity', as: 'start_edit_image'
2016-02-12 23:52:43 +08:00
2017-01-03 16:49:18 +08:00
devise_scope :user do
get 'avatar/:id/:style' => 'users/registrations#avatar', as: 'avatar'
2018-02-26 18:05:05 +08:00
get 'users/sign_up_provider' => 'users/registrations#new_with_provider'
2020-07-13 15:51:04 +08:00
get 'users/two_factor_recovery' => 'users/sessions#two_factor_recovery'
2021-05-05 02:51:34 +08:00
get 'users/two_factor_auth' => 'users/sessions#two_factor_auth'
2022-08-08 18:24:50 +08:00
get 'users/expire_in' => 'users/sessions#expire_in'
post 'users/revive_session' => 'users/sessions#revive_session'
2020-06-30 20:16:00 +08:00
post 'users/authenticate_with_two_factor' => 'users/sessions#authenticate_with_two_factor'
2020-07-13 15:51:04 +08:00
post 'users/authenticate_with_recovery_code' => 'users/sessions#authenticate_with_recovery_code'
2020-06-30 20:16:00 +08:00
post 'users/complete_sign_up_provider' => 'users/registrations#create_with_provider'
2020-07-01 17:07:33 +08:00
post 'users/2fa_enable' => 'users/registrations#two_factor_enable'
post 'users/2fa_disable' => 'users/registrations#two_factor_disable'
get 'users/2fa_qr_code' => 'users/registrations#two_factor_qr_code'
2017-01-03 16:49:18 +08:00
end
2017-08-30 00:49:07 +08:00
namespace :api, defaults: { format: 'json' } do
get 'health', to: 'api#health'
2017-08-30 00:49:07 +08:00
get 'status', to: 'api#status'
namespace :service do
post 'projects_json_export', to: 'projects_json_export#projects_json_export'
resources :teams, only: [] do
post 'clone_experiment' => 'experiments#clone'
resources :protocols, only: [] do
post 'reorder_steps' => 'protocols#reorder_steps'
end
resources :steps, only: [] do
post 'reorder_elements' => 'steps#reorder_elements'
end
end
end
2021-05-30 00:40:26 +08:00
if Rails.configuration.x.core_api_v1_enabled
2018-08-24 18:11:28 +08:00
namespace :v1 do
resources :teams, only: %i(index show) do
resources :inventories, only: %i(index create show update destroy) do
resources :inventory_columns,
only: %i(index create show update destroy),
path: 'columns',
as: :columns do
resources :inventory_list_items,
only: %i(index create show update destroy),
path: 'list_items',
as: :list_items
resources :inventory_checklist_items,
only: %i(index create show update destroy),
path: 'checklist_items',
as: :checklist_items
2019-10-21 16:38:20 +08:00
resources :inventory_status_items,
only: %i(index create show update destroy),
path: 'status_items',
as: :status_items
resources :inventory_stock_unit_items,
only: %i(index create show update destroy),
path: 'stock_unit_items',
as: :stock_unit_items
end
resources :inventory_items,
only: %i(index create show update destroy),
path: 'items',
as: :items do
resources :inventory_cells,
only: %i(index create show update destroy),
path: 'cells',
as: :cells
end
end
resources :projects, only: %i(index show create update) do
resources :user_assignments,
only: %i(index show create update destroy),
controller: :project_user_assignments,
path: 'users',
as: :users
resources :project_comments, only: %i(index show), path: 'comments', as: :comments
get 'activities', to: 'projects#activities'
resources :reports, only: %i(index show), path: 'reports', as: :reports
resources :experiments, only: %i(index show create update) do
resources :user_assignments,
only: %i(index show update),
controller: :experiment_user_assignments
resources :task_groups, only: %i(index show)
resources :connections, only: %i(index show create destroy)
resources :tasks, only: %i(index show create update) do
resources :user_assignments,
only: %i(index show update),
controller: :task_user_assignments
resources :task_inventory_items, only: %i(index show update),
path: 'items',
as: :items
resources :task_users, only: %i(index show),
path: 'users',
as: :users
resources :task_tags, only: %i(index show),
path: 'tags',
as: :tags
resources :task_assignments, only: %i(index create destroy),
path: 'task_assignments',
as: :task_assignments
2020-08-07 22:51:57 +08:00
resources :protocols, only: %i(index show) do
resources :steps, only: %i(index show create update destroy) do
resources :assets, only: %i(index show create), path: 'attachments'
resources :checklists, only: %i(index show create update destroy), path: 'checklists' do
resources :checklist_items,
only: %i(index show create update destroy),
as: :items,
path: 'items'
end
resources :tables, only: %i(index show create update destroy), path: 'tables'
resources :step_texts, only: %i(index show create update destroy), path: 'step_texts'
end
end
resources :results, only: %i(index create show update)
2018-10-07 17:49:11 +08:00
get 'activities', to: 'tasks#activities'
2018-09-07 19:36:55 +08:00
end
2018-09-06 21:38:48 +08:00
end
2018-09-05 15:55:04 +08:00
end
2020-11-23 14:09:10 +08:00
resources :project_folders, only: %i(index show create update)
resources :users, only: %i(index)
resources :protocol_templates, only: %i(index show)
2018-09-07 18:54:09 +08:00
end
resources :users, only: %i(show) do
resources :user_identities,
only: %i(index create show update destroy),
path: 'identities',
as: :identities
2018-08-24 18:11:28 +08:00
end
2020-08-20 21:49:48 +08:00
resources :user_roles, only: :index
2020-08-20 21:49:48 +08:00
resources :workflows, only: %i(index show) do
resources :workflow_statuses, path: :statuses, only: %i(index)
end
end
end
2017-08-30 00:49:07 +08:00
end
2016-02-12 23:52:43 +08:00
end
2016-08-03 21:31:25 +08:00
resources :global_activities, only: [:index] do
collection do
get :project_filter
get :experiment_filter
get :my_module_filter
get :inventory_filter
get :inventory_item_filter
get :report_filter
get :protocol_filter
get :team_filter
get :user_filter
2021-05-31 19:32:31 +08:00
post :save_activity_filter
end
end
2019-02-14 20:20:32 +08:00
2019-04-30 23:32:55 +08:00
resources :marvin_js_assets, only: %i(create update destroy show) do
collection do
get :team_sketches
end
member do
post :start_editing
end
2019-04-30 23:32:55 +08:00
end
2019-04-27 04:59:38 +08:00
post 'global_activities', to: 'global_activities#index'
2017-01-03 16:49:18 +08:00
constraints WopiSubdomain do
# Office integration
get 'wopi/files/:id/contents', to: 'wopi#file_contents_get_endpoint'
post 'wopi/files/:id/contents', to: 'wopi#file_contents_post_endpoint'
get 'wopi/files/:id', to: 'wopi#file_get_endpoint', as: 'wopi_rest_endpoint'
post 'wopi/files/:id', to: 'wopi#post_file_endpoint'
end
resources :gene_sequence_assets, only: %i(new create edit update)
2016-02-12 23:52:43 +08:00
end