diff --git a/src/components/entity/ha-entity-toggle.ts b/src/components/entity/ha-entity-toggle.ts index 93bd745e87..10fb56e096 100644 --- a/src/components/entity/ha-entity-toggle.ts +++ b/src/components/entity/ha-entity-toggle.ts @@ -17,6 +17,7 @@ import { forwardHaptic } from "../../data/haptics"; import { HomeAssistant } from "../../types"; import "../ha-icon-button"; import "../ha-switch"; +import "../ha-formfield"; const isOn = (stateObj?: HassEntity) => stateObj !== undefined && @@ -29,6 +30,8 @@ export class HaEntityToggle extends LitElement { @property() public stateObj?: HassEntity; + @property() public label?: string; + @internalProperty() private _isOn = false; protected render(): TemplateResult { @@ -55,15 +58,21 @@ export class HaEntityToggle extends LitElement { `; } + const switchTemplate = html``; + + if (!this.label) { + return switchTemplate; + } + return html` - + ${switchTemplate} `; } diff --git a/src/panels/config/automation/ha-automation-editor.ts b/src/panels/config/automation/ha-automation-editor.ts index dca916a6d0..a7af6b6879 100644 --- a/src/panels/config/automation/ha-automation-editor.ts +++ b/src/panels/config/automation/ha-automation-editor.ts @@ -197,7 +197,11 @@ export class HaAutomationEditor extends KeyboardShortcutMixin(LitElement) { ${this.narrow ? html` ${this._config?.alias} ` : ""} -
+
${this._errors ? html`
${this._errors}
` : ""} @@ -223,52 +227,52 @@ export class HaAutomationEditor extends KeyboardShortcutMixin(LitElement) { ` : this._mode === "yaml" ? html` - - ${!this.narrow - ? html` - ${this._config.alias} - ` - : ``} - -
- - - ${this.hass.localize( - "ui.panel.config.automation.editor.copy_to_clipboard" - )} - -
- ${stateObj - ? html` -
-
- - ${this.hass.localize( - "ui.panel.config.automation.editor.enable_disable" - )} -
- - ${this.hass.localize( - "ui.card.automation.trigger" - )} - -
- ` - : ""} -
-
+ ${!this.narrow + ? html` +
+ ${this._config.alias} +
+ ${stateObj + ? html` +
+ + + + ${this.hass.localize( + "ui.card.automation.trigger" + )} + +
+ ` + : ""} +
+ ` + : ``} + +
+ + ${this.hass.localize( + "ui.panel.config.automation.editor.copy_to_clipboard" + )} + +
+
` : ``}
@@ -531,6 +535,22 @@ export class HaAutomationEditor extends KeyboardShortcutMixin(LitElement) { .content { padding-bottom: 20px; } + .yaml-mode { + height: 100%; + display: flex; + flex-direction: column; + padding-bottom: 0; + } + ha-yaml-editor { + flex-grow: 1; + --code-mirror-height: 100%; + min-height: 0; + } + .yaml-mode ha-card { + overflow: initial; + --ha-card-border-radius: 0; + border-bottom: 1px solid var(--divider-color); + } p { margin-bottom: 0; }