Expand array outputs in execution viewer

This commit is contained in:
Lucio Lelii 2026-03-27 16:14:38 +01:00
parent 27f9bc1285
commit b10e9c59e0
2 changed files with 24 additions and 12 deletions

View File

@ -201,7 +201,12 @@
@for (output of group.outputs; track output.key) {
<div class="execution-output-item">
<div class="execution-output-item-head">
<div class="execution-output-item-name">{{ output.outputName }}</div>
<div>
<div class="execution-output-item-name">{{ output.outputName }}</div>
@if (output.itemLabel) {
<div class="text-[11px] text-slate-500">{{ output.itemLabel }}</div>
}
</div>
@if (output.isLong) {
<button
type="button"

View File

@ -44,6 +44,7 @@ type ExecutionOutputEntry = {
value: string;
preview: string;
isLong: boolean;
itemLabel: string | null;
};
type ExecutionOutputGroup = {
@ -310,18 +311,24 @@ export class TaskExecutionViewerComponent implements OnDestroy {
const resultMap = this.execution()?.context.result ?? {};
return Object.entries(resultMap)
.map(([key, rawValue]) => {
const value = this.stringifyOutputValue(rawValue);
const isLong = value.length > TaskExecutionViewerComponent.OUTPUT_PREVIEW_LIMIT;
.flatMap(([key, rawValue]) => {
const label = this.formatExecutionOutputLabel(key, steps);
return {
key,
nodeTitle: label.nodeTitle,
outputName: label.outputName,
value,
preview: isLong ? `${value.slice(0, TaskExecutionViewerComponent.OUTPUT_PREVIEW_LIMIT)}...` : value,
isLong
};
const values = Array.isArray(rawValue) ? rawValue : [rawValue];
return values.map((item, index) => {
const value = this.stringifyOutputValue(item);
const isLong = value.length > TaskExecutionViewerComponent.OUTPUT_PREVIEW_LIMIT;
const isArrayItem = Array.isArray(rawValue);
return {
key: isArrayItem ? `${key}:${index}` : key,
nodeTitle: label.nodeTitle,
outputName: label.outputName,
value,
preview: isLong ? `${value.slice(0, TaskExecutionViewerComponent.OUTPUT_PREVIEW_LIMIT)}...` : value,
isLong,
itemLabel: isArrayItem ? `Item ${index + 1}` : null
};
});
})
.sort((a, b) => a.nodeTitle.localeCompare(b.nodeTitle) || a.outputName.localeCompare(b.outputName));
});