mirror of
https://github.com/scinote-eln/scinote-web.git
synced 2024-11-11 10:06:53 +08:00
Merge pull request #4658 from aignatov-bio/ai-sci-7453-add-restore-task-to-experiment-table-view
Add restore action to experiment table [SCI-7453]
This commit is contained in:
commit
fdf13f822e
6 changed files with 37 additions and 1 deletions
|
@ -115,6 +115,12 @@ var ExperimnetTable = {
|
|||
this.archiveMyModules(e.target.href, e.target.dataset.id);
|
||||
});
|
||||
|
||||
|
||||
$(this.table).on('click', '.restore-my-module', (e) => {
|
||||
e.preventDefault();
|
||||
this.restoreMyModules(e.target.href, e.target.dataset.id);
|
||||
});
|
||||
|
||||
$(this.table).on('click', '.duplicate-my-module', (e) => {
|
||||
e.preventDefault();
|
||||
this.duplicateMyModules($('#duplicateTasks').data('url'), e.target.dataset.id);
|
||||
|
@ -157,6 +163,14 @@ var ExperimnetTable = {
|
|||
HelperModule.flashAlertMsg(data.responseJSON.message, 'danger');
|
||||
});
|
||||
},
|
||||
initRestoreMyModules: function() {
|
||||
$('#restoreTask').on('click', (e) => {
|
||||
this.restoreMyModules(e.target.dataset.url, this.selectedMyModules);
|
||||
});
|
||||
},
|
||||
restoreMyModules: function(url, ids) {
|
||||
$.post(url, { my_modules_ids: ids, view: 'table' });
|
||||
},
|
||||
initAccessModal: function() {
|
||||
$('#manageTaskAccess').on('click', () => {
|
||||
$(`.table-row[data-id="${this.selectedMyModules[0]}"] .open-access-modal`).click();
|
||||
|
@ -525,6 +539,7 @@ var ExperimnetTable = {
|
|||
this.initNewTaskModal(this);
|
||||
this.initMyModuleActions();
|
||||
this.updateExperimentToolbar();
|
||||
this.initRestoreMyModules();
|
||||
this.initManageUsersDropdown();
|
||||
}
|
||||
};
|
||||
|
|
|
@ -376,7 +376,12 @@ class MyModulesController < ApplicationController
|
|||
else
|
||||
flash[:error] = t('my_modules.restore_group.error_flash')
|
||||
end
|
||||
redirect_to module_archive_experiment_path(experiment)
|
||||
|
||||
if params[:view] == 'table'
|
||||
redirect_to table_experiment_path(experiment, view_mode: :archived)
|
||||
else
|
||||
redirect_to module_archive_experiment_path(experiment)
|
||||
end
|
||||
end
|
||||
|
||||
def update_state
|
||||
|
|
|
@ -74,9 +74,11 @@ module Experiments
|
|||
permissions: permissions_my_module_path(my_module),
|
||||
actions_dropdown: actions_dropdown_my_module_path(my_module),
|
||||
name_update: my_module_path(my_module),
|
||||
restore: restore_my_modules_experiment_path(experiment),
|
||||
provisioning_status:
|
||||
my_module.provisioning_status == 'in_progress' && provisioning_status_my_module_url(my_module),
|
||||
access: edit_access_permissions_project_experiment_my_module_path(project, experiment, my_module)
|
||||
|
||||
}
|
||||
}
|
||||
end
|
||||
|
|
|
@ -37,3 +37,11 @@
|
|||
</a>
|
||||
</li>
|
||||
<% end %>
|
||||
<% if can_restore_my_module?(my_module) %>
|
||||
<li>
|
||||
<a href="<%= restore_my_modules_experiment_path(my_module.experiment) %>" class="restore-my-module" data-id="<%= my_module.id %>">
|
||||
<i class="fas fa-undo"></i>
|
||||
<%= t("experiments.table.my_module_actions.restore") %>
|
||||
</a>
|
||||
</li>
|
||||
<% end %>
|
||||
|
|
|
@ -32,6 +32,10 @@
|
|||
<i class="fas fa-archive"></i>
|
||||
<%= t("experiments.table.toolbar.archive") %>
|
||||
</button>
|
||||
<button id="restoreTask" class="btn btn-light multiple-object-action hidden only-archive" data-url="<%= restore_my_modules_experiment_path(@experiment) %>" data-for="restorable">
|
||||
<i class="fas fa-undo"></i>
|
||||
<%= t("experiments.table.toolbar.restore") %>
|
||||
</button>
|
||||
</div>
|
||||
<div class="toolbar-right-block">
|
||||
<button id="taskDataDisplay" class="btn btn-light" data-toggle="modal" data-target="#tableDisplayModal">
|
||||
|
|
|
@ -1333,6 +1333,7 @@ en:
|
|||
new: 'New task'
|
||||
edit: 'Edit'
|
||||
archive: 'Archive'
|
||||
restore: 'Restore'
|
||||
move: 'Move'
|
||||
duplicate: 'Duplicate'
|
||||
manage_access: 'Manage access'
|
||||
|
@ -1344,6 +1345,7 @@ en:
|
|||
move: 'Move to another experiment'
|
||||
access: 'Task access'
|
||||
archive: 'Archive'
|
||||
restore: 'Restore'
|
||||
filters:
|
||||
name: 'Task name'
|
||||
due_date: 'Due date'
|
||||
|
|
Loading…
Reference in a new issue