Clean up frontend

This commit is contained in:
Paulus Schoutsen 2015-02-19 23:08:53 -08:00
parent 8b590a43be
commit ff4c3f791c
15 changed files with 73 additions and 71 deletions

View File

@ -1,2 +1,2 @@
""" DO NOT MODIFY. Auto-generated by build_frontend script """
VERSION = "516c0ee306fbd56fb3867e23dafdd7a6"
VERSION = "9d3e518a6c0516a3543fe6b364e4307b"

File diff suppressed because one or more lines are too long

View File

@ -31,22 +31,22 @@
</div>
</template>
<script>
Polymer({
var storeListenerMixIn = window.hass.storeListenerMixIn;
Polymer(Polymer.mixin({
cbEventClicked: null,
states: [],
ready: function() {
this.statesUpdated = this.statesUpdated.bind(this);
window.hass.stateStore.addChangeListener(this.statesUpdated);
this.statesUpdated();
attached: function() {
this.listenToStores(true);
},
detached: function() {
window.hass.stateStore.removeChangeListener(this.statesUpdated);
this.stopListeningToStores();
},
statesUpdated: function() {
this.states = window.hass.stateStore.all();
stateStoreChanged: function(stateStore) {
this.states = stateStore.all();
},
handleClick: function(ev) {
@ -55,6 +55,6 @@
}
},
});
}, storeListenerMixIn));
</script>
</polymer-element>

View File

@ -33,22 +33,22 @@
</div>
</template>
<script>
Polymer({
var storeListenerMixIn = window.hass.storeListenerMixIn;
Polymer(Polymer.mixin({
cbEventClicked: null,
events: [],
ready: function() {
this.eventsUpdated = this.eventsUpdated.bind(this);
window.hass.eventStore.addChangeListener(this.eventsUpdated);
this.eventsUpdated();
attached: function() {
this.listenToStores(true);
},
detached: function() {
window.hass.eventStore.removeChangeListener(this.eventsUpdated);
this.stopListeningToStores();
},
eventsUpdated: function() {
this.events = window.hass.eventStore.all();
eventStoreChanged: function(eventStore) {
this.events = eventStore.all();
},
handleClick: function(ev) {
@ -57,6 +57,6 @@
}
},
});
}, storeListenerMixIn));
</script>
</polymer-element>

View File

@ -47,26 +47,26 @@
</div>
</template>
<script>
Polymer({
var storeListenerMixIn = window.hass.storeListenerMixIn;
Polymer(Polymer.mixin({
services: [],
cbServiceClicked: null,
ready: function() {
this.servicesUpdated = this.servicesUpdated.bind(this);
window.hass.serviceStore.addChangeListener(this.servicesUpdated);
this.servicesUpdated();
attached: function() {
this.listenToStores(true);
},
detached: function() {
window.hass.serviceStore.removeChangeListener(this.servicesUpdated);
this.stopListeningToStores();
},
getIcon: function(domain) {
return (new DomainIcon()).icon(domain);
},
servicesUpdated: function() {
this.services = window.hass.serviceStore.all();
serviceStoreChanged: function(serviceStore) {
this.services = serviceStore.all();
},
serviceClicked: function(ev) {
@ -79,6 +79,6 @@
}
}
});
}, storeListenerMixIn));
</script>
</polymer-element>

View File

@ -2,7 +2,7 @@
<link rel="import" href="../cards/state-card.html">
<polymer-element name="state-cards" attributes="states">
<polymer-element name="state-cards" attributes="states" noscript>
<template>
<style>
:host {
@ -53,8 +53,4 @@
</div>
</template>
<script>
Polymer({
});
</script>
</polymer-element>

View File

@ -33,7 +33,7 @@
icon: "swap-vert-circle",
color: 'red',
ready: function() {
attached: function() {
this.listenToStores(true);
},

View File

@ -8,20 +8,13 @@
<polymer-element name="more-info-dialog">
<template>
<ha-dialog id="dialog">
<style>
.title-card {
margin-bottom: 24px;
}
</style>
<div>
<state-card-content stateObj="{{stateObj}}" class='title-card'>
<state-card-content stateObj="{{stateObj}}" style='margin-bottom: 24px;'>
</state-card-content>
<state-timeline stateHistory="{{stateHistory}}"></state-timeline>
<more-info-content stateObj="{{stateObj}}"></more-info-content>
</div>
</ha-dialog>
</template>
<script>
var storeListenerMixIn = window.hass.storeListenerMixIn;
@ -39,7 +32,7 @@ Polymer(Polymer.mixin({
'stateObj.attributes': 'reposition'
},
ready: function() {
attached: function() {
this.listenToStores(true);
},
@ -104,7 +97,6 @@ Polymer(Polymer.mixin({
this.$.dialog.toggle();
}.bind(this));
},
}, storeListenerMixIn));
</script>
</polymer-element>

@ -1 +1 @@
Subproject commit 83d86a9328a79bfb73da16787d8b59862a83fa98
Subproject commit 6222eedb4e042fa08c2393ab465bb4e8c8afd5fd

View File

@ -156,7 +156,7 @@ Polymer(Polymer.mixin({
isStreaming: false,
hasStreamError: false,
ready: function() {
attached: function() {
this.togglePanel = this.togglePanel.bind(this);
this.listenToStores(true);

View File

@ -71,12 +71,9 @@
spinnerMessage: "",
ready: function() {
this.listenToStores(true);
},
attached: function() {
this.focusPassword();
this.listenToStores(true);
},
detached: function() {

View File

@ -37,7 +37,7 @@
Polymer(Polymer.mixin({
stateHistory: null,
ready: function() {
attached: function() {
this.listenToStores(true);
},

View File

@ -38,7 +38,7 @@
isFetching: false,
isStreaming: false,
ready: function() {
attached: function() {
this.listenToStores(true);
},

View File

@ -13,7 +13,6 @@
display: block;
}
</style>
<div id='moreInfoContainer' class='{{classNames}}'></div>
</template>
<script>
@ -56,7 +55,6 @@ Polymer({
this.classNames = Object.keys(newVal).map(
function(key) { return "has-" + key; }).join(' ');
},
});
</script>
</polymer-element>

View File

@ -20,14 +20,33 @@
</template>
</template>
<script>
Polymer({
observe: {
'stateObj.attributes.entity_id': 'updateStates'
var storeListenerMixIn = window.hass.storeListenerMixIn;
var stateStore = window.hass.stateStore;
Polymer(Polymer.mixin({
attached: function() {
this.listenToStores(true);
},
detached: function() {
this.stopListeningToStores();
},
stateStoreChanged: function() {
this.updateStates();
},
stateObjChanged: function() {
this.updateStates();
},
updateStates: function() {
this.states = window.hass.stateStore.gets(this.stateObj.attributes.entity_id);
}
});
if (this.stateObj && this.stateObj.attributes.entity_id) {
this.states = stateStore.gets(this.stateObj.attributes.entity_id);
} else {
this.states = [];
}
},
}, storeListenerMixIn));
</script>
</polymer-element>