Skip to content
This repository has been archived by the owner on May 25, 2020. It is now read-only.

Commit

Permalink
Get lovelace in firstUpdated
Browse files Browse the repository at this point in the history
  • Loading branch information
maykar authored Jul 1, 2019
1 parent 233e6f0 commit c079e9e
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions compact-custom-header-editor.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@ import {
html,
fireEvent,
defaultConfig,
lovelace,
hass
} from "./compact-custom-header.js";

const buttonOptions = ["show", "hide", "clock", "overflow"];
const overflowOptions = ["show", "hide", "clock"];
const swipeAnimation = ["none", "swipe", "fade", "flip"];
let lovelace;

export class CompactCustomHeaderEditor extends LitElement {
static get properties() {
Expand All @@ -19,13 +19,23 @@ export class CompactCustomHeaderEditor extends LitElement {
}

firstUpdated() {
let ll = document.querySelector("home-assistant");
ll = ll && ll.shadowRoot;
ll = ll && ll.querySelector("home-assistant-main");
ll = ll && ll.shadowRoot;
ll = ll && ll.querySelector("app-drawer-layout partial-panel-resolver");
ll = (ll && ll.shadowRoot) || ll;
ll = ll && ll.querySelector("ha-panel-lovelace");
ll = ll && ll.shadowRoot;
lovelace = ll && ll.querySelector("hui-root").lovelace;

let loader = this.parentNode.querySelector(".lds-ring");
loader.parentNode.removeChild(loader);
this._config = lovelace.config.cch ? deepcopy(lovelace.config.cch) : {};
}

render() {
if (!this._config) return html``;
if (!this._config || !lovelace) return html``;
return html`
<div @click="${this._close}" class="title_control">
X
Expand Down

0 comments on commit c079e9e

Please sign in to comment.