@@ -5,10 +5,9 @@ import { Button, Checkbox, cn, handleKeyboardActivation } from '@sim/emcn'
55import { PlayOutline , Square } from '@sim/emcn/icons'
66import type { ActiveDispatch } from '@/lib/api/contracts/tables'
77import type { ColumnDefinition , TableRow as TableRowType , WorkflowGroup } from '@/lib/table'
8- import { mapInputValues } from '@/lib/table/cell-format'
98import { getColumnId } from '@/lib/table/column-keys'
109import { getUnmetGroupDeps } from '@/lib/table/deps'
11- import { getEnrichmentReadiness } from '@/enrichments/readiness'
10+ import { getEnrichmentRowReadiness } from '@/enrichments/readiness'
1211import { getEnrichment } from '@/enrichments/registry'
1312import type { SaveReason } from '../../types'
1413import { CellContent } from './cells'
@@ -209,19 +208,10 @@ export const DataRow = React.memo(function DataRow({
209208 if ( group . type === 'enrichment' && ( group . autoRun !== false || hasAttemptedManualRun ) ) {
210209 const enrichment = getEnrichment ( group . enrichmentId )
211210 if ( enrichment ) {
212- const ownOutputColumns = new Set ( group . outputs . map ( ( output ) => output . columnName ) )
213- const enrichmentInputMappings = ( group . inputMappings ?? [ ] ) . filter (
214- ( mapping ) => ! ownOutputColumns . has ( mapping . columnName )
215- )
216- const inputColumnById = new Map < string , string > ( )
217- for ( const mapping of enrichmentInputMappings ) {
218- inputColumnById . set ( mapping . inputName , mapping . columnName )
219- }
220- const inputs = mapInputValues ( row . data , schemaColumns , enrichmentInputMappings )
221- const readiness = getEnrichmentReadiness ( enrichment , inputs )
211+ const readiness = getEnrichmentRowReadiness ( enrichment , group , row . data , schemaColumns )
222212 if ( ! readiness . ready ) {
223213 const mappedLabels = readiness . missingInputs . flatMap ( ( input ) => {
224- const columnId = inputColumnById . get ( input . id )
214+ const columnId = readiness . inputColumnById . get ( input . id )
225215 return columnId ? [ nameByColumnId . get ( columnId ) ?? columnId ] : [ ]
226216 } )
227217 const waitingLabels =
@@ -411,7 +401,10 @@ export const DataRow = React.memo(function DataRow({
411401 column . workflowGroupId
412402 ? workflowGroups . find ( ( g ) => g . id === column . workflowGroupId )
413403 : undefined ,
414- activeDispatches
404+ activeDispatches ,
405+ column . workflowGroupId
406+ ? waitingByGroupId ?. has ( column . workflowGroupId ) === true
407+ : false
415408 ) }
416409 column = { column }
417410 isEditing = { isEditing }
0 commit comments