remove zip transfert

This commit is contained in:
GMrrc 2024-12-11 15:32:58 +01:00
parent 7dc81a905b
commit 12a3664654
2 changed files with 13 additions and 41 deletions

View File

@ -5,12 +5,12 @@
<!-- Première section -->
<div
class="w-full sm:w-1/3 max-sm:h-2/5 p-4 sm:m-6 sm:mr-0 rounded-xl dark:bg-NcBlack/40 bg-white/80">
<WebContentViewer :translate="translate" @zip-upload="handleZipUpload" @file-upload="handleFileUpload" @dragEnded="toggleDragEnded" :zipUrl="zipUrl"/>
<WebContentViewer :translate="translate" @file-upload="handleFileUpload" @dragEnded="toggleDragEnded" :zipUrl="zipUrl"/>
</div>
<!-- Deuxième section -->
<div
class="w-full sm:w-2/3 max-sm:h-3/5 p-4 sm:m-6 sm:ml-4 dark:bg-NcBlack bg-white rounded-xl">
<FileTable :file="sharedFile" :zip="zip" :dragEnded="dragEnded" :translate="translate" @dragEnded="toggleDragEnded"/>
<FileTable :file="sharedFile" :dragEnded="dragEnded" :translate="translate" @dragEnded="toggleDragEnded"/>
</div>
</div>
</div>
@ -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) {

View File

@ -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;