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,
} = 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'];
export default new Polymer({
@ -63,6 +62,7 @@ export default new Polymer({
showHistoryComponent: {
type: Boolean,
value: false,
computed: 'computeShowHistoryComponent(hasHistoryComponent, stateObj)',
},
dialogOpen: {
@ -87,6 +87,11 @@ export default new Polymer({
return !_delayedDialogOpen || _isLoadingHistoryData;
},
computeShowHistoryComponent(hasHistoryComponent, stateObj) {
return this.hasHistoryComponent && stateObj &&
DOMAINS_WITH_NO_HISTORY.indexOf(stateObj.domain) === -1;
},
fetchHistoryData() {
if (this.stateObj && this.hasHistoryComponent &&
this.shouldFetchHistory) {
@ -100,11 +105,6 @@ export default new Polymer({
return;
}
this.showHistoryComponent = (
this.hasHistoryComponent &&
DOMAINS_WITH_NO_HISTORY.indexOf(this.stateObj.domain) === -1
);
this.async(() => {
// Firing action while other action is happening confuses nuclear
this.fetchHistoryData();