1
0
mirror of https://github.com/axllent/mailpit.git synced 2025-06-17 00:07:54 +02:00

Feature(UI): List messages in side nav when viewing message for easy navigation (#336)

This commit is contained in:
Ralph Slooten
2024-08-04 17:04:14 +12:00
parent 54e0c32948
commit a1cb0af639
21 changed files with 636 additions and 162 deletions

View File

@ -7,6 +7,9 @@ import { pagination } from '../stores/pagination'
export default {
mixins: [CommonMixins],
// global event bus to handle message status changes
inject: ["eventBus"],
data() {
return {
pagination,
@ -63,7 +66,7 @@ export default {
} else {
// update pagination offset
pagination.start++
// prevent "Too many calls to Location or History APIs within a short timeframe"
// prevent "Too many calls to Location or History APIs within a short time frame"
this.delayedPaginationUpdate()
}
}
@ -91,6 +94,7 @@ export default {
window.scrollInPlace = true
mailbox.refresh = true // trigger refresh
window.setTimeout(() => { mailbox.refresh = false }, 500)
this.eventBus.emit("prune");
} else if (response.Type == "stats" && response.Data) {
// refresh mailbox stats
mailbox.total = response.Data.Total
@ -100,6 +104,15 @@ export default {
if (this.version != response.Data.Version) {
location.reload()
}
} else if (response.Type == "delete" && response.Data) {
// broadcast for components
this.eventBus.emit("delete", response.Data);
} else if (response.Type == "update" && response.Data) {
// broadcast for components
this.eventBus.emit("update", response.Data);
} else if (response.Type == "truncate") {
// broadcast for components
this.eventBus.emit("truncate")
}
}
@ -151,6 +164,11 @@ export default {
}
},
handleMessageEvents(message) {
console.log("generic")
console.log(message)
},
socketBreakReset() {
window.setTimeout(() => {
this.socketBreaks = 0