mirror of
https://github.com/home-assistant/frontend.git
synced 2025-11-27 19:57:24 +00:00
Fix sequence action copy-paste (#27652)
This commit is contained in:
@@ -222,6 +222,7 @@ export interface StopAction extends BaseAction {
|
|||||||
|
|
||||||
export interface SequenceAction extends BaseAction {
|
export interface SequenceAction extends BaseAction {
|
||||||
sequence: (ManualScriptConfig | Action)[];
|
sequence: (ManualScriptConfig | Action)[];
|
||||||
|
metadata?: {};
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface ParallelAction extends BaseAction {
|
export interface ParallelAction extends BaseAction {
|
||||||
@@ -479,6 +480,7 @@ export const migrateAutomationAction = (
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (typeof action === "object" && action !== null && "sequence" in action) {
|
if (typeof action === "object" && action !== null && "sequence" in action) {
|
||||||
|
delete (action as SequenceAction).metadata;
|
||||||
for (const sequenceAction of (action as SequenceAction).sequence) {
|
for (const sequenceAction of (action as SequenceAction).sequence) {
|
||||||
migrateAutomationAction(sequenceAction);
|
migrateAutomationAction(sequenceAction);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -588,7 +588,11 @@ export default class HaAutomationActionRow extends LitElement {
|
|||||||
...this._clipboard,
|
...this._clipboard,
|
||||||
action: deepClone(this.action),
|
action: deepClone(this.action),
|
||||||
};
|
};
|
||||||
copyToClipboard(dump(this.action));
|
let action = this.action;
|
||||||
|
if ("sequence" in action) {
|
||||||
|
action = { ...this.action, metadata: {} };
|
||||||
|
}
|
||||||
|
copyToClipboard(dump(action));
|
||||||
}
|
}
|
||||||
|
|
||||||
private _onDisable = () => {
|
private _onDisable = () => {
|
||||||
|
|||||||
@@ -371,7 +371,11 @@ export class HaManualScriptEditor extends LitElement {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!["sequence", "unknown"].includes(getActionType(config))) {
|
const actionType = getActionType(config);
|
||||||
|
if (
|
||||||
|
!["sequence", "unknown"].includes(actionType) ||
|
||||||
|
(actionType === "sequence" && "metadata" in config)
|
||||||
|
) {
|
||||||
config = { sequence: [config] };
|
config = { sequence: [config] };
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user