More frontend bugfixes
This commit is contained in:
parent
3be8a1ad02
commit
faddb5d57e
10 changed files with 64 additions and 63 deletions
|
@ -1,2 +1,2 @@
|
||||||
""" DO NOT MODIFY. Auto-generated by build_frontend script """
|
""" DO NOT MODIFY. Auto-generated by build_frontend script """
|
||||||
VERSION = "3c4dc2ed787b1b4c50b17f4b2bedf0c4"
|
VERSION = "8a29fbc60ac02a7b0ac05fcc2f69c1fd"
|
||||||
|
|
File diff suppressed because one or more lines are too long
|
@ -4,7 +4,7 @@
|
||||||
|
|
||||||
<link rel="import" href="../components/state-info.html">
|
<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>
|
<template>
|
||||||
<core-style ref='ha-paper-toggle'></core-style>
|
<core-style ref='ha-paper-toggle'></core-style>
|
||||||
|
|
||||||
|
@ -13,6 +13,7 @@
|
||||||
|
|
||||||
<paper-toggle-button self-center
|
<paper-toggle-button self-center
|
||||||
checked="{{toggleChecked}}"
|
checked="{{toggleChecked}}"
|
||||||
|
on-change="{{toggleChanged}}"
|
||||||
on-click="{{toggleClicked}}">
|
on-click="{{toggleClicked}}">
|
||||||
</paper-toggle-button>
|
</paper-toggle-button>
|
||||||
</div>
|
</div>
|
||||||
|
@ -20,7 +21,7 @@
|
||||||
</template>
|
</template>
|
||||||
<script>
|
<script>
|
||||||
Polymer({
|
Polymer({
|
||||||
toggleChecked: -1,
|
toggleChecked: false,
|
||||||
|
|
||||||
observe: {
|
observe: {
|
||||||
'stateObj.state': 'stateChanged'
|
'stateObj.state': 'stateChanged'
|
||||||
|
@ -30,24 +31,26 @@
|
||||||
this.forceStateChange = this.forceStateChange.bind(this);
|
this.forceStateChange = this.forceStateChange.bind(this);
|
||||||
},
|
},
|
||||||
|
|
||||||
// prevent the event from propegating
|
|
||||||
toggleClicked: function(ev) {
|
toggleClicked: function(ev) {
|
||||||
ev.stopPropagation();
|
ev.stopPropagation();
|
||||||
},
|
},
|
||||||
|
|
||||||
toggleCheckedChanged: function(oldVal, newVal) {
|
toggleChanged: function(ev) {
|
||||||
// to filter out init
|
var newVal = ev.target.checked;
|
||||||
if(oldVal === -1) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if(newVal && this.stateObj.state == "off") {
|
if(newVal && this.stateObj.state === "off") {
|
||||||
this.turn_on();
|
this.turn_on();
|
||||||
} else if(!newVal && this.stateObj.state == "on") {
|
} else if(!newVal && this.stateObj.state === "on") {
|
||||||
this.turn_off();
|
this.turn_off();
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
stateObjChanged: function(oldVal, newVal) {
|
||||||
|
if (newVal) {
|
||||||
|
this.toggleChecked = newVal.state === 'on';
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
stateChanged: function(oldVal, newVal) {
|
stateChanged: function(oldVal, newVal) {
|
||||||
this.toggleChecked = newVal === "on";
|
this.toggleChecked = newVal === "on";
|
||||||
},
|
},
|
||||||
|
|
|
@ -24,7 +24,9 @@
|
||||||
|
|
||||||
</template>
|
</template>
|
||||||
<script>
|
<script>
|
||||||
Polymer({
|
var storeListenerMixIn = window.hass.storeListenerMixIn;
|
||||||
|
|
||||||
|
Polymer(Polymer.mixin({
|
||||||
stateObj: {},
|
stateObj: {},
|
||||||
stateHistory: null,
|
stateHistory: null,
|
||||||
hasHistoryComponent: false,
|
hasHistoryComponent: false,
|
||||||
|
@ -34,34 +36,34 @@ Polymer({
|
||||||
},
|
},
|
||||||
|
|
||||||
ready: function() {
|
ready: function() {
|
||||||
this.stateHistoryStoreChanged = this.stateHistoryStoreChanged.bind(this);
|
this.listenToStores(true);
|
||||||
|
|
||||||
window.hass.stateHistoryStore.addChangeListener(this.stateHistoryStoreChanged);
|
|
||||||
},
|
},
|
||||||
|
|
||||||
detached: function() {
|
detached: function() {
|
||||||
window.hass.stateHistoryStore.removeChangeListener(this.stateHistoryStoreChanged);
|
this.stopListeningToStores();
|
||||||
},
|
},
|
||||||
|
|
||||||
componentStoreChanged: function() {
|
componentStoreChanged: function(componentStore) {
|
||||||
this.hasHistoryComponent = componentStore.isLoaded('history');
|
this.hasHistoryComponent = componentStore.isLoaded('history');
|
||||||
},
|
},
|
||||||
|
|
||||||
stateHistoryStoreChanged: function() {
|
stateHistoryStoreChanged: function(stateHistoryStore) {
|
||||||
if (this.stateObj.entityId) {
|
if (this.hasHistoryComponent && this.stateObj && this.stateObj.entityId) {
|
||||||
this.stateHistory = window.hass.stateHistoryStore.get(this.stateObj.entityId);
|
this.stateHistory = stateHistoryStore.get(this.stateObj.entityId);
|
||||||
} else {
|
} else {
|
||||||
this.stateHistory = null;
|
this.stateHistory = null;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
stateObjChanged: function() {
|
stateObjChanged: function() {
|
||||||
if (this.stateObj.entityId &&
|
if (this.hasHistoryComponent) {
|
||||||
window.hass.stateHistoryStore.isStale(this.stateObj.entityId)) {
|
if (this.stateObj && this.stateObj.entityId &&
|
||||||
// window.hass.stateHistoryActions.fetch(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));
|
}.bind(this));
|
||||||
},
|
},
|
||||||
|
|
||||||
});
|
}, storeListenerMixIn));
|
||||||
</script>
|
</script>
|
||||||
</polymer-element>
|
</polymer-element>
|
||||||
|
|
|
@ -1,10 +1,10 @@
|
||||||
<link rel="import" href="./bower_components/polymer/polymer.html">
|
<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="./home-assistant-js/dist/homeassistant.min.js"></script>
|
||||||
<script src="./bower_components/moment/moment.js"></script>
|
<script src="./bower_components/moment/moment.js"></script>
|
||||||
|
|
||||||
|
<link rel="import" href="./dialogs/more-info-dialog.html">
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
var DOMAINS_WITH_CARD = ['thermostat', 'configurator'];
|
var DOMAINS_WITH_CARD = ['thermostat', 'configurator'];
|
||||||
var DOMAINS_WITH_MORE_INFO = ['light', 'group', 'sun', 'configurator'];
|
var DOMAINS_WITH_MORE_INFO = ['light', 'group', 'sun', 'configurator'];
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
Subproject commit 7e398ff5239a2d5335a8c32bbe69f0e3c61fa07f
|
Subproject commit 229e3bfc12ca0270c45003cf3189530c0e9a0875
|
|
@ -2,7 +2,7 @@
|
||||||
<link rel="import" href="../bower_components/paper-button/paper-button.html">
|
<link rel="import" href="../bower_components/paper-button/paper-button.html">
|
||||||
<link rel="import" href="../bower_components/paper-spinner/paper-spinner.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>
|
<template>
|
||||||
<style>
|
<style>
|
||||||
p {
|
p {
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
<link rel="import" href="../bower_components/polymer/polymer.html">
|
<link rel="import" href="../bower_components/polymer/polymer.html">
|
||||||
<link rel="import" href="../bower_components/core-style/core-style.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>
|
<template>
|
||||||
<core-style ref='ha-key-value-table'></core-style>
|
<core-style ref='ha-key-value-table'></core-style>
|
||||||
<style>
|
<style>
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
|
|
||||||
<link rel="import" href="../bower_components/color-picker-element/dist/color-picker.html">
|
<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>
|
<template>
|
||||||
<style>
|
<style>
|
||||||
.brightness {
|
.brightness {
|
||||||
|
@ -43,8 +43,8 @@
|
||||||
<div center horizontal layout>
|
<div center horizontal layout>
|
||||||
<div>Brightness</div>
|
<div>Brightness</div>
|
||||||
<paper-slider
|
<paper-slider
|
||||||
max="255" flex id='brightness'
|
max="255" flex id='brightness' value='{{brightnessSliderValue}}'
|
||||||
on-core-change="{{brightnessSliderChanged}}">
|
on-change="{{brightnessSliderChanged}}">
|
||||||
</paper-slider>
|
</paper-slider>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -55,19 +55,20 @@
|
||||||
</template>
|
</template>
|
||||||
<script>
|
<script>
|
||||||
Polymer({
|
Polymer({
|
||||||
|
brightnessSliderValue: 0,
|
||||||
// initial change should be ignored
|
|
||||||
ignoreNextBrightnessEvent: true,
|
|
||||||
|
|
||||||
observe: {
|
observe: {
|
||||||
'stateObj.attributes.brightness': 'brightnessChanged',
|
'stateObj.attributes.brightness': 'stateObjBrightnessChanged',
|
||||||
'stateObj.attributes.xy_color': 'colorChanged'
|
|
||||||
},
|
},
|
||||||
|
|
||||||
brightnessChanged: function(oldVal, newVal) {
|
stateObjChanged: function(oldVal, newVal) {
|
||||||
this.ignoreNextBrightnessEvent = true;
|
if (newVal && newVal.state === 'on') {
|
||||||
|
this.brightnessSliderValue = newVal.attributes.brightness;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
this.$.brightness.value = newVal;
|
stateObjBrightnessChanged: function(oldVal, newVal) {
|
||||||
|
this.brightnessSliderValue = newVal;
|
||||||
},
|
},
|
||||||
|
|
||||||
domReady: function() {
|
domReady: function() {
|
||||||
|
@ -75,11 +76,6 @@ Polymer({
|
||||||
},
|
},
|
||||||
|
|
||||||
brightnessSliderChanged: function(ev, details, target) {
|
brightnessSliderChanged: function(ev, details, target) {
|
||||||
if(this.ignoreNextBrightnessEvent) {
|
|
||||||
this.ignoreNextBrightnessEvent = false;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
var bri = parseInt(target.value);
|
var bri = parseInt(target.value);
|
||||||
|
|
||||||
if(isNaN(bri)) return;
|
if(isNaN(bri)) return;
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
<link rel="import" href="../bower_components/polymer/polymer.html">
|
<link rel="import" href="../bower_components/polymer/polymer.html">
|
||||||
<link rel="import" href="../bower_components/core-style/core-style.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>
|
<template>
|
||||||
<core-style ref='ha-key-value-table'></core-style>
|
<core-style ref='ha-key-value-table'></core-style>
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue