@@ -14,7 +14,7 @@ import { TriggerType, DEFAULT_STATUS, GIT_BRANCH_NOT_CONFIGURED } from '../../..
14
14
import { isEmpty } from '../../../common'
15
15
import { WebhookDetailsType } from '../../../ciPipeline/Webhook/types'
16
16
import { getExternalCIList } from '../../../ciPipeline/Webhook/webhook.service'
17
- import { CommonNodeAttr , TriggerTypeMap , WorkflowNodeType , PipelineType } from '@devtron-labs/devtron-fe-common-lib'
17
+ import { CommonNodeAttr , TriggerTypeMap , WorkflowNodeType , PipelineType , DownstreamNodesEnvironmentsType } from '@devtron-labs/devtron-fe-common-lib'
18
18
import { CIPipelineBuildType } from '../../../ciPipeline/types'
19
19
import { BlackListedCI } from '../../../workflowEditor/types'
20
20
@@ -348,10 +348,17 @@ function addDownstreams(workflows: WorkflowType[]) {
348
348
349
349
if ( ! ! parentNode ) {
350
350
const _downstream = type + '-' + node . id
351
+ const environmentDetails : DownstreamNodesEnvironmentsType = {
352
+ environmentId : node . environmentId ,
353
+ environmentName : node . environmentName ,
354
+ }
355
+
351
356
if ( parentNode . postNode ) {
352
357
parentNode . postNode . downstreams . push ( _downstream )
358
+ parentNode . postNode . downstreamEnvironments ?. push ( environmentDetails )
353
359
} else {
354
360
parentNode . downstreams . push ( _downstream )
361
+ parentNode . downstreamEnvironments ?. push ( environmentDetails )
355
362
}
356
363
parentNode . downstreamNodes . push ( node )
357
364
}
@@ -453,6 +460,7 @@ function ciPipelineToNode(ciPipeline: CiPipeline, dimensions: WorkflowDimensions
453
460
url : '' ,
454
461
id : `${ WorkflowNodeType . GIT } -${ materialName } -${ index } ` ,
455
462
downstreams : [ `${ WorkflowNodeType . CI } -${ ciPipeline . id } ` ] ,
463
+ downstreamEnvironments : [ ] ,
456
464
type : WorkflowNodeType . GIT ,
457
465
icon : 'git' ,
458
466
branch : getStaticCurrentBranchName ( ciMaterial ) ,
@@ -486,6 +494,7 @@ function ciPipelineToNode(ciPipeline: CiPipeline, dimensions: WorkflowDimensions
486
494
type : WorkflowNodeType . CI ,
487
495
inputMaterialList : [ ] ,
488
496
downstreams : [ ] ,
497
+ downstreamEnvironments : [ ] ,
489
498
isExternalCI : ciPipeline . isExternal ,
490
499
// Can't rely on pipelineType for legacy pipelines, so using parentCiPipeline as well
491
500
isLinkedCI : ciPipeline . pipelineType !== PipelineType . LINKED_CD && ! ! ciPipeline . parentCiPipeline ,
@@ -517,6 +526,7 @@ function webhookToNode(webhookDetails: WebhookDetailsType, dimensions: WorkflowD
517
526
type : WorkflowNodeType . WEBHOOK ,
518
527
inputMaterialList : [ ] ,
519
528
downstreams : [ ] ,
529
+ downstreamEnvironments : [ ] ,
520
530
isExternalCI : true ,
521
531
isLinkedCI : false ,
522
532
linkedCount : 0 ,
@@ -545,6 +555,7 @@ function cdPipelineToNode(cdPipeline: CdPipeline, dimensions: WorkflowDimensions
545
555
activeIn : false ,
546
556
activeOut : false ,
547
557
downstreams : [ `${ WorkflowNodeType . CD } -${ cdPipeline . id } ` ] ,
558
+ downstreamEnvironments : [ ] ,
548
559
type : WorkflowNodeType . PRE_CD ,
549
560
status : cdPipeline . preDeployStage ?. status || cdPipeline . preStage ?. status || DEFAULT_STATUS ,
550
561
triggerType : TriggerTypeMap [ trigger ] ,
@@ -581,6 +592,7 @@ function cdPipelineToNode(cdPipeline: CdPipeline, dimensions: WorkflowDimensions
581
592
activeIn : false ,
582
593
activeOut : false ,
583
594
downstreams : cdDownstreams ,
595
+ downstreamEnvironments : [ ] ,
584
596
type : WorkflowNodeType . CD ,
585
597
status : DEFAULT_STATUS ,
586
598
triggerType : TriggerTypeMap [ trigger ] ,
@@ -624,6 +636,7 @@ function cdPipelineToNode(cdPipeline: CdPipeline, dimensions: WorkflowDimensions
624
636
activeIn : false ,
625
637
activeOut : false ,
626
638
downstreams : [ ] ,
639
+ downstreamEnvironments : [ ] ,
627
640
type : WorkflowNodeType . POST_CD ,
628
641
status : cdPipeline . postDeployStage ?. status || cdPipeline . postStage ?. status || DEFAULT_STATUS ,
629
642
triggerType : TriggerTypeMap [ trigger ] ,
0 commit comments