diff --git a/src/app/authorisation.service.ts b/src/app/authorisation.service.ts index 860498e15aada4610bb175e98d54446c09aa6840..a4016b55da87c287359c87b7aeeca2518610b1aa 100644 --- a/src/app/authorisation.service.ts +++ b/src/app/authorisation.service.ts @@ -1,7 +1,7 @@ import { Injectable } from '@angular/core'; import { HttpClientModule, HttpClient, HttpHeaders, HttpErrorResponse } from '@angular/common/http'; import { Observable, Subject, BehaviorSubject } from 'rxjs'; -import { catchError, map, tap, take,filter } from 'rxjs/operators'; +import { catchError, map, tap, take,filter,skip } from 'rxjs/operators'; import { ActivatedRoute, Router } from '@angular/router'; import {LocationStrategy, Location} from '@angular/common'; // import { keypair } from 'keypair'; @@ -164,12 +164,18 @@ export class AuthorisationService { public getCert() { var token: AuthToken; - token = this.token.value - if (this.backendSelectionService.apiserver.value === null) { - this.backendSelectionService.apiserver.pipe(take(1)).subscribe(() => this.getCert()) - } + token = this.token.value; + // if (this.backendSelectionService.apiserver.value === null) { + // this.backendSelectionService.apiserver.pipe(take(1)).subscribe(() => this.getCert()) + // return + //} if (token.token === undefined || token.token === '' || token.token == null) { this.token.pipe(take(1)).subscribe(() => this.getCert()) + return + } + if (this.backendSelectionService.apiserver.value === null || this.backendSelectionService.apiserver.value == undefined) { + this.backendSelectionService.apiserver.pipe(skip(1),take(1)).subscribe(() => this.getCert()) + return } @@ -184,7 +190,7 @@ export class AuthorisationService { let data = {'token': token.token, 'pubkey': sshpub, 'signing_url': token.sshauthzservice.sign}; - this.http.post<any>(this.backendURI+'/getcert',data, options) + this.http.post<any>(this.backendSelectionService.apiserver.value.tes+'/getcert',data, options) .pipe(catchError(this.handleError([]))) .subscribe(resp => this.makeKeyCert(newkeypair.private, resp, token.sshauthzservice), error => this.signingError(error,token.sshauthzservice)); @@ -220,7 +226,11 @@ public getKeys(id?: Identity) { window.open(sshauthzservice.logout); } let path=localStorage.getItem('path'); - this.readyToNavigate.next([true,path]); + console.log('I should have a keycert now'); + this.updateAgentContents(); + console.log('requested agent contens update'); + // only navigate once the agent contents has been refreshed + this.loggedInAuthZ.pipe(take(1)).subscribe( () => {this.readyToNavigate.next([true,path])}); } public querySshAgentError(error: any) { @@ -331,11 +341,12 @@ public getKeys(id?: Identity) { } private signingError(error: any,sshauthzservice: SshAuthzServer) { this.statusMsg.next('You don\'t appear to have an account on '+sshauthzservice.name); + console.log(error); if (!(sshauthzservice.logout === null)) { window.open(sshauthzservice.logout); } - let path=localStorage.getItem('path'); - this.readyToNavigate.next([true,path]); + //let path=localStorage.getItem('path'); + //this.readyToNavigate.next([true,path]); } diff --git a/src/app/backend-selection.service.ts b/src/app/backend-selection.service.ts index be86a591533c9ca2eead8c0732a4dc318c933c9f..45238393c3f33b9d2490c08277b2542a400eaf45 100644 --- a/src/app/backend-selection.service.ts +++ b/src/app/backend-selection.service.ts @@ -33,6 +33,7 @@ export class BackendSelectionService { console.log('no saved api server, waitin for a list to choose the first one') //this.apiservers.pipe(filter((v) => v !== []),take(1)).subscribe((v) => {console.log('got some apiservers to choose from'); this.defaultApiServer(v)}) this.apiservers.subscribe((v) => {console.log('got some apiservers to choose from'); this.defaultApiServer(v)}) + this.apiservers.subscribe((l) => {console.log('api servers changed'); console.log(l);}); } } @@ -100,7 +101,7 @@ export class BackendSelectionService { } } } - if (!found) { + if (!found && current !== undefined) { list.push(current); } this.apiservers.next(list); diff --git a/src/app/launcher/launcher.component.html b/src/app/launcher/launcher.component.html index fd9bb5cce2da4a303baf73a52614c6fc1a1ea4a6..bf9c048f96574cefd314a65dc33365f2891ecd62 100644 --- a/src/app/launcher/launcher.component.html +++ b/src/app/launcher/launcher.component.html @@ -81,11 +81,33 @@ </div> </mat-list-item> </div> + <!--<div *ngIf="h.type == 'table'"> + <table mat-table [dataSource]="h.data"> + <div *ngFor="let c of h.cols"> + <ng-container *matColumnDef="c.key"> + <th mat-header-cell *matHeaderCellDef>{{c.name}}</th> + <th mat-cell *matCellDef="let row;"> {{row[c.key]}}</th> + </ng-container> + </div> + <ng-container matColumnDef="usage"> + <th mat-header-cell *matHeaderCellDef> Usage </th> + <td mat-cell *matCellDef="let row"> {{row.pu}} </td> + </ng-container> + <ng-container matColumnDef="quota"> + <th mat-header-cell *matHeaderCellDef> Quota </th> + <td mat-cell *matCellDef="let row"> {{row.pq}} </td> + </ng-container> + + <tr mat-header-row *matHeaderRowDef="displayedColumns" ></tr> + <tr mat-row *matRowDef="let row; columns: displayedColumns;" [ngClass]="quotaClass(row)"></tr> + <tr mat-row *matRowDef="let row; columns: displayedColumns" ></tr> + </table> + </div>--> </div> </mat-list> <!-- this table contains all the user level alerts that are quotas --> - <table mat-table [dataSource]="quotas" style="width: 100%"> + <!--<table mat-table [dataSource]="quotas" style="width: 100%"> <ng-container matColumnDef="resource"> <th mat-header-cell *matHeaderCellDef> Resource </th> @@ -103,7 +125,7 @@ <tr mat-header-row *matHeaderRowDef="displayedColumns"></tr> <tr mat-row *matRowDef="let row; columns: displayedColumns;" [ngClass]="quotaClass(row)"></tr> - </table> + </table>--> </ng-template> </div> diff --git a/src/app/launcher/launcher.component.ts b/src/app/launcher/launcher.component.ts index e120031fa9dc9c7253b99b3935905e9c0b16c500..da6331577ee9cd425d26ae67a528b9d81738707e 100644 --- a/src/app/launcher/launcher.component.ts +++ b/src/app/launcher/launcher.component.ts @@ -55,7 +55,7 @@ export class LauncherComponent implements OnInit { private launchwindowWatcher: any; private subscriptions: Subscription[]; public quotas: BehaviorSubject<any[]>; - displayedColumns: string[] = ['resource', 'usage', 'quota']; + displayedColumns: string[] = ['usage']; constructor( public dialog: MatDialog, diff --git a/src/app/settings/settings.component.html b/src/app/settings/settings.component.html index 4f54973f2d6721f059f6c441a2dd576c2fb6a39d..53a507bcd468b989858afcf49864b27203704ba1 100644 --- a/src/app/settings/settings.component.html +++ b/src/app/settings/settings.component.html @@ -13,6 +13,7 @@ <div gdAreas = "header header | apiselect apiselect | themeselect themeselect | loadconfig resetconfig | done done"> <div gdArea="header"><h2 style="width: 100%">Settings</h2></div> <div gdArea="apiselect"> + <div *ngIf="(backendSelectionService.apiservers | async) !== undefined"> <mat-form-field> <mat-label>API Server</mat-label> <mat-select [ngModel]="selectedApiServer" (selectionChange)="backendSelectionService.setApiServer($event.value)"> @@ -21,6 +22,7 @@ </mat-option> </mat-select> </mat-form-field> + </div> </div> <div gdArea="themeselect"> <mat-form-field > diff --git a/src/app/settings/settings.component.ts b/src/app/settings/settings.component.ts index cbc8e15c2e59d46d1d5229afa698a768455a5b6d..6140c4f779f4f6d74ff26e9f19c6091212abe9fd 100644 --- a/src/app/settings/settings.component.ts +++ b/src/app/settings/settings.component.ts @@ -19,13 +19,17 @@ export class SettingsComponent implements OnInit { public themeSubject: BehaviorSubject<string>; public themes: any[] = [ {'name':'Light','value':'strudel-light-theme'}, {'name': 'Dark','value':'strudel-dark-theme'}] + public apiservers: any[] constructor( public backendSelectionService: BackendSelectionService, public authService: AuthorisationService, public computeSitesService: ComputesitesService, public overlayContainer: OverlayContainer, ) { + this.selectedApiServer = null; this.backendSelectionService.apiserver.subscribe((s) => this.selectedApiServer = s); + this.apiservers = [] + this.backendSelectionService.apiservers.subscribe((l) => this.apiservers = l); } ngOnInit() { diff --git a/src/assets/config/computesites.json b/src/assets/config/computesites.json index 863577f9a7350564e95cbe1751ca73d5e0c68dc8..73a65e8cab464e017fc5c0215a292ab444709628 100644 --- a/src/assets/config/computesites.json +++ b/src/assets/config/computesites.json @@ -9,7 +9,7 @@ "appCatalogUri": "./assets/config/m3apps.dev.json", "cancelcmd": "/usr/local/sv2/dev/sv2scancel.sh {jobid}", "statcmd": "/usr/local/sv2/dev/sv2stat.py", - "userhealth": "/home/chines/userhealth/uijson.py", + "userhealth": "/usr/local/sv2/dev/userhealth/bin/uijson", "cacheturis": ["https://cachet-dev.erc.monash.edu.au/api/v1/incidents"] }, {