Commit e13fd70f authored by Chris Hines's avatar Chris Hines
Browse files

add titles to the tables of user information

parent a709c844
Pipeline #7535 passed with stages
in 3 minutes and 6 seconds
......@@ -39,4 +39,5 @@ export class Health {
msg: string;
type: string;
data: any;
title: string;
}
......@@ -16,8 +16,8 @@ export class Identity {
this.username = username;
this.site = site;
this.keyCerts = [];
this.systemalerts = new BehaviorSubject<Health[]>([]);
this.accountalerts = new BehaviorSubject<Health[]>([]);
this.systemalerts = new BehaviorSubject<Health[]>(null);
this.accountalerts = new BehaviorSubject<Health[]>(null);
this.joblist = new BehaviorSubject<Job[]>([]);
this.quotas = [];
}
......
......@@ -51,16 +51,18 @@
<div fxLayout="column" style="height: 100%">
<div *ngIf="identitySubject | async as id">
<!-- the list of warning either on the computer system or the users account -->
<div *ngIf="(identitySubject | async) !== null && (appSubject | async) === null" >
<div *ngIf="countErrors(((identitySubject | async).systemalerts | async),((identitySubject | async).accountalerts | async)) == 0; then noAlerts else displayAlerts"></div>
<ng-template #noAlerts><h2> No Alerts for {{ (identitySubject | async).displayName() }}</h2></ng-template>
<div *ngIf="id !== null && (appSubject | async) === null" >
<div *ngIf="(id.systemalerts | async) == null || (id.accountalerts | async) == null; then loading else displayAlerts"></div>
<ng-template #loading><h2> Loading ...</h2></ng-template>
<ng-template #displayAlerts>
<h2>Alerts for {{ (identitySubject | async).displayName() }}</h2>
<!-- This is all the system level alerts-->
<mat-list>
<div *ngFor="let h of ((identitySubject | async).systemalerts | async)">
<div *ngFor="let h of (id.systemalerts | async)">
<mat-list-item>
<div *ngIf="h.stat == 'error'">
<div class='health-warn'>
......@@ -81,6 +83,7 @@
</mat-list-item>
</div>
<div *ngIf="h.type == 'table'">
<h3>{{ h.title }}</h3>
<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>
......@@ -101,6 +104,7 @@
<app-joblist [identitySubject]="identitySubject" [appSubject]="appSubject"></app-joblist>
</div>
</div>
</div>
</mat-sidenav-content>
......
......@@ -77,6 +77,7 @@ export class LauncherComponent implements OnInit {
countErrors(a: Health[], b: Health[]) {
var count: number = 0
var h: Health;
if (a != null) {
for (h of a) {
if (h.stat == 'error' || h.stat == 'warn') {
count++;
......@@ -85,6 +86,8 @@ export class LauncherComponent implements OnInit {
count = count + parseInt(h.stat);
}
}
}
if (b != null) {
for (h of b) {
if (h.stat == 'error' || h.stat == 'warn') {
count++;
......@@ -93,6 +96,7 @@ export class LauncherComponent implements OnInit {
count = count + parseInt(h.stat);
}
}
}
return count;
}
......@@ -154,12 +158,6 @@ export class LauncherComponent implements OnInit {
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
......
......@@ -228,6 +228,7 @@ getUserHealth(identity: Identity) {
return
}
if (identity.site.userhealth === undefined) {
identity.accountalerts.next([]);
return
}
params.set('statcmd',JSON.stringify(identity.site.userhealth));
......@@ -240,8 +241,8 @@ getUserHealth(identity: Identity) {
}
getHealthAlerts(identity: Identity) {
identity.accountalerts.next([]);
identity.systemalerts.next([]);
identity.accountalerts.next(null);
identity.systemalerts.next(null);
this.getCachetIncidents(identity);
this.getUserHealth(identity);
}
......@@ -253,6 +254,7 @@ getCachetIncidents(identity: Identity) {
let params = new URLSearchParams();
if (identity.site.cacheturis === undefined || identity.site.cacheturis.length == 0) {
identity.systemalerts.next([]);
return
}
for (let uri of identity.site.cacheturis) {
......@@ -264,6 +266,9 @@ getCachetIncidents(identity: Identity) {
addCachetIncidents(identity,resp) {
let ci = identity.systemalerts.value;
if (ci == null) {
ci = []
}
for (let i of resp.data) {
if (i.status == 3 || i.status == 4) {
continue;
......@@ -278,11 +283,17 @@ addCachetIncidents(identity,resp) {
addUserHealth(identity,resp) {
let ci = identity.accountalerts.value;
if (ci == null) {
ci = []
}
console.log('in add User HEalth');
for (let i of resp) {
let h = new Health();
h.stat = i.stat;
h.msg = i.message;
if (i.title != undefined) {
h.title = i.title;
}
if (i.type != undefined) {
h.type = i.type;
h.data = i.data;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment