mirror of
https://github.com/home-assistant/frontend.git
synced 2025-07-16 22:06:34 +00:00
Fix graphs in more info dialogs
This commit is contained in:
parent
f509f29235
commit
46dbd30fba
@ -37,6 +37,11 @@ export default new Polymer({
|
|||||||
},
|
},
|
||||||
|
|
||||||
isLoadingHistoryData: {
|
isLoadingHistoryData: {
|
||||||
|
type: Boolean,
|
||||||
|
computed: 'computeIsLoadingHistoryData(_delayedDialogOpen, _isLoadingHistoryData)',
|
||||||
|
},
|
||||||
|
|
||||||
|
_isLoadingHistoryData: {
|
||||||
type: Boolean,
|
type: Boolean,
|
||||||
bindNuclear: entityHistoryGetters.isLoadingEntityHistory,
|
bindNuclear: entityHistoryGetters.isLoadingEntityHistory,
|
||||||
},
|
},
|
||||||
@ -64,6 +69,11 @@ export default new Polymer({
|
|||||||
observer: 'dialogOpenChanged',
|
observer: 'dialogOpenChanged',
|
||||||
},
|
},
|
||||||
|
|
||||||
|
_delayedDialogOpen: {
|
||||||
|
type: Boolean,
|
||||||
|
value: false,
|
||||||
|
},
|
||||||
|
|
||||||
_boundOnBackdropTap: {
|
_boundOnBackdropTap: {
|
||||||
type: Function,
|
type: Function,
|
||||||
value: function bindBackdropTap() {
|
value: function bindBackdropTap() {
|
||||||
@ -72,6 +82,16 @@ export default new Polymer({
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* We depend on a delayed dialogOpen value to tell the chart component
|
||||||
|
* that the data is there. Otherwise the chart component will render
|
||||||
|
* before the dialog is attached to the screen and is unable to determine
|
||||||
|
* graph size resulting in scroll bars.
|
||||||
|
*/
|
||||||
|
computeIsLoadingHistoryData(_delayedDialogOpen, _isLoadingHistoryData) {
|
||||||
|
return !_delayedDialogOpen || _isLoadingHistoryData;
|
||||||
|
},
|
||||||
|
|
||||||
fetchHistoryData() {
|
fetchHistoryData() {
|
||||||
if (this.stateObj && this.hasHistoryComponent &&
|
if (this.stateObj && this.hasHistoryComponent &&
|
||||||
this.shouldFetchHistory) {
|
this.shouldFetchHistory) {
|
||||||
@ -103,8 +123,10 @@ export default new Polymer({
|
|||||||
if (newVal) {
|
if (newVal) {
|
||||||
this.$.dialog.backdropElement.addEventListener('click',
|
this.$.dialog.backdropElement.addEventListener('click',
|
||||||
this._boundOnBackdropTap);
|
this._boundOnBackdropTap);
|
||||||
|
this.async(() => this._delayedDialogOpen = true, 10);
|
||||||
} else if (!newVal && this.stateObj) {
|
} else if (!newVal && this.stateObj) {
|
||||||
moreInfoActions.deselectEntity();
|
moreInfoActions.deselectEntity();
|
||||||
|
this._delayedDialogOpen = false;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user