@@ -248,25 +248,23 @@ export class SessionCardComponent extends AntiMemLeak implements OnInit {
248248 /**
249249 * Set the region for the session
250250 */
251- changeDefaultRegion ( ) {
251+ changeRegion ( ) {
252252 if ( this . selectedDefaultRegion ) {
253- this . workspace = this . configurationService . getDefaultWorkspaceSync ( ) ;
254-
255- this . workspace . sessions . forEach ( session => {
256- if ( session . id === this . session . id ) {
257- session . account . region = this . selectedDefaultRegion ;
258- this . session . account . region = this . selectedDefaultRegion ;
259- this . configurationService . updateWorkspaceSync ( this . workspace ) ;
260-
261- this . sessionService . invalidateSessionToken ( session ) ;
262-
263- if ( this . session . active ) {
264- this . startSession ( ) ;
265- } else {
266- this . appService . redrawList . emit ( true ) ;
267- }
268- }
269- } ) ;
253+
254+ if ( this . session . active ) {
255+ this . sessionService . stopSession ( this . session ) ;
256+ }
257+
258+ this . session . account . region = this . selectedDefaultRegion ;
259+ this . sessionService . invalidateSessionToken ( this . session ) ;
260+ this . sessionService . updateSession ( this . session ) ;
261+
262+ if ( this . session . active ) {
263+ this . startSession ( ) ;
264+ } else {
265+ this . appService . redrawList . emit ( true ) ;
266+ }
267+
270268
271269 this . appService . toast ( 'Default region has been changed!' , ToastLevel . SUCCESS , 'Region changed!' ) ;
272270 this . modalRef . hide ( ) ;
@@ -321,10 +319,10 @@ export class SessionCardComponent extends AntiMemLeak implements OnInit {
321319 }
322320 }
323321
324- changeDefaultProfile ( ) {
322+ changeProfile ( ) {
325323 if ( this . selectedProfile ) {
326324 if ( this . session . active ) {
327- this . sessionService . removeFromIniFile ( this . session . profile ) ;
325+ this . sessionService . stopSession ( this . session ) ;
328326 }
329327
330328 this . sessionService . addProfile ( this . selectedProfile ) ;
0 commit comments