mirror of
https://github.com/scinote-eln/scinote-web.git
synced 2025-11-09 16:01:30 +08:00
Merge pull request #659 from Ducz0r/lm-sci-1279
Include repositories in reports [SCI-1279]
This commit is contained in:
commit
27feb46d8f
32 changed files with 372 additions and 260 deletions
|
|
@ -100,8 +100,8 @@ function initializeElementControls(el) {
|
|||
sortCommentsElement(el, true);
|
||||
} else if (el.hasClass("report-module-activity-element")) {
|
||||
sortModuleActivityElement(el, true);
|
||||
} else if (el.hasClass("report-module-samples-element")) {
|
||||
sortModuleSamplesElement(el, true);
|
||||
} else if (el.is("[data-sort-hot]")) {
|
||||
sortModuleHotElement(el, true);
|
||||
} else {
|
||||
sortElementChildren(el, true, false);
|
||||
}
|
||||
|
|
@ -115,8 +115,8 @@ function initializeElementControls(el) {
|
|||
sortCommentsElement(el, false);
|
||||
} else if (el.hasClass("report-module-activity-element")) {
|
||||
sortModuleActivityElement(el, false);
|
||||
} else if (el.hasClass("report-module-samples-element")) {
|
||||
sortModuleSamplesElement(el, false);
|
||||
} else if (el.is("[data-sort-hot]")) {
|
||||
sortModuleHotElement(el, false);
|
||||
} else {
|
||||
sortElementChildren(el, false, false);
|
||||
}
|
||||
|
|
@ -217,9 +217,7 @@ function initializeNewElement(newEl) {
|
|||
url: url,
|
||||
type: "GET",
|
||||
dataType: "json",
|
||||
data: {
|
||||
id: parentElementId
|
||||
},
|
||||
data: parentElementId,
|
||||
success: function(data, status, jqxhr) {
|
||||
// Open modal, set its title, and display module contents
|
||||
addContentsModal.find(".modal-title").text(modalTitle);
|
||||
|
|
@ -500,11 +498,11 @@ function initializeUnsavedWorkDialog() {
|
|||
*/
|
||||
function getSidebarEl(reportEl) {
|
||||
var type = reportEl.data("type");
|
||||
var id = reportEl.data("id");
|
||||
var scrollId = reportEl.data("scroll-id");
|
||||
return $(SIDEBAR_PARENT_TREE).find(
|
||||
"li" +
|
||||
"[data-type='" + type + "']" +
|
||||
"[data-id='" + id + "']"
|
||||
"[data-scroll-id='" + scrollId + "']"
|
||||
);
|
||||
}
|
||||
|
||||
|
|
@ -516,11 +514,11 @@ function getSidebarEl(reportEl) {
|
|||
*/
|
||||
function getReportEl(sidebarEl) {
|
||||
var type = sidebarEl.data("type");
|
||||
var id = sidebarEl.data("id");
|
||||
var scrollId = sidebarEl.data("scroll-id");
|
||||
return $(REPORT_CONTENT).find(
|
||||
"div.report-element" +
|
||||
"[data-type='" + type + "']" +
|
||||
"[data-id='" + id + "']"
|
||||
"[data-scroll-id='" + scrollId + "']"
|
||||
);
|
||||
}
|
||||
|
||||
|
|
@ -565,14 +563,14 @@ function initSidebarElement(reportEl) {
|
|||
var elChildrenContainer = reportEl.children(".report-element-children");
|
||||
var type = reportEl.data("type");
|
||||
var name = reportEl.data("name");
|
||||
var id = reportEl.data("id");
|
||||
var scrollId = reportEl.data("scroll-id");
|
||||
var iconClass = "glyphicon " + reportEl.data("icon-class");
|
||||
|
||||
// Generate list element
|
||||
var newLi = $(document.createElement("li"));
|
||||
newLi
|
||||
.attr("data-type", type)
|
||||
.attr("data-id", id);
|
||||
.attr("data-scroll-id", scrollId);
|
||||
|
||||
var newSpan = $(document.createElement("span"));
|
||||
newSpan.appendTo(newLi);
|
||||
|
|
@ -814,17 +812,18 @@ function sortModuleActivityElement(el, asc) {
|
|||
}
|
||||
|
||||
/**
|
||||
* Sort the module samples element (special handling needs
|
||||
* Sort the module HoT element (special handling needs
|
||||
* to be done in this case).
|
||||
* @param el - The module samples element in the report.
|
||||
* @param el - The module element in the report that contains handsontables.
|
||||
* @param asc - True to sort in ascending order, false to sort
|
||||
* in descending order.
|
||||
*/
|
||||
function sortModuleSamplesElement(el, asc) {
|
||||
function sortModuleHotElement(el, asc) {
|
||||
var hotEl = el.find(".report-element-body .hot-table-container");
|
||||
var hotInstance = hotEl.handsontable("getInstance");
|
||||
var col = el.attr('data-sort-hot');
|
||||
|
||||
hotInstance.sort(3, asc);
|
||||
hotInstance.sort(col, asc);
|
||||
|
||||
// Update data attribute on sorting on the element
|
||||
el.attr("data-order", asc ? "asc" : "desc");
|
||||
|
|
@ -1024,7 +1023,7 @@ function addElement(jsonEl, prevEl) {
|
|||
.find(
|
||||
".report-element" +
|
||||
"[data-type='" + el.attr("data-type") + "']" +
|
||||
"[data-id='" + el.attr("data-id") + "']"
|
||||
"[data-scroll-id='" + el.attr("data-scroll-id") + "']"
|
||||
);
|
||||
if (existing.length && existing.length > 0) {
|
||||
// TODO Remove event listeners on existing element
|
||||
|
|
|
|||
|
|
@ -509,6 +509,26 @@ label {
|
|||
}
|
||||
}
|
||||
|
||||
// Module repository element
|
||||
.report-module-repository-element {
|
||||
margin-bottom: 0;
|
||||
|
||||
.report-element-header {
|
||||
border-bottom: 0;
|
||||
|
||||
.repository-name {
|
||||
margin-left: 5px;
|
||||
}
|
||||
}
|
||||
|
||||
&:hover > .report-element-header {
|
||||
.repository-icon,
|
||||
.repository-name {
|
||||
color: $color-theme-primary;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/** Module activity element */
|
||||
.report-module-activity-element {
|
||||
margin-bottom: 0;
|
||||
|
|
|
|||
|
|
@ -70,37 +70,54 @@ module ReportActions
|
|||
def generate_module_contents_json(my_module)
|
||||
res = []
|
||||
ReportExtends::MODULE_CONTENTS.each do |contents|
|
||||
present = false
|
||||
elements = []
|
||||
contents.values.each do |element|
|
||||
present = in_params?("module_#{element}".to_sym) ||
|
||||
in_params?(element.to_sym)
|
||||
break if present
|
||||
end
|
||||
next unless present
|
||||
|
||||
if contents.children
|
||||
contents.collection(my_module, params).each do |report_el|
|
||||
res << generate_new_el(false)
|
||||
el = generate_el(
|
||||
"reports/elements/my_module_#{contents.element.to_s.singularize}"\
|
||||
"_element.html.erb",
|
||||
contents.parse_locals([report_el])
|
||||
)
|
||||
if :step.in? contents.locals
|
||||
el[:children] = generate_step_contents_json(report_el)
|
||||
elsif :result.in? contents.locals
|
||||
el[:children] = generate_result_contents_json(report_el)
|
||||
if contents.has_many
|
||||
elements = params.select { |k| k.starts_with?("module_#{element}") }
|
||||
elements = elements.select { |_,v| v == '1' }.keys
|
||||
elements.map! { |el| el.gsub('module_', '')}.map!{|el| el.split('_') }
|
||||
elements.map! { |el| [el[0].to_sym, el[1].to_i] }
|
||||
break unless elements.empty?
|
||||
else
|
||||
present = in_params?("module_#{element}".to_sym) ||
|
||||
in_params?(element.to_sym)
|
||||
if present
|
||||
elements << [element.to_sym, nil]
|
||||
break
|
||||
end
|
||||
res << el
|
||||
end
|
||||
else
|
||||
file_name = contents.file_name
|
||||
file_name = contents.element if contents.element == :samples
|
||||
res << generate_new_el(false)
|
||||
res << generate_el(
|
||||
"reports/elements/my_module_#{file_name}_element.html.erb",
|
||||
contents.parse_locals([my_module, :asc])
|
||||
)
|
||||
end
|
||||
next if elements.empty?
|
||||
|
||||
elements.each do |_, el_id|
|
||||
if contents.children
|
||||
contents.collection(my_module, params).each do |report_el|
|
||||
res << generate_new_el(false)
|
||||
locals = contents.parse_locals([report_el])
|
||||
locals[:element_id] = el_id if el_id
|
||||
el = generate_el(
|
||||
"reports/elements/my_module_#{contents.element.to_s.singularize}"\
|
||||
"_element.html.erb",
|
||||
locals
|
||||
)
|
||||
if :step.in? contents.locals
|
||||
el[:children] = generate_step_contents_json(report_el)
|
||||
elsif :result.in? contents.locals
|
||||
el[:children] = generate_result_contents_json(report_el)
|
||||
end
|
||||
res << el
|
||||
end
|
||||
else
|
||||
file_name = contents.file_name
|
||||
file_name = contents.element if contents.element == :samples
|
||||
res << generate_new_el(false)
|
||||
locals = contents.parse_locals([my_module, :asc])
|
||||
locals[:element_id] = el_id if el_id
|
||||
res << generate_el(
|
||||
"reports/elements/my_module_#{file_name}_element.html.erb",
|
||||
locals
|
||||
)
|
||||
end
|
||||
end
|
||||
end
|
||||
res << generate_new_el(false)
|
||||
|
|
|
|||
|
|
@ -233,7 +233,7 @@ class ReportsController < ApplicationController
|
|||
|
||||
# Experiment for adding contents into experiment element
|
||||
def experiment_contents_modal
|
||||
experiment = Experiment.find_by_id(params[:id])
|
||||
experiment = Experiment.find_by_id(params[:experiment_id])
|
||||
|
||||
respond_to do |format|
|
||||
if experiment.blank?
|
||||
|
|
@ -255,7 +255,7 @@ class ReportsController < ApplicationController
|
|||
|
||||
# Modal for adding contents into module element
|
||||
def module_contents_modal
|
||||
my_module = MyModule.find_by_id(params[:id])
|
||||
my_module = MyModule.find_by_id(params[:my_module_id])
|
||||
|
||||
respond_to do |format|
|
||||
if my_module.blank?
|
||||
|
|
@ -277,7 +277,7 @@ class ReportsController < ApplicationController
|
|||
|
||||
# Modal for adding contents into step element
|
||||
def step_contents_modal
|
||||
step = Step.find_by_id(params[:id])
|
||||
step = Step.find_by_id(params[:step_id])
|
||||
|
||||
respond_to do |format|
|
||||
if step.blank?
|
||||
|
|
@ -299,7 +299,7 @@ class ReportsController < ApplicationController
|
|||
|
||||
# Modal for adding contents into result element
|
||||
def result_contents_modal
|
||||
result = Result.find_by_id(params[:id])
|
||||
result = Result.find_by_id(params[:result_id])
|
||||
|
||||
respond_to do |format|
|
||||
if result.blank?
|
||||
|
|
|
|||
|
|
@ -45,13 +45,9 @@ module ReportsHelper
|
|||
|
||||
ReportElement.type_ofs.keys.each do |type|
|
||||
next unless element.public_send("#{type}?")
|
||||
local_sym = type.split('_').last.to_sym
|
||||
local_sym = type
|
||||
.split('_')
|
||||
.first
|
||||
.to_sym if type.in? ReportExtends::FIRST_PART_ELEMENTS
|
||||
local_sym = :my_module if type.in? ReportExtends::MY_MODULE_ELEMENTS
|
||||
locals[local_sym] = element.element_reference
|
||||
element.element_references.each do |el_ref|
|
||||
locals[el_ref.class.name.underscore.to_sym] = el_ref
|
||||
end
|
||||
locals[:order] = element
|
||||
.sort_order if type.in? ReportExtends::SORTED_ELEMENTS
|
||||
end
|
||||
|
|
|
|||
|
|
@ -313,6 +313,29 @@ class MyModule < ActiveRecord::Base
|
|||
{ data: data, headers: headers }
|
||||
end
|
||||
|
||||
# Generate the repository rows belonging to this module
|
||||
# in JSON form, suitable for display in handsontable.js
|
||||
def repository_json_hot(repository_id, order)
|
||||
data = []
|
||||
repository_rows
|
||||
.where(repository_id: repository_id)
|
||||
.order(created_at: order).find_each do |row|
|
||||
row_json = []
|
||||
row_json << row.name
|
||||
row_json << I18n.l(row.created_at, format: :full)
|
||||
row_json << row.created_by.full_name
|
||||
data << row_json
|
||||
end
|
||||
|
||||
# Prepare column headers
|
||||
headers = [
|
||||
I18n.t('repositories.table.name'),
|
||||
I18n.t('repositories.table.created_at'),
|
||||
I18n.t('repositories.table.created_by')
|
||||
]
|
||||
{ data: data, headers: headers }
|
||||
end
|
||||
|
||||
def deep_clone(current_user)
|
||||
deep_clone_to_experiment(current_user, experiment)
|
||||
end
|
||||
|
|
|
|||
|
|
@ -95,7 +95,7 @@ class Report < ActiveRecord::Base
|
|||
el.parent = parent
|
||||
el.type_of = json_element['type_of']
|
||||
el.sort_order = json_element['sort_order']
|
||||
el.set_element_reference(json_element['id'])
|
||||
el.set_element_references(json_element['id'])
|
||||
el.save!
|
||||
|
||||
if json_element['children'].present?
|
||||
|
|
|
|||
|
|
@ -31,6 +31,7 @@ class ReportElement < ActiveRecord::Base
|
|||
belongs_to :checklist, inverse_of: :report_elements
|
||||
belongs_to :asset, inverse_of: :report_elements
|
||||
belongs_to :table, inverse_of: :report_elements
|
||||
belongs_to :repository, inverse_of: :report_elements
|
||||
|
||||
def has_children?
|
||||
children.length > 0
|
||||
|
|
@ -44,19 +45,23 @@ class ReportElement < ActiveRecord::Base
|
|||
step_comments? or result_comments?
|
||||
end
|
||||
|
||||
# Get the referenced element (previously, element's type_of must be set)
|
||||
def element_reference
|
||||
# Get the referenced elements (previously, element's type_of must be set)
|
||||
def element_references
|
||||
ReportExtends::ELEMENT_REFERENCES.each do |el_ref|
|
||||
return eval(el_ref.element.gsub('_id', '')) if el_ref.check(self)
|
||||
if el_ref.check(self)
|
||||
return el_ref.elements.map { |el| eval(el.gsub('_id', '')) }
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
# Set the element reference (previously, element's type_of must be set)
|
||||
def set_element_reference(ref_id)
|
||||
# Set the element references (previously, element's type_of must be set)
|
||||
def set_element_references(ref_ids)
|
||||
ReportExtends::SET_ELEMENT_REFERENCES_LIST.each do |el_ref|
|
||||
check = el_ref.check(self)
|
||||
next unless check
|
||||
public_send("#{el_ref.element}=", ref_id)
|
||||
el_ref.elements.each do |element|
|
||||
public_send("#{element}=", ref_ids[element])
|
||||
end
|
||||
break
|
||||
end
|
||||
end
|
||||
|
|
@ -64,7 +69,15 @@ class ReportElement < ActiveRecord::Base
|
|||
# removes element that are archived or deleted
|
||||
def clean_removed_or_archived_elements
|
||||
parent_model = ''
|
||||
%w(project experiment my_module step result checklist asset table)
|
||||
%w(project
|
||||
experiment
|
||||
my_module
|
||||
step
|
||||
result
|
||||
checklist
|
||||
asset
|
||||
table
|
||||
repository)
|
||||
.each do |el|
|
||||
parent_model = el if send el
|
||||
end
|
||||
|
|
@ -81,17 +94,11 @@ class ReportElement < ActiveRecord::Base
|
|||
private
|
||||
|
||||
def has_one_of_referenced_elements
|
||||
num_of_refs = [project,
|
||||
experiment,
|
||||
my_module,
|
||||
step,
|
||||
result,
|
||||
checklist,
|
||||
asset,
|
||||
table].count { |r| r.present? }
|
||||
if num_of_refs != 1
|
||||
element_references.each do |el|
|
||||
next unless el.nil?
|
||||
errors.add(:base,
|
||||
'Report element must have exactly one element reference.')
|
||||
'Report element doesn\'t have correct element references.')
|
||||
break
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
|||
|
|
@ -5,6 +5,7 @@ class Repository < ActiveRecord::Base
|
|||
has_many :repository_rows
|
||||
has_many :repository_table_states,
|
||||
inverse_of: :repository, dependent: :destroy
|
||||
has_many :report_elements, inverse_of: :repository, dependent: :destroy
|
||||
|
||||
auto_strip_attributes :name, nullify: false
|
||||
validates :name,
|
||||
|
|
|
|||
|
|
@ -18,6 +18,7 @@ class RepositoryTableState < ActiveRecord::Base
|
|||
user: user,
|
||||
repository: custom_column.repository
|
||||
)
|
||||
return if table_state.empty?
|
||||
repository_state = table_state.first['state']
|
||||
if column_index
|
||||
# delete column
|
||||
|
|
|
|||
|
|
@ -177,8 +177,8 @@ class User < ActiveRecord::Base
|
|||
class_name: 'Protocol',
|
||||
foreign_key: 'restored_by_id',
|
||||
inverse_of: :restored_by
|
||||
has_many :assigned_repository_row_my_modules,
|
||||
class_name: 'RepositoryRowMyModules',
|
||||
has_many :assigned_my_module_repository_rows,
|
||||
class_name: 'MyModuleRepositoryRow',
|
||||
foreign_key: 'assigned_by_id'
|
||||
|
||||
has_many :user_notifications, inverse_of: :user
|
||||
|
|
|
|||
|
|
@ -3,7 +3,8 @@
|
|||
<div class="report-element report-experiment-element"
|
||||
data-ts="<%= timestamp.to_i %>"
|
||||
data-type="experiment"
|
||||
data-id="<%= experiment.id %>"
|
||||
data-id='{ "experiment_id": <%= experiment.id %> }'
|
||||
data-scroll-id="<%= experiment.id %>"
|
||||
data-modal-title="<%=t "projects.reports.elements.modals.experiment_contents.head_title",
|
||||
experiment: experiment.name %>" data-name="<%= name %>" data-icon-class="fa fa-flask">
|
||||
<div class="report-element-header">
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
<% if order.blank? and @order.present? then order = @order end %>
|
||||
<% timestamp = Time.current + 1.year - 2.days %>
|
||||
<% activities = my_module.activities.order(created_at: order) %>
|
||||
<div class="report-element report-module-activity-element" data-ts="<%= timestamp.to_i %>" data-type="my_module_activity" data-id="<%= my_module.id %>" data-order="<%= order == :asc ? "asc" : "desc" %>" data-name="<%=t "projects.reports.elements.module_activity.sidebar_name" %>" data-icon-class="glyphicon glyphicon-equalizer">
|
||||
<div class="report-element report-module-activity-element" data-ts="<%= timestamp.to_i %>" data-type="my_module_activity" data-id='{ "my_module_id": <%= my_module.id %> }' data-scroll-id="<%= my_module.id %>" data-order="<%= order == :asc ? "asc" : "desc" %>" data-name="<%=t "projects.reports.elements.module_activity.sidebar_name" %>" data-icon-class="glyphicon glyphicon-equalizer">
|
||||
<div class="report-element-header">
|
||||
<div class="row">
|
||||
<div class="pull-left activity-icon">
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
<% if my_module.blank? and @my_module.present? then my_module = @my_module end %>
|
||||
<% timestamp = my_module.created_at %>
|
||||
<% name = my_module.name %>
|
||||
<div class="report-element report-module-element" data-ts="<%= timestamp.to_i %>" data-type="my_module" data-id="<%= my_module.id %>" data-modal-title="<%=t "projects.reports.elements.modals.module_contents.head_title", module: my_module.name %>" data-name="<%= name %>" data-icon-class="glyphicon-credit-card">
|
||||
<div class="report-element report-module-element" data-ts="<%= timestamp.to_i %>" data-type="my_module" data-id='{ "my_module_id": <%= my_module.id %> }' data-scroll-id="<%= my_module.id %>" data-modal-title="<%=t "projects.reports.elements.modals.module_contents.head_title", module: my_module.name %>" data-name="<%= name %>" data-icon-class="glyphicon-credit-card">
|
||||
<div class="report-element-header">
|
||||
<div class="row">
|
||||
<div class="pull-left user-time">
|
||||
|
|
|
|||
|
|
@ -0,0 +1,36 @@
|
|||
<% repository ||= Repository.find(element_id) %>
|
||||
<% if my_module.blank? and @my_module.present? then my_module = @my_module end %>
|
||||
<% rows = my_module.repository_rows.where(repository: repository) %>
|
||||
<% if order.blank? and @order.present? then order = @order end %>
|
||||
<% timestamp = Time.current + 1.year - 1.days %>
|
||||
<% rows_json = my_module.repository_json_hot(repository.id, order) %>
|
||||
<div class="report-element report-module-repository-element" data-sort-hot="1" data-ts="<%= timestamp.to_i %>" data-type="my_module_repository" data-id='{ "my_module_id": <%= my_module.id %>, "repository_id": <%= repository.id %> }' data-scroll-id="<%= "#{my_module.id}_#{repository.id}" %>" data-order="<%= order == :asc ? "asc" : "desc" %>" data-name="<%= repository.name %>" data-icon-class="glyphicon-oil">
|
||||
<div class="report-element-header">
|
||||
<div class="row">
|
||||
<div class="pull-left repository-icon">
|
||||
<span class="glyphicon glyphicon-oil"></span>
|
||||
</div>
|
||||
<div class="pull-left repository-name">
|
||||
<%=t "projects.reports.elements.module_repository.name", repository: repository.name, my_module: my_module.name %>
|
||||
</div>
|
||||
<div class="pull-right controls">
|
||||
<%= render partial: "reports/elements/element_controls.html.erb", locals: { show_sort: true } %>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="report-element-body">
|
||||
<% if rows_json[:data].count > 0 %>
|
||||
<input type="hidden" class="hot-table-contents hot-samples" value='<%= rows_json.to_json.force_encoding(Encoding::UTF_8) %>' />
|
||||
<div class="hot-table-container"></div>
|
||||
<% else %>
|
||||
<div class="row">
|
||||
<div class="col-xs-12">
|
||||
<em><%=t "projects.reports.elements.module_repository.no_items" %></em>
|
||||
</div>
|
||||
</div>
|
||||
<% end %>
|
||||
</div>
|
||||
<div class="report-element-children">
|
||||
<%= children if (defined? children and children.present?) %>
|
||||
</div>
|
||||
</div>
|
||||
|
|
@ -5,7 +5,7 @@
|
|||
<% timestamp = asset.created_at %>
|
||||
<% name = result.name %>
|
||||
<% icon_class = is_image ? "glyphicon-picture" : "glyphicon-file" %>
|
||||
<div class="report-element report-result-element report-result-asset-element" data-ts="<%= timestamp.to_i %>" data-type="result_asset" data-id="<%= result.id %>" data-modal-title="<%=t "projects.reports.elements.modals.result_contents.head_title", result: result.name %>" data-name="<%= name %>" data-icon-class="<%= icon_class %>">
|
||||
<div class="report-element report-result-element report-result-asset-element" data-ts="<%= timestamp.to_i %>" data-type="result_asset" data-id='{ "result_id": <%= result.id %> }' data-scroll-id="<%= result.id %>" data-modal-title="<%=t "projects.reports.elements.modals.result_contents.head_title", result: result.name %>" data-name="<%= name %>" data-icon-class="<%= icon_class %>">
|
||||
<div class="report-element-header">
|
||||
<div class="row">
|
||||
<div class="pull-left result-icon">
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
<% comments = result.result_comments %>
|
||||
<% timestamp = table.created_at %>
|
||||
<% name = result.name %>
|
||||
<div class="report-element report-result-element report-result-table-element" data-ts="<%= timestamp.to_i %>" data-type="result_table" data-id="<%= result.id %>" data-modal-title="<%=t "projects.reports.elements.modals.result_contents.head_title", result: result.name %>" data-name="<%= name %>" data-icon-class="glyphicon-th">
|
||||
<div class="report-element report-result-element report-result-table-element" data-ts="<%= timestamp.to_i %>" data-type="result_table" data-id='{ "result_id": <%= result.id %> }' data-scroll-id="<%= result.id %>" data-modal-title="<%=t "projects.reports.elements.modals.result_contents.head_title", result: result.name %>" data-name="<%= name %>" data-icon-class="glyphicon-th">
|
||||
<div class="report-element-header">
|
||||
<div class="row">
|
||||
<div class="pull-left result-name-container">
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
<% comments = result.result_comments %>
|
||||
<% timestamp = result.created_at %>
|
||||
<% name = result.name %>
|
||||
<div class="report-element report-result-element report-result-text-element" data-ts="<%= timestamp.to_i %>" data-type="result_text" data-id="<%= result.id %>" data-modal-title="<%=t "projects.reports.elements.modals.result_contents.head_title", result: result.name %>" data-name="<%= name %>" data-icon-class="glyphicon-asterisk">
|
||||
<div class="report-element report-result-element report-result-text-element" data-ts="<%= timestamp.to_i %>" data-type="result_text" data-id='{ "result_id": <%= result.id %> }' data-scroll-id="<%= result.id %>" data-modal-title="<%=t "projects.reports.elements.modals.result_contents.head_title", result: result.name %>" data-name="<%= name %>" data-icon-class="glyphicon-asterisk">
|
||||
<div class="report-element-header">
|
||||
<div class="row">
|
||||
<div class="pull-left result-icon">
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
<% if order.blank? and @order.present? then order = @order end %>
|
||||
<% timestamp = Time.current + 1.year - 1.days %>
|
||||
<% samples_json = my_module.samples_json_hot(order) %>
|
||||
<div class="report-element report-module-samples-element" data-ts="<%= timestamp.to_i %>" data-type="my_module_samples" data-id="<%= my_module.id %>" data-order="<%= order == :asc ? "asc" : "desc" %>" data-name="<%=t "projects.reports.elements.module_samples.sidebar_name" %>" data-icon-class="glyphicon-tint">
|
||||
<div class="report-element report-module-samples-element" data-sort-hot="3" data-ts="<%= timestamp.to_i %>" data-type="my_module_samples" data-id='{ "my_module_id": <%= my_module.id %> }' data-scroll-id="<%= my_module.id %>" data-order="<%= order == :asc ? "asc" : "desc" %>" data-name="<%=t "projects.reports.elements.module_samples.sidebar_name" %>" data-icon-class="glyphicon-tint">
|
||||
<div class="report-element-header">
|
||||
<div class="row">
|
||||
<div class="pull-left samples-icon">
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@
|
|||
<% assets = step.assets %>
|
||||
<% checklists = step.checklists %>
|
||||
<% comments = step.step_comments %>
|
||||
<div class="report-element report-step-element" data-ts="<%= timestamp.to_i %>" data-type="step" data-id="<%= step.id %>" data-modal-title="<%=t "projects.reports.elements.modals.step_contents.head_title", step: step.name %>" data-name="<%=t "projects.reports.elements.step.sidebar_name", pos: (step.position + 1), name: step.name %>" data-icon-class="glyphicon-circle-arrow-right">
|
||||
<div class="report-element report-step-element" data-ts="<%= timestamp.to_i %>" data-type="step" data-id='{ "step_id": <%= step.id %> }' data-scroll-id="<%= step.id %>" data-modal-title="<%=t "projects.reports.elements.modals.step_contents.head_title", step: step.name %>" data-name="<%=t "projects.reports.elements.step.sidebar_name", pos: (step.position + 1), name: step.name %>" data-icon-class="glyphicon-circle-arrow-right">
|
||||
<div class="report-element-header">
|
||||
<div class="row">
|
||||
<div class="pull-left user-time">
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
<% if project.blank? and @project.present? then project = @project end %>
|
||||
<% name = t("projects.reports.elements.project_header.title", project: project.name) %>
|
||||
<div class="report-element report-project-header-element" data-ts="ignore" data-type="project_header" data-id="<%= project.id %>" data-name="<%= name %>" data-icon-class="glyphicon-header">
|
||||
<div class="report-element report-project-header-element" data-ts="ignore" data-type="project_header" data-id='{ "project_id": <%= project.id %> }' data-scroll-id="<%= project.id %>" data-name="<%= name %>" data-icon-class="glyphicon-header">
|
||||
<div class="report-element-header">
|
||||
<div class="row">
|
||||
<div class="pull-left user-time">
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
<% if order.blank? and @order.present? then order = @order end %>
|
||||
<% comments = result.result_comments.order(created_at: order) %>
|
||||
<% timestamp = Time.current + 1.year %>
|
||||
<div class="report-element report-comments-element report-result-comments-element" data-ts="<%= timestamp.to_i %>" data-order="<%= order == :asc ? "asc" : "desc" %>" data-type="result_comments" data-id="<%= result.id %>" data-name="<%=t "projects.reports.elements.result_comments.sidebar_name" %>" data-icon-class="glyphicon-comment">
|
||||
<div class="report-element report-comments-element report-result-comments-element" data-ts="<%= timestamp.to_i %>" data-order="<%= order == :asc ? "asc" : "desc" %>" data-type="result_comments" data-id='{ "result_id": <%= result.id %> }' data-scroll-id="<%= result.id %>" data-name="<%=t "projects.reports.elements.result_comments.sidebar_name" %>" data-icon-class="glyphicon-comment">
|
||||
<div class="report-element-header">
|
||||
<div class="row">
|
||||
<div class="pull-left comments-icon">
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
<% is_image = asset.is_image? %>
|
||||
<% timestamp = asset.created_at %>
|
||||
<% icon_class = is_image ? 'glyphicon-picture' : 'glyphicon-file' %>
|
||||
<div class="report-element report-step-attachment-element report-step-asset-element" data-ts="<%= timestamp.to_i %>" data-type="step_asset" data-id="<%= asset.id %>" data-name="<%=t "projects.reports.elements.step_asset.sidebar_name", file: asset.file_file_name %>" data-icon-class="<%= icon_class %>">
|
||||
<div class="report-element report-step-attachment-element report-step-asset-element" data-ts="<%= timestamp.to_i %>" data-type="step_asset" data-id='{ "asset_id": <%= asset.id %> }' data-scroll-id="<%= asset.id %>" data-name="<%=t "projects.reports.elements.step_asset.sidebar_name", file: asset.file_file_name %>" data-icon-class="<%= icon_class %>">
|
||||
<div class="report-element-header">
|
||||
<div class="row">
|
||||
<div class="pull-left attachment-icon">
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
<% if checklist.blank? and @checklist.present? then checklist = @checklist end %>
|
||||
<% items = checklist.checklist_items %>
|
||||
<% timestamp = checklist.created_at %>
|
||||
<div class="report-element report-step-attachment-element report-step-checklist-element" data-ts="<%= timestamp.to_i %>" data-type="step_checklist" data-id="<%= checklist.id %>" data-name="<%= checklist.name %>" data-icon-class="glyphicon-list">
|
||||
<div class="report-element report-step-attachment-element report-step-checklist-element" data-ts="<%= timestamp.to_i %>" data-type="step_checklist" data-id='{ "checklist_id": <%= checklist.id %> }' data-scroll-id="<%= checklist.id %>" data-name="<%= checklist.name %>" data-icon-class="glyphicon-list">
|
||||
<div class="report-element-header">
|
||||
<div class="row">
|
||||
<div class="pull-left attachment-icon">
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
<% if order.blank? and @order.present? then order = @order end %>
|
||||
<% comments = step.step_comments.order(created_at: order) %>
|
||||
<% timestamp = Time.current + 1.year %>
|
||||
<div class="report-element report-comments-element report-step-comments-element" data-ts="<%= timestamp.to_i %>" data-order="asc" data-type="step_comments" data-id="<%= step.id %>" data-name="<%=t "projects.reports.elements.step_comments.sidebar_name" %>" data-icon-class="glyphicon-comment">
|
||||
<div class="report-element report-comments-element report-step-comments-element" data-ts="<%= timestamp.to_i %>" data-order="asc" data-type="step_comments" data-id='{ "step_id": <%= step.id %> }' data-scroll-id="<%= step.id %>" data-name="<%=t "projects.reports.elements.step_comments.sidebar_name" %>" data-icon-class="glyphicon-comment">
|
||||
<div class="report-element-header">
|
||||
<div class="row">
|
||||
<div class="pull-left comments-icon">
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
<% if table.blank? and @table.present? then table = @table end %>
|
||||
<% timestamp = table.created_at %>
|
||||
<div class="report-element report-step-attachment-element report-step-table-element" data-ts="<%= timestamp.to_i %>" data-type="step_table" data-id="<%= table.id %>" data-name="<%= table.name %>" data-icon-class="glyphicon-th">
|
||||
<div class="report-element report-step-attachment-element report-step-table-element" data-ts="<%= timestamp.to_i %>" data-type="step_table" data-id='{ "table_id": <%= table.id %> }' data-scroll-id="<%= table.id %>" data-name="<%= table.name %>" data-icon-class="glyphicon-th">
|
||||
<div class="report-element-header">
|
||||
<div class="row">
|
||||
<div class="pull-left attachment-icon">
|
||||
|
|
|
|||
|
|
@ -69,7 +69,12 @@
|
|||
<li>
|
||||
<%= form.check_box :module_samples, label: t("projects.reports.elements.modals.module_contents_inner.samples") %>
|
||||
</li>
|
||||
|
||||
<% # List all repositories, no matter whether rows are assigned or not %>
|
||||
<% Repository.where(team: @project.team).order(created_at: :asc).select(:id, :name).find_each do |repository| %>
|
||||
<li>
|
||||
<%= form.check_box "module_repository_#{repository.id}", label: repository.name.capitalize, data: { id: repository.id } %>
|
||||
</li>
|
||||
<% end %>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
|
|
|
|||
|
|
@ -35,7 +35,9 @@ class Extends
|
|||
result_comments: 12,
|
||||
project_activity: 13, # TODO
|
||||
project_samples: 14, # TODO
|
||||
experiment: 15 }
|
||||
experiment: 15,
|
||||
# Higher number because of addons
|
||||
my_module_repository: 17 }
|
||||
|
||||
# Data type name should match corresponding model's name
|
||||
REPOSITORY_DATA_TYPES = { RepositoryTextValue: 0,
|
||||
|
|
|
|||
|
|
@ -19,15 +19,24 @@ module ReportExtends
|
|||
# collection of elements
|
||||
# :singular => true by defaut; change the enum type to singular - needed when
|
||||
# querying partials by name
|
||||
# :has_many => false by default; whether the element can have many
|
||||
# manifestations, and its id will be appended.
|
||||
|
||||
ModuleElement = Struct.new(:values,
|
||||
:element,
|
||||
:children,
|
||||
:locals,
|
||||
:coll,
|
||||
:singular) do
|
||||
def initialize(values, element, children, locals, coll = nil, singular = true)
|
||||
super(values, element, children, locals, coll, singular)
|
||||
:singular,
|
||||
:has_many) do
|
||||
def initialize(values,
|
||||
element,
|
||||
children,
|
||||
locals,
|
||||
coll = nil,
|
||||
singular = true,
|
||||
has_many = false)
|
||||
super(values, element, children, locals, coll, singular, has_many)
|
||||
end
|
||||
|
||||
def collection(my_module, params2)
|
||||
|
|
@ -84,11 +93,18 @@ module ReportExtends
|
|||
ModuleElement.new([:activity],
|
||||
:activity,
|
||||
false,
|
||||
[:my_module, :order]),
|
||||
%i(my_module order)),
|
||||
ModuleElement.new([:samples],
|
||||
:samples,
|
||||
false,
|
||||
[:my_module, :order])
|
||||
%i(my_module order)),
|
||||
ModuleElement.new([:repository],
|
||||
:repository,
|
||||
false,
|
||||
%i(my_module order),
|
||||
nil,
|
||||
true,
|
||||
true)
|
||||
]
|
||||
|
||||
# path: app/helpers/reports_helpers.rb
|
||||
|
|
@ -98,10 +114,14 @@ module ReportExtends
|
|||
# ADD REPORT ELEMENT TYPE WHICH YOU WANT TO PASS 'ORDER' LOCAL IN THE PARTIAL
|
||||
SORTED_ELEMENTS = %w(my_module_activity
|
||||
my_module_samples
|
||||
my_module_repository
|
||||
step_comments
|
||||
result_comments)
|
||||
# sets local :my_module to the listed my_module child elements
|
||||
MY_MODULE_ELEMENTS = %w(my_module my_module_activity my_module_samples)
|
||||
MY_MODULE_ELEMENTS = %w(my_module
|
||||
my_module_activity
|
||||
my_module_samples
|
||||
my_module_repository)
|
||||
|
||||
# sets local name to first element of the listed elements
|
||||
FIRST_PART_ELEMENTS = %w(result_comments
|
||||
|
|
@ -114,9 +134,9 @@ module ReportExtends
|
|||
# path: app/models/report_element.rb
|
||||
# method: set_element_reference
|
||||
|
||||
ElementReference = Struct.new(:checker, :element) do
|
||||
def initialize(checker, element = :element_reference_needed!)
|
||||
super(checker, element)
|
||||
ElementReference = Struct.new(:checker, :elements) do
|
||||
def initialize(checker, elements = :element_reference_needed!)
|
||||
super(checker, elements)
|
||||
end
|
||||
|
||||
def check(report_element)
|
||||
|
|
@ -131,22 +151,26 @@ module ReportExtends
|
|||
report_element.project_activity? ||
|
||||
report_element.project_samples?
|
||||
end,
|
||||
'project_id'
|
||||
['project_id']
|
||||
),
|
||||
ElementReference.new(proc(&:experiment?), 'experiment_id'),
|
||||
ElementReference.new(proc(&:experiment?), ['experiment_id']),
|
||||
ElementReference.new(
|
||||
proc do |report_element|
|
||||
report_element.my_module? ||
|
||||
report_element.my_module_activity? ||
|
||||
report_element.my_module_samples?
|
||||
end,
|
||||
'my_module_id'
|
||||
['my_module_id']
|
||||
),
|
||||
ElementReference.new(
|
||||
proc(&:my_module_repository?),
|
||||
%w(my_module_id repository_id)
|
||||
),
|
||||
ElementReference.new(
|
||||
proc do |report_element|
|
||||
report_element.step? || report_element.step_comments?
|
||||
end,
|
||||
'step_id'
|
||||
['step_id']
|
||||
),
|
||||
ElementReference.new(
|
||||
proc do |report_element|
|
||||
|
|
@ -155,11 +179,11 @@ module ReportExtends
|
|||
report_element.result_text? ||
|
||||
report_element.result_comments?
|
||||
end,
|
||||
'result_id'
|
||||
['result_id']
|
||||
),
|
||||
ElementReference.new(proc(&:step_checklist?), 'checklist_id'),
|
||||
ElementReference.new(proc(&:step_asset?), 'asset_id'),
|
||||
ElementReference.new(proc(&:step_table?), 'table_id')
|
||||
ElementReference.new(proc(&:step_checklist?), ['checklist_id']),
|
||||
ElementReference.new(proc(&:step_asset?), ['asset_id']),
|
||||
ElementReference.new(proc(&:step_table?), ['table_id'])
|
||||
]
|
||||
|
||||
# path: app/models/report_element.rb
|
||||
|
|
@ -172,23 +196,27 @@ module ReportExtends
|
|||
report_element.project_activity? ||
|
||||
report_element.project_samples?
|
||||
end,
|
||||
'project_id'
|
||||
['project_id']
|
||||
),
|
||||
ElementReference.new(proc(&:experiment?), 'experiment_id'),
|
||||
ElementReference.new(proc(&:experiment?), ['experiment_id']),
|
||||
ElementReference.new(
|
||||
proc do |report_element|
|
||||
report_element.my_module? ||
|
||||
report_element.my_module_activity? ||
|
||||
report_element.my_module_samples?
|
||||
end,
|
||||
'my_module_id'
|
||||
['my_module_id']
|
||||
),
|
||||
ElementReference.new(
|
||||
proc(&:my_module_repository?),
|
||||
%w(my_module_id repository_id)
|
||||
),
|
||||
ElementReference.new(
|
||||
proc do |report_element|
|
||||
report_element.step? ||
|
||||
report_element.step_comments?
|
||||
end,
|
||||
'step_id'
|
||||
['step_id']
|
||||
),
|
||||
ElementReference.new(
|
||||
proc do |report_element|
|
||||
|
|
@ -197,10 +225,10 @@ module ReportExtends
|
|||
report_element.result_text? ||
|
||||
report_element.result_comments?
|
||||
end,
|
||||
'result_id'
|
||||
['result_id']
|
||||
),
|
||||
ElementReference.new(proc(&:step_checklist?), 'checklist_id'),
|
||||
ElementReference.new(proc(&:step_asset?), 'asset_id'),
|
||||
ElementReference.new(proc(&:step_table?), 'table_id')
|
||||
ElementReference.new(proc(&:step_checklist?), ['checklist_id']),
|
||||
ElementReference.new(proc(&:step_asset?), ['asset_id']),
|
||||
ElementReference.new(proc(&:step_table?), ['table_id'])
|
||||
]
|
||||
end
|
||||
|
|
|
|||
|
|
@ -371,6 +371,9 @@ en:
|
|||
name: "Samples of task %{my_module}"
|
||||
sidebar_name: "Samples"
|
||||
no_samples: "No samples"
|
||||
module_repository:
|
||||
name: "%{repository} of task %{my_module}"
|
||||
no_items: "No items"
|
||||
result_asset:
|
||||
file_name: "[ %{file} ]"
|
||||
user_time: "Uploaded by %{user} on %{timestamp}."
|
||||
|
|
@ -1029,6 +1032,12 @@ en:
|
|||
destroy_modal_submit: 'Permanently delete sample type'
|
||||
destroy_flash: "\"%{name}\" sample type was successfully deleted!"
|
||||
|
||||
repositories:
|
||||
table:
|
||||
name: 'Name'
|
||||
created_at: 'Added on'
|
||||
created_by: 'Added by'
|
||||
|
||||
custom_fields:
|
||||
new:
|
||||
title_html: "Add new column to team <strong>%{team}</strong>"
|
||||
|
|
|
|||
|
|
@ -78,5 +78,8 @@ class AddCustomRepositories < ActiveRecord::Migration
|
|||
t.references :repository, index: true, null: false
|
||||
t.timestamps null: false
|
||||
end
|
||||
|
||||
add_column :report_elements, :repository_id, :integer
|
||||
add_index :report_elements, :repository_id
|
||||
end
|
||||
end
|
||||
|
|
|
|||
248
db/schema.rb
248
db/schema.rb
|
|
@ -11,7 +11,7 @@
|
|||
#
|
||||
# It's strongly recommended that you check this file into your version control system.
|
||||
|
||||
ActiveRecord::Schema.define(version: 20170515073041) do
|
||||
ActiveRecord::Schema.define(version: 20170515141252) do
|
||||
|
||||
# These are extensions that must be enabled in order to support this database
|
||||
enable_extension "plpgsql"
|
||||
|
|
@ -70,67 +70,6 @@ ActiveRecord::Schema.define(version: 20170515073041) do
|
|||
add_index "assets", ["last_modified_by_id"], name: "index_assets_on_last_modified_by_id", using: :btree
|
||||
add_index "assets", ["team_id"], name: "index_assets_on_team_id", using: :btree
|
||||
|
||||
create_table "billing_accounts", force: :cascade do |t|
|
||||
t.string "braintree_customer_id"
|
||||
t.datetime "created_at", null: false
|
||||
t.datetime "updated_at", null: false
|
||||
end
|
||||
|
||||
add_index "billing_accounts", ["braintree_customer_id"], name: "index_billing_accounts_on_braintree_customer_id", using: :btree
|
||||
|
||||
create_table "billing_addons", force: :cascade do |t|
|
||||
t.string "braintree_addon_id"
|
||||
t.integer "type_of"
|
||||
t.string "name", null: false
|
||||
t.string "description"
|
||||
t.integer "amount_cents", default: 0, null: false
|
||||
t.string "amount_currency", default: "USD", null: false
|
||||
t.integer "additional_storage", limit: 8, default: 0
|
||||
t.datetime "created_at", null: false
|
||||
t.datetime "updated_at", null: false
|
||||
end
|
||||
|
||||
add_index "billing_addons", ["braintree_addon_id"], name: "index_billing_addons_on_braintree_addon_id", using: :btree
|
||||
add_index "billing_addons", ["name"], name: "index_billing_addons_on_name", using: :btree
|
||||
add_index "billing_addons", ["type_of"], name: "index_billing_addons_on_type_of", using: :btree
|
||||
|
||||
create_table "billing_plans", force: :cascade do |t|
|
||||
t.string "braintree_plan_id", null: false
|
||||
t.string "name", null: false
|
||||
t.string "description"
|
||||
t.integer "price_cents", default: 0, null: false
|
||||
t.string "price_currency", default: "USD", null: false
|
||||
t.datetime "created_at", null: false
|
||||
t.datetime "updated_at", null: false
|
||||
t.boolean "main", default: false, null: false
|
||||
t.integer "max_storage", limit: 8, default: 0
|
||||
t.integer "position", default: 0, null: false
|
||||
t.boolean "free", default: false, null: false
|
||||
end
|
||||
|
||||
add_index "billing_plans", ["braintree_plan_id"], name: "index_billing_plans_on_braintree_plan_id", using: :btree
|
||||
|
||||
create_table "billing_subscription_addons", force: :cascade do |t|
|
||||
t.integer "billing_subscription_id", null: false
|
||||
t.integer "billing_addon_id", null: false
|
||||
t.datetime "created_at", null: false
|
||||
t.datetime "updated_at", null: false
|
||||
end
|
||||
|
||||
add_index "billing_subscription_addons", ["billing_addon_id"], name: "index_billing_subscription_addons_on_billing_addon_id", using: :btree
|
||||
add_index "billing_subscription_addons", ["billing_subscription_id"], name: "index_billing_subscription_addons_on_billing_subscription_id", using: :btree
|
||||
|
||||
create_table "billing_subscriptions", force: :cascade do |t|
|
||||
t.string "braintree_subscription_id"
|
||||
t.integer "billing_account_id", null: false
|
||||
t.integer "billing_plan_id", null: false
|
||||
t.boolean "active", default: false, null: false
|
||||
t.datetime "created_at", null: false
|
||||
t.datetime "updated_at", null: false
|
||||
end
|
||||
|
||||
add_index "billing_subscriptions", ["braintree_subscription_id"], name: "index_billing_subscriptions_on_braintree_subscription_id", using: :btree
|
||||
|
||||
create_table "checklist_items", force: :cascade do |t|
|
||||
t.string "text", null: false
|
||||
t.boolean "checked", default: false, null: false
|
||||
|
|
@ -236,16 +175,6 @@ ActiveRecord::Schema.define(version: 20170515073041) do
|
|||
add_index "experiments", ["project_id"], name: "index_experiments_on_project_id", using: :btree
|
||||
add_index "experiments", ["restored_by_id"], name: "index_experiments_on_restored_by_id", using: :btree
|
||||
|
||||
create_table "logs", force: :cascade do |t|
|
||||
t.integer "action_type", null: false
|
||||
t.string "user_name"
|
||||
t.jsonb "details", default: {}, null: false
|
||||
t.datetime "created_at", null: false
|
||||
t.datetime "updated_at", null: false
|
||||
end
|
||||
|
||||
add_index "logs", ["created_at", "action_type"], name: "index_logs_on_created_at_and_action_type", using: :btree
|
||||
|
||||
create_table "my_module_groups", force: :cascade do |t|
|
||||
t.string "name", null: false
|
||||
t.datetime "created_at", null: false
|
||||
|
|
@ -257,6 +186,17 @@ ActiveRecord::Schema.define(version: 20170515073041) do
|
|||
add_index "my_module_groups", ["created_by_id"], name: "index_my_module_groups_on_created_by_id", using: :btree
|
||||
add_index "my_module_groups", ["experiment_id"], name: "index_my_module_groups_on_experiment_id", using: :btree
|
||||
|
||||
create_table "my_module_repository_rows", force: :cascade do |t|
|
||||
t.integer "repository_row_id", null: false
|
||||
t.integer "my_module_id"
|
||||
t.integer "assigned_by_id", null: false
|
||||
t.datetime "created_at"
|
||||
t.datetime "updated_at"
|
||||
end
|
||||
|
||||
add_index "my_module_repository_rows", ["my_module_id", "repository_row_id"], name: "index_my_module_ids_repository_row_ids", using: :btree
|
||||
add_index "my_module_repository_rows", ["repository_row_id"], name: "index_my_module_repository_rows_on_repository_row_id", using: :btree
|
||||
|
||||
create_table "my_module_tags", force: :cascade do |t|
|
||||
t.integer "my_module_id"
|
||||
t.integer "tag_id"
|
||||
|
|
@ -268,28 +208,26 @@ ActiveRecord::Schema.define(version: 20170515073041) do
|
|||
add_index "my_module_tags", ["tag_id"], name: "index_my_module_tags_on_tag_id", using: :btree
|
||||
|
||||
create_table "my_modules", force: :cascade do |t|
|
||||
t.string "name", null: false
|
||||
t.string "name", null: false
|
||||
t.datetime "due_date"
|
||||
t.string "description"
|
||||
t.integer "x", default: 0, null: false
|
||||
t.integer "y", default: 0, null: false
|
||||
t.integer "x", default: 0, null: false
|
||||
t.integer "y", default: 0, null: false
|
||||
t.integer "my_module_group_id"
|
||||
t.datetime "created_at", null: false
|
||||
t.datetime "updated_at", null: false
|
||||
t.boolean "archived", default: false, null: false
|
||||
t.datetime "created_at", null: false
|
||||
t.datetime "updated_at", null: false
|
||||
t.boolean "archived", default: false, null: false
|
||||
t.datetime "archived_on"
|
||||
t.integer "created_by_id"
|
||||
t.integer "last_modified_by_id"
|
||||
t.integer "archived_by_id"
|
||||
t.integer "restored_by_id"
|
||||
t.datetime "restored_on"
|
||||
t.integer "nr_of_assigned_samples", default: 0
|
||||
t.integer "workflow_order", default: -1, null: false
|
||||
t.integer "experiment_id", default: 0, null: false
|
||||
t.integer "state", limit: 2, default: 0
|
||||
t.integer "nr_of_assigned_samples", default: 0
|
||||
t.integer "workflow_order", default: -1, null: false
|
||||
t.integer "experiment_id", default: 0, null: false
|
||||
t.integer "state", limit: 2, default: 0
|
||||
t.datetime "completed_on"
|
||||
t.integer "electronic_signature_status", default: 1
|
||||
t.datetime "electronic_signature_status_locked_at"
|
||||
end
|
||||
|
||||
add_index "my_modules", ["archived_by_id"], name: "index_my_modules_on_archived_by_id", using: :btree
|
||||
|
|
@ -395,6 +333,7 @@ ActiveRecord::Schema.define(version: 20170515073041) do
|
|||
t.datetime "created_at", null: false
|
||||
t.datetime "updated_at", null: false
|
||||
t.integer "experiment_id"
|
||||
t.integer "repository_id"
|
||||
end
|
||||
|
||||
add_index "report_elements", ["asset_id"], name: "index_report_elements_on_asset_id", using: :btree
|
||||
|
|
@ -404,6 +343,7 @@ ActiveRecord::Schema.define(version: 20170515073041) do
|
|||
add_index "report_elements", ["parent_id"], name: "index_report_elements_on_parent_id", using: :btree
|
||||
add_index "report_elements", ["project_id"], name: "index_report_elements_on_project_id", using: :btree
|
||||
add_index "report_elements", ["report_id"], name: "index_report_elements_on_report_id", using: :btree
|
||||
add_index "report_elements", ["repository_id"], name: "index_report_elements_on_repository_id", using: :btree
|
||||
add_index "report_elements", ["result_id"], name: "index_report_elements_on_result_id", using: :btree
|
||||
add_index "report_elements", ["step_id"], name: "index_report_elements_on_step_id", using: :btree
|
||||
add_index "report_elements", ["table_id"], name: "index_report_elements_on_table_id", using: :btree
|
||||
|
|
@ -422,6 +362,79 @@ ActiveRecord::Schema.define(version: 20170515073041) do
|
|||
add_index "reports", ["project_id"], name: "index_reports_on_project_id", using: :btree
|
||||
add_index "reports", ["user_id"], name: "index_reports_on_user_id", using: :btree
|
||||
|
||||
create_table "repositories", force: :cascade do |t|
|
||||
t.integer "team_id"
|
||||
t.integer "created_by_id", null: false
|
||||
t.string "name"
|
||||
t.datetime "created_at"
|
||||
t.datetime "updated_at"
|
||||
end
|
||||
|
||||
add_index "repositories", ["team_id"], name: "index_repositories_on_team_id", using: :btree
|
||||
|
||||
create_table "repository_cells", force: :cascade do |t|
|
||||
t.integer "repository_row_id"
|
||||
t.integer "repository_column_id"
|
||||
t.integer "value_id"
|
||||
t.string "value_type"
|
||||
t.datetime "created_at"
|
||||
t.datetime "updated_at"
|
||||
end
|
||||
|
||||
add_index "repository_cells", ["repository_column_id"], name: "index_repository_cells_on_repository_column_id", using: :btree
|
||||
add_index "repository_cells", ["repository_row_id"], name: "index_repository_cells_on_repository_row_id", using: :btree
|
||||
add_index "repository_cells", ["value_type", "value_id"], name: "index_repository_cells_on_value_type_and_value_id", using: :btree
|
||||
|
||||
create_table "repository_columns", force: :cascade do |t|
|
||||
t.integer "repository_id"
|
||||
t.integer "created_by_id", null: false
|
||||
t.string "name"
|
||||
t.integer "data_type", null: false
|
||||
t.datetime "created_at"
|
||||
t.datetime "updated_at"
|
||||
end
|
||||
|
||||
add_index "repository_columns", ["repository_id"], name: "index_repository_columns_on_repository_id", using: :btree
|
||||
|
||||
create_table "repository_date_values", force: :cascade do |t|
|
||||
t.datetime "data"
|
||||
t.datetime "created_at"
|
||||
t.datetime "updated_at"
|
||||
t.integer "created_by_id", null: false
|
||||
t.integer "last_modified_by_id", null: false
|
||||
end
|
||||
|
||||
create_table "repository_rows", force: :cascade do |t|
|
||||
t.integer "repository_id"
|
||||
t.integer "created_by_id", null: false
|
||||
t.integer "last_modified_by_id", null: false
|
||||
t.string "name"
|
||||
t.datetime "created_at"
|
||||
t.datetime "updated_at"
|
||||
end
|
||||
|
||||
add_index "repository_rows", ["name"], name: "index_repository_rows_on_name", using: :btree
|
||||
add_index "repository_rows", ["repository_id"], name: "index_repository_rows_on_repository_id", using: :btree
|
||||
|
||||
create_table "repository_table_states", force: :cascade do |t|
|
||||
t.jsonb "state", null: false
|
||||
t.integer "user_id", null: false
|
||||
t.integer "repository_id", null: false
|
||||
t.datetime "created_at", null: false
|
||||
t.datetime "updated_at", null: false
|
||||
end
|
||||
|
||||
add_index "repository_table_states", ["repository_id"], name: "index_repository_table_states_on_repository_id", using: :btree
|
||||
add_index "repository_table_states", ["user_id"], name: "index_repository_table_states_on_user_id", using: :btree
|
||||
|
||||
create_table "repository_text_values", force: :cascade do |t|
|
||||
t.string "data"
|
||||
t.datetime "created_at"
|
||||
t.datetime "updated_at"
|
||||
t.integer "created_by_id", null: false
|
||||
t.integer "last_modified_by_id", null: false
|
||||
end
|
||||
|
||||
create_table "result_assets", force: :cascade do |t|
|
||||
t.integer "result_id", null: false
|
||||
t.integer "asset_id", null: false
|
||||
|
|
@ -541,37 +554,6 @@ ActiveRecord::Schema.define(version: 20170515073041) do
|
|||
add_index "samples_tables", ["team_id"], name: "index_samples_tables_on_team_id", using: :btree
|
||||
add_index "samples_tables", ["user_id"], name: "index_samples_tables_on_user_id", using: :btree
|
||||
|
||||
create_table "scinote_core_gamification_scores", force: :cascade do |t|
|
||||
t.integer "leaf_tokens", limit: 8
|
||||
t.integer "step", default: 0, null: false
|
||||
t.integer "user_id"
|
||||
t.boolean "tutorial", default: false
|
||||
t.boolean "project", default: false
|
||||
t.boolean "experiment", default: false
|
||||
t.boolean "task", default: false
|
||||
t.datetime "created_at", null: false
|
||||
t.datetime "updated_at", null: false
|
||||
end
|
||||
|
||||
add_index "scinote_core_gamification_scores", ["user_id"], name: "index_scinote_core_gamification_scores_on_user_id", using: :btree
|
||||
|
||||
create_table "scinote_enterprise_electronic_signatures", force: :cascade do |t|
|
||||
t.integer "user_id"
|
||||
t.string "user_full_name", null: false
|
||||
t.string "user_role", null: false
|
||||
t.string "user_email", null: false
|
||||
t.text "comment"
|
||||
t.integer "action"
|
||||
t.integer "type_of_signature"
|
||||
t.integer "reference_object_id"
|
||||
t.integer "reference_object_name"
|
||||
t.datetime "created_at", null: false
|
||||
t.datetime "updated_at", null: false
|
||||
end
|
||||
|
||||
add_index "scinote_enterprise_electronic_signatures", ["created_at"], name: "index_scinote_enterprise_electronic_signatures_on_created_at", using: :btree
|
||||
add_index "scinote_enterprise_electronic_signatures", ["user_id"], name: "index_scinote_enterprise_electronic_signatures_on_user_id", using: :btree
|
||||
|
||||
create_table "settings", force: :cascade do |t|
|
||||
t.text "type", null: false
|
||||
t.jsonb "values", default: {}, null: false
|
||||
|
|
@ -651,11 +633,8 @@ ActiveRecord::Schema.define(version: 20170515073041) do
|
|||
t.integer "last_modified_by_id"
|
||||
t.string "description"
|
||||
t.integer "space_taken", limit: 8, default: 1048576, null: false
|
||||
t.integer "billing_account_id"
|
||||
t.integer "agile_crm_deal_id", limit: 8
|
||||
end
|
||||
|
||||
add_index "teams", ["billing_account_id"], name: "index_teams_on_billing_account_id", using: :btree
|
||||
add_index "teams", ["created_by_id"], name: "index_teams_on_created_by_id", using: :btree
|
||||
add_index "teams", ["last_modified_by_id"], name: "index_teams_on_last_modified_by_id", using: :btree
|
||||
add_index "teams", ["name"], name: "index_teams_on_name", using: :btree
|
||||
|
|
@ -776,8 +755,6 @@ ActiveRecord::Schema.define(version: 20170515073041) do
|
|||
t.string "invited_by_type"
|
||||
t.integer "invitations_count", default: 0
|
||||
t.integer "tutorial_status", default: 0, null: false
|
||||
t.datetime "last_seen_at"
|
||||
t.integer "agile_crm_contact_id", limit: 8
|
||||
t.boolean "assignments_notification", default: true
|
||||
t.boolean "recent_notification", default: true
|
||||
t.boolean "assignments_notification_email", default: false
|
||||
|
|
@ -785,8 +762,6 @@ ActiveRecord::Schema.define(version: 20170515073041) do
|
|||
t.integer "current_team_id"
|
||||
t.boolean "system_message_notification_email", default: false
|
||||
t.string "authentication_token", limit: 30
|
||||
t.integer "organization_role", limit: 2, default: 0
|
||||
t.datetime "password_changed_at"
|
||||
end
|
||||
|
||||
add_index "users", ["authentication_token"], name: "index_users_on_authentication_token", unique: true, using: :btree
|
||||
|
|
@ -795,22 +770,8 @@ ActiveRecord::Schema.define(version: 20170515073041) do
|
|||
add_index "users", ["invitation_token"], name: "index_users_on_invitation_token", unique: true, using: :btree
|
||||
add_index "users", ["invitations_count"], name: "index_users_on_invitations_count", using: :btree
|
||||
add_index "users", ["invited_by_id"], name: "index_users_on_invited_by_id", using: :btree
|
||||
add_index "users", ["password_changed_at"], name: "index_users_on_password_changed_at", using: :btree
|
||||
add_index "users", ["reset_password_token"], name: "index_users_on_reset_password_token", unique: true, using: :btree
|
||||
|
||||
create_table "versions", force: :cascade do |t|
|
||||
t.string "item_type", null: false
|
||||
t.integer "item_id", null: false
|
||||
t.string "event", null: false
|
||||
t.string "whodunnit"
|
||||
t.text "object"
|
||||
t.text "object_changes"
|
||||
t.integer "team_id"
|
||||
t.datetime "created_at"
|
||||
end
|
||||
|
||||
add_index "versions", ["item_type", "item_id", "team_id"], name: "index_versions_on_item_type_and_item_id_and_team_id", using: :btree
|
||||
|
||||
create_table "wopi_actions", force: :cascade do |t|
|
||||
t.string "action", null: false
|
||||
t.string "extension", null: false
|
||||
|
|
@ -853,10 +814,6 @@ ActiveRecord::Schema.define(version: 20170515073041) do
|
|||
add_foreign_key "asset_text_data", "assets"
|
||||
add_foreign_key "assets", "users", column: "created_by_id"
|
||||
add_foreign_key "assets", "users", column: "last_modified_by_id"
|
||||
add_foreign_key "billing_subscription_addons", "billing_addons"
|
||||
add_foreign_key "billing_subscription_addons", "billing_subscriptions"
|
||||
add_foreign_key "billing_subscriptions", "billing_accounts"
|
||||
add_foreign_key "billing_subscriptions", "billing_plans"
|
||||
add_foreign_key "checklist_items", "checklists"
|
||||
add_foreign_key "checklist_items", "users", column: "created_by_id"
|
||||
add_foreign_key "checklist_items", "users", column: "last_modified_by_id"
|
||||
|
|
@ -876,6 +833,7 @@ ActiveRecord::Schema.define(version: 20170515073041) do
|
|||
add_foreign_key "experiments", "users", column: "restored_by_id"
|
||||
add_foreign_key "my_module_groups", "experiments"
|
||||
add_foreign_key "my_module_groups", "users", column: "created_by_id"
|
||||
add_foreign_key "my_module_repository_rows", "users", column: "assigned_by_id"
|
||||
add_foreign_key "my_module_tags", "users", column: "created_by_id"
|
||||
add_foreign_key "my_modules", "experiments"
|
||||
add_foreign_key "my_modules", "my_module_groups"
|
||||
|
|
@ -910,6 +868,14 @@ ActiveRecord::Schema.define(version: 20170515073041) do
|
|||
add_foreign_key "reports", "projects"
|
||||
add_foreign_key "reports", "users"
|
||||
add_foreign_key "reports", "users", column: "last_modified_by_id"
|
||||
add_foreign_key "repositories", "users", column: "created_by_id"
|
||||
add_foreign_key "repository_columns", "users", column: "created_by_id"
|
||||
add_foreign_key "repository_date_values", "users", column: "created_by_id"
|
||||
add_foreign_key "repository_date_values", "users", column: "last_modified_by_id"
|
||||
add_foreign_key "repository_rows", "users", column: "created_by_id"
|
||||
add_foreign_key "repository_rows", "users", column: "last_modified_by_id"
|
||||
add_foreign_key "repository_text_values", "users", column: "created_by_id"
|
||||
add_foreign_key "repository_text_values", "users", column: "last_modified_by_id"
|
||||
add_foreign_key "result_assets", "assets"
|
||||
add_foreign_key "result_assets", "results"
|
||||
add_foreign_key "result_tables", "results"
|
||||
|
|
@ -936,7 +902,6 @@ ActiveRecord::Schema.define(version: 20170515073041) do
|
|||
add_foreign_key "samples", "teams"
|
||||
add_foreign_key "samples", "users"
|
||||
add_foreign_key "samples", "users", column: "last_modified_by_id"
|
||||
add_foreign_key "scinote_core_gamification_scores", "users"
|
||||
add_foreign_key "step_assets", "assets"
|
||||
add_foreign_key "step_assets", "steps"
|
||||
add_foreign_key "step_tables", "steps"
|
||||
|
|
@ -949,7 +914,6 @@ ActiveRecord::Schema.define(version: 20170515073041) do
|
|||
add_foreign_key "tags", "projects"
|
||||
add_foreign_key "tags", "users", column: "created_by_id"
|
||||
add_foreign_key "tags", "users", column: "last_modified_by_id"
|
||||
add_foreign_key "teams", "billing_accounts"
|
||||
add_foreign_key "teams", "users", column: "created_by_id"
|
||||
add_foreign_key "teams", "users", column: "last_modified_by_id"
|
||||
add_foreign_key "tokens", "users"
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue