mirror of
https://github.com/scinote-eln/scinote-web.git
synced 2025-01-30 19:48:18 +08:00
Improve speed of assigned modules popout [SCI-6350] (#3754)
This commit is contained in:
parent
9c0582543b
commit
7c4143249e
2 changed files with 38 additions and 37 deletions
|
@ -213,12 +213,12 @@ class RepositoryRowsController < ApplicationController
|
|||
params[:query],
|
||||
whole_phrase: true
|
||||
)
|
||||
viewable_modules = assigned_modules.viewable_by_user(current_user, current_user.teams)
|
||||
private_modules = assigned_modules - viewable_modules
|
||||
viewable_modules = assigned_modules.viewable_by_user(current_user, current_team)
|
||||
private_modules_number = assigned_modules.where.not(id: viewable_modules).count
|
||||
render json: {
|
||||
html: render_to_string(partial: 'shared/my_modules_list_partial.html.erb', locals: {
|
||||
my_modules: viewable_modules,
|
||||
private_modules: private_modules
|
||||
private_modules_number: private_modules_number
|
||||
})
|
||||
}
|
||||
end
|
||||
|
|
|
@ -1,43 +1,44 @@
|
|||
<div class="my-modules-list-partial">
|
||||
<% grouped_by_prj_exp(my_modules).each do |task_group| %>
|
||||
<div class="task-group">
|
||||
<div class="header">
|
||||
<% if task_group[:project_archived]%>
|
||||
<span class="archived"><%= t('general.archived') %></span>
|
||||
<% end %>
|
||||
<span class="project" title="<%= task_group[:project_name] %>"><%= task_group[:project_name] %></span>
|
||||
<span class="slash">/</span>
|
||||
<% if task_group[:experiment_archived] %>
|
||||
<span class="archived"><%= t('general.archived') %></span>
|
||||
<% end %>
|
||||
<span class="experiment" title="<%= task_group[:experiment_name] %>"><%= task_group[:experiment_name] %></span>
|
||||
</div>
|
||||
<div class="tasks">
|
||||
<% task_group[:tasks].each do |task| %>
|
||||
<div class="task">
|
||||
<%= draw_custom_icon('task-icon') %>
|
||||
<% if task.archived %>
|
||||
<% grouped_my_modules = grouped_by_prj_exp(my_modules) %>
|
||||
<% grouped_my_modules.each do |task_group| %>
|
||||
<div class="task-group">
|
||||
<div class="header">
|
||||
<% if task_group[:project_archived] %>
|
||||
<span class="archived"><%= t('general.archived') %></span>
|
||||
<% end %>
|
||||
<%= link_to(task.name, protocols_my_module_path(task.id), {class: "task-link", title: task.name, target: "_blank"}) %>
|
||||
<span class="project" title="<%= task_group[:project_name] %>"><%= task_group[:project_name] %></span>
|
||||
<span class="slash">/</span>
|
||||
<% if task_group[:experiment_archived] %>
|
||||
<span class="archived"><%= t('general.archived') %></span>
|
||||
<% end %>
|
||||
<span class="experiment" title="<%= task_group[:experiment_name] %>"><%= task_group[:experiment_name] %></span>
|
||||
</div>
|
||||
<div class="tasks">
|
||||
<% task_group[:tasks].each do |task| %>
|
||||
<div class="task">
|
||||
<%= draw_custom_icon('task-icon') %>
|
||||
<% if task.archived? %>
|
||||
<span class="archived"><%= t('general.archived') %></span>
|
||||
<% end %>
|
||||
<%= link_to(task.name, protocols_my_module_path(task.id), { class: 'task-link', title: task.name, target: '_blank' }) %>
|
||||
</div>
|
||||
<% end %>
|
||||
</div>
|
||||
<% end %>
|
||||
</div>
|
||||
</div>
|
||||
<% end %>
|
||||
<% if defined?(private_modules) && private_modules.size.positive? %>
|
||||
<div class="private-tasks-counter">
|
||||
<%= t('my_modules.modules_list_partial.private_tasks_html', nr: private_modules.size ) %>
|
||||
</div>
|
||||
<% if defined?(private_modules_number) && private_modules_number.positive? %>
|
||||
<div class="private-tasks-counter">
|
||||
<%= t('my_modules.modules_list_partial.private_tasks_html', nr: private_modules_number) %>
|
||||
</div>
|
||||
<% end %>
|
||||
<% unless my_modules.any? || (defined?(private_modules) && private_modules.any?) %>
|
||||
<div class="no-results-placeholder">
|
||||
<span class="fa-stack">
|
||||
<i class="fas fa-search fa-stack-1x"></i>
|
||||
<i class="fas fa-slash fa-stack-1x fa-flip-vertical"></i>
|
||||
</span>
|
||||
<h2 class="title"><%= t('my_modules.modules_list_partial.no_results.title') %></h2>
|
||||
<p><%= t('my_modules.modules_list_partial.no_results.description') %></p>
|
||||
</div>
|
||||
<% unless grouped_my_modules.present? || (defined?(private_modules_number) && private_modules_number.positive?) %>
|
||||
<div class="no-results-placeholder">
|
||||
<span class="fa-stack">
|
||||
<i class="fas fa-search fa-stack-1x"></i>
|
||||
<i class="fas fa-slash fa-stack-1x fa-flip-vertical"></i>
|
||||
</span>
|
||||
<h2 class="title"><%= t('my_modules.modules_list_partial.no_results.title') %></h2>
|
||||
<p><%= t('my_modules.modules_list_partial.no_results.description') %></p>
|
||||
</div>
|
||||
<% end %>
|
||||
</div>
|
||||
|
|
Loading…
Reference in a new issue