+ }" @click="toggleFolder(file)" v-if="file.isDirectory" draggable="true"
+ @dragstart="onDragStart(file)" @dragend="onDragEnd">
+
+
@@ -36,10 +46,16 @@
+ }" v-else draggable="true" @dragstart="onDragStart(file, $event)">
+
+
+
+
@@ -40,11 +40,10 @@ export default {
data() {
console.log('feur')
let zipUrl = document.getElementById('archiveInfos').getAttribute('dataarchiveurl');
- console.log(zipUrl);
+ console.log(zipUrl)
return {
zipUrl,
sharedFile: null,
- zip: null,
dragEnded: false,
};
},
@@ -52,12 +51,8 @@ export default {
handleFileUpload(file) {
this.sharedFile = file;
},
- handleZipUpload(zip) {
- this.zip = zip;
- },
toggleDragEnded(){
this.dragEnded = !this.dragEnded;
- this.zip = null;
this.sharedFile = null;
},
translate(id) {
diff --git a/src/components/FileTable.vue b/src/components/FileTable.vue
index c641f56..a1662ff 100644
--- a/src/components/FileTable.vue
+++ b/src/components/FileTable.vue
@@ -190,10 +190,6 @@ export default {
type: Object,
default: null,
},
- zip: {
- type: Object,
- default: null,
- },
dragEnded: {
type: Boolean,
Required: true,
@@ -411,39 +407,20 @@ export default {
try {
this.isTransfering = true;
const file = this.file;
- const zip = this.zip;
- console.log(file);
- console.log(zip);
- if (!file && !zip) return;
-
- if (zip) {
- const response = await fetch(zip.url);
- this.transferProgress = 25;
- if (!response.ok) {
- throw new Error(`Erreur lors du téléchargement : ${response.statusText}`);
- }
- const zipFile = await response.arrayBuffer();
- this.transferProgress = 50;
-
- await this.moveFileToTarget({
- name: zip.name,
- content: zipFile
- }, '');
- this.transferProgress = 100;
+ if (!file) return;
+ if (file.isDirectory) {
+ await this.moveFilesOfFolder(file, '');
} else {
- if (file.isDirectory) {
- await this.moveFilesOfFolder(file, '');
- } else {
- this.transferProgress = 25;
- if (file.content && typeof file.content.arrayBuffer === 'function') {
- file.content = await file.content.arrayBuffer();
- }
- this.transferProgress = 50;
- await this.moveFileToTarget(file, '');
- this.transferProgress = 100;
+ this.transferProgress = 25;
+ if (file.content && typeof file.content.arrayBuffer === 'function') {
+ file.content = await file.content.arrayBuffer();
}
+ this.transferProgress = 50;
+ await this.moveFileToTarget(file, '');
+ this.transferProgress = 100;
}
+
this.isTransfering = false;
this.transferProgress = 0;
this.cancelOperation = false;
From cefedd56cb7e6a1b1acf2b6801168d93221201db Mon Sep 17 00:00:00 2001
From: GMrrc <143954951+GMrrc@users.noreply.github.com>
Date: Wed, 11 Dec 2024 15:38:32 +0100
Subject: [PATCH 4/9] transfert cochedList
---
src/components/FileTable.vue | 17 +++++++++++
src/components/WebContentViewer.vue | 47 +++++++++++++++++------------
2 files changed, 45 insertions(+), 19 deletions(-)
diff --git a/src/components/FileTable.vue b/src/components/FileTable.vue
index a1662ff..1f27fe9 100644
--- a/src/components/FileTable.vue
+++ b/src/components/FileTable.vue
@@ -408,6 +408,11 @@ export default {
this.isTransfering = true;
const file = this.file;
+ if (file.isList) {
+ await this.moveListOfFiles(file);
+ return;
+ }
+
if (!file) return;
if (file.isDirectory) {
await this.moveFilesOfFolder(file, '');
@@ -437,6 +442,18 @@ export default {
}
this.isDroppable = true;
},
+ async moveListOfFiles(files) {
+ for (const file of files) {
+ if (file.isDirectory) {
+ await this.moveFilesOfFolder(file, '');
+ } else {
+ if (file.content && typeof file.content.arrayBuffer === 'function') {
+ file.content = await file.content.arrayBuffer();
+ }
+ await this.moveFileToTarget(file, '');
+ }
+ }
+ },
async moveFilesOfFolder(folder, parentPath) {
await this.createFolder(folder, parentPath + '/');
const checkChildrenInChildren = (folder) => {
diff --git a/src/components/WebContentViewer.vue b/src/components/WebContentViewer.vue
index 1e3b615..eb35bad 100644
--- a/src/components/WebContentViewer.vue
+++ b/src/components/WebContentViewer.vue
@@ -18,8 +18,7 @@
+ @change="handleCheckboxChange(file, $event)" :checked="isChecked(file)">
@@ -52,8 +51,7 @@
+ @change="handleCheckboxChange(file, $event)" :checked="isChecked(file)">
@@ -309,29 +307,40 @@ export default {
}
},
async onDragStart(file, event) {
+ const getFilesFromFolder = (folder) => {
+ const files = [];
+ if (!folder.children || folder.children.length === 0) return files;
+
+ for (let i = 0; i < folder.children.length; i++) {
+ const child = folder.children[i];
+ if (child.isDirectory) {
+ files.push(...getFilesFromFolder(child));
+ } else {
+ files.push(child);
+ }
+ }
+ return files;
+ };
// Si des fichiers sont cochés, utiliser cette liste
if (this.cochedFiles.length > 0) {
+ const folder = {
+ name: file.name,
+ isDirectory: true,
+ children: this.cochedFiles,
+ unzip: Promise.all(this.cochedFiles.map(file => file.unzip))
+ };
try {
- console.log('Fichiers cochés :', this.cochedFiles);
+ const files = getFilesFromFolder(folder);
+ const filesToUnzip = files.map(file => file.unzip);
+ await Promise.all(filesToUnzip);
+ this.$emit('file-upload', folder);
} catch (error) {
- console.error('Erreur lors du drag start avec fichiers cochés :', error);
+ console.error('Erreur lors du drag start :', error);
}
+
} else {
// Logique existante pour un seul fichier/dossier
- const getFilesFromFolder = (folder) => {
- const files = [];
- if (!folder.children || folder.children.length === 0) return files;
- for (let i = 0; i < folder.children.length; i++) {
- const child = folder.children[i];
- if (child.isDirectory) {
- files.push(...getFilesFromFolder(child));
- } else {
- files.push(child);
- }
- }
- return files;
- };
try {
if (file.isDirectory) {
From 20bfa586310caaa2ed76f21554eea739e8afc1d8 Mon Sep 17 00:00:00 2001
From: GMrrc <143954951+GMrrc@users.noreply.github.com>
Date: Wed, 11 Dec 2024 15:39:49 +0100
Subject: [PATCH 5/9] fix
---
src/components/WebContentViewer.vue | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/src/components/WebContentViewer.vue b/src/components/WebContentViewer.vue
index eb35bad..d84b996 100644
--- a/src/components/WebContentViewer.vue
+++ b/src/components/WebContentViewer.vue
@@ -321,11 +321,14 @@ export default {
}
return files;
};
- // Si des fichiers sont cochés, utiliser cette liste
+
if (this.cochedFiles.length > 0) {
+
const folder = {
+ // Si des fichiers sont cochés, utiliser cette liste
name: file.name,
isDirectory: true,
+ isList: true,
children: this.cochedFiles,
unzip: Promise.all(this.cochedFiles.map(file => file.unzip))
};
@@ -340,8 +343,6 @@ export default {
} else {
// Logique existante pour un seul fichier/dossier
-
-
try {
if (file.isDirectory) {
const files = getFilesFromFolder(file);
From 99fa335004caa76871668942cb15d1052a8c6a1e Mon Sep 17 00:00:00 2001
From: GMrrc <143954951+GMrrc@users.noreply.github.com>
Date: Wed, 11 Dec 2024 15:41:19 +0100
Subject: [PATCH 6/9] Update EditFileName.vue
---
src/components/EditFileName.vue | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/components/EditFileName.vue b/src/components/EditFileName.vue
index 50a6ac1..b892d38 100644
--- a/src/components/EditFileName.vue
+++ b/src/components/EditFileName.vue
@@ -1,6 +1,6 @@
-
+
{{ translate('modify.file.name') }}
Date: Wed, 11 Dec 2024 16:04:40 +0100
Subject: [PATCH 7/9] fix transfert
---
src/components/FileTable.vue | 32 ++++++++++++++---------------
src/components/WebContentViewer.vue | 5 +----
2 files changed, 17 insertions(+), 20 deletions(-)
diff --git a/src/components/FileTable.vue b/src/components/FileTable.vue
index 1f27fe9..f886795 100644
--- a/src/components/FileTable.vue
+++ b/src/components/FileTable.vue
@@ -407,25 +407,24 @@ export default {
try {
this.isTransfering = true;
const file = this.file;
+ if (!file) return;
if (file.isList) {
await this.moveListOfFiles(file);
- return;
- }
-
- if (!file) return;
- if (file.isDirectory) {
- await this.moveFilesOfFolder(file, '');
} else {
- this.transferProgress = 25;
- if (file.content && typeof file.content.arrayBuffer === 'function') {
- file.content = await file.content.arrayBuffer();
+ if (file.isDirectory) {
+ await this.moveFilesOfFolder(file, '');
+ } else {
+ this.transferProgress = 25;
+ if (file.content && typeof file.content.arrayBuffer === 'function') {
+ file.content = await file.content.arrayBuffer();
+ }
+ this.transferProgress = 50;
+ await this.moveFileToTarget(file, '');
+ this.transferProgress = 100;
}
- this.transferProgress = 50;
- await this.moveFileToTarget(file, '');
- this.transferProgress = 100;
}
-
+
this.isTransfering = false;
this.transferProgress = 0;
this.cancelOperation = false;
@@ -443,14 +442,15 @@ export default {
this.isDroppable = true;
},
async moveListOfFiles(files) {
- for (const file of files) {
+ for (const file of files.children) {
if (file.isDirectory) {
- await this.moveFilesOfFolder(file, '');
+ //just create the folder
+ await this.createFolder(file, file.parentPath + '/');
} else {
if (file.content && typeof file.content.arrayBuffer === 'function') {
file.content = await file.content.arrayBuffer();
}
- await this.moveFileToTarget(file, '');
+ await this.moveFileToTarget(file, file.parentPath + '/');
}
}
},
diff --git a/src/components/WebContentViewer.vue b/src/components/WebContentViewer.vue
index d84b996..11db017 100644
--- a/src/components/WebContentViewer.vue
+++ b/src/components/WebContentViewer.vue
@@ -72,7 +72,6 @@
{{ formatFileSize(file.size) }}
-
@@ -333,9 +332,7 @@ export default {
unzip: Promise.all(this.cochedFiles.map(file => file.unzip))
};
try {
- const files = getFilesFromFolder(folder);
- const filesToUnzip = files.map(file => file.unzip);
- await Promise.all(filesToUnzip);
+ await folder.unzip;
this.$emit('file-upload', folder);
} catch (error) {
console.error('Erreur lors du drag start :', error);
From 8aea56cf3b6730bf476465245cc4a96a6f1390b4 Mon Sep 17 00:00:00 2001
From: GMrrc <143954951+GMrrc@users.noreply.github.com>
Date: Wed, 11 Dec 2024 16:07:36 +0100
Subject: [PATCH 8/9] fix while uncheck
---
src/components/WebContentViewer.vue | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/components/WebContentViewer.vue b/src/components/WebContentViewer.vue
index 11db017..4a60a8a 100644
--- a/src/components/WebContentViewer.vue
+++ b/src/components/WebContentViewer.vue
@@ -252,7 +252,7 @@ export default {
},
getFullPath(file) {
if (!file.parentPath || file.parentPath === '') {
- return [file.name];
+ return file.name;
} else {
return `${file.parentPath}/${file.name}`;
}
From dc6b2e7213ffb0185d23357aa6b3b5cc470156e9 Mon Sep 17 00:00:00 2001
From: GMrrc <143954951+GMrrc@users.noreply.github.com>
Date: Wed, 11 Dec 2024 16:09:08 +0100
Subject: [PATCH 9/9] progressbar for checkedFile transfert
---
src/components/FileTable.vue | 1 +
1 file changed, 1 insertion(+)
diff --git a/src/components/FileTable.vue b/src/components/FileTable.vue
index f886795..27a4652 100644
--- a/src/components/FileTable.vue
+++ b/src/components/FileTable.vue
@@ -443,6 +443,7 @@ export default {
},
async moveListOfFiles(files) {
for (const file of files.children) {
+ this.transferProgress += 100 / files.children.length;
if (file.isDirectory) {
//just create the folder
await this.createFolder(file, file.parentPath + '/');