ha-frontend/panels/config/zwave/zwave-log.html

67 lines
1.5 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">
<link rel="import" href="../ha-config-section.html">
<dom-module id='ozw-log'>
<template>
<style include="iron-flex ha-style">
.content {
margin-top: 24px;
}
paper-card {
display: block;
margin: 0 auto;
max-width: 600px;
}
</style>
<ha-config-section is-wide='[[isWide]]'>
<span slot='header'>OZW Log</span>
<paper-card>
<div class='help-text'>
<pre>[[ozwLogs]]</pre>
</div>
<div class="card-actions">
<paper-button raised on-tap='refreshLog'>Refresh</paper-button>
</div>
</paper-card>
</ha-config-section>
</template>
</dom-module>
<script>
class OzwLog extends Polymer.Element {
static get is() { return 'ozw-log'; }
static get properties() {
return {
hass: {
type: Object,
},
isWide: {
type: Boolean,
value: false,
},
ozwLogs: {
type: String,
value: 'Refresh to pull log'
},
};
}
refreshLog() {
this.ozwLogs = 'Loading ozw log...';
this.hass.callApi('GET', 'zwave/ozwlog')
.then((info) => {
this.ozwLogs = info;
});
}
}
customElements.define(OzwLog.is, OzwLog);
</script>