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

use a ping url rather than the sshagent to test if a server is available

parent 34f283b3
No related branches found
No related tags found
4 merge requests!106if stat fails, display the error instead of immediately refreshing...,!99Dev,!66Test,!64Dev
Pipeline #10690 passed
...@@ -83,7 +83,7 @@ export class BackendSelectionService { ...@@ -83,7 +83,7 @@ export class BackendSelectionService {
servers = this.apiservers.value; servers = this.apiservers.value;
for (let server of servers) { for (let server of servers) {
combineLatest([of(performance.now()), combineLatest([of(performance.now()),
this.http.get<string>(server.tes+'/sshagent',options).pipe( this.http.get<string>(server.tes+'/ping',options).pipe(
timeout(timeouts))]) timeout(timeouts))])
.subscribe((ok) => {server.ping = (performance.now() - <number>(ok[0]))}, .subscribe((ok) => {server.ping = (performance.now() - <number>(ok[0]))},
(err) => {server.ping = null}); (err) => {server.ping = null});
......
...@@ -17,6 +17,10 @@ export class NotificationsService { ...@@ -17,6 +17,10 @@ export class NotificationsService {
} }
notify(msg: any) { notify(msg: any) {
if (msg === null || msg === undefined) {
this.msg.next("");
return
}
if (msg.hasOwnProperty('error')) { if (msg.hasOwnProperty('error')) {
this.notify(msg.error); this.notify(msg.error);
return; return;
......
...@@ -28,7 +28,7 @@ ...@@ -28,7 +28,7 @@
<mat-form-field style="width: 100%"> <mat-form-field style="width: 100%">
<mat-label>API Server</mat-label> <mat-label>API Server</mat-label>
<mat-select [ngModel]="selectedApiServer" (selectionChange)="backendSelectionService.setApiServer($event.value)"> <mat-select [ngModel]="selectedApiServer" (selectionChange)="backendSelectionService.setApiServer($event.value)">
<mat-option *ngFor="let apis of backendSelectionService.apiservers|async" [value]="apis" [disabled] ="apis.ping === undefined"> <mat-option *ngFor="let apis of backendSelectionService.apiservers|async" [value]="apis" [disabled] ="apis.ping === undefined || apis.ping === null">
{{ apis.name }} <span *ngIf="apis.ping !== undefined">(ping: {{ apis.ping }} ms)</span> {{ apis.name }} <span *ngIf="apis.ping !== undefined">(ping: {{ apis.ping }} ms)</span>
</mat-option> </mat-option>
</mat-select> </mat-select>
......
...@@ -359,10 +359,13 @@ private handleError(error: HttpErrorResponse) { ...@@ -359,10 +359,13 @@ private handleError(error: HttpErrorResponse) {
if (error.error instanceof ErrorEvent) { if (error.error instanceof ErrorEvent) {
this.notifications.notify("A networking error occured.") this.notifications.notify("A networking error occured.")
return return
} else { }
this.notifications.notify("Your login appears to have expired. Please login again"); if (error.hasOwnProperty("status") && error.status == 500) {
this.authorisationService.updateAgentContents().subscribe((v) => {return}); this.notifications.notify(error);
return
} }
this.notifications.notify("Your login appears to have expired. Please login again");
this.authorisationService.updateAgentContents().subscribe((v) => {return});
} }
......
[ [
{ {
"url": "https://strudel2-api-dev.cloud.cvl.org.au/m3/", "url": "https://beta-api.cloud.cvl.org.au/m3/",
"name": "M3", "name": "M3",
"host": "m3-login2.massive.org.au", "host": "m3-login2.massive.org.au",
"dtn": "m3-dtn1.massive.org.au", "dtn": "m3-dtn1.massive.org.au",
"cafingerprint": "RSA SHA256:cmDxHrZQSPlBMUUcI/BWmruXho1XOzfXPDHSqVTwV2I", "cafingerprint": "RSA SHA256:cmDxHrZQSPlBMUUcI/BWmruXho1XOzfXPDHSqVTwV2I",
"appCatalog": [], "appCatalog": [],
"appCatalogCmd": "cat /usr/local/sv2/dev/apps.json", "appCatalogCmd": "/usr/local/strudel2_cluster/latest/bin/getapps",
"cancelcmd": "/usr/local/sv2/dev/scripts/bin/s2cancel {jobid}", "cancelcmd": "/usr/local/sv2/dev/scripts/bin/s2cancel {jobid}",
"statcmd": "/usr/local/sv2/dev/scripts/bin/s2stat", "statcmd": "/usr/local/sv2/dev/scripts/bin/s2stat",
"userhealth": "/usr/local/userhealth/0.0.2/bin/uijson", "userhealth": "/usr/local/userhealth/0.0.2/bin/uijson",
......
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