Skip to content

Commit 0870d4e

Browse files
code review comments incorporated
1 parent 6db1733 commit 0870d4e

File tree

1 file changed

+25
-26
lines changed

1 file changed

+25
-26
lines changed

src/components/ApplicationGroup/AppGroup.service.ts

Lines changed: 25 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -74,32 +74,31 @@ export const getWorkflows = (envID: string, appIds: string): Promise<WorkflowsRe
7474
getCIConfig(envID, appIds),
7575
getCDConfig(envID, appIds),
7676
getExternalCIList(envID, appIds),
77-
])
78-
.then(([workflow, ciConfig, cdConfig, externalCIConfig]) => {
79-
if (workflow.result) {
80-
const _ciConfigMap = new Map<number, CiPipelineResult>()
81-
for (const _ciConfig of ciConfig.result) {
82-
_ciConfigMap.set(_ciConfig.appId, _ciConfig)
83-
}
84-
for (const workflowResult of workflow.result.workflows) {
85-
const processWorkflowData = processWorkflow(
86-
{
87-
...workflowResult,
88-
workflows: [workflowResult],
89-
} as WorkflowResult,
90-
_ciConfigMap.get(workflowResult.appId),
91-
cdConfig.result as CdPipelineResult,
92-
externalCIConfig.result,
93-
WorkflowTrigger,
94-
WorkflowTrigger.workflow,
95-
filterChildAndSiblingCD(envID),
96-
)
97-
_workflows.push(...processWorkflowData.workflows)
98-
_filteredCIPipelines.set(workflowResult.appId, processWorkflowData.filteredCIPipelines)
99-
}
100-
}
101-
return { workflows: _workflows, filteredCIPipelines: _filteredCIPipelines }
102-
})
77+
]).then(([workflow, ciConfig, cdConfig, externalCIConfig]) => {
78+
const _ciConfigMap = new Map<number, CiPipelineResult>()
79+
for (const _ciConfig of ciConfig.result) {
80+
_ciConfigMap.set(_ciConfig.appId, _ciConfig)
81+
}
82+
if (workflow?.result?.workflows){
83+
for (const workflowResult of workflow.result.workflows) {
84+
const processWorkflowData = processWorkflow(
85+
{
86+
...workflowResult,
87+
workflows: [workflowResult],
88+
} as WorkflowResult,
89+
_ciConfigMap.get(workflowResult.appId),
90+
cdConfig.result as CdPipelineResult,
91+
externalCIConfig.result,
92+
WorkflowTrigger,
93+
WorkflowTrigger.workflow,
94+
filterChildAndSiblingCD(envID),
95+
)
96+
_workflows.push(...processWorkflowData.workflows)
97+
_filteredCIPipelines.set(workflowResult.appId, processWorkflowData.filteredCIPipelines)
98+
}
99+
}
100+
return { workflows: _workflows, filteredCIPipelines: _filteredCIPipelines }
101+
})
103102
}
104103

105104
export const getCIConfigList = (envID: string, appIds: string): Promise<CIConfigListType> => {

0 commit comments

Comments
 (0)