Hassio: support new mode (stable, beta, dev) (#1024)

* Hassio: support new mode (stable, beta, dev)

* mode -> channel

* Fix beta data
This commit is contained in:
c727 2018-03-24 22:14:48 +01:00 committed by Pascal Vizeli
parent 796ec4a4b0
commit 3b76238241

View File

@ -48,10 +48,10 @@
<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]]'> <template is='dom-if' if='[[!_equals(data.channel, "stable")]]'>
<tr> <tr>
<td>Beta channel</td> <td>Channel</td>
<td>Active</td> <td>[[data.channel]]</td>
</tr> </tr>
</template> </template>
</table> </table>
@ -70,14 +70,14 @@
path="hassio/supervisor/update" path="hassio/supervisor/update"
>Update</ha-call-api-button> >Update</ha-call-api-button>
</template> </template>
<template is='dom-if' if='[[data.beta_channel]]'> <template is='dom-if' if='[[_equals(data.channel, "beta")]]'>
<ha-call-api-button <ha-call-api-button
hass='[[hass]]' hass='[[hass]]'
path='hassio/supervisor/options' path='hassio/supervisor/options'
data='[[leaveBeta]]' data='[[leaveBeta]]'
>Leave beta channel</ha-call-api-button> >Leave beta channel</ha-call-api-button>
</template> </template>
<template is='dom-if' if='[[!data.beta_channel]]'> <template is='dom-if' if='[[_equals(data.channel, "stable")]]'>
<paper-button <paper-button
on-click='_joinBeta' on-click='_joinBeta'
class='warning' class='warning'
@ -100,7 +100,7 @@ class HassioSupervisorInfo extends window.hassMixins.EventsMixin(Polymer.Element
errors: String, errors: String,
leaveBeta: { leaveBeta: {
type: Object, type: Object,
value: { beta_channel: false }, value: { channel: 'stable' },
}, },
}; };
} }
@ -129,6 +129,10 @@ class HassioSupervisorInfo extends window.hassMixins.EventsMixin(Polymer.Element
return data.version !== data.last_version; return data.version !== data.last_version;
} }
_equals(a, b) {
return a === b;
}
_joinBeta() { _joinBeta() {
if (!confirm(`WARNING: 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. 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.
@ -141,7 +145,7 @@ This inludes beta releases for:
} }
const method = 'post'; const method = 'post';
const path = 'hassio/supervisor/options'; const path = 'hassio/supervisor/options';
const data = { beta_channel: true }; const data = { channel: 'beta' };
const eventData = { const eventData = {
method: method, method: method,