More frontend bugfixes

This commit is contained in:
Paulus Schoutsen 2015-02-14 01:06:51 -08:00
parent 3be8a1ad02
commit faddb5d57e
10 changed files with 64 additions and 63 deletions

View file

@ -1,2 +1,2 @@
""" DO NOT MODIFY. Auto-generated by build_frontend script """
VERSION = "3c4dc2ed787b1b4c50b17f4b2bedf0c4"
VERSION = "8a29fbc60ac02a7b0ac05fcc2f69c1fd"

File diff suppressed because one or more lines are too long

View file

@ -4,7 +4,7 @@
<link rel="import" href="../components/state-info.html">
<polymer-element name="state-card-toggle" attributes="stateObj api">
<polymer-element name="state-card-toggle" attributes="stateObj">
<template>
<core-style ref='ha-paper-toggle'></core-style>
@ -13,6 +13,7 @@
<paper-toggle-button self-center
checked="{{toggleChecked}}"
on-change="{{toggleChanged}}"
on-click="{{toggleClicked}}">
</paper-toggle-button>
</div>
@ -20,7 +21,7 @@
</template>
<script>
Polymer({
toggleChecked: -1,
toggleChecked: false,
observe: {
'stateObj.state': 'stateChanged'
@ -30,24 +31,26 @@
this.forceStateChange = this.forceStateChange.bind(this);
},
// prevent the event from propegating
toggleClicked: function(ev) {
ev.stopPropagation();
},
toggleCheckedChanged: function(oldVal, newVal) {
// to filter out init
if(oldVal === -1) {
return;
}
toggleChanged: function(ev) {
var newVal = ev.target.checked;
if(newVal && this.stateObj.state == "off") {
if(newVal && this.stateObj.state === "off") {
this.turn_on();
} else if(!newVal && this.stateObj.state == "on") {
} else if(!newVal && this.stateObj.state === "on") {
this.turn_off();
}
},
stateObjChanged: function(oldVal, newVal) {
if (newVal) {
this.toggleChecked = newVal.state === 'on';
}
},
stateChanged: function(oldVal, newVal) {
this.toggleChecked = newVal === "on";
},

View file

@ -24,7 +24,9 @@
</template>
<script>
Polymer({
var storeListenerMixIn = window.hass.storeListenerMixIn;
Polymer(Polymer.mixin({
stateObj: {},
stateHistory: null,
hasHistoryComponent: false,
@ -34,34 +36,34 @@ Polymer({
},
ready: function() {
this.stateHistoryStoreChanged = this.stateHistoryStoreChanged.bind(this);
window.hass.stateHistoryStore.addChangeListener(this.stateHistoryStoreChanged);
this.listenToStores(true);
},
detached: function() {
window.hass.stateHistoryStore.removeChangeListener(this.stateHistoryStoreChanged);
this.stopListeningToStores();
},
componentStoreChanged: function() {
componentStoreChanged: function(componentStore) {
this.hasHistoryComponent = componentStore.isLoaded('history');
},
stateHistoryStoreChanged: function() {
if (this.stateObj.entityId) {
this.stateHistory = window.hass.stateHistoryStore.get(this.stateObj.entityId);
stateHistoryStoreChanged: function(stateHistoryStore) {
if (this.hasHistoryComponent && this.stateObj && this.stateObj.entityId) {
this.stateHistory = stateHistoryStore.get(this.stateObj.entityId);
} else {
this.stateHistory = null;
}
},
stateObjChanged: function() {
if (this.stateObj.entityId &&
window.hass.stateHistoryStore.isStale(this.stateObj.entityId)) {
// window.hass.stateHistoryActions.fetch(this.stateObj.entityId);
}
if (this.hasHistoryComponent) {
if (this.stateObj && this.stateObj.entityId &&
window.hass.stateHistoryStore.isStale(this.stateObj.entityId)) {
window.hass.stateHistoryActions.fetch(this.stateObj.entityId);
}
this.stateHistoryStoreChanged();
this.stateHistoryStoreChanged();
}
},
/**
@ -84,6 +86,6 @@ Polymer({
}.bind(this));
},
});
}, storeListenerMixIn));
</script>
</polymer-element>

View file

@ -1,10 +1,10 @@
<link rel="import" href="./bower_components/polymer/polymer.html">
<link rel="import" href="./dialogs/more-info-dialog.html">
<script src="./home-assistant-js/dist/homeassistant.min.js"></script>
<script src="./bower_components/moment/moment.js"></script>
<link rel="import" href="./dialogs/more-info-dialog.html">
<script>
var DOMAINS_WITH_CARD = ['thermostat', 'configurator'];
var DOMAINS_WITH_MORE_INFO = ['light', 'group', 'sun', 'configurator'];

@ -1 +1 @@
Subproject commit 7e398ff5239a2d5335a8c32bbe69f0e3c61fa07f
Subproject commit 229e3bfc12ca0270c45003cf3189530c0e9a0875

View file

@ -2,7 +2,7 @@
<link rel="import" href="../bower_components/paper-button/paper-button.html">
<link rel="import" href="../bower_components/paper-spinner/paper-spinner.html">
<polymer-element name="more-info-configurator" attributes="stateObj api">
<polymer-element name="more-info-configurator" attributes="stateObj">
<template>
<style>
p {

View file

@ -1,7 +1,7 @@
<link rel="import" href="../bower_components/polymer/polymer.html">
<link rel="import" href="../bower_components/core-style/core-style.html">
<polymer-element name="more-info-default" attributes="stateObj api">
<polymer-element name="more-info-default" attributes="stateObj">
<template>
<core-style ref='ha-key-value-table'></core-style>
<style>

View file

@ -3,7 +3,7 @@
<link rel="import" href="../bower_components/color-picker-element/dist/color-picker.html">
<polymer-element name="more-info-light" attributes="stateObj api">
<polymer-element name="more-info-light" attributes="stateObj">
<template>
<style>
.brightness {
@ -43,8 +43,8 @@
<div center horizontal layout>
<div>Brightness</div>
<paper-slider
max="255" flex id='brightness'
on-core-change="{{brightnessSliderChanged}}">
max="255" flex id='brightness' value='{{brightnessSliderValue}}'
on-change="{{brightnessSliderChanged}}">
</paper-slider>
</div>
</div>
@ -55,19 +55,20 @@
</template>
<script>
Polymer({
// initial change should be ignored
ignoreNextBrightnessEvent: true,
brightnessSliderValue: 0,
observe: {
'stateObj.attributes.brightness': 'brightnessChanged',
'stateObj.attributes.xy_color': 'colorChanged'
'stateObj.attributes.brightness': 'stateObjBrightnessChanged',
},
brightnessChanged: function(oldVal, newVal) {
this.ignoreNextBrightnessEvent = true;
stateObjChanged: function(oldVal, newVal) {
if (newVal && newVal.state === 'on') {
this.brightnessSliderValue = newVal.attributes.brightness;
}
},
this.$.brightness.value = newVal;
stateObjBrightnessChanged: function(oldVal, newVal) {
this.brightnessSliderValue = newVal;
},
domReady: function() {
@ -75,11 +76,6 @@ Polymer({
},
brightnessSliderChanged: function(ev, details, target) {
if(this.ignoreNextBrightnessEvent) {
this.ignoreNextBrightnessEvent = false;
return;
}
var bri = parseInt(target.value);
if(isNaN(bri)) return;

View file

@ -1,7 +1,7 @@
<link rel="import" href="../bower_components/polymer/polymer.html">
<link rel="import" href="../bower_components/core-style/core-style.html">
<polymer-element name="more-info-sun" attributes="stateObj api">
<polymer-element name="more-info-sun" attributes="stateObj">
<template>
<core-style ref='ha-key-value-table'></core-style>