mirror of
https://github.com/home-assistant/frontend.git
synced 2025-07-29 12:16:39 +00:00
Fix typo in alarm editor (#2729)
* Fix typo in alarm editor * tacking on decorators, styles and card size fix
This commit is contained in:
parent
f71612d6cf
commit
0f680bcfd6
@ -2,8 +2,10 @@ import {
|
|||||||
html,
|
html,
|
||||||
LitElement,
|
LitElement,
|
||||||
PropertyValues,
|
PropertyValues,
|
||||||
PropertyDeclarations,
|
|
||||||
TemplateResult,
|
TemplateResult,
|
||||||
|
CSSResult,
|
||||||
|
css,
|
||||||
|
property,
|
||||||
} from "lit-element";
|
} from "lit-element";
|
||||||
import { classMap } from "lit-html/directives/class-map";
|
import { classMap } from "lit-html/directives/class-map";
|
||||||
|
|
||||||
@ -50,20 +52,22 @@ class HuiAlarmPanelCard extends LitElement implements LovelaceCard {
|
|||||||
return { states: ["arm_home", "arm_away"] };
|
return { states: ["arm_home", "arm_away"] };
|
||||||
}
|
}
|
||||||
|
|
||||||
public hass?: HomeAssistant;
|
@property() public hass?: HomeAssistant;
|
||||||
private _config?: Config;
|
@property() private _config?: Config;
|
||||||
private _code?: string;
|
@property() private _code?: string;
|
||||||
|
|
||||||
static get properties(): PropertyDeclarations {
|
|
||||||
return {
|
|
||||||
hass: {},
|
|
||||||
_config: {},
|
|
||||||
_code: {},
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
public getCardSize(): number {
|
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 {
|
public setConfig(config: Config): void {
|
||||||
@ -114,7 +118,6 @@ class HuiAlarmPanelCard extends LitElement implements LovelaceCard {
|
|||||||
}
|
}
|
||||||
|
|
||||||
return html`
|
return html`
|
||||||
${this.renderStyle()}
|
|
||||||
<ha-card .header="${this._config.name || this._label(stateObj.state)}">
|
<ha-card .header="${this._config.name || this._label(stateObj.state)}">
|
||||||
<ha-label-badge
|
<ha-label-badge
|
||||||
class="${classMap({ [stateObj.state]: true })}"
|
class="${classMap({ [stateObj.state]: true })}"
|
||||||
@ -204,9 +207,9 @@ class HuiAlarmPanelCard extends LitElement implements LovelaceCard {
|
|||||||
this._code = "";
|
this._code = "";
|
||||||
}
|
}
|
||||||
|
|
||||||
private renderStyle(): TemplateResult {
|
static get styles(): CSSResult[] {
|
||||||
return html`
|
return [
|
||||||
<style>
|
css`
|
||||||
ha-card {
|
ha-card {
|
||||||
padding-bottom: 16px;
|
padding-bottom: 16px;
|
||||||
position: relative;
|
position: relative;
|
||||||
@ -293,8 +296,8 @@ class HuiAlarmPanelCard extends LitElement implements LovelaceCard {
|
|||||||
paper-button#disarm {
|
paper-button#disarm {
|
||||||
color: var(--google-red-500);
|
color: var(--google-red-500);
|
||||||
}
|
}
|
||||||
</style>
|
`,
|
||||||
`;
|
];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -57,7 +57,7 @@ export class HuiAlarmPanelCardEditor extends LitElement
|
|||||||
return html``;
|
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`
|
return html`
|
||||||
${configElementStyle} ${this.renderStyle()}
|
${configElementStyle} ${this.renderStyle()}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user