More info dialog plays nice again with History

This commit is contained in:
Paulus Schoutsen committed 2015-02-14 12:19:58 -08:00
1 parent 4047bf0775
commit c8cbb8ebb5
3 files changed
+4 -19

No files matched your search

+1 -1
View File
@@ -1,2 +1,2 @@
""" DO NOT MODIFY. Auto-generated by build_frontend script """
VERSION = "3822abfa5abb0a8d60ddf434a2f341d5"
VERSION = "f580c3369e5a44f71d3304dc0939ddd1"
@@ -193,7 +193,7 @@ return pickBy("isBefore",args)};moment.max=function(){var args=[].slice.call(arg
{{stateObj.attributes.errors}}
</p><p class="center" hidden?="{{!stateObj.attributes.description_image}}"><img src="{{stateObj.attributes.description_image}}"></p><p class="submit"><paper-button raised="" on-click="{{submitClicked}}" hidden?="{{action !== 'display'}}">
{{stateObj.attributes.submit_caption || "Set configuration"}}
</paper-button><span hidden?="{{action !== 'configuring'}}"><paper-spinner active="true"></paper-spinner><span>Configuring…</span></span></p></template></div></template><script>Polymer("more-info-configurator",{action:"display",submitClicked:function(){this.action="configuring";var data={configure_id:this.stateObj.attributes.configure_id};window.hass.serviceActions.callService("configurator","configure",data).then(function(){this.action="display";window.hass.syncActions.sync()}.bind(this),function(){this.action="display"}.bind(this))}});</script></polymer-element><polymer-element name="more-info-content" attributes="stateObj" assetpath="polymer/more-infos/"><template><style>:host{display:block}</style><div id="moreInfoContainer" class="{{classNames}}"></div></template><script>Polymer("more-info-content",{classNames:"",observe:{"stateObj.attributes":"stateAttributesChanged"},stateObjChanged:function(oldVal,newVal){var moreInfoContainer=this.$.moreInfoContainer;if(!newVal){if(moreInfoContainer.lastChild){moreInfoContainer.removeChild(moreInfoContainer.lastChild)}return}if(!oldVal||oldVal.moreInfoType!=newVal.moreInfoType){if(moreInfoContainer.lastChild){moreInfoContainer.removeChild(moreInfoContainer.lastChild)}var moreInfo=document.createElement("more-info-"+newVal.moreInfoType);moreInfo.stateObj=newVal;moreInfoContainer.appendChild(moreInfo)}else{moreInfoContainer.lastChild.stateObj=newVal}},stateAttributesChanged:function(oldVal,newVal){this.classNames=Object.keys(newVal).map(function(key){return"has-"+key}).join(" ")}});</script></polymer-element><polymer-element name="more-info-dialog" assetpath="polymer/dialogs/"><template><ha-dialog id="dialog"><style>.title-card{margin-bottom:24px}</style><div><state-card-content stateobj="{{stateObj}}" class="title-card"></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;var stateStore=window.hass.stateStore;var stateHistoryStore=window.hass.stateHistoryStore;var stateHistoryActions=window.hass.stateHistoryActions;Polymer(Polymer.mixin({entityId:false,stateObj:null,stateHistory:null,hasHistoryComponent:false,observe:{"stateObj.attributes":"reposition"},ready:function(){this.listenToStores()},detached:function(){this.stopListeningToStores()},componentStoreChanged:function(componentStore){this.hasHistoryComponent=componentStore.isLoaded("history")},stateStoreChanged:function(){var newState;if(!this.entityId){newState=null}else{newState=stateStore.get(this.entityId)}console.log("state store changed");if(newState!==this.stateObj){console.log("Setting new stateobj");this.stateObj=newState}},stateHistoryStoreChanged:function(){var newHistory;if(this.hasHistoryComponent&&this.entityId){newHistory=stateHistoryStore.get(this.entityId)}else{newHistory=null}if(newHistory!==this.stateHistory){this.stateHistory=newHistory}},changeEntityId:function(entityId){this.entityId=entityId;if(!entityId){this.stateObj=null;this.stateHistory=null;return}this.stateStoreChanged();this.stateHistoryStoreChanged();if(this.hasHistoryComponent&&stateHistoryStore.isStale(entityId)){stateHistoryActions.fetch(entityId)}},reposition:function(oldVal,newVal){if(this.$.dialog.opened){this.job("resizeAfterLayoutChange",function(){this.$.dialog.resizeHandler()}.bind(this),1e3)}},show:function(entityId){this.changeEntityId(entityId);this.job("showDialogAfterRender",function(){this.$.dialog.toggle()}.bind(this))}},storeListenerMixIn));</script></polymer-element><script>var DOMAINS_WITH_CARD=["thermostat","configurator"];var DOMAINS_WITH_MORE_INFO=["light","group","sun","configurator"];PolymerExpressions.prototype.relativeHATime=function(timeString){if(!timeString)return;return moment(window.hass.util.parseDateTime(timeString)).fromNow()};PolymerExpressions.prototype.HATimeStripDate=function(timeString){return(timeString||"").split(" ")[0]};Object.defineProperties(window.hass.stateModel.prototype,{cardType:{get:function(){if(DOMAINS_WITH_CARD.indexOf(this.domain)!==-1){return this.domain}else if(this.canToggle){return"toggle"}else{return"display"}}},moreInfoType:{get:function(){if(DOMAINS_WITH_MORE_INFO.indexOf(this.domain)!==-1){return this.domain}else{return"default"}}},relativeLastChanged:{get:function(){return moment(this.lastChangedAsDate).fromNow()}}});var state,constants=window.hass.constants,dispatcher=window.hass.dispatcher,preferenceStore=window.hass.preferenceStore;var uiActions=window.hass.uiActions={ACTION_SHOW_TOAST:constants.ACTION_SHOW_TOAST,ACTION_SHOW_DIALOG_MORE_INFO:"ACTION_SHOW_DIALOG_MORE_INFO",showMoreInfoDialog:function(entityId){dispatcher.dispatch({actionType:this.ACTION_SHOW_DIALOG_MORE_INFO,entityId:entityId})},validateAuth:function(authToken){window.hass.authActions.validate(authToken,preferenceStore.useStreaming())}};</script><polymer-element name="home-assistant-api" attributes="authLine truncated
</paper-button><span hidden?="{{action !== 'configuring'}}"><paper-spinner active="true"></paper-spinner><span>Configuring…</span></span></p></template></div></template><script>Polymer("more-info-configurator",{action:"display",submitClicked:function(){this.action="configuring";var data={configure_id:this.stateObj.attributes.configure_id};window.hass.serviceActions.callService("configurator","configure",data).then(function(){this.action="display";window.hass.syncActions.sync()}.bind(this),function(){this.action="display"}.bind(this))}});</script></polymer-element><polymer-element name="more-info-content" attributes="stateObj" assetpath="polymer/more-infos/"><template><style>:host{display:block}</style><div id="moreInfoContainer" class="{{classNames}}"></div></template><script>Polymer("more-info-content",{classNames:"",observe:{"stateObj.attributes":"stateAttributesChanged"},stateObjChanged:function(oldVal,newVal){var moreInfoContainer=this.$.moreInfoContainer;if(!newVal){if(moreInfoContainer.lastChild){moreInfoContainer.removeChild(moreInfoContainer.lastChild)}return}if(!oldVal||oldVal.moreInfoType!=newVal.moreInfoType){if(moreInfoContainer.lastChild){moreInfoContainer.removeChild(moreInfoContainer.lastChild)}var moreInfo=document.createElement("more-info-"+newVal.moreInfoType);moreInfo.stateObj=newVal;moreInfoContainer.appendChild(moreInfo)}else{moreInfoContainer.lastChild.stateObj=newVal}},stateAttributesChanged:function(oldVal,newVal){this.classNames=Object.keys(newVal).map(function(key){return"has-"+key}).join(" ")}});</script></polymer-element><polymer-element name="more-info-dialog" assetpath="polymer/dialogs/"><template><ha-dialog id="dialog"><style>.title-card{margin-bottom:24px}</style><div><state-card-content stateobj="{{stateObj}}" class="title-card"></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;var stateStore=window.hass.stateStore;var stateHistoryStore=window.hass.stateHistoryStore;var stateHistoryActions=window.hass.stateHistoryActions;Polymer(Polymer.mixin({entityId:false,stateObj:null,stateHistory:null,hasHistoryComponent:false,observe:{"stateObj.attributes":"reposition"},ready:function(){this.listenToStores(true)},detached:function(){this.stopListeningToStores()},componentStoreChanged:function(componentStore){this.hasHistoryComponent=componentStore.isLoaded("history")},stateStoreChanged:function(){var newState=this.entityId?stateStore.get(this.entityId):null;if(newState!==this.stateObj){this.stateObj=newState}},stateHistoryStoreChanged:function(){var newHistory;if(this.hasHistoryComponent&&this.entityId){newHistory=stateHistoryStore.get(this.entityId)}else{newHistory=null}if(newHistory!==this.stateHistory){this.stateHistory=newHistory}},changeEntityId:function(entityId){this.entityId=entityId;this.stateStoreChanged();this.stateHistoryStoreChanged();if(this.hasHistoryComponent&&stateHistoryStore.isStale(entityId)){stateHistoryActions.fetch(entityId)}},reposition:function(oldVal,newVal){if(this.$.dialog.opened){this.job("resizeAfterLayoutChange",function(){this.$.dialog.resizeHandler()}.bind(this),1e3)}},show:function(entityId){this.changeEntityId(entityId);this.job("showDialogAfterRender",function(){this.$.dialog.toggle()}.bind(this))}},storeListenerMixIn));</script></polymer-element><script>var DOMAINS_WITH_CARD=["thermostat","configurator"];var DOMAINS_WITH_MORE_INFO=["light","group","sun","configurator"];PolymerExpressions.prototype.relativeHATime=function(timeString){if(!timeString)return;return moment(window.hass.util.parseDateTime(timeString)).fromNow()};PolymerExpressions.prototype.HATimeStripDate=function(timeString){return(timeString||"").split(" ")[0]};Object.defineProperties(window.hass.stateModel.prototype,{cardType:{get:function(){if(DOMAINS_WITH_CARD.indexOf(this.domain)!==-1){return this.domain}else if(this.canToggle){return"toggle"}else{return"display"}}},moreInfoType:{get:function(){if(DOMAINS_WITH_MORE_INFO.indexOf(this.domain)!==-1){return this.domain}else{return"default"}}},relativeLastChanged:{get:function(){return moment(this.lastChangedAsDate).fromNow()}}});var state,constants=window.hass.constants,dispatcher=window.hass.dispatcher,preferenceStore=window.hass.preferenceStore;var uiActions=window.hass.uiActions={ACTION_SHOW_TOAST:constants.ACTION_SHOW_TOAST,ACTION_SHOW_DIALOG_MORE_INFO:"ACTION_SHOW_DIALOG_MORE_INFO",showMoreInfoDialog:function(entityId){dispatcher.dispatch({actionType:this.ACTION_SHOW_DIALOG_MORE_INFO,entityId:entityId})},validateAuth:function(authToken){window.hass.authActions.validate(authToken,preferenceStore.useStreaming())}};</script><polymer-element name="home-assistant-api" attributes="auth" assetpath="polymer/"><template><more-info-dialog id="moreInfoDialog"></more-info-dialog></template><script>Polymer("home-assistant-api",{ready:function(){diLine truncated
<div hidden><polymer-element name="login-form" assetpath="polymer/layouts/"><template><style>paper-input{display:block}.login paper-button{margin-left:242px}.login .interact{height:125px}#validatebox{text-align:center}.validatemessage{margin-top:10px}</style><div layout="" horizontal="" center="" fit="" class="login" id="splash"><div layout="" vertical="" center="" flex=""><img src="/static/favicon-192x192.png"><h1>Home Assistant</h1><a href="polymer/layouts/#" id="hideKeyboardOnFocus"></a><div class="interact" layout="" vertical=""><div id="loginform" hidden?="{{isValidating || isLoggedIn}}"><paper-input-decorator label="Password" id="passwordDecorator"><input is="core-input" type="password" id="passwordInput" value="{{authToken}}" on-keyup="{{passwordKeyup}}"></paper-input-decorator><paper-button on-click="{{validatePassword}}">Log In</paper-button></div><div id="validatebox" hidden?="{{!(isValidating || isLoggedIn)}}"><paper-spinner active="true"></paper-spinner><br><div class="validatemessage">{{spinnerMessage}}</div></div></div></div></div></template><script>var storeListenerMixIn=window.hass.storeListenerMixIn;Polymer(Polymer.mixin({MSG_VALIDATING:"Validating password…",MSG_LOADING_DATA:"Loading data…",authToken:"",isValidating:false,isLoggedIn:false,spinnerMessage:"",ready:function(){this.listenToStores(true)},attached:function(){this.focusPassword()},detached:function(){this.stopListeningToStores()},authStoreChanged:function(authStore){this.isValidating=authStore.isValidating();this.isLoggedIn=authStore.isLoggedIn();this.spinnerMessage=this.isValidating?this.MSG_VALIDATING:this.MSG_LOADING_DATA;if(authStore.wasLastAttemptInvalid()){this.$.passwordDecorator.error=this.authStore.getLastAttemptMessage();this.$.passwordDecorator.isInvalid=true}if(!(this.isValidating&&this.isLoggedIn)){this.job("focusPasswordBox",this.focusPassword.bind(this))}},focusPassword:function(){this.$.passwordInput.focus()},passwordKeyup:function(ev){if(ev.keyCode===13){this.validatePassword()}else if(this.$.passwordDecorator.isInvalid){this.$.passwordDecorator.isInvalid=false}},validatePassword:function(){this.$.hideKeyboardOnFocus.focus();window.hass.uiActions.validateAuth(this.authToken)}},storeListenerMixIn));</script></polymer-element></div>
<div hidden><polymer-element name="core-media-query" attributes="query queryMatches" assetpath="polymer/bower_components/core-media-query/"><template><style>:host{display:none}</style></template><script>Polymer("core-media-query",{queryMatches:false,query:"",ready:function(){this._mqHandler=this.queryHandler.bind(this);this._mq=null},queryChanged:function(){if(this._mq){this._mq.removeListener(this._mqHandler)}var query=this.query;if(query[0]!=="("){query="("+this.query+")"}this._mq=window.matchMedia(query);this._mq.addListener(this._mqHandler);this.queryHandler(this._mq)},queryHandler:function(mq){this.queryMatches=mq.matches;this.asyncFire("core-media-change",mq)}});</script></polymer-element><polymer-element name="core-selection" attributes="multi" hidden assetpath="polymer/bower_components/core-selection/"><script>Polymer("core-selection",{multi:false,ready:function(){this.clear()},clear:function(){this.selection=[]},getSelection:function(){return this.multi?this.selection:this.selection[0]},isSelected:function(item){return this.selection.indexOf(item)>=0},setItemSelected:function(item,isSelected){if(item!==undefined&&item!==null){if(isSelected){this.selection.push(item)}else{var i=this.selection.indexOf(item);if(i>=0){this.selection.splice(i,1)}}this.fire("core-select",{isSelected:isSelected,item:item})}},select:function(item){if(this.multi){this.toggle(item)}else if(this.getSelection()!==item){this.setItemSelected(this.getSelection(),false);this.setItemSelected(item,true)}},toggle:function(item){this.setItemSelected(item,!this.isSelected(item))}});</script></polymer-element><polymer-element name="core-selector" attributes="selected multi valueattr selectedClass selectedProperty selectedAttribute selectedItem selectedModel selectedIndex notap excludedLocalNames target itemsSelector activateEvent" assetpath="polymer/bower_components/core-selector/"><template><core-selection id="selection" multi="{{multi}}" on-core-select="{{selectionSelect}}"></core-selection><content id="items" select="*"></content></template><script>Polymer("core-selector",{selected:null,multi:false,valueattr:"name",selectedClass:"core-selected",selectedProperty:"",selectedAttribute:"active",selectedItem:null,selectedModel:null,selectedIndex:-1,excludedLocalNames:"",target:null,itemsSelector:"",activateEvent:"tap",notap:false,defaultExcludedLocalNames:"template",observe:{"selected multi":"selectedChanged"},ready:function(){this.activateListener=this.activateHandler.bind(this);this.itemFilter=this.filterItem.bind(this);this.excludedLocalNamesChanged();this.observer=new MutationObserver(this.updateSelected.bind(this));if(!this.target){this.target=this}},get items(){if(!this.target){return[]}var nodes=this.target!==this?this.itemsSelector?this.target.querySelectorAll(this.itemsSelector):this.target.children:this.$.items.getDistributedNodes();return Array.prototype.filter.call(nodes,this.itemFilter)},filterItem:function(node){return!this._excludedNames[node.localName]},excludedLocalNamesChanged:function(){this._excludedNames={};var s=this.defaultExcludedLocalNames;if(this.excludedLocalNames){s+=" "+this.excludedLocalNames}s.split(/\s+/g).forEach(function(n){this._excludedNames[n]=1},this)},targetChanged:function(old){if(old){this.removeListener(old);this.observer.disconnect();this.clearSelection()}if(this.target){this.addListener(this.target);this.observer.observe(this.target,{childList:true});this.updateSelected()}},addListener:function(node){Polymer.addEventListener(node,this.activateEvent,this.activateListener)},removeListener:function(node){Polymer.removeEventListener(node,this.activateEvent,this.activateListener)},get selection(){return this.$.selection.getSelection()},selectedChanged:function(){if(arguments.length===1){this.processSplices(arguments[0])}else{this.updateSelected()}},updateSelected:function(){this.validateSelected();if(this.multi){this.clearSelection(this.selected);this.selected&&this.selected.forEach(function(s){this.setValueSelected(s,true)},this)}else{this.valueToSelection(this.selected)}},validateSelected:function(){if(this.multi&&!Array.isArray(this.selected)&&this.selected!=null){this.selected=[this.selected]}else if(!this.multi&&Array.isArray(this.selected)){var s=this.selected[0];this.clearSelection([s]);this.selected=s}},processSplices:function(splices){for(var i=0,splice;splice=splices[i];i++){for(var j=0;j<splice.removed.length;j++){this.setValueSelected(splice.removed[j],false)}for(var j=0;j<splice.addedCount;j++){this.setValueSelected(this.selected[splice.index+j],true)}}},clearSelection:function(excludes){this.$.selection.selection.slice().forEach(function(item){var v=this.valueForNode(item)||this.items.indexOf(item);if(!excludes||excludes.indexOf(v)<0){this.$.selection.setItemSelected(item,false)}},this)},valueToSelection:function(value){var item=this.valueToItem(value);this.$.selection.select(item)},setValueSelected:function(value,isSelected){var item=this.valueToItem(value);if(isSelected^this.$.selectLine truncated
It looks like we have nothing to show you right now. It could be that we have not yet discovered all your devices but it is more likely that you have not configured Home Assistant yet.
@@ -40,7 +40,7 @@ Polymer(Polymer.mixin({
},
ready: function() {
this.listenToStores();
this.listenToStores(true);
},
detached: function() {
@@ -52,18 +52,9 @@ Polymer(Polymer.mixin({
},
stateStoreChanged: function() {
var newState;
if (!this.entityId) {
newState = null;
} else {
newState = stateStore.get(this.entityId);
}
console.log('state store changed');
var newState = this.entityId ? stateStore.get(this.entityId) : null;
if (newState !== this.stateObj) {
console.log("Setting new stateobj");
this.stateObj = newState;
}
},
@@ -85,12 +76,6 @@ Polymer(Polymer.mixin({
changeEntityId: function(entityId) {
this.entityId = entityId;
if (!entityId) {
this.stateObj = null;
this.stateHistory = null;
return;
}
this.stateStoreChanged();
this.stateHistoryStoreChanged();