11import  *  as  awssfUtils  from  "../utils" ; 
22
33export  const  awssfImportDialog  =  function  ( editorUi ,  title )  { 
4-   var  graph  =  editorUi . editor . graph ; 
4+   const  graph  =  editorUi . editor . graph ; 
55
66  function  recurseStates  ( states )  { 
7-     var  res  =  { hash : { } ,  list : [ ] } ; 
8-     var  cell ; 
9-     for  ( var  name  in  states )  { 
10-       var  body  =  states [ name ] ; 
7+     const  res  =  { hash : { } ,  list : [ ] } ; 
8+     let  cell ; 
9+     for  ( const  name  in  states )  { 
10+       const  body  =  states [ name ] ; 
1111      if  ( body . Type  ===  "Pass" )  { 
1212        cell  =  PassState . prototype . create ( name ,  body ) ; 
1313      }  else  if  ( body . Type  ===  "Task" )  { 
@@ -23,10 +23,15 @@ export const awssfImportDialog = function (editorUi, title) {
2323      }  else  if  ( body . Type  ===  "Parallel" )  { 
2424        cell  =  ParallelState . prototype . create ( name ,  body ) ; 
2525        for ( const  branch  in  body . Branches )  { 
26-           var  _sub  =  recurseStates ( body . Branches [ branch ] . States ) ; 
26+           const  _sub  =  recurseStates ( body . Branches [ branch ] . States ) ; 
2727          for ( const  _cell  of  _sub . list )  cell . insert ( _cell ) ; 
2828          Object . assign ( res . hash ,  _sub . hash ) ; 
2929        } 
30+       }  else  if  ( body . Type  ===  "Map" )  { 
31+         cell  =  MapState . prototype . create ( name ,  body ) ; 
32+         const  _sub  =  recurseStates ( body . Iterator . States ) ; 
33+         for ( const  _cell  of  _sub . list )  cell . insert ( _cell ) ; 
34+         Object . assign ( res . hash ,  _sub . hash ) ; 
3035      } 
3136      res . hash [ name ]  =  cell ; 
3237      res . list . push ( cell ) ; 
@@ -79,11 +84,16 @@ export const awssfImportDialog = function (editorUi, title) {
7984      } 
8085      if  ( body . Type  ===  "Parallel" )  { 
8186        for ( const  branch  of  body . Branches )  { 
82-           var  _sp  =  vertexes [ name ] . getChildAt ( 0 ) ; 
83-           var  tmp  =  recurseEdges ( branch ,  vertexes ,  _sp ) ; 
87+           const  _sp  =  vertexes [ name ] . getChildAt ( 0 ) ; 
88+           const  tmp  =  recurseEdges ( branch ,  vertexes ,  _sp ) ; 
8489          tmp . map ( v  =>  vertexes [ name ] . insert ( v ) ) ; 
8590        } 
8691      } 
92+       if  ( body . Type  ===  "Map" )  { 
93+         const  _sp  =  vertexes [ name ] . getChildAt ( 0 ) ; 
94+         const  tmp  =  recurseEdges ( body . Iterator ,  vertexes ,  _sp ) ; 
95+         tmp . map ( v  =>  vertexes [ name ] . insert ( v ) ) ; 
96+       } 
8797    } 
8898    return  res ; 
8999  } 
@@ -122,7 +132,7 @@ export const awssfImportDialog = function (editorUi, title) {
122132    graph . setSelectionCells ( cells ) ; 
123133    graph . getModel ( ) . beginUpdate ( ) ; 
124134    try  { 
125-       var  parallels  =  cells . filter ( function  ( v )  {  return  v . awssf . type   ===   " Parallel" ;  } ) ; 
135+       var  parallels  =  cells . filter ( function  ( v )  {  return  v . awssf . type . match ( / P a r a l l e l | M a p / ) ;  } ) ; 
126136      var  parallelLayout  =  new  mxCompactTreeLayout ( graph ,  false ) ; 
127137      parallelLayout . edgeRouting  =  false ; 
128138      parallelLayout . levelDistance  =  30 ; 
0 commit comments