edit bug fix

This commit is contained in:
Alexandre_BRAVO 2024-11-22 14:43:30 +01:00
commit 602a2b2d9a
2 changed files with 17 additions and 3 deletions

View File

@ -11,11 +11,14 @@
</NcBreadcrumb> </NcBreadcrumb>
<template #actions> <template #actions>
<div class="flex items-center ml-2"> <div class="flex items-center ml-2">
<button @click="toggleAddFilePopup" <button v-if="!isTransfering" @click="toggleAddFilePopup"
class="flex items-center space-x-2 bg-blue-100 text-blue-600 font-medium px-4 py-2 rounded-md hover:bg-blue-200 transition"> class="flex items-center space-x-2 bg-blue-100 text-blue-600 font-medium px-4 py-2 rounded-md hover:bg-blue-200 transition">
<Plus :size="20" /> <Plus :size="20" />
<span>Nouveau</span> <span>Nouveau</span>
</button> </button>
<span v-else>
<NcProgressBar :value="transferProgress" size="medium" :color="transferStatus" />
</span>
</div> </div>
</template> </template>
</NcBreadcrumbs> </NcBreadcrumbs>
@ -123,7 +126,6 @@
<script> <script>
import { ref } from 'vue';
import { getClient, getRootPath } from '@nextcloud/files/dav'; import { getClient, getRootPath } from '@nextcloud/files/dav';
import NcBreadcrumbs from '@nextcloud/vue/dist/Components/NcBreadcrumbs.js'; import NcBreadcrumbs from '@nextcloud/vue/dist/Components/NcBreadcrumbs.js';
import NcBreadcrumb from '@nextcloud/vue/dist/Components/NcBreadcrumb.js'; import NcBreadcrumb from '@nextcloud/vue/dist/Components/NcBreadcrumb.js';
@ -132,6 +134,7 @@ import NcActions from '@nextcloud/vue/dist/Components/NcActions.js';
import NcActionButton from '@nextcloud/vue/dist/Components/NcActionButton.js'; import NcActionButton from '@nextcloud/vue/dist/Components/NcActionButton.js';
import Delete from 'vue-material-design-icons/Delete.vue'; import Delete from 'vue-material-design-icons/Delete.vue';
import Pencil from 'vue-material-design-icons/Pencil.vue' import Pencil from 'vue-material-design-icons/Pencil.vue'
import NcProgressBar from '@nextcloud/vue/dist/Components/NcProgressBar.js'
import EditFileName from './EditFileName.vue'; import EditFileName from './EditFileName.vue';
export default { export default {
@ -142,6 +145,7 @@ export default {
Plus, Plus,
NcActions, NcActions,
NcActionButton, NcActionButton,
NcProgressBar,
Delete, Delete,
Pencil, Pencil,
EditFileName EditFileName
@ -165,6 +169,8 @@ export default {
editDialogDisabled: true, editDialogDisabled: true,
initialFileName: '', // Nom originel du fichier/dossier edite initialFileName: '', // Nom originel du fichier/dossier edite
isDirectory: false, // Si l'element edite est un dossier ou non isDirectory: false, // Si l'element edite est un dossier ou non
transferProgress: 0,
transferStatus: 'green',
}; };
}, },
async mounted() { async mounted() {
@ -264,16 +270,21 @@ export default {
if (file.isDirectory) { if (file.isDirectory) {
await this.moveFilesOfFolder(file,''); await this.moveFilesOfFolder(file,'');
} else { } else {
this.transferProgress = 25;
if (file.content && typeof file.content.arrayBuffer === 'function') { if (file.content && typeof file.content.arrayBuffer === 'function') {
file.content = await file.content.arrayBuffer(); file.content = await file.content.arrayBuffer();
} }
this.transferProgress = 50;
await this.moveFileToTarget(file, ''); await this.moveFileToTarget(file, '');
this.transferProgress = 100;
} }
this.isTransfering = false; this.isTransfering = false;
this.transferProgress = 0;
} catch (error) { } catch (error) {
console.error('Erreur lors du drop :', error); console.error('Erreur lors du drop :', error);
this.transferStatus = 'red';
this.isTransfering = false; this.isTransfering = false;
} }
}, },
@ -281,7 +292,10 @@ export default {
await this.createFolder(folder, parentPath); await this.createFolder(folder, parentPath);
const progressSteps = 100 / folder.children.length;
for (const child of folder.children) { for (const child of folder.children) {
this.transferProgress += progressSteps;
if (child.isDirectory) { if (child.isDirectory) {
await this.moveFilesOfFolder(child, parentPath + child.parentPath + '/'); await this.moveFilesOfFolder(child, parentPath + child.parentPath + '/');
} else { } else {

View File

@ -4,7 +4,7 @@
<div class="w-4/6 px-4 py-2 text-gray-500 font-semibold border-r border-gray-300">Nom</div> <div class="w-4/6 px-4 py-2 text-gray-500 font-semibold border-r border-gray-300">Nom</div>
<div class="w-2/6 px-4 py-2 text-gray-500 font-semibold">Taille</div> <div class="w-2/6 px-4 py-2 text-gray-500 font-semibold">Taille</div>
</div> </div>
<div v-if="!isLoading && zipContent.length !== 0" class="overflow-y-auto"> <div v-if="!isLoading && zipContent.length !== 0" class="overflow-y-auto h-full">
<div v-for="(file, index) in sortedFiles" :key="file.fullPath" class="flex flex-col"> <div v-for="(file, index) in sortedFiles" :key="file.fullPath" class="flex flex-col">
<div <div