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

allow the user info scripts to send me a table to be rendered

parent 547ae2cb
No related branches found
No related tags found
2 merge requests!21New css dev,!13Dev
Pipeline #7523 passed
......@@ -152,11 +152,11 @@ export class AuthorisationService {
//Verify that the state matched the nonce we used when initiating login
let tuple = JSON.parse(localStorage.getItem('authservice'));
if (tuple == null) {
console.log('unable to get the authservice from localStorage');
console.log(localStorage.getItem('authservice'));
return
}
//if (tuple == null) {
// console.log('unable to get the authservice from localStorage');
// console.log(localStorage.getItem('authservice'));
// return
//}
if (tuple[1] != state) {
return
}
......@@ -306,8 +306,6 @@ public getKeys(id?: Identity) {
let redirect_uri = window.location.origin+this.locationStrategy.getBaseHref()+"sshauthz_callback";
let nonce=Math.random().toString(36).substring(2, 15)
localStorage.setItem('authservice', JSON.stringify([authservice,nonce]));
localStorage.setItem('path', this.location.path());
if (authservice.scope == null) {
......
:host {
height: 100%;
}
.mat-header-cell {
text-align: right;
}
.mat-row {
height: 24px;
}
......@@ -71,7 +71,6 @@
</div>
</mat-list>
<!-- this is all the user level alerts that are not quota -->
<mat-list>
<div *ngFor="let h of ((identitySubject | async).accountalerts | async)">
<div *ngIf="h.type === undefined || h.type != 'quota'">
......@@ -82,49 +81,18 @@
</mat-list-item>
</div>
<div *ngIf="h.type == 'table'">
<table mat-table [dataSource]="h.data">
<ng-container *ngFor="let c of h.cols" matColumnDef="{{c.key}}">
<th mat-header-cell *matHeaderCellDef>{{c.name}}</th>
<th mat-cell *matCellDef="let row;"> {{row[c.key]}}</th>
<table mat-table [dataSource]="h.data.rows" style="width: 100%">
<ng-container *ngFor="let c of h.data.cols" matColumnDef="{{c.key}}">
<th mat-header-cell *matHeaderCellDef>{{ c.header }} </th>
<td mat-cell *matCellDef="let row;"> {{row[c.key]}}</td>
</ng-container>
<!--<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>
<tr mat-header-row *matHeaderRowDef="calculateCols(h.data.cols); sticky: true" ></tr>
<tr mat-row *matRowDef="let row; columns: calculateCols(h.data.cols)" [ngClass]="rowClass(row)" ></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%">
<ng-container matColumnDef="resource">
<th mat-header-cell *matHeaderCellDef> Resource </th>
<td mat-cell *matCellDef="let quota"> {{quota.data.resource}} </td>
</ng-container>
<ng-container matColumnDef="usage">
<th mat-header-cell *matHeaderCellDef> Usage </th>
<td mat-cell *matCellDef="let quota"> {{humanKBytes(quota.data.usage)}} </td>
</ng-container>
<ng-container matColumnDef="quota">
<th mat-header-cell *matHeaderCellDef> Quota </th>
<td mat-cell *matCellDef="let quota"> {{humanKBytes(quota.data.quota)}} </td>
</ng-container>
<tr mat-header-row *matHeaderRowDef="displayedColumns"></tr>
<tr mat-row *matRowDef="let row; columns: displayedColumns;" [ngClass]="quotaClass(row)"></tr>
</table>-->
</ng-template>
</div>
......
......@@ -54,8 +54,8 @@ export class LauncherComponent implements OnInit {
private launchwindow: any;
private launchwindowWatcher: any;
private subscriptions: Subscription[];
public quotas: BehaviorSubject<any[]>;
displayedColumns: string[] = ['pu','pq'];
//public quotas: BehaviorSubject<any[]>;
displayedColumns: string[] = [];
constructor( public dialog: MatDialog,
......@@ -71,7 +71,7 @@ export class LauncherComponent implements OnInit {
this.subscriptions.push(this.computeSitesService.appidentities.subscribe(o => this.getHealth(o)));
this.appSubject = new BehaviorSubject<Strudelapp>(null);
this.identitySubject = new BehaviorSubject<Identity>(null);
this.quotas = new BehaviorSubject<any[]>([]);
//this.quotas = new BehaviorSubject<any[]>([]);
}
countErrors(a: Health[], b: Health[]) {
......@@ -90,6 +90,10 @@ export class LauncherComponent implements OnInit {
return count;
}
calculateCols(data) {
return data.map(function(r) { return r.key });
}
humanKBytes(n: number) {
if (n > 1024*1024*1024) {
let v = n/1024/1024/1024;
......@@ -106,8 +110,8 @@ export class LauncherComponent implements OnInit {
return '0 MB';
}
quotaClass(quota) {
if (quota.stat == 'error' || quota.stat == 'warn') {
rowClass(row) {
if (row.stat == 'error' || row.stat == 'warn') {
return 'health-warn';
} else {
return 'health-ok';
......@@ -132,7 +136,6 @@ export class LauncherComponent implements OnInit {
ngOnInit() {
this.strudelapps = [];
}
ngOnDestroy() {
......@@ -144,13 +147,20 @@ export class LauncherComponent implements OnInit {
selectId(id: Identity) {
this.identitySubject.next(id);
this.appSubject.next(null);
if (id != null) {
for (let a of id.accountalerts.value) {
console.log('acocunt alert');
console.log(a);
}
}
//if (id != null) {
// We will subscribe to account alerts until the id changes (in which case we will subscribe to account alerts
// on the next id
// BUT
// since identitySubject is a behaviorsubject and already has a value, we must skip(1)
id.accountalerts.pipe(takeUntil(this.identitySubject.pipe(skip(1)))).subscribe((msgs) => { this.quotas.next(msgs.filter(q => q.type =='quota')) });
}
// id.accountalerts.pipe(takeUntil(this.identitySubject.pipe(skip(1)))).subscribe((msgs) => { this.quotas.next(msgs.filter(q => q.type =='quota')) });
//}
}
selectApp(app: Strudelapp) {
......
......@@ -10,9 +10,11 @@
}
.health-warn .mat-cell {
color: mat-color($warn);
text-align: right;
}
.health-ok .mat-cell {
color: mat-color($foreground);
text-align: right;
}
.mat-menu-panel {
.mat-menu-item {
......
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