|
@@ -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({
|
|
export function ExecutionListPanel({
|
|
|
workflowId,
|
|
workflowId,
|
|
|
isOpen,
|
|
isOpen,
|
|
@@ -356,9 +372,9 @@ export function ExecutionListPanel({
|
|
|
</button>
|
|
</button>
|
|
|
<button
|
|
<button
|
|
|
onClick={() => handleAction(exec.id, 'pin')}
|
|
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"
|
|
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 ? (
|
|
{loadingId === exec.id ? (
|
|
|
<Loader2 className="w-4 h-4 animate-spin" />
|
|
<Loader2 className="w-4 h-4 animate-spin" />
|