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

fix up a bunch of errors with site selection

parent 9b29e26f
No related branches found
No related tags found
2 merge requests!21New css dev,!11fix up a bunch of errors with site selection
Pipeline #7512 passed
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]);
}
......
......@@ -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);
......
......@@ -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>
......
......@@ -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,
......
......@@ -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 >
......
......@@ -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() {
......
......@@ -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"]
},
{
......
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