33
44define ( [
55 'deepforge/updates/Updates' ,
6+ 'deepforge/utils' ,
67 'js/Constants' ,
78 'js/PanelBase/PanelBase' ,
89 'panels/AutoViz/AutoVizPanel' ,
@@ -11,6 +12,7 @@ define([
1112 'q'
1213] , function (
1314 Updates ,
15+ Utils ,
1416 CONSTANTS ,
1517 PanelBase ,
1618 AutoVizPanel ,
@@ -164,15 +166,14 @@ define([
164166 } ) ;
165167 } ;
166168
167- SidebarPanel . prototype . applyUpdates = function ( updates ) {
168- // Seed Updates should apply the
169+ SidebarPanel . prototype . applyUpdates = async function ( updates ) {
169170 const seedUpdates = updates . filter ( update => update . type === Updates . SEED ) ;
170- const promises = seedUpdates . map ( update => {
171- const { name, hash} = update ;
172- return Q . ninvoke ( this . _client , 'updateLibrary' , name , hash ) ;
173- } ) ;
171+ for ( let i = 0 ; i < seedUpdates . length ; i ++ ) {
172+ const { name, hash} = seedUpdates [ i ] ;
173+ await Q . ninvoke ( this . _client , 'updateLibrary' , name , hash ) ;
174+ }
174175
175- // Apply the migrations
176+ await Utils . sleep ( 1000 ) ;
176177 const pluginId = 'ApplyUpdates' ;
177178 const migrations = updates
178179 . filter ( update => update . type === Updates . MIGRATION )
@@ -183,11 +184,7 @@ define([
183184 updates : migrations
184185 } ;
185186
186- promises . push (
187- Q . ninvoke ( this . _client , 'runServerPlugin' , pluginId , context )
188- ) ;
189-
190- return Q . all ( promises ) ;
187+ await Q . ninvoke ( this . _client , 'runServerPlugin' , pluginId , context ) ;
191188 } ;
192189
193190 return SidebarPanel ;
0 commit comments