From 9efc4f0a4dd20dc48e87f6073e8019df5e48a50b Mon Sep 17 00:00:00 2001 From: Chris Hines <chris.hines@monash.edu> Date: Thu, 7 Feb 2019 16:54:04 +1100 Subject: [PATCH] convert to a reduced set of parameters for stat --- src/app/authorisation.service.ts | 6 ++--- src/app/tes.service.ts | 38 +++++++++++++------------------- 2 files changed, 18 insertions(+), 26 deletions(-) diff --git a/src/app/authorisation.service.ts b/src/app/authorisation.service.ts index c85b7d4..321db36 100644 --- a/src/app/authorisation.service.ts +++ b/src/app/authorisation.service.ts @@ -268,12 +268,12 @@ public getKeys(id?: Identity) { private httperror(error: any) { console.log('authorsation service got an error'); - this.statusMsg.next(error); - console.log(error); + this.statusMsg.next('There was an error logging in or generating crypto tokens'); + console.error(error); } private httperrorLogout(error: any,sshauthzservice: SshAuthzServer) { console.log('authorsation service got an error'); - this.statusMsg.next(error); + this.statusMsg.next('There was an error logging out and clearing all tokens'); console.log(error); if (!(sshauthzservice.logout === null)) { window.open(sshauthzservice.logout); diff --git a/src/app/tes.service.ts b/src/app/tes.service.ts index 84b9166..dbadf09 100644 --- a/src/app/tes.service.ts +++ b/src/app/tes.service.ts @@ -102,7 +102,7 @@ public setStatusMsg(statusMsg: BehaviorSubject<any>) { this.statusMsg.next("A network error occured. Please try again latter"); return } - console.log(error); + console.error(error); if (error.status == 404 || error.status == 400) { this.statusMsg.next("Login expired. Please log in again."); this.authorisationService.updateAgentContents(); @@ -123,26 +123,16 @@ public setStatusMsg(statusMsg: BehaviorSubject<any>) { let bi = new BatchInterface(); bi.cancelcmd = identity.site.cancelcmd; bi.statcmd = identity.site.statcmd; - // if (this.batchinterface[identity.repr()] === undefined) { - // this.getconfig(new Strudelapp(),identity) - // // .pipe(catchError(this.handleError)) - // .subscribe(resp => { this.batchinterface[identity.repr()] = resp; this.getJobs(identity) }, - // error => this.getBatchInterfaceError(error)); - // // error => this.getJobsError(error,identity)); - // - // - // } else { - // let paramstr = this.buildParams(null,identity,this.batchinterface[identity.repr()]); - // this.http.get<Job[]>(this.Base+'/stat'+'?'+paramstr,options) - // // .pipe(catchError(this.networkError)) - // .subscribe(resp => this.updateJoblist(resp, identity), - // error => this.getJobsError(error)); - // } - let paramstr = this.buildParams(null,identity,bi); - this.http.get<Job[]>(this.Base+'/stat'+'?'+paramstr,options) - // .pipe(catchError(this.networkError)) - .subscribe(resp => this.updateJoblist(resp, identity), - error => this.getJobsError(error)); + let params = new URLSearchParams(); + params.set('statcmd',JSON.stringify(identity.site.statcmd)); + params.set('host',JSON.stringify(identity.site.host)); + params.set('username',JSON.stringify(identity.username)); + console.log('getjob with params',params.toString()); + + this.http.get<Job[]>(this.Base+'/stat'+'?'+params.toString(),options) + // .pipe(catchError(this.networkError)) + .subscribe(resp => this.updateJoblist(resp, identity), + error => this.getJobsError(error)); } public getconfig(app: Strudelapp, identity: Identity): Observable<any> { @@ -154,7 +144,9 @@ public setStatusMsg(statusMsg: BehaviorSubject<any>) { submissionError(error: any) { if (error.status != 0) { - this.statusMsg.next(error.error.message); + this.statusMsg.next('Job submission failed'); + //this.statusMsg.next(error.error.message); + console.error(error.error.message); this.busy.next(false); } } @@ -276,7 +268,6 @@ public setStatusMsg(statusMsg: BehaviorSubject<any>) { }); this.appwindowWatcher = timer(500).pipe(repeat()).subscribe(() => this.watchAppwindow(this.appwindow,dialogRef)); // this.appwindow.location.assign(windowloc); - this.appwindow.focus(); } public connect(job: Job, appinst?: any) { @@ -335,6 +326,7 @@ private httperror(errorstr: string) { let searchresult = errorstr.search(re); if (searchresult != -1) { this.statusMsg.next("Some authentication tokens have expired, you may need to log in again"); + console.error(errorstr); this.authorisationService.updateAgentContents(); } console.error(errorstr); -- GitLab