Random fixes (#3328)

* Fix scroll into view on first load

* Do not crash when deleting script/automation

* Disable swipe on notification drawer
This commit is contained in:
Paulus Schoutsen 2019-07-02 10:31:48 -07:00 committed by GitHub
parent deaccd6cd4
commit 6f77992387
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 7 additions and 12 deletions

View File

@ -306,10 +306,11 @@ class HaSidebar extends LitElement {
} }
const oldHass = changedProps.get("hass") as HomeAssistant | undefined; const oldHass = changedProps.get("hass") as HomeAssistant | undefined;
if (!oldHass || oldHass.panelUrl !== this.hass.panelUrl) { if (!oldHass || oldHass.panelUrl !== this.hass.panelUrl) {
this.shadowRoot!.querySelector( const selectedEl = this.shadowRoot!.querySelector(".iron-selected");
".iron-selected" if (selectedEl) {
// @ts-ignore // @ts-ignore
)!.scrollIntoViewIfNeeded(); selectedEl.scrollIntoViewIfNeeded();
}
} }
} }

View File

@ -45,7 +45,7 @@ export class HuiNotificationDrawer extends EventsMixin(
text-align: center; text-align: center;
} }
</style> </style>
<app-drawer id='drawer' opened="{{open}}"> <app-drawer id='drawer' opened="{{open}}" disable-swipe>
<app-toolbar> <app-toolbar>
<div main-title>[[localize('ui.notification_drawer.title')]]</div> <div main-title>[[localize('ui.notification_drawer.title')]]</div>
<ha-paper-icon-button-prev on-click="_closeDrawer"></paper-icon-button> <ha-paper-icon-button-prev on-click="_closeDrawer"></paper-icon-button>

View File

@ -26,7 +26,6 @@ import { HomeAssistant } from "../../../types";
import { AutomationEntity } from "../../../data/automation"; import { AutomationEntity } from "../../../data/automation";
import format_date_time from "../../../common/datetime/format_date_time"; import format_date_time from "../../../common/datetime/format_date_time";
import { fireEvent } from "../../../common/dom/fire_event"; import { fireEvent } from "../../../common/dom/fire_event";
import { repeat } from "lit-html/directives/repeat";
@customElement("ha-automation-picker") @customElement("ha-automation-picker")
class HaAutomationPicker extends LitElement { class HaAutomationPicker extends LitElement {
@ -74,9 +73,7 @@ class HaAutomationPicker extends LitElement {
</p> </p>
</div> </div>
` `
: repeat( : this.automations.map(
this.automations,
(automation) => automation.entity_id,
(automation) => html` (automation) => html`
<div class='automation'> <div class='automation'>

View File

@ -25,7 +25,6 @@ import { haStyle } from "../../../resources/styles";
import { HomeAssistant } from "../../../types"; import { HomeAssistant } from "../../../types";
import { triggerScript } from "../../../data/script"; import { triggerScript } from "../../../data/script";
import { showToast } from "../../../util/toast"; import { showToast } from "../../../util/toast";
import { repeat } from "lit-html/directives/repeat";
@customElement("ha-script-picker") @customElement("ha-script-picker")
class HaScriptPicker extends LitElement { class HaScriptPicker extends LitElement {
@ -57,9 +56,7 @@ class HaScriptPicker extends LitElement {
<p>We couldn't find any scripts.</p> <p>We couldn't find any scripts.</p>
</div> </div>
` `
: repeat( : this.scripts.map(
this.scripts,
(script) => script.entity_id,
(script) => html` (script) => html`
<div class="script"> <div class="script">
<paper-icon-button <paper-icon-button