X-Git-Url: https://git.arvados.org/arvados.git/blobdiff_plain/32002eb6e87a391d1fad2b1b206dbc74d6659fc5..c2a1539e64937b126c0090bc5d9fe8d65411be8f:/apps/workbench/app/assets/javascripts/selection.js.erb diff --git a/apps/workbench/app/assets/javascripts/selection.js.erb b/apps/workbench/app/assets/javascripts/selection.js.erb index 55df78697c..a8e2738fe0 100644 --- a/apps/workbench/app/assets/javascripts/selection.js.erb +++ b/apps/workbench/app/assets/javascripts/selection.js.erb @@ -53,6 +53,8 @@ function dispatch_selection_action() { function enable_disable_selection_actions() { var $container = $(this); var $checked = $('.persistent-selection:checkbox:checked', $container); + var collection_lock_classes = $('.lock-collection-btn').attr('class') + $('[data-selection-action]', $container). closest('div.btn-group-sm'). find('ul li'). @@ -74,6 +76,15 @@ function enable_disable_selection_actions() { toggleClass('disabled', ($checked.filter('[value*=-4zz18-]').length < 1) || ($checked.length != $checked.filter('[value*=-4zz18-]').length)); + $('[data-selection-action=remove-selected-files]', $container). + closest('li'). + toggleClass('disabled', + ($checked.length < 0) || + !($checked.length > 0 && collection_lock_classes && collection_lock_classes.indexOf("fa-unlock") !=-1)); + $('[data-selection-action=untrash-selected-items]', $container). + closest('li'). + toggleClass('disabled', + ($checked.length < 1)); } $(document). @@ -86,3 +97,11 @@ $(document). on('click', dispatch_selection_action); $(this).trigger('selections-updated'); }); + +function select_all_items() { + $(".arv-selectable-items :checkbox").filter(":visible").prop("checked", true).trigger("change"); +} + +function unselect_all_items() { + $(".arv-selectable-items :checkbox").filter(":visible").prop("checked", false).trigger("change"); +}