File tree Expand file tree Collapse file tree 1 file changed +19
-2
lines changed
packages/ui/src/views/pipeline-edit/components/graph-implementation/utils Expand file tree Collapse file tree 1 file changed +19
-2
lines changed Original file line number Diff line number Diff line change @@ -29,6 +29,23 @@ export const yamlString2Nodes = (
2929 return yaml2Nodes ( yamlJson , options )
3030}
3131
32+ export const processGithubJobsToStages = ( yamlJson : Record < string , any > ) => {
33+ if ( yamlJson . jobs ) {
34+ yamlJson . pipeline = yamlJson . pipeline || { }
35+ yamlJson . pipeline . stages = yamlJson . pipeline . stages || [ ]
36+
37+ Object . entries ( yamlJson . jobs ) . forEach ( ( [ key , value ] ) => {
38+ if ( typeof value === 'object' && value !== null ) {
39+ yamlJson . pipeline . stages . push ( { ...value , id : key , name : key } )
40+ }
41+ } )
42+
43+ delete yamlJson . jobs
44+ return yamlJson
45+ }
46+ return yamlJson
47+ }
48+
3249export const yaml2Nodes = (
3350 yamlObject : Record < string , any > ,
3451 options : {
@@ -37,8 +54,8 @@ export const yaml2Nodes = (
3754 } = { }
3855) : AnyContainerNodeType [ ] => {
3956 const nodes : AnyContainerNodeType [ ] = [ ]
40-
41- const stages = yamlObject ?. pipeline ?. stages ?? [ ]
57+ const processedYamlObject = processGithubJobsToStages ( yamlObject )
58+ const stages = processedYamlObject ?. pipeline ?. stages ?? [ ]
4259
4360 if ( stages ) {
4461 const stagesNodes = processStages ( stages , 'pipeline.stages' , options )
You can’t perform that action at this time.
0 commit comments