2016-11-08 18:26:55 +08:00
|
|
|
# Extends class holds the arrays for the models enum fields
|
|
|
|
# so that can be extended in sub modules.
|
|
|
|
|
|
|
|
class Extends
|
|
|
|
# To extend the enum fields in the engine you have to put in
|
|
|
|
# lib/engine_name/engine.rb file as in the example:
|
|
|
|
|
|
|
|
# > initializer 'add_additional enum values to my model' do
|
|
|
|
# > Extends::MY_ARRAY_OF_ENUM_VALUES.merge!(value1, value2, ....)
|
|
|
|
# > end
|
|
|
|
# >
|
|
|
|
|
2017-03-08 21:14:03 +08:00
|
|
|
# Extends enum types. Should not be freezed, as modules might append to this.
|
2017-03-23 22:45:02 +08:00
|
|
|
# !!!Check all addons for the correct order!!!
|
2019-01-26 00:04:16 +08:00
|
|
|
# DEPRECATED 'system_message' in (SCI-2952, kept b/c of integer enums)
|
2016-11-08 18:26:55 +08:00
|
|
|
NOTIFICATIONS_TYPES = { assignment: 0,
|
|
|
|
recent_changes: 1,
|
2019-01-26 00:04:16 +08:00
|
|
|
system_message: 2, # DEPRECATED
|
2017-03-23 22:45:02 +08:00
|
|
|
deliver: 5 }
|
2017-02-10 21:27:20 +08:00
|
|
|
|
|
|
|
TASKS_STATES = { uncompleted: 0,
|
2017-02-13 22:42:28 +08:00
|
|
|
completed: 1 }
|
2017-02-27 20:53:46 +08:00
|
|
|
|
|
|
|
REPORT_ELEMENT_TYPES = { project_header: 0,
|
|
|
|
my_module: 1,
|
|
|
|
step: 2,
|
|
|
|
result_asset: 3,
|
|
|
|
result_table: 4,
|
|
|
|
result_text: 5,
|
|
|
|
my_module_activity: 6,
|
|
|
|
my_module_samples: 7,
|
|
|
|
step_checklist: 8,
|
|
|
|
step_asset: 9,
|
|
|
|
step_table: 10,
|
|
|
|
step_comments: 11,
|
|
|
|
result_comments: 12,
|
|
|
|
project_activity: 13, # TODO
|
|
|
|
project_samples: 14, # TODO
|
2017-06-05 18:24:06 +08:00
|
|
|
experiment: 15,
|
2017-06-08 17:23:24 +08:00
|
|
|
# Higher number because of addons
|
2019-05-13 16:55:08 +08:00
|
|
|
my_module_repository: 17,
|
|
|
|
my_module_protocol: 18 }
|
2017-03-08 21:14:03 +08:00
|
|
|
|
2017-05-16 21:27:36 +08:00
|
|
|
# Data type name should match corresponding model's name
|
|
|
|
REPOSITORY_DATA_TYPES = { RepositoryTextValue: 0,
|
2018-02-07 22:28:28 +08:00
|
|
|
RepositoryDateValue: 1,
|
2018-03-10 00:04:54 +08:00
|
|
|
RepositoryListValue: 2,
|
|
|
|
RepositoryAssetValue: 3 }
|
2018-03-13 18:36:05 +08:00
|
|
|
|
|
|
|
# Data types which can be imported to repository,
|
|
|
|
# name should match record in REPOSITORY_DATA_TYPES
|
|
|
|
REPOSITORY_IMPORTABLE_TYPES = %i(RepositoryTextValue RepositoryListValue)
|
|
|
|
|
2018-03-09 18:05:43 +08:00
|
|
|
# Extra attributes used for search in repositories, text columns
|
|
|
|
# are only supported
|
|
|
|
REPOSITORY_EXTRA_SEARCH_ATTR = ['repository_text_values.data',
|
2018-03-26 19:19:09 +08:00
|
|
|
'repository_list_items.data',
|
2019-07-09 16:28:15 +08:00
|
|
|
'active_storage_blobs.filename']
|
2018-03-09 18:05:43 +08:00
|
|
|
|
|
|
|
# Array of includes used in search query for repository rows
|
|
|
|
REPOSITORY_SEARCH_INCLUDES = [:repository_text_value,
|
2018-03-26 19:19:09 +08:00
|
|
|
repository_list_value: :repository_list_item,
|
2019-07-09 16:28:15 +08:00
|
|
|
repository_asset_value: { asset: { file_attachment: :blob } }]
|
2017-08-30 00:49:07 +08:00
|
|
|
|
|
|
|
# List of implemented core API versions
|
2018-10-06 17:47:23 +08:00
|
|
|
API_VERSIONS = ['v1']
|
2017-08-30 00:49:07 +08:00
|
|
|
|
|
|
|
# Array used for injecting names of additional authentication methods for API
|
2018-07-24 20:21:33 +08:00
|
|
|
API_PLUGABLE_AUTH_METHODS = [:azure_jwt_auth]
|
2017-08-30 00:49:07 +08:00
|
|
|
|
2018-10-16 21:35:02 +08:00
|
|
|
API_REPOSITORY_DATA_TYPE_MAPPINGS = { 'RepositoryTextValue' => 'text',
|
|
|
|
'RepositoryDateValue' => 'date',
|
|
|
|
'RepositoryListValue' => 'list',
|
|
|
|
'RepositoryAssetValue' => 'file' }
|
|
|
|
|
2018-03-01 16:18:36 +08:00
|
|
|
OMNIAUTH_PROVIDERS = [:linkedin]
|
2018-01-18 22:25:51 +08:00
|
|
|
|
|
|
|
INITIAL_USER_OPTIONS = {}
|
2018-03-01 21:04:57 +08:00
|
|
|
|
2018-02-26 21:23:02 +08:00
|
|
|
# Hash used for mapping file extensions to custom icons,
|
|
|
|
# 'extension' => 'path_to_the_icon'
|
|
|
|
FILE_ICON_MAPPINGS = {}
|
2018-03-30 17:50:28 +08:00
|
|
|
|
|
|
|
# Hash used for mapping file extensions to custom font awesome icon classes,
|
|
|
|
# 'extension' => 'fa class'
|
|
|
|
FILE_FA_ICON_MAPPINGS = {}
|
2019-04-23 21:16:40 +08:00
|
|
|
|
|
|
|
# Mapping of rich text fileds to specific model
|
|
|
|
RICH_TEXT_FIELD_MAPPINGS = { 'Step' => :description,
|
|
|
|
'ResultText' => :text,
|
|
|
|
'Protocol' => :description,
|
|
|
|
'MyModule' => :description }
|
2019-04-23 23:01:13 +08:00
|
|
|
|
2019-02-26 18:01:15 +08:00
|
|
|
ACTIVITY_SUBJECT_TYPES = %w(
|
2019-03-20 18:03:00 +08:00
|
|
|
Team Repository Project Experiment MyModule Result Protocol Report
|
2019-02-28 21:01:58 +08:00
|
|
|
).freeze
|
2019-02-26 18:01:15 +08:00
|
|
|
|
|
|
|
SEARCHABLE_ACTIVITY_SUBJECT_TYPES = %w(
|
2019-03-11 20:26:54 +08:00
|
|
|
Repository Project Experiment MyModule Result Protocol Step Report
|
2019-02-28 21:01:58 +08:00
|
|
|
).freeze
|
|
|
|
|
2019-03-29 16:26:27 +08:00
|
|
|
ACTIVITY_SUBJECT_CHILDREN = {
|
|
|
|
Repository: nil,
|
|
|
|
Report: nil,
|
|
|
|
Project: nil,
|
|
|
|
Experiment: [:my_modules],
|
|
|
|
MyModule: [:results,:protocols],
|
|
|
|
Result: nil,
|
|
|
|
Protocol: [:steps],
|
2019-04-05 22:25:22 +08:00
|
|
|
Step: nil
|
2019-03-29 16:26:27 +08:00
|
|
|
}.freeze
|
|
|
|
|
2019-02-28 21:01:58 +08:00
|
|
|
ACTIVITY_MESSAGE_ITEMS_TYPES =
|
2019-08-09 15:47:07 +08:00
|
|
|
ACTIVITY_SUBJECT_TYPES + %w(User Tag RepositoryColumn RepositoryRow Step Asset TinyMceAsset)
|
2019-02-28 21:01:58 +08:00
|
|
|
.freeze
|
2019-02-26 20:46:25 +08:00
|
|
|
|
2019-02-25 22:21:13 +08:00
|
|
|
ACTIVITY_TYPES = {
|
|
|
|
create_project: 0,
|
|
|
|
rename_project: 1,
|
|
|
|
change_project_visibility: 2,
|
|
|
|
archive_project: 3,
|
|
|
|
restore_project: 4,
|
|
|
|
assign_user_to_project: 5,
|
|
|
|
change_user_role_on_project: 6,
|
|
|
|
unassign_user_from_project: 7,
|
|
|
|
create_module: 8,
|
|
|
|
clone_module: 9,
|
2019-04-04 01:13:00 +08:00
|
|
|
archive_module: 10,
|
2019-02-25 22:21:13 +08:00
|
|
|
restore_module: 11,
|
|
|
|
change_module_description: 12,
|
|
|
|
assign_user_to_module: 13,
|
|
|
|
unassign_user_from_module: 14,
|
|
|
|
create_step: 15,
|
|
|
|
destroy_step: 16,
|
|
|
|
add_comment_to_step: 17,
|
|
|
|
complete_step: 18,
|
|
|
|
uncomplete_step: 19,
|
|
|
|
check_step_checklist_item: 20,
|
|
|
|
uncheck_step_checklist_item: 21,
|
|
|
|
edit_step: 22,
|
|
|
|
add_result: 23,
|
|
|
|
add_comment_to_result: 24,
|
|
|
|
archive_result: 25,
|
|
|
|
edit_result: 26,
|
|
|
|
create_experiment: 27,
|
|
|
|
edit_experiment: 28,
|
|
|
|
archive_experiment: 29,
|
|
|
|
clone_experiment: 30,
|
|
|
|
move_experiment: 31,
|
|
|
|
add_comment_to_project: 32,
|
|
|
|
edit_project_comment: 33,
|
|
|
|
delete_project_comment: 34,
|
|
|
|
add_comment_to_module: 35,
|
|
|
|
edit_module_comment: 36,
|
|
|
|
delete_module_comment: 37,
|
|
|
|
edit_step_comment: 38,
|
|
|
|
delete_step_comment: 39,
|
|
|
|
edit_result_comment: 40,
|
|
|
|
delete_result_comment: 41,
|
|
|
|
destroy_result: 42,
|
2019-03-27 18:24:44 +08:00
|
|
|
start_edit_wopi_file: 43, # not in use
|
|
|
|
unlock_wopi_file: 44, # not in use
|
2019-03-19 23:12:07 +08:00
|
|
|
load_protocol_to_task_from_file: 45,
|
|
|
|
load_protocol_to_task_from_repository: 46,
|
|
|
|
update_protocol_in_task_from_repository: 47,
|
2019-02-25 22:21:13 +08:00
|
|
|
create_report: 48,
|
|
|
|
delete_report: 49,
|
|
|
|
edit_report: 50,
|
2019-03-27 18:24:44 +08:00
|
|
|
assign_sample: 51, # not in use
|
|
|
|
unassign_sample: 52, # not in use
|
2019-02-25 22:21:13 +08:00
|
|
|
complete_task: 53,
|
|
|
|
uncomplete_task: 54,
|
|
|
|
assign_repository_record: 55,
|
2019-03-06 22:42:33 +08:00
|
|
|
unassign_repository_record: 56,
|
|
|
|
restore_experiment: 57,
|
|
|
|
rename_task: 58,
|
|
|
|
move_task: 59,
|
|
|
|
set_task_due_date: 61,
|
|
|
|
change_task_due_date: 62,
|
|
|
|
remove_task_due_date: 63,
|
|
|
|
add_task_tag: 64,
|
2019-04-30 16:23:09 +08:00
|
|
|
edit_tag: 65,
|
2019-04-05 22:25:22 +08:00
|
|
|
remove_task_tag: 66, # 67, 68, 69 are in addons
|
2019-03-06 22:42:33 +08:00
|
|
|
create_inventory: 70,
|
|
|
|
rename_inventory: 71,
|
|
|
|
delete_inventory: 72,
|
|
|
|
create_item_inventory: 73,
|
|
|
|
edit_item_inventory: 74,
|
|
|
|
delete_item_inventory: 75,
|
|
|
|
create_column_inventory: 76,
|
|
|
|
edit_column_inventory: 77,
|
|
|
|
delete_column_inventory: 78,
|
|
|
|
update_protocol_in_repository_from_task: 79,
|
|
|
|
create_protocol_in_repository: 80,
|
|
|
|
add_step_to_protocol_repository: 81,
|
|
|
|
edit_step_in_protocol_repository: 82,
|
|
|
|
delete_step_in_protocol_repository: 83,
|
|
|
|
edit_description_in_protocol_repository: 84,
|
|
|
|
edit_keywords_in_protocol_repository: 85,
|
|
|
|
edit_authors_in_protocol_repository: 86,
|
|
|
|
archive_protocol_in_repository: 87,
|
|
|
|
restore_protocol_in_repository: 88,
|
|
|
|
move_protocol_in_repository: 89,
|
|
|
|
import_protocol_in_repository: 90,
|
|
|
|
export_protocol_in_repository: 91,
|
|
|
|
invite_user_to_team: 92,
|
|
|
|
remove_user_from_team: 93,
|
|
|
|
change_users_role_on_team: 94,
|
|
|
|
export_projects: 95,
|
2019-04-05 22:25:22 +08:00
|
|
|
export_inventory_items: 96, # 97 is in addon
|
2019-03-19 23:12:07 +08:00
|
|
|
edit_wopi_file_on_result: 99,
|
2019-03-29 22:09:20 +08:00
|
|
|
edit_wopi_file_on_step: 100,
|
2019-04-05 22:25:22 +08:00
|
|
|
edit_wopi_file_on_step_in_repository: 101,
|
|
|
|
copy_inventory_item: 102,
|
2019-04-02 17:50:37 +08:00
|
|
|
copy_protocol_in_repository: 103,
|
|
|
|
user_leave_team: 104,
|
2019-03-29 18:24:22 +08:00
|
|
|
copy_inventory: 105,
|
2019-04-30 16:23:09 +08:00
|
|
|
export_protocol_from_task: 106,
|
2019-04-30 18:07:59 +08:00
|
|
|
import_inventory_items: 107,
|
2019-04-30 16:23:09 +08:00
|
|
|
create_tag: 108,
|
2019-06-14 22:15:30 +08:00
|
|
|
delete_tag: 109,
|
|
|
|
edit_image_on_result: 110,
|
|
|
|
edit_image_on_step: 111,
|
|
|
|
edit_image_on_step_in_repository: 112,
|
2019-08-09 15:47:07 +08:00
|
|
|
edit_chemical_structure_on_step: 115,
|
|
|
|
edit_chemical_structure_on_result: 116,
|
|
|
|
edit_chemical_structure_on_step_in_repository: 117,
|
|
|
|
edit_chemical_structure_on_task_protocol: 118,
|
|
|
|
edit_chemical_structure_on_protocol: 119,
|
|
|
|
edit_chemical_structure_on_task: 120,
|
|
|
|
create_chemical_structure_on_step: 121,
|
|
|
|
create_chemical_structure_on_result: 122,
|
|
|
|
create_chemical_structure_on_step_in_repository: 123,
|
|
|
|
create_chemical_structure_on_task_protocol: 124,
|
|
|
|
create_chemical_structure_on_protocol: 125,
|
|
|
|
create_chemical_structure_on_task: 126,
|
|
|
|
delete_chemical_structure_on_step: 127,
|
|
|
|
delete_chemical_structure_on_result: 128,
|
|
|
|
delete_chemical_structure_on_step_in_repository: 129,
|
|
|
|
delete_chemical_structure_on_task_protocol: 130,
|
|
|
|
delete_chemical_structure_on_protocol: 131,
|
|
|
|
delete_chemical_structure_on_task: 132
|
2019-04-05 22:25:22 +08:00
|
|
|
}
|
2019-03-26 22:29:21 +08:00
|
|
|
|
|
|
|
ACTIVITY_GROUPS = {
|
2019-04-30 16:23:09 +08:00
|
|
|
projects: [*0..7, 32, 33, 34, 95, 108, 65, 109],
|
2019-08-09 15:47:07 +08:00
|
|
|
task_results: [23, 26, 25, 42, 24, 40, 41, 99, 110, 122, 116, 128],
|
|
|
|
task: [8, 58, 9, 59, 10, 11, 12, 13, 14, 35, 36, 37, 53, 54, *60..64, *66..69, 106, 126, 120, 132],
|
|
|
|
task_protocol: [15, 22, 16, 18, 19, 20, 21, 17, 38, 39, 100, 111, 45, 46, 47, 121, 124, 115, 118, 127, 130],
|
2019-03-26 22:29:21 +08:00
|
|
|
task_inventory: [55, 56],
|
|
|
|
experiment: [*27..31, 57],
|
2019-04-09 20:18:22 +08:00
|
|
|
reports: [48, 50, 49],
|
2019-04-18 21:18:10 +08:00
|
|
|
inventories: [70, 71, 105, 72, 73, 74, 102, 75, 76, 77, 78, 96, 107],
|
2019-08-09 15:47:07 +08:00
|
|
|
protocol_repository: [80, 103, 89, 87, 79, 90, 91, 88, 85, 86, 84, 81, 82,
|
|
|
|
83, 101, 112, 123, 125, 117, 119, 129, 131],
|
2019-04-09 20:18:22 +08:00
|
|
|
team: [92, 94, 93, 97, 104]
|
2019-03-26 22:29:21 +08:00
|
|
|
}.freeze
|
2016-11-08 18:26:55 +08:00
|
|
|
end
|