diff --git a/plugins/drive-assets/lang/en.json b/plugins/drive-assets/lang/en.json
index bbb0b4c9b1..f78383395d 100644
--- a/plugins/drive-assets/lang/en.json
+++ b/plugins/drive-assets/lang/en.json
@@ -20,8 +20,7 @@
"Upload": "Upload",
"CreateDrive": "Create Drive",
"CreateFolder": "Create Folder",
- "UploadFile": "Upload File",
- "UploadFolder": "Upload Folder",
+ "UploadFile": "Upload Files",
"EditDrive": "Edit Drive",
"Rename": "Rename",
"Restore": "Restore",
diff --git a/plugins/drive-assets/lang/es.json b/plugins/drive-assets/lang/es.json
index a79eeeefd3..a06ae13a75 100644
--- a/plugins/drive-assets/lang/es.json
+++ b/plugins/drive-assets/lang/es.json
@@ -20,8 +20,7 @@
"Upload": "Subir",
"CreateDrive": "Crear unidad",
"CreateFolder": "Crear carpeta",
- "UploadFile": "Subir archivo",
- "UploadFolder": "Subir carpeta",
+ "UploadFile": "Subir archivos",
"EditDrive": "Editar unidad",
"Rename": "Renombrar",
"Restore": "Restaurar",
diff --git a/plugins/drive-assets/lang/fr.json b/plugins/drive-assets/lang/fr.json
index 61a79d2642..7daf2d616e 100644
--- a/plugins/drive-assets/lang/fr.json
+++ b/plugins/drive-assets/lang/fr.json
@@ -20,8 +20,7 @@
"Upload": "Téléverser",
"CreateDrive": "Créer un disque",
"CreateFolder": "Créer un dossier",
- "UploadFile": "Télécharger un fichier",
- "UploadFolder": "Télécharger un dossier",
+ "UploadFile": "Télécharger des fichiers",
"EditDrive": "Modifier le disque",
"Rename": "Renommer",
"Restore": "Restaurer",
diff --git a/plugins/drive-assets/lang/pt.json b/plugins/drive-assets/lang/pt.json
index 9822a424ee..fc063c799f 100644
--- a/plugins/drive-assets/lang/pt.json
+++ b/plugins/drive-assets/lang/pt.json
@@ -20,8 +20,7 @@
"Upload": "Carregar",
"CreateDrive": "Criar unidade",
"CreateFolder": "Criar pasta",
- "UploadFile": "Carregar ficheiro",
- "UploadFolder": "Carregar pasta",
+ "UploadFile": "Carregar ficheiros",
"EditDrive": "Editar unidade",
"Rename": "Renomear",
"Restore": "Restaurar",
diff --git a/plugins/drive-assets/lang/ru.json b/plugins/drive-assets/lang/ru.json
index 9d7c4ea9cc..825892ec0d 100644
--- a/plugins/drive-assets/lang/ru.json
+++ b/plugins/drive-assets/lang/ru.json
@@ -20,8 +20,7 @@
"Upload": "Загрузить",
"CreateDrive": "Создать диск",
"CreateFolder": "Создать папку",
- "UploadFile": "Загрузить файл",
- "UploadFolder": "Загрузить папку",
+ "UploadFile": "Загрузить файлы",
"EditDrive": "Редактировать",
"Rename": "Переименовать",
"Restore": "Восстановить",
diff --git a/plugins/drive-assets/lang/zh.json b/plugins/drive-assets/lang/zh.json
index 1359f4c65f..0ac452d5ac 100644
--- a/plugins/drive-assets/lang/zh.json
+++ b/plugins/drive-assets/lang/zh.json
@@ -21,7 +21,6 @@
"CreateDrive": "创建磁盘",
"CreateFolder": "创建文件夹",
"UploadFile": "上传文件",
- "UploadFolder": "上传文件夹",
"EditDrive": "编辑磁盘",
"Rename": "重命名",
"Restore": "恢复",
diff --git a/plugins/drive-resources/src/components/DriveSpaceHeader.svelte b/plugins/drive-resources/src/components/DriveSpaceHeader.svelte
index f638ee2937..8054b62c46 100644
--- a/plugins/drive-resources/src/components/DriveSpaceHeader.svelte
+++ b/plugins/drive-resources/src/components/DriveSpaceHeader.svelte
@@ -14,22 +14,19 @@
-->
diff --git a/plugins/drive-resources/src/components/FilePanel.svelte b/plugins/drive-resources/src/components/FilePanel.svelte
index 8481c0b60b..bbbd74b924 100644
--- a/plugins/drive-resources/src/components/FilePanel.svelte
+++ b/plugins/drive-resources/src/components/FilePanel.svelte
@@ -73,6 +73,7 @@
maxNumberOfFiles: 1,
hideProgress: true
},
+ {},
async (uuid, name, file, path, metadata) => {
const data = {
file: uuid,
diff --git a/plugins/drive-resources/src/plugin.ts b/plugins/drive-resources/src/plugin.ts
index 4512ce0fbf..661209ad96 100644
--- a/plugins/drive-resources/src/plugin.ts
+++ b/plugins/drive-resources/src/plugin.ts
@@ -21,7 +21,6 @@ export default mergeIds(driveId, drive, {
CreateDrive: '' as IntlString,
CreateFolder: '' as IntlString,
UploadFile: '' as IntlString,
- UploadFolder: '' as IntlString,
Download: '' as IntlString,
Upload: '' as IntlString,
EditDrive: '' as IntlString,
diff --git a/plugins/drive-resources/src/utils.ts b/plugins/drive-resources/src/utils.ts
index 51121f5da0..269b530928 100644
--- a/plugins/drive-resources/src/utils.ts
+++ b/plugins/drive-resources/src/utils.ts
@@ -19,7 +19,12 @@ import drive, { createFile } from '@hcengineering/drive'
import { type Asset, setPlatformStatus, unknownError } from '@hcengineering/platform'
import { getClient } from '@hcengineering/presentation'
import { type AnySvelteComponent, showPopup } from '@hcengineering/ui'
-import { uploadFiles } from '@hcengineering/uploader'
+import {
+ type FileUploadCallback,
+ getDataTransferFiles,
+ showFilesUploadPopup,
+ uploadFiles
+} from '@hcengineering/uploader'
import { openDoc } from '@hcengineering/view-resources'
import CreateDrive from './components/CreateDrive.svelte'
@@ -154,7 +159,38 @@ export async function resolveParents (object: Resource): Promise {
return parents.reverse()
}
-export async function uploadFilesToDrive (files: DataTransfer, space: Ref, parent: Ref): Promise {
+export async function uploadFilesToDrive (dt: DataTransfer, space: Ref, parent: Ref): Promise {
+ const files = await getDataTransferFiles(dt)
+
+ const onFileUploaded = await fileUploadCallback(space, parent)
+
+ const target =
+ parent !== drive.ids.Root
+ ? { objectId: parent, objectClass: drive.class.Folder }
+ : { objectId: space, objectClass: drive.class.Drive }
+
+ await uploadFiles(files, target, {}, onFileUploaded)
+}
+
+export async function uploadFilesToDrivePopup (space: Ref, parent: Ref): Promise {
+ const onFileUploaded = await fileUploadCallback(space, parent)
+
+ const target =
+ parent !== drive.ids.Root
+ ? { objectId: parent, objectClass: drive.class.Folder }
+ : { objectId: space, objectClass: drive.class.Drive }
+
+ await showFilesUploadPopup(
+ target,
+ {},
+ {
+ fileManagerSelectionType: 'both'
+ },
+ onFileUploaded
+ )
+}
+
+async function fileUploadCallback (space: Ref, parent: Ref): Promise {
const client = getClient()
const query = parent !== drive.ids.Root ? { space, path: parent } : { space }
@@ -190,12 +226,7 @@ export async function uploadFilesToDrive (files: DataTransfer, space: Ref
return current
}
- const target =
- parent !== drive.ids.Root
- ? { objectId: parent, objectClass: drive.class.Folder }
- : { objectId: space, objectClass: drive.class.Drive }
-
- await uploadFiles(files, target, {}, async (uuid, name, file, path, metadata) => {
+ const callback: FileUploadCallback = async (uuid, name, file, path, metadata) => {
const folder = await findParent(path)
try {
const data = {
@@ -211,5 +242,7 @@ export async function uploadFilesToDrive (files: DataTransfer, space: Ref
} catch (err) {
void setPlatformStatus(unknownError(err))
}
- })
+ }
+
+ return callback
}
diff --git a/plugins/uploader-resources/src/components/FileUploadPopup.svelte b/plugins/uploader-resources/src/components/FileUploadPopup.svelte
index 3f83c5213b..1791b70c1a 100644
--- a/plugins/uploader-resources/src/components/FileUploadPopup.svelte
+++ b/plugins/uploader-resources/src/components/FileUploadPopup.svelte
@@ -14,6 +14,7 @@
-->