Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 13 additions & 6 deletions src/panels/lovelace/components/hui-entity-editor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,16 +42,23 @@ export class HuiEntityEditor extends LitElement {
`;
})
}
<ha-entity-picker
.hass="${this.hass}"
@change="${this._addEntity}"
></ha-entity-picker>
</div>
<paper-button noink raised @click="${this._addEntity}"
>Add Entity</paper-button
>
`;
}

private _addEntity() {
const newConfigEntities = this.entities!.concat({ entity: "" });

private _addEntity(ev: Event): void {
const target = ev.target! as EditorTarget;
if (target.value === "") {
return;
}
const newConfigEntities = this.entities!.concat({
entity: target.value as string,
});
target.value = "";
fireEvent(this, "entities-changed", { entities: newConfigEntities });
}

Expand Down
6 changes: 5 additions & 1 deletion src/panels/lovelace/editor/hui-card-preview.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,11 @@ export class HuiCardPreview extends HTMLElement {
const tag = getCardElementTag(configValue.type);

if (tag.toUpperCase() === this._element.tagName) {
this._element.setConfig(configValue);
try {
this._element.setConfig(configValue);
} catch (err) {
this._createCard(createErrorCardConfig(err.message, configValue));
}
} else {
this._createCard(configValue);
}
Expand Down
1 change: 1 addition & 0 deletions src/panels/lovelace/editor/hui-edit-view.ts
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,7 @@ export class HuiEditView extends hassLocalizeLitMixin(LitElement) {
paper-tabs {
--paper-tabs-selection-bar-color: var(--primary-color);
text-transform: uppercase;
border-bottom: 1px solid rgba(0, 0, 0, 0.1);
}
paper-button paper-spinner {
width: 14px;
Expand Down