diff --git a/bower.json b/bower.json index 883616143c..c302a04b8d 100644 --- a/bower.json +++ b/bower.json @@ -17,7 +17,9 @@ "google-apis": "GoogleWebComponents/google-apis#~1.1.6", "font-roboto-local": "^1.0.1", "iron-flex-layout": "^1.3.1", - "paper-scroll-header-panel": "1.0.16" + "paper-scroll-header-panel": "1.0.16", + "app-elements": "^0.9.0", + "app-layout": "^0.10.1" }, "_comment": "added to get min version for iron-flex-layout, paper-scroll-header-panel" } diff --git a/panels/dev-event/ha-panel-dev-event.html b/panels/dev-event/ha-panel-dev-event.html index f97c2f4c1e..9533e5df7a 100644 --- a/panels/dev-event/ha-panel-dev-event.html +++ b/panels/dev-event/ha-panel-dev-event.html @@ -5,23 +5,29 @@ - + + + + + + diff --git a/panels/dev-info/ha-panel-dev-info.html b/panels/dev-info/ha-panel-dev-info.html index f1aeadfbe1..589b95b231 100644 --- a/panels/dev-info/ha-panel-dev-info.html +++ b/panels/dev-info/ha-panel-dev-info.html @@ -2,22 +2,28 @@ - + + + + + + + + diff --git a/panels/dev-state/ha-panel-dev-state.html b/panels/dev-state/ha-panel-dev-state.html index ec97658b59..f10c22670d 100644 --- a/panels/dev-state/ha-panel-dev-state.html +++ b/panels/dev-state/ha-panel-dev-state.html @@ -4,58 +4,85 @@ + - + + + - + + + @@ -63,6 +90,8 @@ Polymer({ is: 'ha-panel-dev-state', + behaviors: [window.hassBehavior], + properties: { hass: { type: Object, @@ -78,43 +107,51 @@ Polymer({ value: false, }, - entityId: { + _entityId: { type: String, value: '', }, - state: { + _state: { type: String, value: '', }, - stateAttributes: { + _stateAttributes: { type: String, value: '', }, - }, - setStateData: function (stateData) { - var value = stateData ? JSON.stringify(stateData, null, ' ') : ''; + _showAttributes: { + type: Boolean, + value: true, + }, - this.$.inputData.value = value; - - // not according to the spec but it works... - this.$.inputDataWrapper.update(this.$.inputData); + _entities: { + type: Array, + bindNuclear: function (hass) { + return [ + hass.entityGetters.entityMap, + function (map) { + return map.valueSeq().sortBy(function (entity) { return entity.entityId; }).toArray(); + }, + ]; + }, + }, }, entitySelected: function (ev) { - var state = this.hass.reactor.evaluate(this.hass.entityGetters.byId(ev.detail.entityId)); - - this.entityId = state.entityId; - this.state = state.state; - this.stateAttributes = JSON.stringify(state.attributes, null, ' '); + var state = ev.model.entity; + this._entityId = state.entityId; + this._state = state.state; + this._stateAttributes = JSON.stringify(state.attributes, null, ' '); + ev.preventDefault(); }, handleSetState: function () { var attr; try { - attr = this.stateAttributes ? JSON.parse(this.stateAttributes) : {}; + attr = this.stateAttributes ? JSON.parse(this._stateAttributes) : {}; } catch (err) { /* eslint-disable no-alert */ alert('Error parsing JSON: ' + err); @@ -123,15 +160,28 @@ Polymer({ } this.hass.entityActions.save({ - entityId: this.entityId, - state: this.state, + entityId: this._entityId, + state: this._state, attributes: attr, }); }, - computeFormClasses: function (narrow) { - return narrow ? - 'content fit' : 'content fit layout horizontal'; + computeShowAttributes: function (narrow, _showAttributes) { + return !narrow && _showAttributes; + }, + + attributeString: function (entity) { + var output = ''; + var i; + var keys; + var key; + + for (i = 0, keys = Object.keys(entity.attributes); i < keys.length; i++) { + key = keys[i]; + output += key + ': ' + entity.attributes[key] + '\n'; + } + + return output; }, }); diff --git a/panels/dev-template/ha-panel-dev-template.html b/panels/dev-template/ha-panel-dev-template.html index 1132ab8b6a..8f5f421ef1 100644 --- a/panels/dev-template/ha-panel-dev-template.html +++ b/panels/dev-template/ha-panel-dev-template.html @@ -4,23 +4,29 @@ - + + + + + + diff --git a/panels/history/ha-panel-history.html b/panels/history/ha-panel-history.html index 60e800dccd..4ba7480395 100644 --- a/panels/history/ha-panel-history.html +++ b/panels/history/ha-panel-history.html @@ -2,15 +2,19 @@ - + + + + + + diff --git a/panels/iframe/ha-panel-iframe.html b/panels/iframe/ha-panel-iframe.html index a243ade784..c0fd889fee 100644 --- a/panels/iframe/ha-panel-iframe.html +++ b/panels/iframe/ha-panel-iframe.html @@ -1,19 +1,23 @@ - + + + +