Fix notifications drawer (#2344)

This commit is contained in:
Paulus Schoutsen 2018-12-17 10:08:23 +01:00 committed by GitHub
parent b7c34c483a
commit 64714c64c7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 7 deletions

View File

@ -46,7 +46,7 @@ export class HuiNotificationsButton extends EventsMixin(PolymerElement) {
static get properties() { static get properties() {
return { return {
notificationsOpen: { open: {
type: Boolean, type: Boolean,
notify: true, notify: true,
}, },
@ -58,7 +58,7 @@ export class HuiNotificationsButton extends EventsMixin(PolymerElement) {
} }
_clicked() { _clicked() {
this.notificationsOpen = true; this.open = true;
} }
_hasNotifications(notifications) { _hasNotifications(notifications) {

View File

@ -68,7 +68,7 @@ class HUIRoot extends hassLocalizeLitMixin(LitElement) {
public route?: { path: string; prefix: string }; public route?: { path: string; prefix: string };
private _routeData?: { view: string }; private _routeData?: { view: string };
private _curView?: number | "hass-unused-entities"; private _curView?: number | "hass-unused-entities";
private notificationsOpen?: boolean; private _notificationsOpen: boolean;
private _persistentNotifications?: Notification[]; private _persistentNotifications?: Notification[];
private _haStyle?: DocumentFragment; private _haStyle?: DocumentFragment;
private _viewCache?: { [viewId: string]: HUIView }; private _viewCache?: { [viewId: string]: HUIView };
@ -86,13 +86,14 @@ class HUIRoot extends hassLocalizeLitMixin(LitElement) {
route: {}, route: {},
_routeData: {}, _routeData: {},
_curView: {}, _curView: {},
notificationsOpen: {}, _notificationsOpen: {},
_persistentNotifications: {}, _persistentNotifications: {},
}; };
} }
constructor() { constructor() {
super(); super();
this._notificationsOpen = false;
// The view can trigger a re-render when it knows that certain // The view can trigger a re-render when it knows that certain
// web components have been loaded. // web components have been loaded.
this._debouncedConfigChanged = debounce( this._debouncedConfigChanged = debounce(
@ -127,7 +128,7 @@ class HUIRoot extends hassLocalizeLitMixin(LitElement) {
<hui-notification-drawer <hui-notification-drawer
.hass="${this.hass}" .hass="${this.hass}"
.notifications="${this._notifications}" .notifications="${this._notifications}"
.open="${this.notificationsOpen}" .open="${this._notificationsOpen}"
@open-changed="${this._handleNotificationsOpenChanged}" @open-changed="${this._handleNotificationsOpenChanged}"
.narrow="${this.narrow}" .narrow="${this.narrow}"
></hui-notification-drawer> ></hui-notification-drawer>
@ -188,7 +189,8 @@ class HUIRoot extends hassLocalizeLitMixin(LitElement) {
<div main-title>${this.config.title || "Home Assistant"}</div> <div main-title>${this.config.title || "Home Assistant"}</div>
<hui-notifications-button <hui-notifications-button
.hass="${this.hass}" .hass="${this.hass}"
.notificationsOpen="{{notificationsOpen}}" .open="${this._notificationsOpen}"
@open-changed="${this._handleNotificationsOpenChanged}"
.notifications="${this._notifications}" .notifications="${this._notifications}"
></hui-notifications-button> ></hui-notifications-button>
<ha-start-voice-button <ha-start-voice-button
@ -477,7 +479,7 @@ class HUIRoot extends hassLocalizeLitMixin(LitElement) {
} }
private _handleNotificationsOpenChanged(ev): void { private _handleNotificationsOpenChanged(ev): void {
this.notificationsOpen = ev.detail.value; this._notificationsOpen = ev.detail.value;
} }
private _updateNotifications( private _updateNotifications(