Skip to content
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

"Live Poll" dashboard #526

Closed
danielwestendorf opened this issue Feb 20, 2022 · 2 comments · Fixed by #528
Closed

"Live Poll" dashboard #526

danielwestendorf opened this issue Feb 20, 2022 · 2 comments · Fixed by #528

Comments

@danielwestendorf
Copy link
Contributor

danielwestendorf commented Feb 20, 2022

Add UX to automatically reload the contexts of the good job dashboard ever X seconds. This could be as simple as a

setInterval(function() { window.location.reload() }, 5000)

or something more complex that dom-diffs or something.

I'd be happy to implement this if it belongs in the project.

@bensheldon
Copy link
Owner

@danielwestendorf definitely. The simpler the better. What do you think of these requiements:

  • disabled by default
  • enableable with a checkbox
  • enableable by a query param
  • frequency can be changed by a query param

I'm imagining the purpose is for a dashboard/wallboard?

danielwestendorf added a commit to danielwestendorf/good_job that referenced this issue Feb 21, 2022
Adds support for live polling the dashboard, adding replaceable content areas anywhere on the page, register event listeners which act upon the `GoodJob` javacript object, and a footer.

### Polling UX
1. Toggle the `Live Poll` checkbox in the navbar (every 5000ms by default)
2. Add a query parameter to the url `/good_job?poll=5000`. The integer (in ms) sets the poll interval.

### Register event listeners
1. Add `data-gj-action` attribute with the event name and the `GoodJob` function to call when the event is triggered. `change#togglePoll` => `element.addEventListener('change, GoodJob.togglePoll)`

### Adding replaceable content areas
1. Add the `data-gj-poll-replace` attribute to the element
2. Add a unique ID to the same element

Fixes bensheldon#526
bensheldon added a commit that referenced this issue Feb 27, 2022
* Add support for live polling the dashboard

Adds support for live polling the dashboard, adding replaceable content areas anywhere on the page, register event listeners which act upon the `GoodJob` javacript object, and a footer.

### Polling UX
1. Toggle the `Live Poll` checkbox in the navbar (every 5000ms by default)
2. Add a query parameter to the url `/good_job?poll=5000`. The integer (in ms) sets the poll interval.

### Register event listeners
1. Add `data-gj-action` attribute with the event name and the `GoodJob` function to call when the event is triggered. `change#togglePoll` => `element.addEventListener('change, GoodJob.togglePoll)`

### Adding replaceable content areas
1. Add the `data-gj-poll-replace` attribute to the element
2. Add a unique ID to the same element

Fixes #526

* Persist poll value when filtering

* Persist poll enablement and interval across page navigations

* Scope poll replacement to relevant fields to input focus jank

If you have live poll enabled, and are typing in an input, your changes to the input can be replaced, resulting in a janky experience.

* Move chart rendering to script.js

Inserting script tags as HTML strings doesn't work without hacks. Instead just render the JSON as a data attr.

* Prevent poll times < 1000ms

* Add system tests; lint

* Lint javascript with JSHint; set default polling interval to 30 seconds; document `?poll` param in Readme

* Fix polling system spec interval from ms to seconds

Co-authored-by: Ben Sheldon <bensheldon@gmail.com>
@bensheldon
Copy link
Owner

@danielwestendorf thank you for the contribution 🙏 This feature has been released in v2.11.0 🎉

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants