-
Notifications
You must be signed in to change notification settings - Fork 217
feat(nimbus): Loading spinner on home page when it sorts/filter data #14251
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
experimenter/experimenter/nimbus_ui/static/js/experiment_home.js
Outdated
Show resolved
Hide resolved
experimenter/experimenter/nimbus_ui/static/js/experiment_home.js
Outdated
Show resolved
Hide resolved
| <div class="htmx-spinner" style="opacity: 0; pointer-events: none"> | ||
| <i class="fa-solid fa-spinner fa-spin fa-lg text-primary"></i> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we perhaps put these properties on a CSS class instead of doing inline style?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah it's not a great pattern but I played around with a bunch of ways to do it and this was the least hassle
experimenter/experimenter/experimenter/nimbus_ui/static/js/experiment_list.js
Lines 1 to 13 in f67bd73
| document.body.addEventListener("htmx:beforeRequest", function () { | |
| const spinner = document.querySelector("#htmx-table-spinner"); | |
| if (spinner) { | |
| spinner.style.opacity = "1"; | |
| } | |
| }); | |
| document.body.addEventListener("htmx:afterRequest", function () { | |
| const spinner = document.querySelector("#htmx-table-spinner"); | |
| if (spinner) { | |
| spinner.style.opacity = "0"; | |
| } | |
| }); |
Maybe we can poke at it again later but for the time being this is the easiest way to get it going.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yeah same I tried and found this one was easy
| </h5> | ||
| <span class="badge rounded-pill bg-primary fs-6 px-3 py-1">{{ page_obj.paginator.count }}</span> | ||
| <div class="d-flex align-items-center gap-2"> | ||
| <div class="htmx-spinner" style="opacity: 0; pointer-events: none"> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
likewise.
jaredlockhart
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tested locally, works great, thnx @yashikakhurana 🙏
| <div class="htmx-spinner" style="opacity: 0; pointer-events: none"> | ||
| <i class="fa-solid fa-spinner fa-spin fa-lg text-primary"></i> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah it's not a great pattern but I played around with a bunch of ways to do it and this was the least hassle
experimenter/experimenter/experimenter/nimbus_ui/static/js/experiment_list.js
Lines 1 to 13 in f67bd73
| document.body.addEventListener("htmx:beforeRequest", function () { | |
| const spinner = document.querySelector("#htmx-table-spinner"); | |
| if (spinner) { | |
| spinner.style.opacity = "1"; | |
| } | |
| }); | |
| document.body.addEventListener("htmx:afterRequest", function () { | |
| const spinner = document.querySelector("#htmx-table-spinner"); | |
| if (spinner) { | |
| spinner.style.opacity = "0"; | |
| } | |
| }); |
Maybe we can poke at it again later but for the time being this is the easiest way to get it going.
Co-authored-by: Beth Rennie <beth@brennie.ca>
Co-authored-by: Beth Rennie <beth@brennie.ca>

Because
This commit
Fixes #14028