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

fix identity managment observables (a bit, more work to be done)

parent fdad4f55
No related branches found
No related tags found
3 merge requests!106if stat fails, display the error instead of immediately refreshing...,!99Dev,!44Dev
......@@ -45,10 +45,10 @@ export class AppComponent {
this.settingsService.theme$.subscribe((v) => this.setTheme(v))
this.authService.loggedInAuthZ.pipe(
isdefined
).subscribe((v) => { console.log('update this.loggedin'); this.loggedin = (<[]>v).length} );
).subscribe((v) => { console.log('update this.loggedin'); this.loggedin = (<[]>v).length ; console.log(this.loggedin)} );
this.authService.loggedOutAuthZ.pipe(
isdefined
).subscribe((v) => { console.log('update this.loggedout'); this.loggedout = (<[]>v).length} );
).subscribe((v) => { console.log('update this.loggedout'); this.loggedout = (<[]>v).length ; console.log(this.loggedout)} );
}
toggleMenu() {
......
......@@ -2,8 +2,8 @@ import { Injectable } from '@angular/core';
import { Computesite, Strudelapp } from './computesite';
import {BehaviorSubject, of, combineLatest} from 'rxjs';
import { HttpClientModule, HttpClient, HttpHeaders, HttpErrorResponse } from '@angular/common/http';
import { Observable } from 'rxjs/Observable';
import { catchError, map, tap} from 'rxjs/operators';
import { Observable } from 'rxjs';
import { catchError, map, tap, filter} from 'rxjs/operators';
import { Identity } from './identity';
import { TesService } from './tes.service';
import { AuthorisationService} from './authorisation.service';
......@@ -29,7 +29,8 @@ export class ComputesitesService {
//this.computesites.subscribe(computesites => this.getStrudelApps(computesites))
this.computesites.subscribe((cs) => this.authorisationService.updateAgentContents());
this.authorisationService.agentContents.subscribe(ac => this.updateIdentities(ac));
combineLatest([this.authorisationService.agentContents,this.computesites.pipe(filter((v) => v !== []))])
.subscribe(([ac,computesites]) => this.updateIdentities(ac, computesites));
this.identities.subscribe((ids) => this.getStrudelAppsIds(ids))
this.getComputeSites();
}
......@@ -188,8 +189,8 @@ export class ComputesitesService {
return [];
}
private updateIdentities(resp) {
let certs = resp;
private updateIdentities(agentContents,computesites) {
let certs = agentContents;
var cs: Computesite;
var identities: Identity[] = [];
var appidentities: Identity[] = [];
......@@ -197,10 +198,10 @@ export class ComputesitesService {
// If the agent contents is set to null we are probably still updating it
console.log('updateIdentities ... check your subscriptions');
if (resp == null) {
if (agentContents == null) {
return
}
for (cs of this.computesites.value) {
for (cs of computesites) {
for (let i in certs) {
let principals = this.siteMatch(certs[i],cs);
for (let principal of principals) {
......
......@@ -69,13 +69,10 @@ export class LauncherComponent implements OnInit {
private strudelappsService: StrudelappsService,
private settingsService: SettingsService,
) {
this.subscriptions = [];
this.subscriptions.push(this.authService.sshAuthzServers.subscribe(o => {this.updateSshAuthZServers(o)}));
this.subscriptions.push(this.computeSitesService.identities.subscribe(o => this.navLogin(o)));
this.subscriptions.push(this.computeSitesService.appidentities.subscribe(o => this.getHealth(o)));
this.app$ = new BehaviorSubject<Strudelapp>(null);
this.identity$ = new BehaviorSubject<Identity>(null);
this.identity = null;
this.app$ = new BehaviorSubject<Strudelapp>(null);
this.identity$ = new BehaviorSubject<Identity>(null);
this.identity = null;
//this.quotas = new BehaviorSubject<any[]>([]);
}
......@@ -167,6 +164,10 @@ export class LauncherComponent implements OnInit {
//this.route.paramMap.subscribe((params: ParamMap) => this.updateIdApp(params));
// if the conents of the ssh agent changes we will get a whole new set of identity objects. In that case we must update out id subject
this.computeSitesService.appidentities.pipe(notNull).subscribe( (appidentities) => this.refreshId(<Identity[]> appidentities));
this.subscriptions = [];
this.subscriptions.push(this.authService.sshAuthzServers.subscribe(o => {this.updateSshAuthZServers(o)}));
this.subscriptions.push(this.computeSitesService.identities.subscribe(o => this.navLogin(o)));
this.subscriptions.push(this.computeSitesService.appidentities.subscribe(o => this.getHealth(o)));
}
......
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