Urgent correction of version v1.0.0-beta.14 due to crash issues when acting on the CDN.
All checks were successful
continuous-integration/drone/push Build is passing

We would like to apologize for the inconvenience caused and we would like to thank you for the quick report.
This commit is contained in:
2024-07-12 18:07:19 +02:00
parent 4b616e825a
commit aaff0ed4ea
15 changed files with 296 additions and 213 deletions

View File

@@ -337,4 +337,78 @@ async function showFileInfo(fileName) {
html: html,
confirmButtonText: 'Fermer'
});
}
}document.addEventListener('DOMContentLoaded', function () {
const moveFileForm = document.getElementById('moveFileForm');
moveFileForm.addEventListener('submit', function (event) {
event.preventDefault(); // Empêche la soumission par défaut du formulaire
const fileName = this.querySelector('input[name="fileName"]').value;
const userName = this.querySelector('input[name="userName"]').value;
const oldFolderName = this.querySelector('input[name="oldFolderName"]').value;
const newFolderName = this.querySelector('select[name="newFolderName"]').value;
if (!newFolderName || newFolderName === "Déplacer vers...") {
Swal.fire({
position: 'top',
icon: 'error',
title: 'Veuillez sélectionner un dossier de destination',
showConfirmButton: false,
timer: 1800,
toast: true
});
return;
}
Swal.fire({
title: 'Confirmer le déplacement du fichier',
text: `Voulez-vous déplacer le fichier ${fileName} vers ${newFolderName} ?`,
icon: 'warning',
showCancelButton: true,
confirmButtonText: 'Déplacer',
cancelButtonText: 'Annuler',
}).then((result) => {
if (result.isConfirmed) {
fetch(`/api/dpanel/dashboard/movefile/${oldFolderName}`, {
method: 'POST',
headers: {
'Content-Type': 'application/json',
},
body: JSON.stringify({ fileName, userName, newFolderName }),
})
.then(response => {
if (!response.ok) {
throw new Error('Network response was not ok');
}
return response.json();
})
.then(data => {
if (data.message === "File moved successfully") {
Swal.fire({
position: 'top',
icon: 'success',
title: 'Le fichier a été déplacé avec succès.',
showConfirmButton: false,
timer: 1800,
toast: true,
}).then(() => {
location.reload();
});
} else {
throw new Error(data.error || 'Une erreur est survenue');
}
})
.catch((error) => {
Swal.fire({
position: 'top',
icon: 'error',
title: 'Erreur lors du déplacement du fichier.',
showConfirmButton: false,
timer: 1800,
toast: true,
});
});
}
});
});
});