-
Notifications
You must be signed in to change notification settings - Fork 2.6k
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
Add period selection to energy dashboard #9756
Conversation
4ac8285
to
b14d8ce
Compare
@@ -82,6 +177,15 @@ export class HuiEnergyPeriodSelector extends SubscribeMixin(LitElement) { | |||
private _updateDates(energyData: EnergyData): void { | |||
this._startDate = energyData.start; | |||
this._endDate = energyData.end || endOfToday(); | |||
this._period = isSameDay(this._startDate, this._endDate) |
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.
I think that we should store "period" in the energy data so it's easier to show such buttons etc.
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.
I wonder even if we should store just a "start date" that combined with period = start + end.
That way we can still do -1 week or -1 month but, scaling up/down will keep us in the same 'range'
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.
I wanted to keep energy and all other elements as flexible as possible really, so it could handle any date range. Just the period selector is the part that is limiting now... I agree that this part is ugly, so maybe we could save the period in energy data just for this... 🤷♂️
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.
Made this logic a bit simpler now...
Proposed change
Add week, month, year views to energy dashboard.
Type of change
Example configuration
Additional information
Checklist
If user exposed functionality or configuration variables are added/changed: