Commit 31848db3 authored by Chris Hines's avatar Chris Hines
Browse files

fix up the frontend so it can take apps properly from a local config file

parent 556932fe
......@@ -230,7 +230,7 @@ public getKeys(id?: Identity) {
this.notifications.notify("");
this.agentContents.next(resp)
}),
catchError((e) => { console.error('updateAGentContents error',e) ; return of([])})
catchError((e) => { console.error('updateAgentContents error',e) ; return of([])})
//tap((_) => this.notifications.notify(""))
)
return agentpipe$
......
......@@ -57,7 +57,12 @@ export class ComputesitesService {
getStrudelAppsIdentity(identity: Identity): Observable<Strudelapp[]> {
let uri$ = this.getStrudelAppsUri(identity.site.appCatalogUri);
let cmd$ = this.getStrudelAppsCmd(identity);
return combineLatest([uri$, cmd$]).pipe(map(([uri,cmd]) => (uri.concat(cmd))))
return combineLatest([uri$, cmd$]).pipe(
tap( ([uri,cmd]) => console.log('getStrudelAppsIdentity',uri,cmd)),
map(([uri,cmd]) => (uri.concat(cmd))),
tap((v) => console.log('getStrudelAppsIdentity concat',v))
)
}
......@@ -82,7 +87,7 @@ export class ComputesitesService {
}
private getStrudelAppsCmd(identity: Identity): Observable<Strudelapp[]> {
console.log('running getStrudleAppsCmd',identity)
console.log('running getStrudelAppsCmd',identity)
if (identity.site.appCatalogCmd != null) {
return (this.tesService.runCommand(identity,identity.site.appCatalogCmd) as Observable<Strudelapp[]>)
.pipe(
......@@ -93,36 +98,16 @@ export class ComputesitesService {
}
storeLocalStrudelApps(name: string, apps: any) {
localStorage.setItem(name+'-apps',JSON.stringify(apps))
}
removeLocalStrudelApps() {
var keys = [];
for (var key in localStorage) {
var idx = key.indexOf('-apps');
if (idx !== -1) {
keys.push(key)
}
}
for (var key in keys) {
localStorage.removeItem(key);
}
}
updateStrudelApps(id: Identity, apps) {
var sapps: Strudelapp[];
var localapps: Strudelapp[];
var currentApps: Strudelapp[];
sapps = <Strudelapp[]>apps;
currentApps = id.appCatalog.value;
console.log('updateStrudelApps',currentApps);
localapps = JSON.parse(localStorage.getItem(id.site.name+'-apps'))
if (localapps !== null) {
for (let a of localapps) {
sapps.push(a);
}
}
id.appCatalog.next(sapps);
id.appCatalog.next(currentApps.concat(sapps));
}
private handleError<T> (operation = 'operation', result?: T) {
......
......@@ -22,7 +22,7 @@ export class Identity {
this.systemalerts = new BehaviorSubject<Health[]>(null);
this.accountalerts = new BehaviorSubject<Health[]>(null);
this.joblist = new BehaviorSubject<Job[]>([]);
this.appCatalog = new BehaviorSubject<Strudelapp[]>([]);
this.appCatalog = new BehaviorSubject<Strudelapp[]>(site.appCatalog);
this.quotas = [];
this.expiry = expiry;
......
......@@ -54,10 +54,8 @@ export class SettingsComponent implements OnInit {
this.config = JSON.parse(e.target.result);
if ('computesites' in this.config) {
this.computeSitesService.storeLocalComputeSites(this.config['computesites'])
}
if ('apps' in this.config) {
this.computeSitesService.storeLocalStrudelApps(this.config['sitename'],this.config['apps']);
this.computeSitesService.storeLocalComputeSites(this.config['computesites']);
console.log('saving compute site',this.config['computesites']);
}
if ('authz' in this.config) {
this.authService.storeLocalAuthZ(this.config['authz'])
......@@ -71,7 +69,6 @@ export class SettingsComponent implements OnInit {
resetConfig() {
this.computeSitesService.removeLocalStrudelApps();
this.computeSitesService.removeLocalComputeSites();
this.authService.removeLocalAuthZ()
}
......
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