From 6f77992387a8241fc4a1b5d7dac39f69173154b1 Mon Sep 17 00:00:00 2001 From: Paulus Schoutsen Date: Tue, 2 Jul 2019 10:31:48 -0700 Subject: [PATCH] Random fixes (#3328) * Fix scroll into view on first load * Do not crash when deleting script/automation * Disable swipe on notification drawer --- src/components/ha-sidebar.ts | 7 ++++--- src/dialogs/notifications/notification-drawer.js | 2 +- src/panels/config/automation/ha-automation-picker.ts | 5 +---- src/panels/config/script/ha-script-picker.ts | 5 +---- 4 files changed, 7 insertions(+), 12 deletions(-) diff --git a/src/components/ha-sidebar.ts b/src/components/ha-sidebar.ts index 06f51a8235..fddaa2b958 100644 --- a/src/components/ha-sidebar.ts +++ b/src/components/ha-sidebar.ts @@ -306,10 +306,11 @@ class HaSidebar extends LitElement { } const oldHass = changedProps.get("hass") as HomeAssistant | undefined; if (!oldHass || oldHass.panelUrl !== this.hass.panelUrl) { - this.shadowRoot!.querySelector( - ".iron-selected" + const selectedEl = this.shadowRoot!.querySelector(".iron-selected"); + if (selectedEl) { // @ts-ignore - )!.scrollIntoViewIfNeeded(); + selectedEl.scrollIntoViewIfNeeded(); + } } } diff --git a/src/dialogs/notifications/notification-drawer.js b/src/dialogs/notifications/notification-drawer.js index b70ec0c496..0b1255a762 100644 --- a/src/dialogs/notifications/notification-drawer.js +++ b/src/dialogs/notifications/notification-drawer.js @@ -45,7 +45,7 @@ export class HuiNotificationDrawer extends EventsMixin( text-align: center; } - +
[[localize('ui.notification_drawer.title')]]
diff --git a/src/panels/config/automation/ha-automation-picker.ts b/src/panels/config/automation/ha-automation-picker.ts index b0ef0ba577..d8c6259bfb 100644 --- a/src/panels/config/automation/ha-automation-picker.ts +++ b/src/panels/config/automation/ha-automation-picker.ts @@ -26,7 +26,6 @@ import { HomeAssistant } from "../../../types"; import { AutomationEntity } from "../../../data/automation"; import format_date_time from "../../../common/datetime/format_date_time"; import { fireEvent } from "../../../common/dom/fire_event"; -import { repeat } from "lit-html/directives/repeat"; @customElement("ha-automation-picker") class HaAutomationPicker extends LitElement { @@ -74,9 +73,7 @@ class HaAutomationPicker extends LitElement {

` - : repeat( - this.automations, - (automation) => automation.entity_id, + : this.automations.map( (automation) => html`
diff --git a/src/panels/config/script/ha-script-picker.ts b/src/panels/config/script/ha-script-picker.ts index 570cc2faa1..bdba5f7621 100644 --- a/src/panels/config/script/ha-script-picker.ts +++ b/src/panels/config/script/ha-script-picker.ts @@ -25,7 +25,6 @@ import { haStyle } from "../../../resources/styles"; import { HomeAssistant } from "../../../types"; import { triggerScript } from "../../../data/script"; import { showToast } from "../../../util/toast"; -import { repeat } from "lit-html/directives/repeat"; @customElement("ha-script-picker") class HaScriptPicker extends LitElement { @@ -57,9 +56,7 @@ class HaScriptPicker extends LitElement {

We couldn't find any scripts.

` - : repeat( - this.scripts, - (script) => script.entity_id, + : this.scripts.map( (script) => html`