diff --git a/src/cards/ha-history_graph-card.html b/src/cards/ha-history_graph-card.html index 8a3cd11e28..98f364293b 100644 --- a/src/cards/ha-history_graph-card.html +++ b/src/cards/ha-history_graph-card.html @@ -22,8 +22,7 @@ @apply --paper-font-common-nowrap; } paper-card[dialog] .header { - padding-top: 0; - padding-left: 0; + display: none; } requestAnimationFrame(() => this.onPropsChange())); } this._resizeListener = () => { this._debouncer = Polymer.Debouncer.debounce( diff --git a/src/dialogs/more-info-dialog.html b/src/dialogs/more-info-dialog.html index 8faaaa8559..d61fc39c52 100644 --- a/src/dialogs/more-info-dialog.html +++ b/src/dialogs/more-info-dialog.html @@ -4,11 +4,12 @@ - - + + + - - - - - - - - - - + + + + + + - - - @@ -86,111 +85,72 @@ class MoreInfoDialog extends window.hassMixins.EventsMixin(Polymer.Element) { stateObj: { type: Object, - computed: 'computeStateObj(hass)', - observer: 'stateObjChanged', + computed: '_computeStateObj(hass)', + observer: '_stateObjChanged', }, - stateHistory: Object, - - stateHistoryLoading: Boolean, - - isLoadingHistoryData: { - type: Boolean, - computed: 'computeIsLoadingHistoryData(delayedDialogOpen, stateHistoryLoading)', - }, - - hasHistoryComponent: { - type: Boolean, - computed: 'computeHasHistoryComponent(hass)', - }, - - showHistoryComponent: { + _dialogOpen: { type: Boolean, value: false, - computed: 'computeShowHistoryComponent(hasHistoryComponent, stateObj)', + observer: '_dialogOpenChanged', }, - dialogOpen: { - type: Boolean, - value: false, - observer: 'dialogOpenChanged', - }, + _dialogElement: Object, + _registryInfo: Object, - delayedDialogOpen: { - type: Boolean, - value: false, - }, - - cacheConfig: { - type: Object, - value: { - refresh: 60, - cacheKey: null, - hoursToShow: 24, - }, + _page: { + type: String, + value: null, }, }; } - connectedCallback() { - super.connectedCallback(); - this.$.scrollable.dialogElement = this.$.dialog; + ready() { + super.ready(); + this._dialogElement = this.$.dialog; + this.addEventListener('more-info-page', (ev) => { this._page = ev.detail.page; }); } - computeDomain(stateObj) { + _computeDomain(stateObj) { return stateObj ? window.hassUtil.computeDomain(stateObj) : ''; } - computeStateObj(hass) { + _computeStateObj(hass) { return hass.states[hass.moreInfoEntityId] || null; } - /** - * 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, stateHistoryLoading) { - return !delayedDialogOpen || stateHistoryLoading; - } - - computeHasHistoryComponent(hass) { - return window.hassUtil.isComponentLoaded(hass, 'history'); - } - - computeShowHistoryComponent(hasHistoryComponent, stateObj) { - return this.hasHistoryComponent && stateObj && - window.hassUtil.DOMAINS_WITH_NO_HISTORY - .indexOf(window.hassUtil.computeDomain(stateObj)) === -1; - } - - stateObjChanged(newVal) { + _stateObjChanged(newVal, oldVal) { if (!newVal) { - this.dialogOpen = false; + this._dialogOpen = false; + this._page = null; + this._registryInfo = null; return; } - window.setTimeout(() => { - // allow dialog to render content before showing it so it is + if (window.hassUtil.isComponentLoaded(this.hass, 'config.entity_registry') && + (!oldVal || oldVal.entity_id !== newVal.entity_id)) { + this.hass.callApi('get', `config/entity_registry/${newVal.entity_id}`) + .then( + (info) => { this._registryInfo = info; }, + () => { this._registryInfo = false; } + ); + } + + requestAnimationFrame(() => requestAnimationFrame(() => { + // allow dialog to render content before showing it so it will be // positioned correctly. - this.dialogOpen = true; - }, 10); - if (this.cacheConfig.cacheKey !== `more_info.${newVal.entity_id}`) { - this.cacheConfig = Object.assign( - {}, this.cacheConfig, - { cacheKey: `more_info.${newVal.entity_id}` } - ); + this._dialogOpen = true; + })); + } + + _dialogOpenChanged(newVal) { + if (!newVal && this.stateObj) { + this.fire('hass-more-info', { entityId: null }); } } - dialogOpenChanged(newVal) { - if (newVal) { - window.setTimeout(() => { this.delayedDialogOpen = true; }, 100); - } else if (!newVal && this.stateObj) { - this.fire('hass-more-info', { entityId: null }); - this.delayedDialogOpen = false; - } + _equals(a, b) { + return a === b; } } customElements.define(MoreInfoDialog.is, MoreInfoDialog); diff --git a/src/more-infos/more-info-alarm_control_panel.html b/src/dialogs/more-info/controls/more-info-alarm_control_panel.html similarity index 89% rename from src/more-infos/more-info-alarm_control_panel.html rename to src/dialogs/more-info/controls/more-info-alarm_control_panel.html index f299f474c5..38bf0443ee 100644 --- a/src/more-infos/more-info-alarm_control_panel.html +++ b/src/dialogs/more-info/controls/more-info-alarm_control_panel.html @@ -1,11 +1,10 @@ - + + - + + - - - - + diff --git a/src/more-infos/more-info-automation.html b/src/dialogs/more-info/controls/more-info-automation.html similarity index 72% rename from src/more-infos/more-info-automation.html rename to src/dialogs/more-info/controls/more-info-automation.html index 79878831ee..4018cd0939 100644 --- a/src/more-infos/more-info-automation.html +++ b/src/dialogs/more-info/controls/more-info-automation.html @@ -1,10 +1,10 @@ - + - + - + - + diff --git a/src/more-infos/more-info-camera.html b/src/dialogs/more-info/controls/more-info-camera.html similarity index 91% rename from src/more-infos/more-info-camera.html rename to src/dialogs/more-info/controls/more-info-camera.html index aa6a2862d7..bb6dc95e63 100644 --- a/src/more-infos/more-info-camera.html +++ b/src/dialogs/more-info/controls/more-info-camera.html @@ -1,6 +1,6 @@ - + - + diff --git a/src/more-infos/more-info-climate.html b/src/dialogs/more-info/controls/more-info-climate.html similarity index 94% rename from src/more-infos/more-info-climate.html rename to src/dialogs/more-info/controls/more-info-climate.html index 8563421bc7..db611e8fe6 100644 --- a/src/more-infos/more-info-climate.html +++ b/src/dialogs/more-info/controls/more-info-climate.html @@ -1,17 +1,17 @@ - - + + - + - - - - - + + + + + - + - + diff --git a/src/more-infos/more-info-configurator.html b/src/dialogs/more-info/controls/more-info-configurator.html similarity index 83% rename from src/more-infos/more-info-configurator.html rename to src/dialogs/more-info/controls/more-info-configurator.html index b4549d3800..b14fef2aa0 100644 --- a/src/more-infos/more-info-configurator.html +++ b/src/dialogs/more-info/controls/more-info-configurator.html @@ -1,11 +1,11 @@ - - - - - - + + + + + + - + diff --git a/src/more-infos/more-info-content.html b/src/dialogs/more-info/controls/more-info-content.html similarity index 95% rename from src/more-infos/more-info-content.html rename to src/dialogs/more-info/controls/more-info-content.html index 90a78ed80b..f2e3b03c59 100644 --- a/src/more-infos/more-info-content.html +++ b/src/dialogs/more-info/controls/more-info-content.html @@ -1,4 +1,4 @@ - + diff --git a/src/more-infos/more-info-cover.html b/src/dialogs/more-info/controls/more-info-cover.html similarity index 86% rename from src/more-infos/more-info-cover.html rename to src/dialogs/more-info/controls/more-info-cover.html index 0539f7b25e..27353dfd98 100644 --- a/src/more-infos/more-info-cover.html +++ b/src/dialogs/more-info/controls/more-info-cover.html @@ -1,10 +1,10 @@ - + - - - + + + - + diff --git a/src/more-infos/more-info-default.html b/src/dialogs/more-info/controls/more-info-default.html similarity index 73% rename from src/more-infos/more-info-default.html rename to src/dialogs/more-info/controls/more-info-default.html index 25abfd5cc2..f469b7db29 100644 --- a/src/more-infos/more-info-default.html +++ b/src/dialogs/more-info/controls/more-info-default.html @@ -1,6 +1,6 @@ - + - + diff --git a/src/more-infos/more-info-fan.html b/src/dialogs/more-info/controls/more-info-fan.html similarity index 84% rename from src/more-infos/more-info-fan.html rename to src/dialogs/more-info/controls/more-info-fan.html index c8a0500d6e..7b67c78fff 100644 --- a/src/more-infos/more-info-fan.html +++ b/src/dialogs/more-info/controls/more-info-fan.html @@ -1,15 +1,15 @@ - + - - - - - - + + + + + + - + - + diff --git a/src/more-infos/more-info-group.html b/src/dialogs/more-info/controls/more-info-group.html similarity index 94% rename from src/more-infos/more-info-group.html rename to src/dialogs/more-info/controls/more-info-group.html index 43dc9682cd..a03feb780b 100644 --- a/src/more-infos/more-info-group.html +++ b/src/dialogs/more-info/controls/more-info-group.html @@ -1,6 +1,6 @@ - + - + diff --git a/src/more-infos/more-info-history_graph.html b/src/dialogs/more-info/controls/more-info-history_graph.html similarity index 74% rename from src/more-infos/more-info-history_graph.html rename to src/dialogs/more-info/controls/more-info-history_graph.html index caed29b392..3b9abf0868 100644 --- a/src/more-infos/more-info-history_graph.html +++ b/src/dialogs/more-info/controls/more-info-history_graph.html @@ -1,8 +1,8 @@ - + - + - + diff --git a/src/more-infos/more-info-input_datetime.html b/src/dialogs/more-info/controls/more-info-input_datetime.html similarity index 90% rename from src/more-infos/more-info-input_datetime.html rename to src/dialogs/more-info/controls/more-info-input_datetime.html index 4399c02407..fad93ad0b0 100644 --- a/src/more-infos/more-info-input_datetime.html +++ b/src/dialogs/more-info/controls/more-info-input_datetime.html @@ -1,8 +1,8 @@ - - - - - + + + + + diff --git a/src/more-infos/more-info-light.html b/src/dialogs/more-info/controls/more-info-light.html similarity index 90% rename from src/more-infos/more-info-light.html rename to src/dialogs/more-info/controls/more-info-light.html index 9cbfb6dd12..2632d864aa 100644 --- a/src/more-infos/more-info-light.html +++ b/src/dialogs/more-info/controls/more-info-light.html @@ -1,15 +1,15 @@ - + - - - - + + + + - + - - - + + + diff --git a/src/more-infos/more-info-lock.html b/src/dialogs/more-info/controls/more-info-lock.html similarity index 82% rename from src/more-infos/more-info-lock.html rename to src/dialogs/more-info/controls/more-info-lock.html index bf2d24bc8d..7395dfab8b 100644 --- a/src/more-infos/more-info-lock.html +++ b/src/dialogs/more-info/controls/more-info-lock.html @@ -1,8 +1,8 @@ - + - - - + + + diff --git a/src/more-infos/more-info-media_player.html b/src/dialogs/more-info/controls/more-info-media_player.html similarity index 93% rename from src/more-infos/more-info-media_player.html rename to src/dialogs/more-info/controls/more-info-media_player.html index 01a67d66a3..ba93143f00 100644 --- a/src/more-infos/more-info-media_player.html +++ b/src/dialogs/more-info/controls/more-info-media_player.html @@ -1,16 +1,16 @@ - + - + - + - - - - - + + + + + - + diff --git a/src/more-infos/more-info-script.html b/src/dialogs/more-info/controls/more-info-script.html similarity index 77% rename from src/more-infos/more-info-script.html rename to src/dialogs/more-info/controls/more-info-script.html index c6fe688c8a..c09d76e045 100644 --- a/src/more-infos/more-info-script.html +++ b/src/dialogs/more-info/controls/more-info-script.html @@ -1,6 +1,6 @@ - + - + diff --git a/src/more-infos/more-info-sun.html b/src/dialogs/more-info/controls/more-info-sun.html similarity index 87% rename from src/more-infos/more-info-sun.html rename to src/dialogs/more-info/controls/more-info-sun.html index 4a17e8604c..dfe47b747d 100644 --- a/src/more-infos/more-info-sun.html +++ b/src/dialogs/more-info/controls/more-info-sun.html @@ -1,8 +1,8 @@ - + - + - + diff --git a/src/more-infos/more-info-updater.html b/src/dialogs/more-info/controls/more-info-updater.html similarity index 74% rename from src/more-infos/more-info-updater.html rename to src/dialogs/more-info/controls/more-info-updater.html index a60130fa75..b69fd758d0 100644 --- a/src/more-infos/more-info-updater.html +++ b/src/dialogs/more-info/controls/more-info-updater.html @@ -1,4 +1,4 @@ - + @@ -9,7 +9,7 @@ - Update Instructions + Update Instructions diff --git a/src/more-infos/more-info-vacuum.html b/src/dialogs/more-info/controls/more-info-vacuum.html similarity index 88% rename from src/more-infos/more-info-vacuum.html rename to src/dialogs/more-info/controls/more-info-vacuum.html index 58e8e52557..0f0c5e8d93 100644 --- a/src/more-infos/more-info-vacuum.html +++ b/src/dialogs/more-info/controls/more-info-vacuum.html @@ -1,15 +1,15 @@ - + - + - + - - - - + + + + - + diff --git a/src/dialogs/more-info/more-info-controls.html b/src/dialogs/more-info/more-info-controls.html new file mode 100644 index 0000000000..516ef89f70 --- /dev/null +++ b/src/dialogs/more-info/more-info-controls.html @@ -0,0 +1,165 @@ + + + + + + + + + + + + + + + + [[_computeStateName(stateObj)]] + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/dialogs/more-info/more-info-settings.html b/src/dialogs/more-info/more-info-settings.html new file mode 100644 index 0000000000..d5b1e3589e --- /dev/null +++ b/src/dialogs/more-info/more-info-settings.html @@ -0,0 +1,109 @@ + + + + + + + + + + + + + + [[_computeStateName(stateObj)]] + Save + + + + + + + + +