@@ -212,6 +212,7 @@ define('pgadmin.browser', [
212212 let save_the_workspace = prefStore . getPreferencesForModule ( 'misc' ) . save_app_state ;
213213 if ( save_the_workspace ) {
214214 this . restore_pgadmin_state ( ) ;
215+ pgBrowser . docker . default_workspace . focus ( ) ;
215216 }
216217 } ,
217218 check_corrupted_db_file : function ( ) {
@@ -299,33 +300,33 @@ define('pgadmin.browser', [
299300 } ,
300301
301302 restore_pgadmin_state : function ( ) {
302- getApiInstance ( ) . get (
303+ getApiInstance ( { 'Content-Encoding' : 'gzip' } ) . get (
303304 url_for ( 'settings.get_application_state' )
304305 ) . then ( ( res ) => {
305306 if ( res . data . success && res . data . data . result . length > 0 ) {
306- _ . each ( res . data . data . result , function ( tool_state ) {
307- let tool_name = tool_state . tool_name ;
308- let tool_data = tool_state . tool_data ;
309- let sql_id = `${ tool_name } -${ getRandomInt ( 1 , 9999999 ) } ` ;
310-
311- if ( tool_name == 'sqleditor' ) {
312- localStorage . setItem ( sql_id , tool_data ) ;
313- showQueryTool . relaunchSqlTool ( tool_state , sql_id ) ;
314- } else if ( tool_name == 'psql' ) {
315- pgAdmin . Tools . Psql . openPsqlTool ( null , null , tool_state ) ;
316- } else if ( tool_name == 'ERD' ) {
317- localStorage . setItem ( sql_id , tool_data ) ;
318- pgAdmin . Tools . ERD . showErdTool ( null , null , false , sql_id , tool_state ) ;
319- } else if ( tool_name == 'schema_diff' ) {
320- localStorage . setItem ( sql_id , tool_data ) ;
321- pgAdmin . Tools . SchemaDiff . launchSchemaDiff ( sql_id ) ;
307+ _ . each ( res . data . data . result , function ( toolState ) {
308+ let toolNme = toolState . tool_name ;
309+ let toolData = toolState . tool_data ;
310+ let toolDataId = `${ toolNme } -${ getRandomInt ( 1 , 9999999 ) } ` ;
311+ let connectionInfo = toolState . connection_info ;
312+
313+ if ( toolNme == 'sqleditor' ) {
314+ localStorage . setItem ( toolDataId , toolData ) ;
315+ showQueryTool . relaunchSqlTool ( connectionInfo , toolDataId ) ;
316+ } else if ( toolNme == 'psql' ) {
317+ pgAdmin . Tools . Psql . openPsqlTool ( null , null , connectionInfo ) ;
318+ } else if ( toolNme == 'ERD' ) {
319+ localStorage . setItem ( toolDataId , toolData ) ;
320+ pgAdmin . Tools . ERD . showErdTool ( null , null , false , connectionInfo , toolDataId ) ;
321+ } else if ( toolNme == 'schema_diff' ) {
322+ localStorage . setItem ( toolDataId , toolData ) ;
323+ pgAdmin . Tools . SchemaDiff . launchSchemaDiff ( toolDataId ) ;
322324 }
323325 } ) ;
324326
325327 // call clear application state data.
326328 try {
327- getApiInstance ( ) . delete ( url_for ( 'settings.delete_application_state' ) , {
328- } ) ;
329+ getApiInstance ( ) . delete ( url_for ( 'settings.delete_application_state' ) , { } ) ;
329330 } catch ( error ) {
330331 console . error ( error ) ;
331332 pgAdmin . Browser . notifier . error ( gettext ( 'Failed to remove query data.' ) + parseApiError ( error ) ) ;
0 commit comments