From 62aa6353908851a8fd648a981e9bf06f2a14a6dc Mon Sep 17 00:00:00 2001 From: Paulus Schoutsen Date: Sun, 12 Feb 2017 22:29:35 -0800 Subject: [PATCH] Add a Z-Wave config panel (#209) --- panels/config/ha-config-section-core.html | 9 +- panels/config/ha-config-section-hassbian.html | 16 +- panels/config/ha-config-section-zwave.html | 252 ++++++++++++++++++ panels/config/ha-config-section.html | 22 +- panels/config/ha-panel-config.html | 81 ++++-- src/resources/ha-style.html | 4 +- 6 files changed, 327 insertions(+), 57 deletions(-) create mode 100644 panels/config/ha-config-section-zwave.html diff --git a/panels/config/ha-config-section-core.html b/panels/config/ha-config-section-core.html index 1780f29cb8..e96e3d870c 100644 --- a/panels/config/ha-config-section-core.html +++ b/panels/config/ha-config-section-core.html @@ -52,8 +52,7 @@ } Server Management @@ -140,11 +139,7 @@ Polymer({ type: Object, }, - narrow: { - type: Boolean, - }, - - showMenu: { + isWide: { type: Boolean, value: false, }, diff --git a/panels/config/ha-config-section-hassbian.html b/panels/config/ha-config-section-hassbian.html index 3a6787da74..3b560b79a6 100644 --- a/panels/config/ha-config-section-hassbian.html +++ b/panels/config/ha-config-section-hassbian.html @@ -32,10 +32,7 @@ font-weight: 500; } - + Bring Hassbian to the next level Discover exciting add-ons to enhance your Home Assistant installation. Add an MQTT server or control a connected TV via HDMI-CEC. @@ -76,15 +73,10 @@ Polymer({ type: Object, }, - narrow: { + isWide: { type: Boolean, }, - showMenu: { - type: Boolean, - value: false, - }, - suiteStatus: { type: Object, value: null, @@ -94,7 +86,7 @@ Polymer({ updateStatus: function () { // TODO tapping install while something is installing triggers a second // update loop to start. - this.hass.callApi('GET', 'hassbian/suites').then(function (suites) { + this.hass.callApi('GET', 'config/hassbian/suites').then(function (suites) { this.suiteStatus = suites; var isInstalling = false; @@ -169,7 +161,7 @@ Polymer({ suiteActionTapped: function () { // TODO install tapped suite - this.hass.callApi('POST', 'hassbian/suites/openzwave/install').then(this.updateStatus); + this.hass.callApi('POST', 'config/hassbian/suites/openzwave/install').then(this.updateStatus); }, }); diff --git a/panels/config/ha-config-section-zwave.html b/panels/config/ha-config-section-zwave.html new file mode 100644 index 0000000000..6e61ba8f34 --- /dev/null +++ b/panels/config/ha-config-section-zwave.html @@ -0,0 +1,252 @@ + + + + + + + + + + + + + + + + + + diff --git a/panels/config/ha-config-section.html b/panels/config/ha-config-section.html index 79b8123916..38223e2a02 100644 --- a/panels/config/ha-config-section.html +++ b/panels/config/ha-config-section.html @@ -1,5 +1,4 @@ - @@ -53,11 +52,6 @@ max-width: 500px; } - - - - -
@@ -90,22 +84,10 @@ Polymer({ value: false, }, - wide: { - type: Boolean, - }, - - wideSidebar: { - type: Boolean, - }, - isWide: { type: Boolean, - computed: 'computeIsWide(showMenu, wideSidebar, wide)' - } - }, - - computeIsWide: function (showMenu, wideSidebar, wide) { - return showMenu ? wideSidebar : wide; + value: false, + }, }, computeContentClasses: function (isWide) { diff --git a/panels/config/ha-panel-config.html b/panels/config/ha-panel-config.html index 7850822289..cb5d15e1a2 100644 --- a/panels/config/ha-panel-config.html +++ b/panels/config/ha-panel-config.html @@ -3,9 +3,10 @@ - + + @@ -60,10 +84,35 @@ Polymer({ type: Boolean, value: false, }, + + wide: { + type: Boolean, + }, + + wideSidebar: { + type: Boolean, + }, + + isWide: { + type: Boolean, + computed: 'computeIsWide(showMenu, wideSidebar, wide)' + }, + }, + + computeIsWide: function (showMenu, wideSidebar, wide) { + return showMenu ? wideSidebar : wide; + }, + + computeClasses: function (isWide) { + return isWide ? 'content' : 'content narrow'; }, computeIsHassbianLoaded(hass) { return window.hassUtil.isComponentLoaded(hass, 'config.hassbian'); }, + + computeIsZwaveLoaded(hass) { + return window.hassUtil.isComponentLoaded(hass, 'config.zwave'); + }, }); diff --git a/src/resources/ha-style.html b/src/resources/ha-style.html index 657405f44a..74c7a580ee 100644 --- a/src/resources/ha-style.html +++ b/src/resources/ha-style.html @@ -77,8 +77,8 @@ @apply(--paper-font-title); } - .card-actions > paper-button, - .card-actions > ha-call-service-button { + .card-actions > paper-button:not([disabled]), + .card-actions > ha-call-service-button:not([disabled]) { color: var(--default-primary-color); font-weight: 500; }