diff --git a/src/app/browser-window.service.ts b/src/app/browser-window.service.ts index f03778943f3ae11f48b4a3df9b696418de06cce0..7ba90bacffdd16c19d76551b80fd422b72f9f581 100644 --- a/src/app/browser-window.service.ts +++ b/src/app/browser-window.service.ts @@ -42,35 +42,29 @@ export class BrowserWindowService { private windowLoaded(window: any, location: string): boolean { - console.log('in windowloaded testing'); - console.log(window.location); try { if (window.location.toString() == location) { - console.log('location match'); return true; } - console.log('location not match'); return false; } catch { return true; } } - public openAppWindow( job: Job, url: any, basicAuth: boolean ) { + public openAppWindow( job: Job, url: any, basicAuth: boolean, action: AppAction ) { var re = /^https:\/\/([a-z0-9\.-]+)\/?/; let twshost = this.twsproxy.replace(re,"$1"); - console.log('in openappwindow url is ',url); let windowloc = url.replace(/\{twsproxy\}/g,this.twsproxy).replace(/twshost/g,twshost); - console.log('window loc is',windowloc); var authwindow = null; if (basicAuth) { let authwindowloc = windowloc.replace(/^https:\/\//,'https://'+job.appinst.username+':'+job.appinst.password+'@'); authwindow = window.open(authwindowloc); - this.authdone$.pipe(take(1)).subscribe( () => { authwindow.close() ; this.finishAppWindow(windowloc,job) }); + this.authdone$.pipe(take(1)).subscribe( () => { authwindow.close() ; this.finishAppWindow(windowloc,job,action) }); interval(500).pipe(takeUntil(this.authdone$),filter((v) => this.windowLoaded(authwindow, authwindowloc))).subscribe( () => this.authdone$.next(true)); } else { - this.finishAppWindow(windowloc,job); + this.finishAppWindow(windowloc,job, action); } } @@ -92,7 +86,7 @@ export class BrowserWindowService { }) } - public finishAppWindow(windowloc: any, job:Job) { + public finishAppWindow(windowloc: any, job:Job, action: AppAction) { let appwindow = window.open(windowloc); if (appwindow == null) { this.notifications.notify('It looks like a window failed to open. Please check your popup blocker settings (Strudel 2 needs to be able to open a window to your application'); @@ -101,6 +95,8 @@ export class BrowserWindowService { if (appwindow.closed) { return } - this.openapps.push({'window':appwindow,'job':job}) + if (action.name == "Connect") { // actions like viewing logs don't cause us to monitor for the window closing. Only actions like connecting to desktops/jupyter labs + this.openapps.push({'window':appwindow,'job':job}) + } } } diff --git a/src/app/launch-dialog/launch-dialog.component.ts b/src/app/launch-dialog/launch-dialog.component.ts index 3f48ea3031840a941664a772fb7ecb119c0fe843..f563e718ce425f0f57c3fa3213f98e56d41813b5 100644 --- a/src/app/launch-dialog/launch-dialog.component.ts +++ b/src/app/launch-dialog/launch-dialog.component.ts @@ -57,7 +57,7 @@ export class LaunchDialogComponent implements OnInit { this.height=0; this.submitcmd.subscribe(() => this.canILaunch()); this.appData.subscribe(() => this.canILaunch()); - this.tesService.openWindow$.subscribe((v) => { console.log('openWindow$ ',v); this.browserWindowService.openAppWindow(v.job,v.url,v.usebasicauth)}) + this.tesService.openWindow$.subscribe((v) => { console.log('openWindow$ ',v); this.browserWindowService.openAppWindow(v.job,v.url,v.usebasicauth,v.action)}) this.browserWindowService.cancelJob$.subscribe((v) => this.tesService.cancel(v)) } diff --git a/src/app/tes.service.ts b/src/app/tes.service.ts index 8762d6ecbee91baf7898c26a28ba6baab254ea9f..76c8e4466679a07d1c1733746e188c3a792f8fe7 100644 --- a/src/app/tes.service.ts +++ b/src/app/tes.service.ts @@ -286,7 +286,7 @@ private addUserHealth(identity,resp) { job.connectionState = 3; this.http.get<string>(this.Base+'/appurl?'+paramstr,options) .pipe(catchError(this.handleError)) - .subscribe((resp) => { job.connectionState = 0; this.openWindow$.next( {'job':job, 'url': <string> resp, 'usebasicauth':action.client.usebasicauth})}); + .subscribe((resp) => { job.connectionState = 0; this.openWindow$.next( {'job':job, 'url': <string> resp, 'usebasicauth':action.client.usebasicauth,'action':action})}); //[this.browserWindowService.openAppWindow(resp,job,action)}); }