mirror of
https://github.com/mperham/sidekiq.git
synced 2022-11-09 13:52:34 -05:00
Enable live poll from url params (#5275)
* Turn on Polling if url has param poll=true. poll=false does nothing. This is because the page is reloaded each time polling happens, and the url param may be out of sync with the current status. One solution would be to rewrite the URL each time the polling status changes, but that seems unnecessary.
This commit is contained in:
parent
d0a4b1fdc8
commit
637e50906e
1 changed files with 9 additions and 0 deletions
|
@ -32,6 +32,7 @@ function addListeners() {
|
|||
})
|
||||
|
||||
updateFuzzyTimes();
|
||||
setLivePollFromUrl();
|
||||
|
||||
var buttons = document.querySelectorAll(".live-poll");
|
||||
if (buttons.length > 0) {
|
||||
|
@ -83,6 +84,14 @@ function updateFuzzyTimes() {
|
|||
t.cancel();
|
||||
}
|
||||
|
||||
function setLivePollFromUrl() {
|
||||
var url_params = new URL(window.location.href).searchParams
|
||||
|
||||
if (url_params.get("poll") == "true") {
|
||||
localStorage.sidekiqLivePoll = "enabled";
|
||||
}
|
||||
}
|
||||
|
||||
function updateLivePollButton() {
|
||||
if (localStorage.sidekiqLivePoll == "enabled") {
|
||||
document.querySelectorAll('.live-poll-stop').forEach(box => { box.style.display = "inline-block" })
|
||||
|
|
Loading…
Add table
Reference in a new issue