Merge branch 'master' into 14078-obtain-configuration-data-from-discovery-endpoint
[arvados-workbench2.git] / src / services / collection-service / collection-service.ts
index d32434919e3d92701f5fd833422063ae295e5fb0..1c62ec5a68b471b89e646e6d698d99b423a421b8 100644 (file)
@@ -28,8 +28,10 @@ export class CollectionService extends CommonResourceService<CollectionResource>
         return Promise.reject();
     }
 
-    async deleteFile(collectionUuid: string, filePath: string) {
-        return this.webdavClient.delete(`/c=${collectionUuid}${filePath}`);
+    async deleteFiles(collectionUuid: string, filePaths: string[]) {
+        for (const path of filePaths) {
+            await this.webdavClient.delete(`/c=${collectionUuid}${path}`);
+        }
     }
 
     async uploadFiles(collectionUuid: string, files: File[], onProgress?: UploadProgress) {
@@ -39,6 +41,13 @@ export class CollectionService extends CommonResourceService<CollectionResource>
         }
     }
 
+    moveFile(collectionUuid: string, oldPath: string, newPath: string) {
+        return this.webdavClient.move(
+            `/c=${collectionUuid}${oldPath}`,
+            `/c=${collectionUuid}${encodeURI(newPath)}`
+        );
+    }
+
     private extendFileURL = (file: CollectionDirectory | CollectionFile) => ({
         ...file,
         url: this.webdavClient.defaults.baseURL + file.url + '?api_token=' + this.authService.getApiToken()