Hassio: Fix error in store, remove asyn await (#1325)

This commit is contained in:
c727 2018-06-23 00:36:15 +02:00 committed by GitHub
parent c579d7fed3
commit 313a3dd2c9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 11 additions and 7 deletions

View File

@ -82,7 +82,7 @@ class HassioRepositoriesEditor extends PolymerElement {
} }
computeAddRepoData(repoList, url) { computeAddRepoData(repoList, url) {
const list = repoList.map(repo => repo.url); const list = repoList ? repoList.map(repo => repo.url) : [];
list.push(url); list.push(url);
return { addons_repositories: list }; return { addons_repositories: list };
} }

View File

@ -74,7 +74,7 @@ class HassioHostInfo extends EventsMixin(PolymerElement) {
<ha-call-api-button class="warning" hass="[[hass]]" path="hassio/host/shutdown">Shutdown</ha-call-api-button> <ha-call-api-button class="warning" hass="[[hass]]" path="hassio/host/shutdown">Shutdown</ha-call-api-button>
</template> </template>
<template is="dom-if" if="[[_featureAvailable(data, 'hassos')]]"> <template is="dom-if" if="[[_featureAvailable(data, 'hassos')]]">
<ha-call-api-button class="warning" hass="[[hass]]" path="hassio/hassos/config/sync">Load host configs from USB</ha-call-api-button> <ha-call-api-button class="warning" hass="[[hass]]" path="hassio/hassos/config/sync" title="Load HassOS configs or updates from USB">Import from USB</ha-call-api-button>
</template> </template>
<template is="dom-if" if="[[_computeUpdateAvailable(_hassOs)]]"> <template is="dom-if" if="[[_computeUpdateAvailable(_hassOs)]]">
<ha-call-api-button hass="[[hass]]" path="hassio/hassos/update">Update</ha-call-api-button> <ha-call-api-button hass="[[hass]]" path="hassio/hassos/update">Update</ha-call-api-button>
@ -116,11 +116,15 @@ class HassioHostInfo extends EventsMixin(PolymerElement) {
} }
} }
async _dataChanged(data) { _dataChanged(data) {
if (!data.features || !data.features.includes('hassos')) return; if (data.features && data.features.includes('hassos')) {
this.hass.callApi('get', 'hassio/hassos/info')
const resp = await this.hass.callApi('get', 'hassio/hassos/info'); .then((resp) => {
this._hassOs = resp.data; this._hassOs = resp.data;
});
} else {
this._hassOs = {};
}
} }
_computeUpdateAvailable(data) { _computeUpdateAvailable(data) {