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

allow apps to specify a different batch command URL, and better detect 401 unauthorized

parent f3c05f50
No related branches found
No related tags found
4 merge requests!106if stat fails, display the error instead of immediately refreshing...,!99Dev,!89Test,!88Dev
......@@ -33,6 +33,7 @@ export class JobsService {
public refreshJobs() {
if (this.id !== undefined && this.id !== null) {
var query$: Observable<Job[]>;
console.log('refreshJobs');
query$ = this.tes.runCommand(this.id, this.id.site.statcmd)
query$.subscribe((qjobs) => this.jobs$.next(<Job[]>qjobs),
(error) => this.getJobsError(error,this.id))
......@@ -41,6 +42,10 @@ export class JobsService {
}
public getJobsError(error,identity: Identity) {
if (error.hasOwnProperty('status') && error.status == 401) {
this.notifications.notify("Your login appears to have expired. Please log in again", () => { this.authService.updateAgentContents().subscribe((_) => {return}) } );
return;
}
this.tsub.unsubscribe();
if (identity.expiry < Date.now()) {
this.notifications.notify("Your login has expired. Please log in again", () => { this.authService.updateAgentContents().subscribe((_) => {return}) } );
......@@ -53,6 +58,7 @@ export class JobsService {
return;
}
this.notifications.notify("Unable to retrieve a list of running jobs.\nThe error messge was " + error.error.message);
console.log(error);
return;
}
console.error(error);
......
......@@ -89,7 +89,11 @@ export class LaunchDialogComponent implements OnInit {
theme = 'strudel-light-theme';
}
if (this.identity !== null && this.app !== null) {
this.batchcmdurl = this.identity.site.url+"/"+encodeURIComponent(this.app.name)+"?theme="+theme;
if (this.app.batchcmdurl !== null) {
this.batchcmdurl = this.app.batchcmdurl+"?theme="+theme;
} else {
this.batchcmdurl = this.identity.site.url+"/"+encodeURIComponent(this.app.name)+"?theme="+theme;
}
}
this.batchcmdsafeurl = this.domSanitizer.bypassSecurityTrustResourceUrl(this.batchcmdurl);
if (this.app.url !== null) {
......
......@@ -8,6 +8,7 @@ export class AppAction {
}
export class Strudelapp {
url: string; // A url used to retrieve extra config options. May be null
batchcmdurl: string = null; // if an app provides a batchcommandurl it overrides the url provieded for the site.
name: string;
startscript: string; // batch script ... should NOT include resource directives
// resource directives like #SBATCH belong in the batchinterface
......
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