From 92394a85db667e619e576c386871edf46bb52ef4 Mon Sep 17 00:00:00 2001 From: kaur16 <126662478+kaur16@users.noreply.github.com> Date: Wed, 4 Sep 2024 15:31:12 +0200 Subject: [PATCH] YDA-5914 - Fixed - Clicking on upload file or folder in deposit module lists all the folders. (#360) * YDA-5914 - Fixed - Clicking on upload file or folder in deposit module lists all the folders. * YDA-5914 - Fixed lint issues --- deposit/static/deposit/js/data.js | 9 ++++++--- deposit/static/deposit/js/dlgFileBrowseOperations.js | 2 +- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/deposit/static/deposit/js/data.js b/deposit/static/deposit/js/data.js index a2b88e2d..ddfb4549 100644 --- a/deposit/static/deposit/js/data.js +++ b/deposit/static/deposit/js/data.js @@ -20,6 +20,10 @@ let downloadChecksumReportTextTooltip let downloadChecksumReportCSVTooltip $(function () { + // Extract current location from query string (default to ''). + currentFolder = decodeURIComponent((/(?:\?|&)dir=([^&]*)/ + .exec(window.location.search) || [0, ''])[1]) + // Canonicalize path somewhat, for convenience. currentFolder = path.replace(/\/+/g, '/').replace(/\/$/, '') @@ -201,7 +205,6 @@ $(function () { $('.upload-folder').on('click', function () { uploadFolder = true - console.log(uploadFolder) }) $('.upload-file').on('click', function () { @@ -802,7 +805,7 @@ const getFolderContents = (() => { limit: batchSize, sort_order: args.order[0].dir, sort_on: ['name', 'size', 'modified'][args.order[0].column - 1], - space: 'Space.RESEARCH' + space: 'Space.DEPOSIT' }) // If another requests has come while we were waiting, simply drop this one. @@ -946,7 +949,7 @@ function startBrowsing () { $('#file-browser').on('length.dt', function (e, settings, len) { Yoda.storage.session.set('pageLength', len) }) - browse(currentFolder) + browse(currentFolder, true) } window.addEventListener('popstate', function (e) { diff --git a/deposit/static/deposit/js/dlgFileBrowseOperations.js b/deposit/static/deposit/js/dlgFileBrowseOperations.js index 05600023..c05fb85d 100644 --- a/deposit/static/deposit/js/dlgFileBrowseOperations.js +++ b/deposit/static/deposit/js/dlgFileBrowseOperations.js @@ -560,7 +560,7 @@ const getFolderContents2 = (() => { limit: batchSize, sort_order: args.order[0].dir, sort_on: ['name', 'modified'][args.order[0].column], - space: 'Space.RESEARCH' + space: 'Space.DEPOSIT' }) // If another requests has come while we were waiting, simply drop this one.