diff --git a/src/components/FileTable.vue b/src/components/FileTable.vue index 776f81c..c7ebe92 100644 --- a/src/components/FileTable.vue +++ b/src/components/FileTable.vue @@ -407,6 +407,7 @@ export default { try { this.isTransfering = true; const file = this.file; + console.log(file) if (!file) return; if (file.isList) { @@ -442,13 +443,19 @@ export default { this.isDroppable = true; }, async moveListOfFiles(files) { + let listOfFolder = []; for (const file of files.children) { this.transferProgress += 100 / files.children.length; - let listOfFolder = []; if (file.isDirectory) { //just create the folder await this.createFolder(file, file.parentPath + '/'); - listOfFolder.push(file.parentPath + '/' + file.name); + let parentPath = file.parentPath; + if(parentPath === ''){ + listOfFolder.push(file.name); + } + else{ + listOfFolder.push(file.parentPath + '/' + file.name); + } } else { if (file.content && typeof file.content.arrayBuffer === 'function') { file.content = await file.content.arrayBuffer(); diff --git a/src/components/WebContentViewer.vue b/src/components/WebContentViewer.vue index ccc2892..a8d562d 100644 --- a/src/components/WebContentViewer.vue +++ b/src/components/WebContentViewer.vue @@ -272,12 +272,10 @@ export default { cocheFile(file) { if (!this.cochedFiles.some(f => this.getFullPath(f) === this.getFullPath(file))) { this.cochedFiles.push(file); - console.log(this.cochedFiles); } }, decocheFile(file) { this.cochedFiles = this.cochedFiles.filter(f => this.getFullPath(f) !== this.getFullPath(file)); - console.log(this.cochedFiles); }, cocheFilesRecursively(files) { files.forEach(file => { @@ -306,6 +304,7 @@ export default { }, toggleFolder(file) { if (!file.isDirectory) return; + this.uncheckAll(); const currentState = this.folderMap[file.fullPath]; const parentPath = file.parentPath; @@ -357,6 +356,7 @@ export default { children: this.cochedFiles, unzip: Promise.all(this.cochedFiles.map(file => file.unzip)) }; + try { await folder.unzip; this.$emit('file-upload', folder); @@ -399,6 +399,7 @@ export default { return parts.join('/'); }, handleClickBreadcrumb(index) { + this.uncheckAll(); if (this.isTransfering) return; let dir = ''; if (index >= -1) { @@ -406,7 +407,6 @@ export default { } this.currentDir = dir; this.breadcrumbParts = this.getBreadcrumbParts(); - //console.log('cur : ', this.currentDir) let file = { fullPath: dir, parentPath: this.generateCrumbHref(index - 1), @@ -418,43 +418,8 @@ export default { }); this.toggleFolder(file) }, - isVisible(file) { - let parentPath = file.parentPath; - if (this.currentDir === parentPath) { - return true; - } - else { - return false; - } - }, - getBreadcrumbParts() { - // Si le currentDir est un simple '/', on le renvoie sous forme de tableau vide. - if (this.currentDir === '') return []; - return this.currentDir.split('/').filter(part => part); - }, - generateCrumbHref(index) { - const parts = this.breadcrumbParts.slice(0, index + 1); - return parts.join('/'); - }, - handleClickBreadcrumb(index) { - if (this.isTransfering) return; - let dir = ''; - if (index >= -1) { - dir = this.generateCrumbHref(index); - } - this.currentDir = dir; - this.breadcrumbParts = this.getBreadcrumbParts(); - //console.log('cur : ', this.currentDir) - let file = { - fullPath: dir, - parentPath: this.generateCrumbHref(index - 1), - isDirectory: true, - }; - - Object.keys(this.folderMap).forEach(key => { - this.folderMap[key] = false; - }); - this.toggleFolder(file); + uncheckAll() { + this.cochedFiles = []; }, }, };