Fix displaying of archived objects for experiments and tasks lists [SCI-10418] (#7255)

This commit is contained in:
ajugo 2024-03-12 10:10:05 +01:00 committed by GitHub
parent e835925ab9
commit 8aadca10c5
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 14 additions and 7 deletions

View file

@ -446,6 +446,9 @@ export default {
handleInfiniteScroll(response) {
const newRows = this.rowData.slice();
this.formatData(response.data.data).forEach((row) => {
if (this.currentViewMode === 'active' && row.archived) {
return;
}
newRows.push(row);
});
this.rowData = newRows;

View file

@ -9,7 +9,7 @@ module Lists
attributes :name, :code, :created_at, :updated_at, :workflow_img, :description, :completed_tasks,
:total_tasks, :archived_on, :urls, :sa_description, :default_public_user_role_id, :team,
:top_level_assignable, :hidden
:top_level_assignable, :hidden, :archived
def created_at
I18n.l(object.created_at, format: :full_date)
@ -61,7 +61,7 @@ module Lists
def urls
urls_list = {
show: my_modules_path(experiment_id: object),
show: my_modules_path(experiment_id: object, view_mode: archived ? 'archived' : 'active'),
actions: actions_toolbar_experiments_path(items: [{ id: object.id }].to_json),
projects_to_clone: projects_to_clone_experiment_path(object),
projects_to_move: projects_to_move_experiment_path(object),

View file

@ -55,7 +55,7 @@ module Lists
user = scope[:user] || @instance_options[:user]
urls_list = {
show: protocols_my_module_path(object, view_mode: object.archived_branch? ? 'archived' : 'active'),
show: protocols_my_module_path(object, view_mode: archived ? 'archived' : 'active'),
results: my_module_results_path(object),
assign_tags: my_module_my_module_tags_path(object),
assigned_tags: assigned_tags_my_module_my_module_tags_path(object),
@ -86,7 +86,7 @@ module Lists
end
def due_date_status
if (object.archived_branch? || object.completed?) && object.due_date
if (archived || object.completed?) && object.due_date
return :ok
elsif object.is_one_day_prior? && !object.completed?
return :one_day_prior
@ -98,7 +98,7 @@ module Lists
end
def archived
object.archived?
object.archived_branch?
end
def archived_on
@ -110,7 +110,7 @@ module Lists
end
def results
(object.archived_branch? ? object.results : object.results.active).length
(archived ? object.results : object.results.active).length
end
def status

View file

@ -69,7 +69,11 @@ module Lists
def urls
urls_list = {
show: project? ? experiments_path(project_id: object) : project_folder_path(object),
show: if project?
experiments_path(project_id: object, view_mode: object.archived ? 'archived' : 'active')
else
project_folder_path(object, view_mode: object.archived ? 'archived' : 'active')
end,
actions: actions_toolbar_projects_path(items: [{ id: object.id,
type: project? ? 'projects' : 'project_folders' }].to_json)
}