Fix typo in alarm editor (#2729)

* Fix typo in alarm editor

* tacking on decorators, styles and card size fix
This commit is contained in:
Ian Richardson 2019-02-12 11:40:39 -06:00 committed by Paulus Schoutsen
parent f71612d6cf
commit 0f680bcfd6
2 changed files with 23 additions and 20 deletions

View File

@ -2,8 +2,10 @@ import {
html,
LitElement,
PropertyValues,
PropertyDeclarations,
TemplateResult,
CSSResult,
css,
property,
} from "lit-element";
import { classMap } from "lit-html/directives/class-map";
@ -50,20 +52,22 @@ class HuiAlarmPanelCard extends LitElement implements LovelaceCard {
return { states: ["arm_home", "arm_away"] };
}
public hass?: HomeAssistant;
private _config?: Config;
private _code?: string;
static get properties(): PropertyDeclarations {
return {
hass: {},
_config: {},
_code: {},
};
}
@property() public hass?: HomeAssistant;
@property() private _config?: Config;
@property() private _code?: string;
public getCardSize(): number {
return 4;
if (!this._config || !this.hass) {
return 0;
}
const stateObj = this.hass.states[this._config.entity];
if (!stateObj) {
return 0;
}
return stateObj.attributes.code_format !== FORMAT_NUMBER ? 3 : 8;
}
public setConfig(config: Config): void {
@ -114,7 +118,6 @@ class HuiAlarmPanelCard extends LitElement implements LovelaceCard {
}
return html`
${this.renderStyle()}
<ha-card .header="${this._config.name || this._label(stateObj.state)}">
<ha-label-badge
class="${classMap({ [stateObj.state]: true })}"
@ -204,9 +207,9 @@ class HuiAlarmPanelCard extends LitElement implements LovelaceCard {
this._code = "";
}
private renderStyle(): TemplateResult {
return html`
<style>
static get styles(): CSSResult[] {
return [
css`
ha-card {
padding-bottom: 16px;
position: relative;
@ -293,8 +296,8 @@ class HuiAlarmPanelCard extends LitElement implements LovelaceCard {
paper-button#disarm {
color: var(--google-red-500);
}
</style>
`;
`,
];
}
}

View File

@ -57,7 +57,7 @@ export class HuiAlarmPanelCardEditor extends LitElement
return html``;
}
const states = ["arm_home", "arm_away", "arm_night", "arm_custom_bypass"];
const states = ["arm_home", "arm_away", "arm_night", "armed_custom_bypass"];
return html`
${configElementStyle} ${this.renderStyle()}