diff --git a/src/app/backend-selection.service.ts b/src/app/backend-selection.service.ts index b06ed2c9058aa7aa087b64ca6719d96cca2ca79c..224df910147e7cfa19135013844a5f437a5d972e 100644 --- a/src/app/backend-selection.service.ts +++ b/src/app/backend-selection.service.ts @@ -32,6 +32,11 @@ export class BackendSelectionService { if (s.tes.indexOf('localhost') == -1) { return true; } else { + if (s.ping === null ) { + return false; + } else { + return true; + } } } private updateApiServer(apiservers: APIServer[]) { @@ -59,6 +64,12 @@ export class BackendSelectionService { if (nextserver === undefined) { nextserver = apiservers[0] } + + if (nextserver !== undefined && nextserver !== null && nextserver.tes.indexOf('localhost') != -1) { + this.localapi.next(true); + } else { + this.localapi.next(false); + } this.apiserver.next(nextserver); } } @@ -75,7 +86,7 @@ export class BackendSelectionService { this.http.get<string>(server.tes+'/sshagent',options).pipe( timeout(timeouts))]) .subscribe((ok) => {server.ping = (performance.now() - <number>(ok[0]))}, - (err) => {server.ping = undefined}); + (err) => {server.ping = null}); } } diff --git a/src/app/browser-window.service.ts b/src/app/browser-window.service.ts index 37f90f1b5fe46eb3d64644c5eb61780c3642d3e5..8670905aecf1d53241276a58b4ddefd3514ea276 100644 --- a/src/app/browser-window.service.ts +++ b/src/app/browser-window.service.ts @@ -109,13 +109,17 @@ export class BrowserWindowService { public logUsage() { var app: any; + console.log('entered log usage'); + console.log(this.settingsService.logging); if (this.settingsService.logging) { this.openapps.forEach( (app,index) => { + console.log('probing window',app); if (!app.window.closed) { if (app.job.state == 'RUNNING') { + console.log('log url',environment.logserver+"/"+app.job.identity.site.name+"/"+app.job.identity.username+"/"+app.job.app.name+"/"+app.job.jobid); this.http.get<any>(environment.logserver+"/"+app.job.identity.site.name+"/"+app.job.identity.username+"/"+app.job.app.name+"/"+app.job.jobid).pipe( //We're expecting 404 not founds - catchError((e) => {return of([]);}) - ).subscribe((_) => {return}) + catchError((e) => {console.error(e); return of([]);}) + ).subscribe((v) => {console.log('log success',v); return}) } } }) diff --git a/src/app/jobs.service.ts b/src/app/jobs.service.ts index 0b6cf6cb1974563c633835d7eec982bc62516a43..b244cacc0a2b96da636675baf14ce394ffa5df7c 100644 --- a/src/app/jobs.service.ts +++ b/src/app/jobs.service.ts @@ -46,11 +46,11 @@ export class JobsService { if (error.error.message.indexOf("Permission denied") != -1) { this.notifications.notify("Your login appears to have expired. Please log in again"); this.authService.updateAgentContents().subscribe((_) => {return}); - } else { - this.notifications.notify(error.error.message); - } - return; + return; + } } + this.notifications.notify("Unable to retrieve a list of running jobs.\nDid your session expire?") + console.error(error); this.authService.updateAgentContents().subscribe((_) => {return}); } diff --git a/src/app/notifications.service.ts b/src/app/notifications.service.ts index 5c28182440644e81a7474196e8310723ad4f6e8f..58496d7f67aa653958340eb15142aa2a9fb3d5b8 100644 --- a/src/app/notifications.service.ts +++ b/src/app/notifications.service.ts @@ -16,8 +16,17 @@ export class NotificationsService { return this.msg; } - notify(msg: string) { + notify(msg: any) { + if (msg.hasOwnProperty('error')) { + this.notify(msg.error); + return; + } + if (msg.hasOwnProperty('message')) { + this.notify(msg.message); + return; + } this.msg.next(msg); + console.log(msg); } diff --git a/src/app/tes.service.ts b/src/app/tes.service.ts index ff3348e6340eae14dbdc0a296ffa39ce9fc48707..5d220e5bf075de44e39e7f9f92123ef5bd51937f 100644 --- a/src/app/tes.service.ts +++ b/src/app/tes.service.ts @@ -159,9 +159,7 @@ private addUserHealth(identity,resp) { return } if (error.status == 400) { - if (error.error !== undefined && error.error.message !== undefined) { - this.notifications.notify(error.error.message); - } + this.notifications.notify(error); return } } @@ -170,35 +168,24 @@ private addUserHealth(identity,resp) { submissionError(error: any) { if (error.status != 0) { try { - this.notifications.notify(error.error); + this.notifications.notify(error); console.error(error); } catch { this.notifications.notify('Job Canceling failed'); console.error(error); } - /*if ('error' in error && 'message' in error.error) { - this.notifications.notify(error.error.message); - } else { - this.notifications.notify('Job submission failed'); - }*/ } } cancelError(error: any) { if (error.status != 0) { try { - this.notifications.notify(error.error); + this.notifications.notify(error); console.error(error); } catch { this.notifications.notify('Job Canceling failed'); console.error(error); } - - /*if ('error' in error && 'message' in error.error) { - this.notifications.notify(error.error.message); - } else { - this.notifications.notify('Job Canceling failed'); - }*/ } }