xk6-dashboard
xk6-dashboard copied to clipboard
[fix] Fix persistence of chart scale selection
Closes https://github.com/grafana/xk6-dashboard/issues/153
What?
This PR fixes an issue with the time range selection persisting upon data refresh.
Note
This does NOT fix active chart selection: https://github.com/grafana/xk6-dashboard/issues/154
Why?
The time range selection would reset with every data update.
Additional context
- Add global time range context
- Update chart hook to handle scale selection
https://github.com/grafana/xk6-dashboard/assets/4395376/5e5bfd33-d0f9-4686-9fb4-7b28c47ba29b
Checklist
- [x] I have performed a self-review of my code.
- [ ] I have added tests for my changes.
- [x] I have run linter locally (
mage lint
) and all checks pass. - [x] I have run tests locally (
mage test
) and all tests pass. - [ ] I have commented on my code, particularly in hard-to-understand areas.
It works perfectly. (I ran an asset generation and pushed it) I have only one comment: I think there should be some visual feedback that a time interval is currently selected and therefore the graphs are not updated. For example, a button in the header: "enable refresh" or similar. Otherwise, the user will not know how to enable it and why it is not updated (especially after switching tabs).
https://github.com/grafana/xk6-dashboard/assets/4395376/0aa535b5-16c1-4424-b694-594cbfe8a8f7
The "reset time range" button should not be displayed in the summary tab, because nothing there depends on the selected time frame. In general, if there is no chart on the page, this button should not be used. This would visually lead to the top row "jumping", because a button would disappear from the middle. Perhaps this button could be placed in front of the icons (with an appropriate design), and then it wouldn't be disturbing if it disappeared from time to time. The other option is that it will be disabled if there is no chart on the page.
UI updated:
https://github.com/grafana/xk6-dashboard/assets/4395376/9d611e14-664b-4ac0-908a-43be6de5e306