Remove advanced mode from scenes editor (#25054)

This commit is contained in:
Bram Kragten 2025-04-14 14:41:24 +02:00 committed by GitHub
parent f6e4f4c0d6
commit 53426d647a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 75 additions and 82 deletions

View File

@ -26,8 +26,6 @@ class HaConfigScene extends HassRouterPage {
@property({ attribute: "is-wide", type: Boolean }) public isWide = false; @property({ attribute: "is-wide", type: Boolean }) public isWide = false;
@property({ attribute: false }) public showAdvanced = false;
@property({ attribute: false }) public scenes: SceneEntity[] = []; @property({ attribute: false }) public scenes: SceneEntity[] = [];
protected routerOptions: RouterOptions = { protected routerOptions: RouterOptions = {
@ -62,7 +60,6 @@ class HaConfigScene extends HassRouterPage {
pageEl.narrow = this.narrow; pageEl.narrow = this.narrow;
pageEl.isWide = this.isWide; pageEl.isWide = this.isWide;
pageEl.route = this.routeTail; pageEl.route = this.routeTail;
pageEl.showAdvanced = this.showAdvanced;
if (this.hass) { if (this.hass) {
if (!pageEl.scenes || !changedProps) { if (!pageEl.scenes || !changedProps) {

View File

@ -98,8 +98,6 @@ export class HaSceneEditor extends PreventUnsavedMixin(
@property({ attribute: false }) public scenes!: SceneEntity[]; @property({ attribute: false }) public scenes!: SceneEntity[];
@property({ attribute: false }) public showAdvanced = false;
@state() private _dirty = false; @state() private _dirty = false;
@state() private _errors?: string; @state() private _errors?: string;
@ -486,88 +484,86 @@ export class HaSceneEditor extends PreventUnsavedMixin(
: nothing} : nothing}
</ha-config-section> </ha-config-section>
${this.showAdvanced <ha-config-section vertical .isWide=${this.isWide}>
? html` <ha-config-section vertical .isWide=${this.isWide}> <div slot="header">
<div slot="header"> ${this.hass.localize(
"ui.panel.config.scene.editor.entities.header"
)}
</div>
${this._mode === "live" || entities.length === 0
? html`<div slot="introduction">
${this.hass.localize( ${this.hass.localize(
"ui.panel.config.scene.editor.entities.header" `ui.panel.config.scene.editor.entities.introduction${this._mode === "review" ? "_review" : ""}`
)} )}
</div> </div>`
${this._mode === "live" || entities.length === 0 : nothing}
? html`<div slot="introduction"> ${entities.length
${this.hass.localize( ? html`
`ui.panel.config.scene.editor.entities.introduction${this._mode === "review" ? "_review" : ""}` <ha-card outlined class="entities">
)} <mwc-list>
</div>` ${entities.map((entityId) => {
: nothing} const entityStateObj = this.hass.states[entityId];
${entities.length if (!entityStateObj) {
? html` return nothing;
<ha-card outlined class="entities"> }
<mwc-list> return html`
${entities.map((entityId) => { <ha-list-item
const entityStateObj = this.hass.states[entityId]; class="entity"
if (!entityStateObj) { hasMeta
return nothing; .graphic=${this._mode === "live"
} ? "icon"
return html` : undefined}
<ha-list-item .entityId=${entityId}
class="entity" @click=${this._mode === "live"
hasMeta ? this._showMoreInfo
.graphic=${this._mode === "live" : undefined}
? "icon" .noninteractive=${this._mode === "review"}
: undefined} >
${this._mode === "live"
? html` <state-badge
.hass=${this.hass}
.stateObj=${entityStateObj}
slot="graphic"
></state-badge>`
: nothing}
${computeStateName(entityStateObj)}
<div slot="meta">
<ha-icon-button
.path=${mdiDelete}
.entityId=${entityId} .entityId=${entityId}
@click=${this._mode === "live" .label=${this.hass.localize(
? this._showMoreInfo "ui.panel.config.scene.editor.entities.delete"
: undefined} )}
.noninteractive=${this._mode === "review"} @click=${this._deleteEntity}
> ></ha-icon-button>
${this._mode === "live" </div>
? html` <state-badge </ha-list-item>
.hass=${this.hass} `;
.stateObj=${entityStateObj} })}
slot="graphic" </mwc-list>
></state-badge>` </ha-card>
: nothing} `
${computeStateName(entityStateObj)} : ""}
<div slot="meta"> ${this._mode === "live"
<ha-icon-button ? html` <ha-card
.path=${mdiDelete} outlined
.entityId=${entityId} header=${this.hass.localize(
.label=${this.hass.localize( "ui.panel.config.scene.editor.entities.add"
"ui.panel.config.scene.editor.entities.delete" )}
)} >
@click=${this._deleteEntity} <div class="card-content">
></ha-icon-button> <ha-entity-picker
</div> @value-changed=${this._entityPicked}
</ha-list-item> .excludeDomains=${SCENE_IGNORED_DOMAINS}
`; .hass=${this.hass}
})} label=${this.hass.localize(
</mwc-list>
</ha-card>
`
: ""}
${this._mode === "live"
? html` <ha-card
outlined
header=${this.hass.localize(
"ui.panel.config.scene.editor.entities.add" "ui.panel.config.scene.editor.entities.add"
)} )}
> ></ha-entity-picker>
<div class="card-content"> </div>
<ha-entity-picker </ha-card>`
@value-changed=${this._entityPicked} : nothing}
.excludeDomains=${SCENE_IGNORED_DOMAINS} </ha-config-section>
.hass=${this.hass}
label=${this.hass.localize(
"ui.panel.config.scene.editor.entities.add"
)}
></ha-entity-picker>
</div>
</ha-card>`
: nothing}
</ha-config-section>`
: nothing}
` `
: nothing} : nothing}
</div>`; </div>`;