mirror of
https://github.com/home-assistant/frontend.git
synced 2025-07-19 15:26:36 +00:00
Make custom cards work as panel (#1447)
* Make custom cards work as panel * Fixed some errors and implemented suggestion from comments
This commit is contained in:
parent
89f9589084
commit
832f4ba6cd
@ -23,6 +23,7 @@ import '../../components/ha-icon.js';
|
||||
import { loadModule, loadJS } from '../../common/dom/load_resource.js';
|
||||
import './hui-unused-entities.js';
|
||||
import './hui-view.js';
|
||||
import debounce from '../../common/util/debounce.js';
|
||||
|
||||
import createCardElement from './common/create-card-element.js';
|
||||
|
||||
@ -105,7 +106,7 @@ class HUIRoot extends NavigateMixin(EventsMixin(PolymerElement)) {
|
||||
</div>
|
||||
</app-header>
|
||||
|
||||
<div id='view'></div>
|
||||
<div id='view' on-rebuild-view='_debouncedConfigChanged'></div>
|
||||
</app-header-layout>
|
||||
`;
|
||||
}
|
||||
@ -140,6 +141,11 @@ class HUIRoot extends NavigateMixin(EventsMixin(PolymerElement)) {
|
||||
};
|
||||
}
|
||||
|
||||
constructor() {
|
||||
super();
|
||||
this._debouncedConfigChanged = debounce(() => this._selectView(this._curView), 100);
|
||||
}
|
||||
|
||||
_routeChanged(route) {
|
||||
const views = this.config && this.config.views;
|
||||
if (route.path === '' && route.prefix === '/lovelace' && views) {
|
||||
|
@ -4,7 +4,6 @@ import { PolymerElement } from '@polymer/polymer/polymer-element.js';
|
||||
import '../../components/entity/ha-state-label-badge.js';
|
||||
|
||||
import applyThemesOnElement from '../../common/dom/apply_themes_on_element.js';
|
||||
import debounce from '../../common/util/debounce.js';
|
||||
|
||||
import createCardElement from './common/create-card-element';
|
||||
|
||||
@ -62,7 +61,7 @@ class HUIView extends PolymerElement {
|
||||
}
|
||||
</style>
|
||||
<div id="badges"></div>
|
||||
<div id="columns" on-rebuild-view="_debouncedConfigChanged"></div>
|
||||
<div id="columns"></div>
|
||||
`;
|
||||
}
|
||||
|
||||
@ -89,7 +88,6 @@ class HUIView extends PolymerElement {
|
||||
super();
|
||||
this._cards = [];
|
||||
this._badges = [];
|
||||
this._debouncedConfigChanged = debounce(this._configChanged, 100);
|
||||
}
|
||||
|
||||
_createBadges(config) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user