Files
ha-frontend-cdce8p/panels/hassio/addon-view/hassio-addon-logs.html
T
Adam Mills fb0b1286d2 Convert remaining elements to ES6 classes (#538)
* Convert remaining elements to ES6 classes

* Use native DOM methods for tests

* Fix Polymer 2 debounce call
2017-10-29 21:47:03 -07:00

65 lines
1.4 KiB
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-button/paper-button.html">
<dom-module id="hassio-addon-logs">
<template>
<style include="iron-flex ha-style">
:host,
paper-card {
display: block;
}
</style>
<paper-card heading='Logs'>
<div class="card-content">
<pre>[[addonLogs]]</pre>
</div>
<div class="card-actions">
<paper-button on-tap='refresh'>Refresh</paper-button>
</div>
</paper-card>
</template>
</dom-module>
<script>
class HassioAddonLogs extends Polymer.Element {
static get is() { return 'hassio-addon-logs'; }
static get properties() {
return {
hass: {
type: Object,
},
addon: {
type: String,
observer: 'addonChanged',
},
addonLogs: {
type: String,
value: '',
},
};
}
addonChanged(addon) {
if (!this.hass) {
setTimeout(function () { this.addonChanged(addon); }.bind(this), 0);
return;
}
this.refresh();
}
refresh() {
this.hass.callApi('get', 'hassio/addons/' + this.addon + '/logs')
.then(function (info) {
this.addonLogs = info;
}.bind(this));
}
}
customElements.define(HassioAddonLogs.is, HassioAddonLogs);
</script>