Upgrade to latest Home-Assistant-JS

This commit is contained in:
Paulus Schoutsen 2015-03-10 22:40:55 -07:00
parent c7ae0f5f90
commit 020213e682
17 changed files with 60 additions and 69 deletions

View File

@ -1,2 +1,2 @@
""" DO NOT MODIFY. Auto-generated by build_frontend script """ """ DO NOT MODIFY. Auto-generated by build_frontend script """
VERSION = "832b49fd1e3ff3bc33e55812743c3a7d" VERSION = "96734c763abefc639b83ea3ee2190adb"

File diff suppressed because one or more lines are too long

View File

@ -54,6 +54,9 @@
case "configurator": case "configurator":
return "settings"; return "settings";
case "conversation":
return "av:hearing";
default: default:
return "bookmark-outline"; return "bookmark-outline";
} }

View File

@ -22,9 +22,9 @@
</template> </template>
<div> <div>
<template repeat="{{state in states}}"> <template repeat="{{entityID in entityIDs}}">
<div class='eventContainer'> <div class='eventContainer'>
<a on-click={{handleClick}}>{{state.entityId}}</a> <a on-click={{handleClick}}>{{entityID}}</a>
</div> </div>
</template> </template>
@ -35,7 +35,7 @@
Polymer(Polymer.mixin({ Polymer(Polymer.mixin({
cbEventClicked: null, cbEventClicked: null,
states: [], entityIDs: [],
attached: function() { attached: function() {
this.listenToStores(true); this.listenToStores(true);
@ -46,7 +46,7 @@
}, },
stateStoreChanged: function(stateStore) { stateStoreChanged: function(stateStore) {
this.states = stateStore.all(); this.entityIDs = stateStore.entityIDs.toArray();
}, },
handleClick: function(ev) { handleClick: function(ev) {

View File

@ -48,7 +48,7 @@
}, },
eventStoreChanged: function(eventStore) { eventStoreChanged: function(eventStore) {
this.events = eventStore.all(); this.events = eventStore.all;
}, },
handleClick: function(ev) { handleClick: function(ev) {

View File

@ -22,7 +22,7 @@
notificationStoreChanged: function(notificationStore) { notificationStoreChanged: function(notificationStore) {
if (notificationStore.hasNewNotifications(this.lastId)) { if (notificationStore.hasNewNotifications(this.lastId)) {
var toast = this.$.toast; var toast = this.$.toast;
var notification = notificationStore.getLastNotification(); var notification = notificationStore.lastNotification;
this.lastId = notification.id; this.lastId = notification.id;
toast.text = notification.message; toast.text = notification.message;

View File

@ -66,7 +66,7 @@
}, },
serviceStoreChanged: function(serviceStore) { serviceStoreChanged: function(serviceStore) {
this.services = serviceStore.all(); this.services = serviceStore.all;
}, },
serviceClicked: function(ev) { serviceClicked: function(ev) {

View File

@ -42,17 +42,15 @@
}, },
streamStoreChanged: function(streamStore) { streamStoreChanged: function(streamStore) {
this.isStreaming = streamStore.isStreaming(); this.hasError = streamStore.hasError;
this.hasError = streamStore.hasError(); this.$.toggle.checked = this.isStreaming = streamStore.isStreaming;
this.$.toggle.checked = this.isStreaming;
}, },
toggleChanged: function(ev) { toggleChanged: function(ev) {
if (this.isStreaming) { if (this.isStreaming) {
streamActions.stop(); streamActions.stop();
} else { } else {
streamActions.start(authStore.getAuthToken()); streamActions.start(authStore.authToken);
} }
}, },
}, storeListenerMixIn)); }, storeListenerMixIn));

@ -1 +1 @@
Subproject commit 9d0ce4e9b867ce7599969714a9c45f8d58a8463f Subproject commit f2dfda38a2a5e4acf428f10c443f985d8fb23248

View File

@ -58,7 +58,7 @@
}, },
syncStoreChanged: function(syncStore) { syncStoreChanged: function(syncStore) {
this.loaded = syncStore.initialLoadDone(); this.loaded = syncStore.initialLoadDone;
}, },
}, storeListenerMixIn)); }, storeListenerMixIn));
</script> </script>

View File

@ -172,10 +172,8 @@ Polymer(Polymer.mixin({
}, },
streamStoreChanged: function(streamStore) { streamStoreChanged: function(streamStore) {
var state = streamStore.getState(); this.isStreaming = streamStore.isStreaming;
this.hasStreamError = streamStore.hasError;
this.isStreaming = state === streamStore.STATE_CONNECTED;
this.hasStreamError = state === streamStore.STATE_ERROR;
}, },
menuSelect: function(ev, detail, sender) { menuSelect: function(ev, detail, sender) {

View File

@ -107,12 +107,12 @@
}, },
authStoreChanged: function(authStore) { authStoreChanged: function(authStore) {
this.isValidating = authStore.isValidating(); this.isValidating = authStore.isValidating;
this.isLoggedIn = authStore.isLoggedIn(); this.isLoggedIn = authStore.isLoggedIn;
this.spinnerMessage = this.isValidating ? this.MSG_VALIDATING : this.MSG_LOADING_DATA; this.spinnerMessage = this.isValidating ? this.MSG_VALIDATING : this.MSG_LOADING_DATA;
if (authStore.wasLastAttemptInvalid()) { if (authStore.lastAttemptInvalid) {
this.$.passwordDecorator.error = authStore.getLastAttemptMessage(); this.$.passwordDecorator.error = authStore.lastAttemptMessage;
this.$.passwordDecorator.isInvalid = true; this.$.passwordDecorator.isInvalid = true;
} }

View File

@ -50,7 +50,7 @@
stateHistoryActions.fetchAll(); stateHistoryActions.fetchAll();
} }
this.stateHistory = stateHistoryStore.all(); this.stateHistory = stateHistoryStore.all;
}, },
handleRefreshClick: function() { handleRefreshClick: function() {

View File

@ -69,6 +69,8 @@
var voiceActions = window.hass.voiceActions; var voiceActions = window.hass.voiceActions;
var stateStore = window.hass.stateStore; var stateStore = window.hass.stateStore;
var stateGroupFilter = function(state) { return state.domain === 'group'; };
Polymer(Polymer.mixin({ Polymer(Polymer.mixin({
headerTitle: "States", headerTitle: "States",
states: [], states: [],
@ -105,28 +107,19 @@
}, },
syncStoreChanged: function(syncStore) { syncStoreChanged: function(syncStore) {
this.isFetching = syncStore.isFetching(); this.isFetching = syncStore.isFetching;
}, },
streamStoreChanged: function(streamStore) { streamStoreChanged: function(streamStore) {
this.isStreaming = streamStore.isStreaming(); this.isStreaming = streamStore.isStreaming;
}, },
voiceStoreChanged: function(voiceStore) { voiceStoreChanged: function(voiceStore) {
this.isListening = voiceStore.isListening(); this.isListening = voiceStore.isListening;
this.isTransmitting = voiceStore.isTransmitting(); this.isTransmitting = voiceStore.isTransmitting;
this.finalTranscript = voiceStore.getFinalTranscript(); this.finalTranscript = voiceStore.finalTranscript;
this.interimTranscript = voiceStore.interimTranscript.slice(
var interimTranscript = voiceStore.getInterimTranscript(); this.finalTranscript.length)
var lengthFinal = this.finalTranscript.length;
// cut off finalTranscript part from beginning interimTranscript
if (interimTranscript.slice(0, lengthFinal) === this.finalTranscript) {
this.interimTranscript = interimTranscript.slice(lengthFinal);
} else {
this.interimTranscript = interimTranscript;
}
}, },
filterChanged: function() { filterChanged: function() {
@ -144,15 +137,15 @@
}, },
refreshStates: function() { refreshStates: function() {
if (this.filter == 'group') { var states = stateStore.all;
this.states = _.filter(stateStore.all(), function(state) {
return state.domain === 'group'; if (this.filter === 'group') {
}); states = states.filter(stateGroupFilter);
} else { } else {
this.states = _.filter(stateStore.all(), function(state) { states = states.filterNot(stateGroupFilter);
return state.domain !== 'group';
});
} }
this.states = states.toArray();
}, },
handleRefreshClick: function() { handleRefreshClick: function() {

View File

@ -84,7 +84,7 @@
}, },
streamStoreChanged: function(streamStore) { streamStoreChanged: function(streamStore) {
this.isStreaming = streamStore.isStreaming(); this.isStreaming = streamStore.isStreaming;
}, },
submitClicked: function() { submitClicked: function() {

View File

@ -41,11 +41,8 @@ Polymer(Polymer.mixin({
}, },
updateStates: function() { updateStates: function() {
if (this.stateObj && this.stateObj.attributes.entity_id) { this.states = this.stateObj && this.stateObj.attributes.entity_id ?
this.states = stateStore.gets(this.stateObj.attributes.entity_id); stateStore.gets(this.stateObj.attributes.entity_id).toArray() : [];
} else {
this.states = [];
}
}, },
}, storeListenerMixIn)); }, storeListenerMixIn));
</script> </script>

View File

@ -63,7 +63,7 @@
validateAuth: function(authToken, rememberLogin) { validateAuth: function(authToken, rememberLogin) {
authActions.validate(authToken, { authActions.validate(authToken, {
useStreaming: preferenceStore.useStreaming(), useStreaming: preferenceStore.useStreaming,
rememberLogin: rememberLogin, rememberLogin: rememberLogin,
}); });
}, },