Misc Polishing (#413)

* Ensure that after we assign a role to a user, we show it immediately

* Cached libraryType api as that is not going to change in a viewing session. Moved some components around to tighten bundles.

* Cleaned up more TODOs
* Refactored Configuration to use getter and setters so that the interface is a lot cleaner. Updated HashUtil to use JWT Secret instead of Machine name (as docker machine name is random each boot).
This commit is contained in:
Joseph Milazzo 2021-07-20 21:39:44 -05:00 committed by GitHub
parent ef5b22b585
commit b8165b311c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
29 changed files with 408 additions and 307 deletions

View file

@ -14,7 +14,8 @@ export class LibraryService {
baseUrl = environment.apiUrl;
libraryNames: {[key:number]: string} | undefined = undefined;
private libraryNames: {[key:number]: string} | undefined = undefined;
private libraryTypes: {[key: number]: LibraryType} | undefined = undefined;
constructor(private httpClient: HttpClient) {}
@ -75,8 +76,17 @@ export class LibraryService {
}
getLibraryType(libraryId: number) {
// TODO: Cache this in browser
return this.httpClient.get<LibraryType>(this.baseUrl + 'library/type?libraryId=' + libraryId);
if (this.libraryTypes != undefined && this.libraryTypes.hasOwnProperty(libraryId)) {
return of(this.libraryTypes[libraryId]);
}
return this.httpClient.get<LibraryType>(this.baseUrl + 'library/type?libraryId=' + libraryId).pipe(map(l => {
if (this.libraryTypes === undefined) {
this.libraryTypes = {};
}
this.libraryTypes[libraryId] = l;
return this.libraryTypes[libraryId];
}));
}
search(term: string) {