@@ -8,6 +8,8 @@ import { useMutation, useQueryClient } from '@tanstack/react-query'
88import { ExternalLink , RepeatIcon , SplitIcon , X } from 'lucide-react'
99import {
1010 Button ,
11+ ButtonGroup ,
12+ ButtonGroupItem ,
1113 Combobox ,
1214 type ComboboxOptionGroup ,
1315 FieldDivider ,
@@ -34,6 +36,7 @@ import type {
3436 ColumnDefinition ,
3537 WorkflowGroup ,
3638 WorkflowGroupDependencies ,
39+ WorkflowGroupDeploymentMode ,
3740 WorkflowGroupInputMapping ,
3841 WorkflowGroupOutput ,
3942} from '@/lib/table'
@@ -347,6 +350,11 @@ export function WorkflowSidebarBody({
347350 const [ autoRun , setAutoRun ] = useState < boolean > ( ( ) =>
348351 existingGroup ? existingGroup . autoRun !== false : false
349352 )
353+ // Which workflow state per-cell runs execute against. Defaults to `'live'`
354+ // (the editable draft) for both new and pre-feature groups.
355+ const [ deploymentMode , setDeploymentMode ] = useState < WorkflowGroupDeploymentMode > (
356+ ( ) => existingGroup ?. deploymentMode ?? 'live'
357+ )
350358 // Deps default to none selected. With auto-run on, at least one is required
351359 // (enforced via `depsValid` below); a legacy group with empty deps will
352360 // surface the error on first open until the user picks at least one column.
@@ -709,6 +717,7 @@ export function WorkflowSidebarBody({
709717 outputs : fullOutputs ,
710718 ...( newOutputColumns . length > 0 ? { newOutputColumns } : { } ) ,
711719 inputMappings : inputMappingsList ,
720+ deploymentMode,
712721 autoRun,
713722 } )
714723 toast . success ( `Saved "${ existingGroup . name ?? 'Workflow' } "` )
@@ -740,6 +749,7 @@ export function WorkflowSidebarBody({
740749 dependencies,
741750 outputs : groupOutputs ,
742751 inputMappings : inputMappingsList ,
752+ deploymentMode,
743753 autoRun,
744754 }
745755 await addWorkflowGroup . mutateAsync ( { group, outputColumns : newOutputColumns } )
@@ -1027,12 +1037,31 @@ export function WorkflowSidebarBody({
10271037 < div className = 'h-[1.25px] flex-1' style = { DASHED_DIVIDER_STYLE } />
10281038 </ div >
10291039 { showAdvanced && (
1030- < InputMappingSection
1031- inputFields = { startBlockInputs . existing }
1032- columnOptions = { depOptions }
1033- value = { inputMappings }
1034- onChange = { setInputMappings }
1035- />
1040+ < >
1041+ { ! isEnrichment && (
1042+ < >
1043+ < div className = 'flex items-center justify-between pl-0.5' >
1044+ < Label > Workflow version</ Label >
1045+ < ButtonGroup
1046+ value = { deploymentMode }
1047+ onValueChange = { ( v ) =>
1048+ setDeploymentMode ( v === 'deployed' ? 'deployed' : 'live' )
1049+ }
1050+ >
1051+ < ButtonGroupItem value = 'live' > Live</ ButtonGroupItem >
1052+ < ButtonGroupItem value = 'deployed' > Deployed</ ButtonGroupItem >
1053+ </ ButtonGroup >
1054+ </ div >
1055+ < FieldDivider />
1056+ </ >
1057+ ) }
1058+ < InputMappingSection
1059+ inputFields = { startBlockInputs . existing }
1060+ columnOptions = { depOptions }
1061+ value = { inputMappings }
1062+ onChange = { setInputMappings }
1063+ />
1064+ </ >
10361065 ) }
10371066 </ >
10381067 ) }
0 commit comments