From 6b10eeb1e91542bf299988968c03acb9f16ca8b8 Mon Sep 17 00:00:00 2001 From: c727 Date: Thu, 5 Jul 2018 04:49:29 +0200 Subject: [PATCH] Hassio: Add button to change hostname (#1406) * Hassio: Add button to change hostname * Lint * Lint --- hassio/src/system/hassio-host-info.js | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/hassio/src/system/hassio-host-info.js b/hassio/src/system/hassio-host-info.js index 7b2ffae062..92236fc3d9 100644 --- a/hassio/src/system/hassio-host-info.js +++ b/hassio/src/system/hassio-host-info.js @@ -39,7 +39,7 @@ class HassioHostInfo extends EventsMixin(PolymerElement) { margin-top: 16px; } paper-button.info { - max-width: 50%; + max-width: calc(50% - 12px); } @@ -61,7 +61,14 @@ class HassioHostInfo extends EventsMixin(PolymerElement) { - Show hardware + + Hardware + + @@ -166,6 +173,14 @@ class HassioHostInfo extends EventsMixin(PolymerElement) { }); return data; } + + _changeHostnameClicked() { + const curHostname = this.data.hostname; + const hostname = prompt('Please enter a new hostname:', curHostname); + if (hostname && hostname !== curHostname) { + this.hass.callApi('post', 'hassio/host/options', { hostname }); + } + } } customElements.define('hassio-host-info', HassioHostInfo);