remove zip transfert
This commit is contained in:
parent
7dc81a905b
commit
12a3664654
11
src/App.vue
11
src/App.vue
@ -5,12 +5,12 @@
|
|||||||
<!-- Première section -->
|
<!-- Première section -->
|
||||||
<div
|
<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">
|
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>
|
</div>
|
||||||
<!-- Deuxième section -->
|
<!-- Deuxième section -->
|
||||||
<div
|
<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">
|
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>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@ -40,11 +40,10 @@ export default {
|
|||||||
data() {
|
data() {
|
||||||
console.log('feur')
|
console.log('feur')
|
||||||
let zipUrl = document.getElementById('archiveInfos').getAttribute('dataarchiveurl');
|
let zipUrl = document.getElementById('archiveInfos').getAttribute('dataarchiveurl');
|
||||||
console.log(zipUrl);
|
console.log(zipUrl)
|
||||||
return {
|
return {
|
||||||
zipUrl,
|
zipUrl,
|
||||||
sharedFile: null,
|
sharedFile: null,
|
||||||
zip: null,
|
|
||||||
dragEnded: false,
|
dragEnded: false,
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
@ -52,12 +51,8 @@ export default {
|
|||||||
handleFileUpload(file) {
|
handleFileUpload(file) {
|
||||||
this.sharedFile = file;
|
this.sharedFile = file;
|
||||||
},
|
},
|
||||||
handleZipUpload(zip) {
|
|
||||||
this.zip = zip;
|
|
||||||
},
|
|
||||||
toggleDragEnded(){
|
toggleDragEnded(){
|
||||||
this.dragEnded = !this.dragEnded;
|
this.dragEnded = !this.dragEnded;
|
||||||
this.zip = null;
|
|
||||||
this.sharedFile = null;
|
this.sharedFile = null;
|
||||||
},
|
},
|
||||||
translate(id) {
|
translate(id) {
|
||||||
|
@ -190,10 +190,6 @@ export default {
|
|||||||
type: Object,
|
type: Object,
|
||||||
default: null,
|
default: null,
|
||||||
},
|
},
|
||||||
zip: {
|
|
||||||
type: Object,
|
|
||||||
default: null,
|
|
||||||
},
|
|
||||||
dragEnded: {
|
dragEnded: {
|
||||||
type: Boolean,
|
type: Boolean,
|
||||||
Required: true,
|
Required: true,
|
||||||
@ -411,39 +407,20 @@ export default {
|
|||||||
try {
|
try {
|
||||||
this.isTransfering = true;
|
this.isTransfering = true;
|
||||||
const file = this.file;
|
const file = this.file;
|
||||||
const zip = this.zip;
|
|
||||||
console.log(file);
|
|
||||||
console.log(zip);
|
|
||||||
|
|
||||||
if (!file && !zip) return;
|
if (!file) return;
|
||||||
|
if (file.isDirectory) {
|
||||||
if (zip) {
|
await this.moveFilesOfFolder(file, '');
|
||||||
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;
|
|
||||||
} else {
|
} else {
|
||||||
if (file.isDirectory) {
|
this.transferProgress = 25;
|
||||||
await this.moveFilesOfFolder(file, '');
|
if (file.content && typeof file.content.arrayBuffer === 'function') {
|
||||||
} else {
|
file.content = await file.content.arrayBuffer();
|
||||||
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.isTransfering = false;
|
||||||
this.transferProgress = 0;
|
this.transferProgress = 0;
|
||||||
this.cancelOperation = false;
|
this.cancelOperation = false;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user