mirror of
https://github.com/home-assistant/frontend.git
synced 2025-07-12 20:06:33 +00:00
Init new scenes in live edit mode (#23051)
* Init new scenes in live edit mode * Update src/panels/config/scene/ha-scene-editor.ts Co-authored-by: Simon Lamon <32477463+silamon@users.noreply.github.com> * imports --------- Co-authored-by: Simon Lamon <32477463+silamon@users.noreply.github.com>
This commit is contained in:
parent
f6c15dc990
commit
2550bff4e9
@ -7,7 +7,9 @@ import {
|
|||||||
mdiContentSave,
|
mdiContentSave,
|
||||||
mdiDelete,
|
mdiDelete,
|
||||||
mdiDotsVertical,
|
mdiDotsVertical,
|
||||||
|
mdiEye,
|
||||||
mdiInformationOutline,
|
mdiInformationOutline,
|
||||||
|
mdiMotionPlayOutline,
|
||||||
mdiPlay,
|
mdiPlay,
|
||||||
mdiTag,
|
mdiTag,
|
||||||
} from "@mdi/js";
|
} from "@mdi/js";
|
||||||
@ -204,6 +206,14 @@ export class HaSceneEditor extends SubscribeMixin(
|
|||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
|
public connectedCallback() {
|
||||||
|
super.connectedCallback();
|
||||||
|
if (!this.sceneId) {
|
||||||
|
this._mode = "live";
|
||||||
|
this._subscribeEvents();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public disconnectedCallback() {
|
public disconnectedCallback() {
|
||||||
super.disconnectedCallback();
|
super.disconnectedCallback();
|
||||||
if (this._unsubscribeEvents) {
|
if (this._unsubscribeEvents) {
|
||||||
@ -387,15 +397,22 @@ export class HaSceneEditor extends SubscribeMixin(
|
|||||||
alert-type="info"
|
alert-type="info"
|
||||||
.narrow=${this.narrow}
|
.narrow=${this.narrow}
|
||||||
.title=${this.hass.localize(
|
.title=${this.hass.localize(
|
||||||
`ui.panel.config.scene.editor.${this._mode === "live" ? "live_preview" : "review_mode"}`
|
`ui.panel.config.scene.editor.${this._mode === "live" ? "live_edit" : "review_mode"}`
|
||||||
)}
|
)}
|
||||||
>
|
>
|
||||||
${this.hass.localize(
|
${this.hass.localize(
|
||||||
`ui.panel.config.scene.editor.${this._mode === "live" ? "live_preview_detail" : "review_mode_detail"}`
|
`ui.panel.config.scene.editor.${this._mode === "live" ? "live_edit_detail" : "review_mode_detail"}`
|
||||||
)}
|
)}
|
||||||
|
<span slot="icon">
|
||||||
|
<ha-svg-icon
|
||||||
|
.path=${this._mode === "live"
|
||||||
|
? mdiMotionPlayOutline
|
||||||
|
: mdiEye}
|
||||||
|
></ha-svg-icon>
|
||||||
|
</span>
|
||||||
<ha-button slot="action" @click=${this._toggleLiveMode}>
|
<ha-button slot="action" @click=${this._toggleLiveMode}>
|
||||||
${this.hass.localize(
|
${this.hass.localize(
|
||||||
`ui.panel.config.scene.editor.${this._mode === "live" ? "back_to_review_mode" : "live_preview"}`
|
`ui.panel.config.scene.editor.${this._mode === "live" ? "switch_to_review_mode" : "live_edit"}`
|
||||||
)}
|
)}
|
||||||
</ha-button>
|
</ha-button>
|
||||||
</ha-alert>
|
</ha-alert>
|
||||||
|
@ -3878,11 +3878,11 @@
|
|||||||
},
|
},
|
||||||
"editor": {
|
"editor": {
|
||||||
"review_mode": "Review Mode",
|
"review_mode": "Review Mode",
|
||||||
"review_mode_detail": "You can adjust the scene's details and remove devices or entities. To fully edit, switch to Live Preview, which will apply the scene.",
|
"review_mode_detail": "You can adjust the scene's details and remove devices or entities. To fully edit, switch to Live Edit, which will apply the scene.",
|
||||||
"live_preview": "Live Preview",
|
"live_edit": "Live Edit",
|
||||||
"live_preview_detail": "In Live Preview, all changes to this scene are applied in real-time to your devices and entities.",
|
"live_edit_detail": "In Live Edit, all changes to this scene are applied in real-time to your devices and entities.",
|
||||||
"enter_live_mode_unsaved": "You have unsaved changes to this scene. Continuing to live preview will apply the saved scene, which may overwrite your unsaved changes. Consider if you would like to save the scene first before activating it.",
|
"enter_live_mode_unsaved": "You have unsaved changes to this scene. Continuing to live preview will apply the saved scene, which may overwrite your unsaved changes. Consider if you would like to save the scene first before activating it.",
|
||||||
"back_to_review_mode": "Back to review mode",
|
"switch_to_review_mode": "Switch to review mode",
|
||||||
"default_name": "New scene",
|
"default_name": "New scene",
|
||||||
"load_error_not_editable": "Only scenes in scenes.yaml are editable.",
|
"load_error_not_editable": "Only scenes in scenes.yaml are editable.",
|
||||||
"load_error_unknown": "Error loading scene ({err_no}).",
|
"load_error_unknown": "Error loading scene ({err_no}).",
|
||||||
|
Loading…
x
Reference in New Issue
Block a user