From 37efb457843c71fc731d9ea0ba24cb7d1a816c7f Mon Sep 17 00:00:00 2001 From: kaur16 <126662478+kaur16@users.noreply.github.com> Date: Mon, 18 Dec 2023 15:06:15 +0100 Subject: [PATCH] YDA-5562: added copy/move overwrite all option when multiple files/folders are selected --- .../research/js/dlgFileBrowseOperations.js | 19 ++++++++++++++++++- research/templates/research/browse.html | 1 + 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/research/static/research/js/dlgFileBrowseOperations.js b/research/static/research/js/dlgFileBrowseOperations.js index 93134e8b..c7556333 100644 --- a/research/static/research/js/dlgFileBrowseOperations.js +++ b/research/static/research/js/dlgFileBrowseOperations.js @@ -215,6 +215,13 @@ $(document).on('click', '.multi-cancel-button', function () { const index = $(this).closest('tr').attr('class').split('-').pop() $('.multi-select-table tr.row-' + index + ' td.item-progress').text('Overwrite cancelled') + if (($('#mutli-select-progress .dlg-multi-action-button span.action').text() === 'Copy and overwrite all') || ($('#mutli-select-progress .dlg-multi-action-button span.action').text() === 'Move and overwrite all')) { + $('#mutli-select-progress .dlg-multi-action-button').prop('disabled', true) + } +}) + +$(document).on('click', '.dlg-multi-action-button', function () { + $('.multi-overwrite-button').click() }) async function copyFile (filepath, newFilepath, multiple, multipleIndex = null, overwrite = false) { @@ -238,6 +245,7 @@ async function copyFile (filepath, newFilepath, multiple, multipleIndex = null, if (result.status === 'ok') { if (multiple) { $('.multi-select-table tr.row-' + multipleIndex + ' td.item-progress').text('Copy completed') + $('#mutli-select-progress .dlg-multi-action-button').prop('disabled', true) browse(currentBrowseFolder, true) } else { Yoda.set_message('success', 'The file has been successfully copied.') @@ -291,6 +299,7 @@ async function moveFile (filepath, newFilepath, multiple, multipleIndex = null, if (result.status === 'ok') { if (multiple) { $('.multi-select-table tr.row-' + multipleIndex + ' td.item-progress').text('Move completed') + $('#mutli-select-progress .dlg-multi-action-button').prop('disabled', true) browse(currentBrowseFolder, true) } else { Yoda.set_message('success', 'The file has been successfully moved.') @@ -346,6 +355,7 @@ async function copyFolder (folderPath, newFolderpath, multiple, multipleIndex = if (result.status === 'ok') { if (multiple) { $('.multi-select-table tr.row-' + multipleIndex + ' td.item-progress').text('Copy completed') + $('#mutli-select-progress .dlg-multi-action-button').prop('disabled', true) browse(currentBrowseFolder, true) } else { Yoda.set_message('success', 'The folder has been successfully copied.') @@ -399,6 +409,7 @@ async function moveFolder (folderPath, newFolderpath, multiple, multipleIndex = if (result.status === 'ok') { if (multiple) { $('.multi-select-table tr.row-' + multipleIndex + ' td.item-progress').text('Move completed') + $('#mutli-select-progress .dlg-multi-action-button').prop('disabled', true) browse(currentBrowseFolder, true) } else { Yoda.set_message('success', 'The folder has been successfully moved.') @@ -721,6 +732,12 @@ function createOverwriteBtn(multipleIndex, path, type, action) { cancelOverwriteBtn = '' $('.multi-select-table tr.row-' + multipleIndex + ' td.item-progress').append(overwriteBtn + cancelOverwriteBtn) + + // Create Overwrite All button + $('#mutli-select-progress .dlg-multi-action-button').html('' + action.charAt(0).toUpperCase() + action.slice(1) + + ' and overwrite all') + $('#mutli-select-progress .dlg-multi-action-button').removeClass('hidden') + $('#mutli-select-progress .dlg-multi-action-button').prop('disabled', false) } function changeActionBtn(action) { @@ -728,6 +745,6 @@ function changeActionBtn(action) { $('#dlg-file-browse-operations .dlg-action-button').html('' + action + ' and overwrite') } else { - $('#dlg-file-browse-operations .dlg-action-button').html('' + action + 'Move') + $('#dlg-file-browse-operations .dlg-action-button').html('' + action + '') } } diff --git a/research/templates/research/browse.html b/research/templates/research/browse.html index 3b13d7ac..5e3e9c67 100644 --- a/research/templates/research/browse.html +++ b/research/templates/research/browse.html @@ -292,6 +292,7 @@