mirror of
https://github.com/home-assistant/frontend.git
synced 2025-12-24 12:49:19 +00:00
Migrate to use websocket client (#158)
* Migrate to websocket client HA-JS * Bump dependency to 0.1.4 * Upgrade HA-JS * Fix missing import
This commit is contained in:
@@ -3,12 +3,12 @@
|
||||
<link rel='import' href='../../bower_components/iron-icon/iron-icon.html'>
|
||||
<link rel='import' href='../../bower_components/paper-menu/paper-menu.html'>
|
||||
<link rel='import' href='../../bower_components/paper-item/paper-item.html'>
|
||||
<link rel='import' href='../../bower_components/paper-toggle-button/paper-toggle-button.html'>
|
||||
<link rel='import' href='../../bower_components/paper-item/paper-icon-item.html'>
|
||||
<link rel='import' href='../../bower_components/paper-icon-button/paper-icon-button.html'>
|
||||
|
||||
<link rel="import" href="../../bower_components/app-layout/app-toolbar/app-toolbar.html">
|
||||
|
||||
<link rel='import' href='../components/stream-status.html'>
|
||||
<link rel='import' href='../util/hass-behavior.html'>
|
||||
|
||||
<dom-module id='ha-sidebar'>
|
||||
@@ -130,11 +130,6 @@
|
||||
</paper-item>
|
||||
</template>
|
||||
|
||||
<paper-item class='horizontal layout justified'>
|
||||
<div class='setting'>Streaming updates</div>
|
||||
<stream-status hass='[[hass]]'></stream-status>
|
||||
</paper-item>
|
||||
|
||||
<div class='divider'></div>
|
||||
|
||||
<div class='subheader'>Developer Tools</div>
|
||||
|
||||
@@ -1,69 +0,0 @@
|
||||
<link rel="import" href="../../bower_components/polymer/polymer.html">
|
||||
|
||||
<link rel="import" href="../../bower_components/iron-icon/iron-icon.html">
|
||||
<link rel="import" href="../../bower_components/paper-toggle-button/paper-toggle-button.html">
|
||||
|
||||
<link rel='import' href='../util/hass-behavior.html'>
|
||||
|
||||
<dom-module id="stream-status">
|
||||
<template>
|
||||
<style>
|
||||
:host {
|
||||
display: inline-block;
|
||||
height: 24px;
|
||||
}
|
||||
|
||||
paper-toggle-button {
|
||||
vertical-align: middle;
|
||||
}
|
||||
|
||||
iron-icon {
|
||||
opacity: var(--dark-primary-opacity);
|
||||
}
|
||||
|
||||
[hidden] {
|
||||
display: none !important;
|
||||
}
|
||||
</style>
|
||||
|
||||
<iron-icon icon="mdi:alert" hidden$="[[!hasError]]"></iron-icon>
|
||||
<paper-toggle-button
|
||||
id="toggle"
|
||||
on-change='toggleChanged'
|
||||
checked$='[[isStreaming]]'
|
||||
hidden$="[[hasError]]"
|
||||
></paper-toggle-button>
|
||||
</template>
|
||||
</dom-module>
|
||||
|
||||
<script>
|
||||
Polymer({
|
||||
is: 'stream-status',
|
||||
|
||||
behaviors: [window.hassBehavior],
|
||||
|
||||
properties: {
|
||||
hass: {
|
||||
type: Object,
|
||||
},
|
||||
|
||||
isStreaming: {
|
||||
type: Boolean,
|
||||
bindNuclear: function (hass) { return hass.streamGetters.isStreamingEvents; },
|
||||
},
|
||||
|
||||
hasError: {
|
||||
type: Boolean,
|
||||
bindNuclear: function (hass) { return hass.streamGetters.hasStreamingEventsError; },
|
||||
},
|
||||
},
|
||||
|
||||
toggleChanged: function () {
|
||||
if (this.isStreaming) {
|
||||
this.hass.streamActions.stop();
|
||||
} else {
|
||||
this.hass.streamActions.start();
|
||||
}
|
||||
},
|
||||
});
|
||||
</script>
|
||||
Reference in New Issue
Block a user