Переглянути джерело

fix: let a failed execution's data be pinned

Pinning was restricted to "completed" runs, which had it backwards. The run
you most want on the canvas is the one that broke: pinning it shows the state
each node was in when it failed, and gives the single-node re-run something to
execute against while the fix is checked.

The restriction dates to the initial commit and had no reason behind it. Only
a run that has not produced its data yet - running or pending - is still
excluded, because there is nothing to show and what exists is still moving.
fszontagh 1 місяць тому
батько
коміт
f97e39a836
1 змінених файлів з 18 додано та 2 видалено
  1. 18 2
      webui/src/components/workflow/ExecutionListPanel.tsx

+ 18 - 2
webui/src/components/workflow/ExecutionListPanel.tsx

@@ -98,6 +98,22 @@ function StatusBadge({ status }: { status: string }) {
   )
 }
 
+/**
+ * Whether an execution has data worth putting on the canvas.
+ *
+ * This used to allow only "completed", which had it backwards: a failed run is
+ * the one you most want pinned - to see the state at the point it broke, and to
+ * re-run the fixed node against the data it actually received. A run that
+ * stopped early still holds everything up to that point, and a cancelled or
+ * waiting one holds everything before the pause.
+ *
+ * Only a run that has not produced anything yet is excluded, because there is
+ * nothing to show and what little exists is still changing under the reader.
+ */
+function hasDataToPin(status: string): boolean {
+  return status !== 'running' && status !== 'pending'
+}
+
 export function ExecutionListPanel({
   workflowId,
   isOpen,
@@ -356,9 +372,9 @@ export function ExecutionListPanel({
                   </button>
                   <button
                     onClick={() => handleAction(exec.id, 'pin')}
-                    disabled={loadingId === exec.id || exec.status !== 'completed'}
+                    disabled={loadingId === exec.id || !hasDataToPin(exec.status)}
                     className="flex-1 flex items-center justify-center gap-1.5 px-3 py-1.5 text-sm bg-primary-100 dark:bg-primary-900/30 hover:bg-primary-200 dark:hover:bg-primary-800/40 text-primary-700 dark:text-primary-400 rounded-lg transition-colors disabled:opacity-50 disabled:cursor-not-allowed"
-                    title={exec.status !== 'completed' ? 'Only completed executions can be pinned' : undefined}
+                    title={!hasDataToPin(exec.status) ? 'This run has not produced its data yet' : undefined}
                   >
                     {loadingId === exec.id ? (
                       <Loader2 className="w-4 h-4 animate-spin" />