Replace bootstrap-notify.js by bootstrapv5-toast - #3843
Conversation
d72ed22 to
ed6cf23
Compare
Signed-off-by: yubiuser <github@yubiuser.dev>
fc6e68c to
de6b61c
Compare
|
When you squash the commits, can you please add a commit message explaining the changes? |
bf6bde6 to
c310cf1
Compare
Signed-off-by: yubiuser <github@yubiuser.dev>
…and was used only in two places Signed-off-by: yubiuser <github@yubiuser.dev>
Signed-off-by: yubiuser <github@yubiuser.dev>
02696f2 to
df4fddc
Compare
|
OK, it's in a state ready for review/comments. |
fefad79 to
6d650c8
Compare
Signed-off-by: yubiuser <github@yubiuser.dev>
6d650c8 to
45614b5
Compare
Signed-off-by: yubiuser <github@yubiuser.dev>
Signed-off-by: yubiuser <github@yubiuser.dev>
56b1489 to
97bed99
Compare
Signed-off-by: yubiuser <github@yubiuser.dev>
97bed99 to
d4518cf
Compare
Signed-off-by: RD WebDesign <github@rdwebdesign.com.br>
Signed-off-by: RD WebDesign <github@rdwebdesign.com.br>
|
I tested and it is working as expected, but I changed a few things:
|
|
Thanks. I'd like to add two things here before this should be merged: implement mass-delete for the messages table (notification currently breaks there) and I'm thinking about moving the handling of the toast state from globalThis into show alert. |
DL6ER
left a comment
There was a problem hiding this comment.
messages.js and settings-dhcp.js used to key their toasts per item (toasts[id], toasts[ip]), both now write to a single global slot. delMsg() and delLease() run in a loop from "Delete Selected", so deleting five rows creates five info toasts but every response updates only the last one.
showAlert() should not throw when the last argument is missing. It is our error-reporting path, so one missed call site turns a reported API error into an uncaught exception, and nothing lints for it. Default to null instead.
settings.js and settings-dns.js pass null as the message. It renders empty today, but #3847 skips the body only for an empty string. escapeHtml(message ?? "") covers both.
The toast container is declared twice, in header_authenticated.lp and in getOrCreateToastContainer().
On #3847: the --bs-toast-bg override drops AdminLTE's subtle body for a solid one - intentional?
Yes. |
|
Moving the toast state into const toastRegistry = new Map();
function showAlert(type, icon, title, message, key = null) {
// ...
const oldToastInstance = key === null ? null : toastRegistry.get(key);
// ...
if (key !== null) {
toastRegistry.set(key, toastInstance);
}
// next to the dispose() in the "hidden.bs.toast" handler
if (key !== null && toastRegistry.get(key) === toastInstance) {
toastRegistry.delete(key);
}
}Callers pass a key instead of an instance, e.g., It is 60 lines across 12 files though, and the |


What does this PR aim to accomplish?:
Replaces
bootstrap-notify.jswith bootstrap-5 toasts.bootstrap-notifyis unmaintained and not compatible with jquery4 (see #3842)The flow is the following: we create a
toast-containerwhich is re-usable and can hold multiple toasts. OnshowAlert()a new toast is created inside the container. Bootstrap handles the delay and autohide by itself.By submitting this pull request, I confirm the following:
git rebase)