Cleanup of picture card editor (#2364)

* Cleanup of `picture` card editor

* Fix `action-editor`
This commit is contained in:
Ian Richardson 2018-12-18 13:40:51 -06:00 committed by Paulus Schoutsen
parent 4c5d3138c1
commit 0a2eaec884
2 changed files with 7 additions and 5 deletions

View File

@ -34,7 +34,7 @@ export class HuiActionEditor extends LitElement {
protected hass?: HomeAssistant; protected hass?: HomeAssistant;
static get properties(): PropertyDeclarations { static get properties(): PropertyDeclarations {
return { hass: {}, config: {} }; return { hass: {}, config: {}, label: {}, actions: {} };
} }
get _action(): string { get _action(): string {

View File

@ -44,7 +44,7 @@ export class HuiPictureCardEditor extends hassLocalizeLitMixin(LitElement)
} }
get _tap_action(): ActionConfig { get _tap_action(): ActionConfig {
return this._config!.tap_action || { action: "more-info" }; return this._config!.tap_action || { action: "none" };
} }
get _hold_action(): ActionConfig { get _hold_action(): ActionConfig {
@ -56,6 +56,8 @@ export class HuiPictureCardEditor extends hassLocalizeLitMixin(LitElement)
return html``; return html``;
} }
const actions = ["navigate", "call-service", "none"];
return html` return html`
${configElementStyle} ${configElementStyle}
<div class="card-config"> <div class="card-config">
@ -70,15 +72,15 @@ export class HuiPictureCardEditor extends hassLocalizeLitMixin(LitElement)
label="Tap Action" label="Tap Action"
.hass="${this.hass}" .hass="${this.hass}"
.config="${this._tap_action}" .config="${this._tap_action}"
.actions="${["navigate", "call-service", "none"]}" .actions="${actions}"
.configValue="${"tap_action"}" .configValue="${"tap_action"}"
@action-changed="${this._valueChanged}" @action-changed="${this._valueChanged}"
></hui-action-editor> ></hui-action-editor>
<hui-action-editor <hui-action-editor
label=Hold Action" label="Hold Action"
.hass="${this.hass}" .hass="${this.hass}"
.config="${this._hold_action}" .config="${this._hold_action}"
.actions="${["navigate", "call-service", "none"]}" .actions="${actions}"
.configValue="${"hold_action"}" .configValue="${"hold_action"}"
@action-changed="${this._valueChanged}" @action-changed="${this._valueChanged}"
></hui-action-editor> ></hui-action-editor>