mirror of
https://github.com/home-assistant/frontend.git
synced 2025-07-13 20:36:35 +00:00
Hassio enable beta updates from UI (#993)
* Hassio enable beta updates from UI * Feedback * Feedback2
This commit is contained in:
parent
196ea97917
commit
e0ca88b3ad
@ -8,16 +8,17 @@
|
|||||||
<style include="iron-flex ha-style">
|
<style include="iron-flex ha-style">
|
||||||
paper-card {
|
paper-card {
|
||||||
display: inline-block;
|
display: inline-block;
|
||||||
width: 350px;
|
width: 400px;
|
||||||
|
margin-left: 8px;
|
||||||
}
|
}
|
||||||
.card-content {
|
.card-content {
|
||||||
height: 110px;
|
height: 110px;
|
||||||
}
|
}
|
||||||
@media screen and (max-width: 730px) {
|
@media screen and (max-width: 830px) {
|
||||||
paper-card {
|
paper-card {
|
||||||
margin-top: 8px;
|
margin-top: 8px;
|
||||||
|
margin-left: 0;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
height: 100%;
|
|
||||||
}
|
}
|
||||||
.card-content {
|
.card-content {
|
||||||
height: 100%;
|
height: 100%;
|
||||||
@ -38,17 +39,17 @@
|
|||||||
<div class="card-content">
|
<div class="card-content">
|
||||||
<table class='info'>
|
<table class='info'>
|
||||||
<tr>
|
<tr>
|
||||||
<td>Type</td>
|
<td>Version</td>
|
||||||
<td>[[data.type]] ([[data.os]])</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td>Host controller version</td>
|
|
||||||
<td>[[data.version]]</td>
|
<td>[[data.version]]</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td>Latest version</td>
|
<td>Latest version</td>
|
||||||
<td>[[data.last_version]]</td>
|
<td>[[data.last_version]]</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>Type</td>
|
||||||
|
<td>[[data.type]] ([[data.os]])</td>
|
||||||
|
</tr>
|
||||||
</table>
|
</table>
|
||||||
<template is='dom-if' if='[[errors]]'>
|
<template is='dom-if' if='[[errors]]'>
|
||||||
<div class='errors'>Error: [[errors]]</div>
|
<div class='errors'>Error: [[errors]]</div>
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
<link rel="import" href="../../bower_components/polymer/polymer-element.html">
|
<link rel="import" href="../../bower_components/polymer/polymer-element.html">
|
||||||
<link rel="import" href="../../bower_components/paper-card/paper-card.html">
|
<link rel="import" href="../../bower_components/paper-card/paper-card.html">
|
||||||
|
<link rel="import" href="../../bower_components/paper-button/paper-button.html">
|
||||||
|
|
||||||
<link rel='import' href='../../src/util/hass-mixins.html'>
|
<link rel='import' href='../../src/util/hass-mixins.html'>
|
||||||
<link rel="import" href="../../src/components/buttons/ha-call-api-button.html">
|
<link rel="import" href="../../src/components/buttons/ha-call-api-button.html">
|
||||||
@ -9,14 +10,14 @@
|
|||||||
<style include="iron-flex ha-style">
|
<style include="iron-flex ha-style">
|
||||||
paper-card {
|
paper-card {
|
||||||
display: inline-block;
|
display: inline-block;
|
||||||
width: 350px;
|
width: 400px;
|
||||||
}
|
}
|
||||||
.card-content {
|
.card-content {
|
||||||
height: 110px;
|
height: 110px;
|
||||||
}
|
}
|
||||||
@media screen and (max-width: 730px) {
|
@media screen and (max-width: 830px) {
|
||||||
paper-card {
|
paper-card {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
}
|
}
|
||||||
.card-content {
|
.card-content {
|
||||||
height: 100%;
|
height: 100%;
|
||||||
@ -40,32 +41,48 @@
|
|||||||
<td>Version</td>
|
<td>Version</td>
|
||||||
<td>
|
<td>
|
||||||
[[data.version]]
|
[[data.version]]
|
||||||
<template is='dom-if' if='[[data.beta_channel]]'>
|
|
||||||
(Beta)
|
|
||||||
</template>
|
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td>Latest version</td>
|
<td>Latest version</td>
|
||||||
<td>[[data.last_version]]</td>
|
<td>[[data.last_version]]</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
<template is='dom-if' if='[[data.beta_channel]]'>
|
||||||
|
<tr>
|
||||||
|
<td>Beta channel</td>
|
||||||
|
<td>Active</td>
|
||||||
|
</tr>
|
||||||
|
</template>
|
||||||
</table>
|
</table>
|
||||||
<template is='dom-if' if='[[errors]]'>
|
<template is='dom-if' if='[[errors]]'>
|
||||||
<div class='errors'>Error: [[errors]]</div>
|
<div class='errors'>Error: [[errors]]</div>
|
||||||
</template>
|
</template>
|
||||||
</div>
|
</div>
|
||||||
<div class="card-actions">
|
<div class="card-actions">
|
||||||
|
<ha-call-api-button
|
||||||
|
hass='[[hass]]'
|
||||||
|
path="hassio/supervisor/reload"
|
||||||
|
>Reload</ha-call-api-button>
|
||||||
<template is='dom-if' if='[[computeUpdateAvailable(data)]]'>
|
<template is='dom-if' if='[[computeUpdateAvailable(data)]]'>
|
||||||
<ha-call-api-button
|
<ha-call-api-button
|
||||||
hass='[[hass]]'
|
hass='[[hass]]'
|
||||||
path="hassio/supervisor/update"
|
path="hassio/supervisor/update"
|
||||||
>Update</ha-call-api-button>
|
>Update</ha-call-api-button>
|
||||||
</template>
|
</template>
|
||||||
<ha-call-api-button
|
<template is='dom-if' if='[[data.beta_channel]]'>
|
||||||
class='warning'
|
<ha-call-api-button
|
||||||
hass='[[hass]]'
|
hass='[[hass]]'
|
||||||
path="hassio/supervisor/reload"
|
path='hassio/supervisor/options'
|
||||||
>Reload</ha-call-api-button>
|
data='[[leaveBeta]]'
|
||||||
|
>Leave beta channel</ha-call-api-button>
|
||||||
|
</template>
|
||||||
|
<template is='dom-if' if='[[!data.beta_channel]]'>
|
||||||
|
<paper-button
|
||||||
|
on-click='_joinBeta'
|
||||||
|
class='warning'
|
||||||
|
title='Get beta updates for Home Assistant (RCs), supervisor and host'
|
||||||
|
>Join beta channel</paper-button>
|
||||||
|
</template>
|
||||||
</div>
|
</div>
|
||||||
</paper-card>
|
</paper-card>
|
||||||
</template>
|
</template>
|
||||||
@ -80,6 +97,10 @@ class HassioSupervisorInfo extends window.hassMixins.EventsMixin(Polymer.Element
|
|||||||
hass: Object,
|
hass: Object,
|
||||||
data: Object,
|
data: Object,
|
||||||
errors: String,
|
errors: String,
|
||||||
|
leaveBeta: {
|
||||||
|
type: Object,
|
||||||
|
value: { beta_channel: false },
|
||||||
|
},
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -106,6 +127,38 @@ class HassioSupervisorInfo extends window.hassMixins.EventsMixin(Polymer.Element
|
|||||||
computeUpdateAvailable(data) {
|
computeUpdateAvailable(data) {
|
||||||
return data.version !== data.last_version;
|
return data.version !== data.last_version;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
_joinBeta() {
|
||||||
|
if (!confirm(`WARNING:
|
||||||
|
Beta releases are for testers and early adopters and can contain unstable code changes. Make sure you have backups of your data before you activate this feature.
|
||||||
|
|
||||||
|
This inludes beta releases for:
|
||||||
|
- Home Assistant (Release Candidates)
|
||||||
|
- Hass.io supervisor
|
||||||
|
- Host system`)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
const method = 'post';
|
||||||
|
const path = 'hassio/supervisor/options';
|
||||||
|
const data = { beta_channel: true };
|
||||||
|
|
||||||
|
const eventData = {
|
||||||
|
method: method,
|
||||||
|
path: path,
|
||||||
|
data: data,
|
||||||
|
};
|
||||||
|
|
||||||
|
this.hass.callApi(method, path, data)
|
||||||
|
.then((resp) => {
|
||||||
|
eventData.success = true;
|
||||||
|
eventData.response = resp;
|
||||||
|
}, (resp) => {
|
||||||
|
eventData.success = false;
|
||||||
|
eventData.response = resp;
|
||||||
|
}).then(() => {
|
||||||
|
this.fire('hass-api-called', eventData);
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
customElements.define(HassioSupervisorInfo.is, HassioSupervisorInfo);
|
customElements.define(HassioSupervisorInfo.is, HassioSupervisorInfo);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user