From 521a8cd73dc06d57a9712f1bbd18f3db6aff4e63 Mon Sep 17 00:00:00 2001 From: vkovtun <viktor.kovtun@id.ethz.ch> Date: Mon, 20 Feb 2023 11:20:27 +0100 Subject: [PATCH] SSDM-13253: Using the jQuery promise for uploadFileWorkspaceDSS. --- api-openbis-javascript/src/v3/openbis.js | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/api-openbis-javascript/src/v3/openbis.js b/api-openbis-javascript/src/v3/openbis.js index 4581c35765c..23b5e42a8a4 100644 --- a/api-openbis-javascript/src/v3/openbis.js +++ b/api-openbis-javascript/src/v3/openbis.js @@ -300,13 +300,25 @@ define([ 'jquery', 'util/Json', 'as/dto/datastore/search/DataStoreSearchCriteria ); } - this.uploadFileWorkspaceDSS = async function(files) { + this.uploadFilesWorkspaceDSS = function(files) { + var thisFacade = this; var uploadId = getUUID(); - await this._uploadFileWorkspaceDSSEmptyDir(uploadId); - return await this._uploadFileWorkspaceDSS(files, uploadId); + var dfd = jquery.Deferred(); + + this._uploadFileWorkspaceDSSEmptyDir(uploadId).then(function() { + thisFacade._uploadFilesWorkspaceDSS(files, uploadId).then(function(result) { + dfd.resolve(result); + }).catch(function(error) { + dfd.reject(error); + }); + }).catch(function(error) { + dfd.reject(error); + }); + + return dfd; } - this._uploadFileWorkspaceDSS = async function(files, parentId) { + this._uploadFilesWorkspaceDSS = async function(files, parentId) { var createdDirectories = new Set(); var filesCount = files.length; for (var i = 0; i < filesCount; i++) { -- GitLab