Skip to content

Commit

Permalink
fix(20321): fix bug with the dual iteration of transitions and pipelines
Browse files Browse the repository at this point in the history
  • Loading branch information
vanch3d committed Apr 23, 2024
1 parent d722bcd commit 6b54dea
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,14 @@ import { Connection, getConnectedEdges, getIncomers, Node, NodeAddChange, XYPosi

import i18n from '@/config/i18n.config.ts'

import { BehaviorPolicy, DataPolicy, PolicyOperation, Schema, SchemaReference, Script } from '@/api/__generated__'
import {
BehaviorPolicyOnTransition,
DataPolicy,
PolicyOperation,
Schema,
SchemaReference,
Script,
} from '@/api/__generated__'
import {
DataHubNodeType,
DataPolicyData,
Expand Down Expand Up @@ -221,26 +228,20 @@ export function checkValidityPipeline(
}

export const loadBehaviorPolicyPipelines = (
behaviorPolicy: BehaviorPolicy,
transitionNode: Node,
behaviorPolicyTransition: BehaviorPolicyOnTransition,
transitionNode: Node<TransitionData>,
schemas: Schema[],
scripts: Script[]
) => {
const newNodes: (NodeAddChange | Connection)[] = []

for (const transition of behaviorPolicy.onTransitions || []) {
const activeTransition = getActiveTransition(transition)
if (!activeTransition)
throw new Error(i18n.t('datahub:error.loading.operation.noTransition', { source: activeTransition }) as string)
const activeTransition = getActiveTransition(behaviorPolicyTransition)
if (!activeTransition)
throw new Error(i18n.t('datahub:error.loading.operation.noTransition', { source: activeTransition }) as string)

const transitionOnEvent = transition[activeTransition]
if (!transitionOnEvent)
throw new Error(i18n.t('datahub:error.loading.operation.noTransition', { source: activeTransition }) as string)
const transitionOnEvent = behaviorPolicyTransition[activeTransition]
if (!transitionOnEvent)
throw new Error(i18n.t('datahub:error.loading.operation.noTransition', { source: activeTransition }) as string)

const pipelines = loadPipeline(transitionNode, transitionOnEvent.pipeline, null, schemas, scripts)
newNodes.push(...pipelines)
}
return newNodes
return loadPipeline(transitionNode, transitionOnEvent.pipeline, null, schemas, scripts)
}

export const loadDataPolicyPipelines = (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ export const loadTransitions = (
position: { ...shiftBottom() },
data: extractEventStates(model, behaviorPolicyTransition),
}
const pipelines = loadBehaviorPolicyPipelines(behaviorPolicy, transitionNode, schemas, scripts)
const pipelines = loadBehaviorPolicyPipelines(behaviorPolicyTransition, transitionNode, schemas, scripts)

newNodes.push(
{ item: transitionNode, type: 'add' } as NodeAddChange,
Expand Down

0 comments on commit 6b54dea

Please sign in to comment.