mirror of
https://github.com/home-assistant/frontend.git
synced 2025-07-18 23:06:40 +00:00
Hassio: confirm add-on uninstall (#977)
* Hassio: confirm add-on uninstall * Travis
This commit is contained in:
parent
964b048a93
commit
b52d2967df
@ -9,6 +9,7 @@
|
|||||||
<link rel='import' href='../../src/components/ha-markdown.html'>
|
<link rel='import' href='../../src/components/ha-markdown.html'>
|
||||||
<link rel='import' href='../../src/resources/ha-style.html'>
|
<link rel='import' href='../../src/resources/ha-style.html'>
|
||||||
<link rel='import' href='../../src/components/hassio-card-content.html'>
|
<link rel='import' href='../../src/components/hassio-card-content.html'>
|
||||||
|
<link rel='import' href='../../src/util/hass-mixins.html'>
|
||||||
|
|
||||||
<link rel='import' href='./hassio-addon-more-info.html'>
|
<link rel='import' href='./hassio-addon-more-info.html'>
|
||||||
|
|
||||||
@ -142,11 +143,10 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class='card-actions'>
|
<div class='card-actions'>
|
||||||
<template is='dom-if' if='[[addon.version]]'>
|
<template is='dom-if' if='[[addon.version]]'>
|
||||||
<ha-call-api-button
|
<paper-button
|
||||||
class='warning'
|
class='warning'
|
||||||
hass='[[hass]]'
|
on-click='_unistallClicked'
|
||||||
path='hassio/addons/[[addonSlug]]/uninstall'
|
>Uninstall</paper-button>
|
||||||
>Uninstall</ha-call-api-button>
|
|
||||||
<template is='dom-if' if='[[addon.build]]'>
|
<template is='dom-if' if='[[addon.build]]'>
|
||||||
<ha-call-api-button
|
<ha-call-api-button
|
||||||
class='warning'
|
class='warning'
|
||||||
@ -200,7 +200,7 @@
|
|||||||
</dom-module>
|
</dom-module>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
class HassioAddonInfo extends Polymer.Element {
|
class HassioAddonInfo extends window.hassMixins.EventsMixin(Polymer.Element) {
|
||||||
static get is() { return 'hassio-addon-info'; }
|
static get is() { return 'hassio-addon-info'; }
|
||||||
|
|
||||||
static get properties() {
|
static get properties() {
|
||||||
@ -255,6 +255,25 @@ class HassioAddonInfo extends Polymer.Element {
|
|||||||
});
|
});
|
||||||
this.shadowRoot.querySelector('hassio-addon-more-info').openDialog();
|
this.shadowRoot.querySelector('hassio-addon-more-info').openDialog();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
_unistallClicked() {
|
||||||
|
if (!confirm('Are you sure you want to uninstall this add-on?')) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
const path = `hassio/addons/${this.addonSlug}/uninstall`;
|
||||||
|
const eventData = {
|
||||||
|
path: path,
|
||||||
|
};
|
||||||
|
this.hass.callApi('post', path).then((resp) => {
|
||||||
|
eventData.success = true;
|
||||||
|
eventData.response = resp;
|
||||||
|
}, (resp) => {
|
||||||
|
eventData.success = false;
|
||||||
|
eventData.response = resp;
|
||||||
|
}).then(() => {
|
||||||
|
this.fire('hass-api-called', eventData);
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
customElements.define(HassioAddonInfo.is, HassioAddonInfo);
|
customElements.define(HassioAddonInfo.is, HassioAddonInfo);
|
||||||
</script>
|
</script>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user