Skip to content
Snippets Groups Projects
Commit c399e36f authored by Chris Hines's avatar Chris Hines
Browse files

don't monitor windows for viewing usage or logs inline with issue 61

parent 176b11c8
No related branches found
No related tags found
3 merge requests!106if stat fails, display the error instead of immediately refreshing...,!99Dev,!42Dev
Pipeline #9035 passed
......@@ -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})
}
}
}
......@@ -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))
}
......
......@@ -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)});
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment