Compare commits

...

1 Commits

Author SHA1 Message Date
Bram Kragten
10c780a847 Add parallel action to trace timeline 2022-05-03 00:07:27 +02:00

View File

@@ -26,6 +26,7 @@ import {
ChooseActionChoice,
getActionType,
IfAction,
ParallelAction,
RepeatAction,
} from "../../data/script";
import { describeAction } from "../../data/script_i18n";
@@ -291,6 +292,10 @@ class ActionRenderer {
return this._handleIf(index);
}
if (actionType === "parallel") {
return this._handleParallel(index);
}
this._renderEntry(path, describeAction(this.hass, data, actionType));
let i = index + 1;
@@ -476,6 +481,35 @@ class ActionRenderer {
return i;
}
private _handleParallel(index: number): number {
const parallelPath = this.keys[index];
const startLevel = parallelPath.split("/").length;
const parallelConfig = this._getDataFromPath(
this.keys[index]
) as ParallelAction;
const name = parallelConfig.alias || "Execute in parallel";
this._renderEntry(parallelPath, name);
let i;
for (i = index + 1; i < this.keys.length; i++) {
const path = this.keys[i];
const parts = path.split("/");
// We're done if no more sequence in current level
if (parts.length <= startLevel) {
return i;
}
i = this._renderItem(i, getActionType(this._getDataFromPath(path)));
}
return i;
}
private _renderEntry(
path: string,
description: string,