diff --git a/app/views/console/comps/header.phtml b/app/views/console/comps/header.phtml
index 53d4b70f5..d46fd3ae0 100644
--- a/app/views/console/comps/header.phtml
+++ b/app/views/console/comps/header.phtml
@@ -223,7 +223,7 @@
-
+
- %
+
@@ -260,6 +260,17 @@
Alpine.store('uploader', {
files: [],
isOpen: true,
+ init() {
+ window.addEventListener('beforeunload', (event) => {
+ this.files.forEach((file) => {
+ if(!file.completed && !file.failed) {
+ let confirmationMessage = "There are incomplete uploads, are you sure you want to leave?";
+ event.returnValue = confirmationMessage;
+ return confirmationMessage;
+ }
+ });
+ });
+ },
toggle() {
this.isOpen = !this.isOpen;
},
@@ -293,8 +304,9 @@
progress: 0,
completed: false,
failed: false,
+ isCancelled: false,
});
-
+ target.reset();
try {
const response = await sdk.storage.createFile(
formData.get('bucketId'),
@@ -303,13 +315,11 @@
read,
write,
(progress) => {
- console.log("progress", progress);
+ /*if cancelled
+ throw something*/
this.updateFile(id, {
id: id,
- name: file.name,
progress: Math.round(progress),
- completed: false,
- failed: false
});
});
this.updateFile(id,{
@@ -319,12 +329,13 @@
completed: true,
failed: false,
});
- target.reset();
+ document.dispatchEvent(new CustomEvent('storage.createFile'));
} catch(error) {
this.updateFile(id, {
id: id,
failed: true,
});
+ document.dispatchEvent(new CustomEvent('storage.createFile'));
}
}