+
@@ -72,30 +54,12 @@ class HassioAdvanced extends Polymer.Element {
static get properties() {
return {
- hass: {
- type: Object,
- },
-
- supervisorInfo: {
- type: Object,
- value: {},
- },
-
- hostInfo: {
- type: Object,
- value: {},
- },
-
- hassInfo: {
- type: Object,
- value: {},
- },
+ hass: Object,
+ supervisorInfo: Object,
+ hostInfo: Object,
+ hassInfo: Object,
};
}
-
- backTapped() {
- history.back();
- }
}
customElements.define(HassioAdvanced.is, HassioAdvanced);
diff --git a/hassio/dashboard/hassio-dashboard.html b/hassio/dashboard/hassio-dashboard.html
index 4101f283de..4aee9948ed 100644
--- a/hassio/dashboard/hassio-dashboard.html
+++ b/hassio/dashboard/hassio-dashboard.html
@@ -1,17 +1,4 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
@@ -22,65 +9,17 @@
.content {
margin: 0 auto;
}
- .status {
- @apply(--layout-horizontal);
- margin-bottom: 24px;
- }
- .status > * {
- @apply(--layout-flex);
- }
-
- .status > *:first-child {
- margin-right: 24px;
- }
-
- paper-listbox paper-item {
- cursor: pointer;
- }
-
-
-
-
- Hass.io
-
-
-
-
- Restart Home Assistant
- Snapshots
- Advanced Settings
-
-
-
-
-
-
-
-
-
-
+
+
+
+
@@ -90,56 +29,11 @@ class HassioDashboard extends window.hassMixins.EventsMixin(Polymer.Element) {
static get properties() {
return {
- hass: {
- type: Object,
- },
-
- narrow: {
- type: Boolean,
- },
-
- showMenu: {
- type: Boolean,
- value: false,
- },
-
- supervisorInfo: {
- type: Object,
- value: {},
- },
-
- hassInfo: {
- type: Object,
- value: {},
- },
+ hass: Object,
+ supervisorInfo: Object,
+ hassInfo: Object,
};
}
-
- _openStore(ev) {
- history.pushState(null, null, '/hassio/store');
- this.fire('location-changed');
- ev.target.blur();
- }
-
- _openAdvanced(ev) {
- history.pushState(null, null, '/hassio/advanced');
- this.fire('location-changed');
- ev.target.blur();
- }
-
- _openSnapshot(ev) {
- history.pushState(null, null, '/hassio/snapshot');
- this.fire('location-changed');
- ev.target.blur();
- }
-
- _restartHomeAssistant(ev) {
- ev.target.blur();
- // eslint-disable-next-line no-alert
- if (confirm('Are you sure you want to restart Home Assistant?')) {
- this.hass.callApi('POST', 'hassio/homeassistant/restart');
- }
- }
}
customElements.define(HassioDashboard.is, HassioDashboard);
diff --git a/hassio/hassio-data.html b/hassio/hassio-data.html
index 2618307e26..9220fbfc3e 100644
--- a/hassio/hassio-data.html
+++ b/hassio/hassio-data.html
@@ -8,19 +8,16 @@ class HassioData extends Polymer.Element {
return {
supervisor: {
type: Object,
- value: {},
notify: true,
},
host: {
type: Object,
- value: {},
notify: true,
},
homeassistant: {
type: Object,
- value: {},
notify: true,
},
};
@@ -41,23 +38,23 @@ class HassioData extends Polymer.Element {
fetchSupervisorInfo() {
return this.hass.callApi('get', 'hassio/supervisor/info')
- .then(function (info) {
+ .then((info) => {
this.supervisor = info.data;
- }.bind(this));
+ });
}
fetchHostInfo() {
return this.hass.callApi('get', 'hassio/host/info')
- .then(function (info) {
+ .then((info) => {
this.host = info.data;
- }.bind(this));
+ });
}
fetchHassInfo() {
return this.hass.callApi('get', 'hassio/homeassistant/info')
- .then(function (info) {
+ .then((info) => {
this.homeassistant = info.data;
- }.bind(this));
+ });
}
}
diff --git a/hassio/hassio-main.html b/hassio/hassio-main.html
index 9bcf22c4e4..746a0b44cf 100644
--- a/hassio/hassio-main.html
+++ b/hassio/hassio-main.html
@@ -1,33 +1,19 @@
-
-
-
-
-
-
-
-
-
-
-
+
+
+
-
-
+
+
-
-
-
-
-
-
-
-
+
-
-
+
+
+
-
-
-
-
-
+ narrow='[[narrow]]'
+ show-menu='[[showMenu]]'
+ route='[[route]]'
+ >
+
@@ -117,34 +71,15 @@ class HassioMain extends window.hassMixins.EventsMixin(Polymer.Element) {
path: '/dashboard',
__queryParams: {}
},
- observer: '_routeChanged',
+ observer: 'routeChanged',
},
- _routeData: Object,
- _routeTail: Object,
-
- addon: {
- type: String,
- value: '',
- },
-
- supervisorInfo: {
- type: Object,
- value: null,
- },
-
- hostInfo: {
- type: Object,
- value: null,
- },
-
- hassInfo: {
- type: Object,
- value: null,
- },
-
+ routeData: Object,
+ supervisorInfo: Object,
+ hostInfo: Object,
+ hassInfo: Object,
loaded: {
type: Boolean,
- computed: '_computeIsLoaded(supervisorInfo, hostInfo, hassInfo)',
+ computed: 'computeIsLoaded(supervisorInfo, hostInfo, hassInfo)',
},
};
}
@@ -152,41 +87,45 @@ class HassioMain extends window.hassMixins.EventsMixin(Polymer.Element) {
ready() {
super.ready();
window.hassUtil.applyThemesOnElement(this, this.hass.themes, this.hass.selectedTheme, true);
- this.addEventListener('hass-api-called', ev => this._apiCalled(ev));
+ this.addEventListener('hass-api-called', ev => this.apiCalled(ev));
}
connectedCallback() {
super.connectedCallback();
- this._routeChanged(this.route);
+ this.routeChanged(this.route);
}
- _apiCalled(ev) {
+ apiCalled(ev) {
if (ev.detail.success) {
- var tries = 1;
+ let tries = 1;
- var tryUpdate = function () {
+ const tryUpdate = () => {
this.$.data.refresh().catch(function () {
tries += 1;
setTimeout(tryUpdate, Math.min(tries, 5) * 1000);
});
- }.bind(this);
+ };
tryUpdate();
}
}
- _computeIsLoaded(supervisorInfo, hostInfo, hassInfo) {
+ computeIsLoaded(supervisorInfo, hostInfo, hassInfo) {
return (supervisorInfo !== null &&
hostInfo !== null &&
hassInfo !== null);
}
- _routeChanged(route) {
+ routeChanged(route) {
if (route.path === '' && route.prefix === '/hassio') {
history.replaceState(null, null, '/hassio/dashboard');
this.fire('location-changed');
}
}
+
+ equalsAddon(page) {
+ return page && page === 'addon';
+ }
}
customElements.define(HassioMain.is, HassioMain);
diff --git a/hassio/hassio-pages-with-tabs.html b/hassio/hassio-pages-with-tabs.html
new file mode 100644
index 0000000000..569f2188c4
--- /dev/null
+++ b/hassio/hassio-pages-with-tabs.html
@@ -0,0 +1,103 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Hass.io
+
+
+ Dashboard
+ Snapshots
+ Add-on store
+ System
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/hassio/snapshots/hassio-snapshot.html b/hassio/snapshots/hassio-snapshot.html
index aedfd4bc4b..210781b623 100644
--- a/hassio/snapshots/hassio-snapshot.html
+++ b/hassio/snapshots/hassio-snapshot.html
@@ -31,7 +31,7 @@
}
}
-
+
[[computeName(snapshot)]]
diff --git a/hassio/snapshots/hassio-snapshots.html b/hassio/snapshots/hassio-snapshots.html
index baf8b6592c..da33c3a46d 100644
--- a/hassio/snapshots/hassio-snapshots.html
+++ b/hassio/snapshots/hassio-snapshots.html
@@ -1,8 +1,4 @@
-
-
-
-
@@ -30,92 +26,76 @@
display: none;
}
-
-
-
-
- Snapshots
-
-
-
-
-
-
-
- New snapshot
-
- Snapshots allow you to easily backup and
- restore all data of your Hass.io instance.
-
+
+
+
+ New snapshot
+
+ Snapshots allow you to easily backup and
+ restore all data of your Hass.io instance.
-
-
-
-
-
-
-
- Full snapshot
-
-
- Partial snapshot
-
-
-
- Folders:
-
-
- [[item.name]]
-
-
-
-
- Add-ons:
-
-
- [[item.name]]
-
-
-
-
-
+
+
+
+
+
+
+
+ Full snapshot
+
+
+ Partial snapshot
+
+
+
+ Folders:
+
+
+ [[item.name]]
+
-
-
-
-
-
Available snapshots
-
-
- You don't have any snapshots yet.
-
-
-
-
-
-
-
-
-
-
+
+ Add-ons:
+
+
+ [[item.name]]
+
+
+
+
+
+
Create
+
+ [[error]]
+
+
+
-
+
+
+
Available snapshots
+
+
+ You don't have any snapshots yet.
+
+
+
+
+
+
+
+
+
+
+
this.apiCalled(ev));
- }
-
- visibleChanged(visible) {
- if (visible) {
- this.updateSnapshots();
- }
+ this.updateSnapshots();
}
apiCalled(ev) {
@@ -274,17 +245,6 @@ class HassioSnapshots extends window.hassMixins.EventsMixin(Polymer.Element) {
this.updateOverview = false;
}
}
-
- backTapped() {
- history.back();
- }
-
- refreshTapped() {
- this.hass.callApi('post', 'hassio/snapshots/reload')
- .then(() => {
- this.updateSnapshots();
- });
- }
}
customElements.define(HassioSnapshots.is, HassioSnapshots);
diff --git a/hassio/supervisor/hassio-supervisor.html b/hassio/supervisor/hassio-supervisor.html
index 1919b787d0..54e8cec6d0 100644
--- a/hassio/supervisor/hassio-supervisor.html
+++ b/hassio/supervisor/hassio-supervisor.html
@@ -1,11 +1,6 @@
-
-
-
-
-
-
-
-
-
- Supervisor Logs
-
-
-
-
- [[logs]]
-
+
+ [[log]]
@@ -41,43 +30,27 @@ class HassioSupervisor extends Polymer.Element {
static get properties() {
return {
- hass: {
- type: Object,
- },
-
- visible: {
- type: Boolean,
- observer: '_visibleChanged',
- },
-
- logs: {
- type: String,
- value: '',
- },
+ hass: Object,
+ log: String,
};
}
- _visibleChanged(visible) {
- if (visible) {
- this._loadData();
- }
+ ready() {
+ super.ready();
+ this.loadData();
}
- _loadData() {
+ loadData() {
this.hass.callApi('get', 'hassio/supervisor/logs')
- .then(function (info) {
- this.logs = info;
- }.bind(this), function () {
- this.logs = 'Error fetching logs';
- }.bind(this));
+ .then((info) => {
+ this.log = info;
+ }, () => {
+ this.log = 'Error fetching logs';
+ });
}
- _refreshTapped() {
- this._loadData();
- }
-
- _backTapped() {
- history.back();
+ refreshTapped() {
+ this.loadData();
}
}