Commit 34f283b3 authored by Chris Hines's avatar Chris Hines
Browse files

cleanup some of the notifications. Hopefully we will now see all notifications...

cleanup some of the notifications. Hopefully we will now see all notifications correctly and failing that get useful info in the javascript console
parent 3f049216
Pipeline #10597 passed with stages
in 3 minutes and 34 seconds
......@@ -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});
}
}
......
......@@ -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})
}
}
})
......
......@@ -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});
}
......
......@@ -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);
}
......
......@@ -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');
}*/
}
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment