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

Feat: Add options for Chart period #752

Merged
merged 8 commits into from
Oct 26, 2021

Conversation

chakflying
Copy link
Collaborator

@chakflying chakflying commented Oct 20, 2021

Closes #223

The current behavior is unchanged. The new default will be "recent", since the last 100 beats doesn't really correspond to a specific time period. Currently available options are 3h, 6h, 24h, 1w. Since these are manually triggered when the user selects, I don't think performance will be a big concern.

Slight issue: Updating the period will cause the heartbeat bar animation to trigger, since the data structure is shared. I don't see any easy solution to this.

In the future we can make the default period configurable, but should the Chart component handle this? Or should the LIMIT 100 be configurable?

image

@chakflying chakflying marked this pull request as draft October 20, 2021 10:45
@chakflying
Copy link
Collaborator Author

New method of storing data implemented. Feels like magic to me but apparently custom watchers is a thing.

@chakflying chakflying marked this pull request as ready for review October 22, 2021 10:52
@chakflying chakflying force-pushed the feat/chart-period branch 2 times, most recently from 80575b5 to 542eb18 Compare October 23, 2021 17:41
Fix: Fix callback, add toast on error

Fix: Improve styling

Fix: Restore default chart behavior

Fix: Replace 1h with 3h

draft only
@louislam louislam added this to the 1.10.0 milestone Oct 26, 2021
@louislam
Copy link
Owner

Great demanding feature.
I tweaked a little bit, the loading transition should be a bit better when switching to 1w.

@louislam louislam merged commit 3bd420f into louislam:master Oct 26, 2021
@chakflying
Copy link
Collaborator Author

Thanks! Was thinking if I need to write unit test for the API, but I guess we haven't set that up yet.

@louislam
Copy link
Owner

Thanks! Was thinking if I need to write unit test for the API, but I guess we haven't set that up yet.

I think this pull request do not require unit testing, as it is pretty straight forward.

Only large charges like #518 and #752 need to come with unit tests.

I updated the contributing guide recently:
https://github.com/louislam/uptime-kuma/blob/master/CONTRIBUTING.md#-low-priority---harsh-mode

@Zixim
Copy link

Zixim commented Oct 31, 2021

Could this setting be sticky?
i.e. If a chart is set to 1w, keep it set to 1w.
Now, it reverts to Recent when navigating away & returning to the chart.

@chakflying chakflying deleted the feat/chart-period branch December 23, 2021 02:18
@derekoharrow
Copy link

Could this setting be sticky? i.e. If a chart is set to 1w, keep it set to 1w. Now, it reverts to Recent when navigating away & returning to the chart.

Yes please - this would be great. That and perhaps adding a "default" setting to the Settings - e.g. so we can default all items to say 24 hours.

@chakflying
Copy link
Collaborator Author

PR for saving the period is open, please discuss in #1007.

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 this pull request may close these issues.

Customizable range for HP bar and graph
4 participants