More info dialog cleanup

This commit is contained in:
Paulus Schoutsen 2016-02-16 20:46:21 -08:00
parent 75cc118cb1
commit 70b04333f1

View File

@ -15,7 +15,6 @@ const {
moreInfoActions, moreInfoActions,
} = hass; } = hass;
// if you don't want the history component to show add the domain to this array
const DOMAINS_WITH_NO_HISTORY = ['camera', 'configurator', 'scene']; const DOMAINS_WITH_NO_HISTORY = ['camera', 'configurator', 'scene'];
export default new Polymer({ export default new Polymer({
@ -63,6 +62,7 @@ export default new Polymer({
showHistoryComponent: { showHistoryComponent: {
type: Boolean, type: Boolean,
value: false, value: false,
computed: 'computeShowHistoryComponent(hasHistoryComponent, stateObj)',
}, },
dialogOpen: { dialogOpen: {
@ -87,6 +87,11 @@ export default new Polymer({
return !_delayedDialogOpen || _isLoadingHistoryData; return !_delayedDialogOpen || _isLoadingHistoryData;
}, },
computeShowHistoryComponent(hasHistoryComponent, stateObj) {
return this.hasHistoryComponent && stateObj &&
DOMAINS_WITH_NO_HISTORY.indexOf(stateObj.domain) === -1;
},
fetchHistoryData() { fetchHistoryData() {
if (this.stateObj && this.hasHistoryComponent && if (this.stateObj && this.hasHistoryComponent &&
this.shouldFetchHistory) { this.shouldFetchHistory) {
@ -100,11 +105,6 @@ export default new Polymer({
return; return;
} }
this.showHistoryComponent = (
this.hasHistoryComponent &&
DOMAINS_WITH_NO_HISTORY.indexOf(this.stateObj.domain) === -1
);
this.async(() => { this.async(() => {
// Firing action while other action is happening confuses nuclear // Firing action while other action is happening confuses nuclear
this.fetchHistoryData(); this.fetchHistoryData();