@@ -143,30 +143,44 @@ qx.Class.define("osparc.file.FileLabelWithActions", {
143143
144144 __retrieveURLAndDownloadSelected : function ( ) {
145145 if ( this . isMultiSelect ( ) ) {
146- this . __selection . forEach ( selection => {
147- if ( selection && osparc . file . FilesTree . isFile ( selection ) ) {
148- this . __retrieveURLAndDownloadFile ( selection ) ;
149- }
150- } ) ;
146+ if ( this . __selection . length === 1 && osparc . file . FilesTree . isFile ( this . __selection [ 0 ] ) ) {
147+ this . __retrieveURLAndDownloadFile ( this . __selection [ 0 ] ) ;
148+ } else if ( this . __selection . length > 1 ) {
149+ const paths = this . __selection . map ( item => item . getPath ( ) ) ;
150+ this . __retrieveURLAndDownloadPaths ( paths ) ;
151+ }
151152 } else if ( this . __selection . length ) {
152153 const selection = this . __selection [ 0 ] ;
153- if ( selection && osparc . file . FilesTree . isFile ( selection ) ) {
154- this . __retrieveURLAndDownloadFile ( selection ) ;
154+ if ( selection ) {
155+ if ( osparc . file . FilesTree . isFile ( selection ) ) {
156+ this . __retrieveURLAndDownloadFile ( selection ) ;
157+ } else {
158+ const paths = [ selection . getPath ( ) ] ;
159+ this . __retrieveURLAndDownloadPaths ( paths ) ;
160+ }
155161 }
156162 }
157163 } ,
158164
159165 __retrieveURLAndDownloadFile : function ( file ) {
160166 const fileId = file . getFileId ( ) ;
161167 const locationId = file . getLocation ( ) ;
162- osparc . utils . Utils . retrieveURLAndDownload ( locationId , fileId )
168+ osparc . utils . Utils . downloadPaths ( locationId , fileId )
163169 . then ( data => {
164170 if ( data ) {
165171 osparc . DownloadLinkTracker . getInstance ( ) . downloadLinkUnattended ( data . link , data . fileName ) ;
166172 }
167173 } ) ;
168174 } ,
169175
176+ __retrieveURLAndDownloadPaths : function ( paths ) {
177+ const locationId = 0 ;
178+ osparc . store . Data . getInstance ( ) . retrieveURLAndDownload ( locationId , paths )
179+ . then ( data => {
180+ console . log ( "data" , data ) ;
181+ } ) ;
182+ } ,
183+
170184 __deleteSelected : function ( ) {
171185 const toBeDeleted = [ ] ;
172186 let isFolderSelected = false ;
0 commit comments