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

style improvements (well I think they are improvements, see what others think ;-)

parent db143283
......@@ -8,20 +8,23 @@ export class Identity {
site: Computesite;
authservice: SshAuthzServer;
keyCerts: KeyCert[];
healthalerts: BehaviorSubject<Health[]>;
systemalerts: BehaviorSubject<Health[]>;
accountalerts: BehaviorSubject<Health[]>;
joblist: BehaviorSubject<Job[]>;
constructor( username: string, site: Computesite) {
this.username = username;
this.site = site;
this.keyCerts = [];
this.healthalerts = new BehaviorSubject<Health[]>([]);
this.systemalerts = new BehaviorSubject<Health[]>([]);
this.accountalerts = new BehaviorSubject<Health[]>([]);
this.joblist = new BehaviorSubject<Job[]>([]);
}
copy_skip_catalog(): Identity {
let id = new Identity(null,null);
id.username = this.username;
id.healthalerts = null;
id.systemalerts = null;
id.accountalerts = null;
id.joblist = null;
id.site = new Computesite();
id.site.url = this.site.url;
......
......@@ -8,7 +8,7 @@
<iframe [src]="batchcmdsafeurl" style="border: none; border-style: none; border-width: 0px; width: 100%" [style.height]="height+'px'" #batchbuilderiframe></iframe>
<div fxLayout="row" fxLayoutAlign="space-around">
<button mat-button (click)="launch()" #launchbtn>Launch</button>
<button mat-flat-button (click)="launch()" color="primary" #launchbtn>Launch</button>
</div>
</div>
</div>
......@@ -19,8 +19,8 @@
<mat-expansion-panel (opened)="selectId(id)" style="width: 100%">
<mat-expansion-panel-header>
<mat-panel-title>
<span fxFlex matBadge="{{ (id.healthalerts | async).length }}"
[matBadgeHidden]= "(id.healthalerts | async).length == 0"
<span fxFlex matBadge="{{ countErrors((id.systemalerts | async), (id.accountalerts | async)) }}"
[matBadgeHidden]= "countErrors((id.systemalerts | async), (id.accountalerts | async)) == 0"
matBadgePosition="above before"
matBadgeColor="warn"
matBadgeOverlap="false" matBadgeSize="small"
......@@ -53,7 +53,20 @@
<!-- the list of warning either on the computer system or the users account -->
<div *ngIf="(identitySubject | async) !== null" >
<mat-list>
<div *ngFor="let h of ((identitySubject | async).healthalerts | async)">
<div *ngFor="let h of ((identitySubject | async).systemalerts | async)">
<mat-list-item>
<div *ngIf="h.stat == 'error'">
<div class='health-warn'>
{{ h.msg }}
</div>
</div>
</mat-list-item>
</div>
</mat-list>
</div>
<div *ngIf="(identitySubject | async) !== null" >
<mat-list>
<div *ngFor="let h of ((identitySubject | async).accountalerts | async)">
<mat-list-item>
<div *ngIf="h.stat == 'error'">
<div class='health-warn'>
......
......@@ -15,7 +15,7 @@ import { TesService } from '../tes.service';
import {BackendSelectionService } from '../backend-selection.service';
import { AuthorisationService } from '../authorisation.service';
import { Identity } from '../identity';
import { Computesite } from '../computesite';
import { Computesite, Health } from '../computesite';
import { LogoutdialogComponent } from '../logoutdialog/logoutdialog.component';
import { SshAuthzServer } from '../identity';
......@@ -63,6 +63,23 @@ export class LauncherComponent implements OnInit {
this.identitySubject = new BehaviorSubject<Identity>(null);
}
countErrors(a: Health[], b: Health[]) {
var count: number = 0
var h: Health;
for (h of a) {
if (h.stat == 'error') {
count++;
}
}
for (h of b) {
if (h.stat == 'error') {
count++;
}
}
return count;
}
navLogin(o) {
if (o.length == 0) {
this.router.navigate(['/login']);
......
<div style="height: 100%">
<mat-toolbar color="primary">
<mat-toolbar-row>
<button mat-icon-button ><mat-icon>menu</mat-icon></button>
......@@ -6,5 +7,15 @@
<span class="fill-horizontal-space"></span>
</mat-toolbar-row>
</mat-toolbar>
<div style="height: 10%"></div>
<div fxLayout=row>
<div fxFlex></div>
<div fxFlex gdAreas="header header | logout cancel " gdGap="10%" style="text-align: center">
<div gdArea="header" >Really Logout?</div>
<div gdArea="logout"> <button mat-flat-button (click)="logout()" color=warn >Logout</button></div>
<div gdArea="cancel"> <button mat-flat-button routerLink="/launch" color=primary >Cancel</button></div>
</div>
<div fxFlex></div>
</div>
</div>
<button mat-button (click)="logout()">Logout</button><button mat-button routerLink="/launch">Cancel</button>
<mat-toolbar color="primary">
<mat-toolbar-row>
<button mat-icon-button (click)=idSideNav.toggle()><mat-icon>menu</mat-icon></button>
Select an API server
<div style="width: 100%">
<mat-form-field>
<mat-select [ngModel]="selectedApiServer" (selectionChange)="backendSelectionService.setApiServer($event.value)">
<mat-option *ngFor="let apis of backendSelectionService.apiservers|async" [value]="apis">
{{ apis.name }}
</mat-option>
</mat-select>
</mat-form-field>
</div>
<button type="button" mat-button (click)="fileInput.click()">Load Config</button>
<input hidden (change)="loadConfig($event)" accept=".json" #fileInput type="file" id="file">
<button mat-button (click)=resetConfig()>Reset Config</button>
<div style="width: 100%">
Select a theme
<mat-form-field >
<mat-select [(value)] ="theme" (selectionChange)="selectTheme($event.value)">
<mat-option *ngFor="let opttheme of themes" [value]="opttheme">
{{ opttheme.name }}
</mat-option>
</mat-select>
</mat-form-field>
</div>
<button mat-button routerLink="/launch">Cancel</button>
<span>Strudel v2.0</span>
<span class="fill-horizontal-space"></span>
</mat-toolbar-row>
</mat-toolbar>
<div fxLayout="row" style="width: 100%">
<div fxFlex></div>
<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">
<mat-form-field>
<mat-label>API Server</mat-label>
<mat-select [ngModel]="selectedApiServer" (selectionChange)="backendSelectionService.setApiServer($event.value)">
<mat-option *ngFor="let apis of backendSelectionService.apiservers|async" [value]="apis">
{{ apis.name }}
</mat-option>
</mat-select>
</mat-form-field>
</div>
<div gdArea="themeselect">
<mat-form-field >
<mat-label>Theme</mat-label>
<mat-select [(value)] ="theme" (selectionChange)="selectTheme($event.value)">
<mat-option *ngFor="let opttheme of themes" [value]="opttheme">
{{ opttheme.name }}
</mat-option>
</mat-select>
</mat-form-field>
</div>
<div gdArea="loadconfig">
<button type="button" mat-button (click)="fileInput.click()">Load Config</button>
<input hidden (change)="loadConfig($event)" accept=".json" #fileInput type="file" id="file">
</div>
<div gdArea="resetconfig">
<button mat-button (click)=resetConfig()>Reset Config</button>
</div>
<div gdArea="done"><button mat-flat-button color=primary routerLink="/launch" style="width: 100%">Done</button></div>
</div>
<div fxFlex></div>
</div>
......@@ -176,7 +176,7 @@ public setStatusMsg(statusMsg: BehaviorSubject<any>) {
private getUserHealthError(error: any, identity: Identity) {
console.log('user health error');
identity.healthalerts.next([]);
identity.accountalerts.next([]);
this.statusMsg.next("There was an error checking your user account");
//return this.getJobsError(error,identity)
}
......@@ -240,7 +240,8 @@ getUserHealth(identity: Identity) {
}
getHealthAlerts(identity: Identity) {
identity.healthalerts.next([]);
identity.accountalerts.next([]);
identity.systemalerts.next([]);
this.getCachetIncidents(identity);
this.getUserHealth(identity);
}
......@@ -262,7 +263,7 @@ getCachetIncidents(identity: Identity) {
}
addCachetIncidents(identity,resp) {
let ci = identity.healthalerts.value;
let ci = identity.systemalerts.value;
for (let i of resp.data) {
if (i.status == 3 || i.status == 4) {
continue;
......@@ -272,11 +273,11 @@ addCachetIncidents(identity,resp) {
h.msg = i.message;
ci.push(h);
}
identity.healthalerts.next(ci);
identity.systemalerts.next(ci);
}
addUserHealth(identity,resp) {
let ci = identity.healthalerts.value;
let ci = identity.accountalerts.value;
console.log('in add User HEalth');
for (let i of resp) {
if (i.stat != 'ok') {
......@@ -286,8 +287,8 @@ addUserHealth(identity,resp) {
ci.push(h);
}
}
identity.healthalerts.next(ci);
console.log('id health is',identity.healthalerts.value);
identity.accountalerts.next(ci);
console.log('id health is',identity.accountalerts.value);
}
......
......@@ -8,7 +8,7 @@
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="icon" type="image/x-icon" href="favicon.ico">
</head>
<body style="height: 100vh; margin-left: 0px; margin-right: 0px; margin-top: 0px; margin-bottom: 0px ">
<body style="height: 100vh; margin-left: 0px; margin-right: 0px; margin-top: 0px; margin-bottom: 0px; font-family: Roboto">
<app-root></app-root>
</body>
</html>
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