Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Added upload pending prompt on close/reload #4840

Merged
merged 3 commits into from
May 28, 2021
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions packages/web-app-files/src/components/UploadProgress.vue
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,10 @@ export default {
} else {
return 100
}
},

uploadPending() {
return this.totalUploadProgress < 100
}
},
watch: {
Expand All @@ -124,10 +128,20 @@ export default {
this.delayForScreenreader(() => this.$refs.progressbar.$el.focus())
})
})
window.addEventListener('beforeunload', this.handlerClose)
},
beforeDestroy() {
window.removeEventListener('beforeunload', this.handlerClose)
},
methods: {
$_toggleExpanded() {
this.expanded = !this.expanded
},
handlerClose(event) {
if (this.uploadPending) {
event.preventDefault()
event.returnValue = ''
}
}
}
}
Expand Down