Merge remote-tracking branch 'origin/dev' into dev

This commit is contained in:
Aaron Louie 2020-05-26 14:48:37 -04:00
commit 0592570529
6 changed files with 27 additions and 16 deletions

6
package-lock.json generated
View File

@ -12291,9 +12291,9 @@
"integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg=="
},
"sartography-workflow-lib": {
"version": "0.0.182",
"resolved": "https://registry.npmjs.org/sartography-workflow-lib/-/sartography-workflow-lib-0.0.182.tgz",
"integrity": "sha512-iqhihrirlzgV+UyhHod0h37QKZSYBkRz1MGxN02cfBdY9b7SpaSG0zzErnwMTDFlWM2IsPiqi+wOx/d1FyFlRA=="
"version": "0.0.187",
"resolved": "https://registry.npmjs.org/sartography-workflow-lib/-/sartography-workflow-lib-0.0.187.tgz",
"integrity": "sha512-r2I+A1RMUyw6Rj04Wd8pOU5nmYZ9Rhk7ruljfcCWt6Trh/NxnNsjPNxrGWlHljA/JK5zMdTOgACeEFlLl+6y9Q=="
},
"sass": {
"version": "1.23.3",

View File

@ -53,7 +53,7 @@
"ngx-file-drop": "^8.0.8",
"ngx-markdown": "^9.0.0",
"rxjs": "~6.5.4",
"sartography-workflow-lib": "^0.0.182",
"sartography-workflow-lib": "0.0.187",
"tslib": "^1.11.1",
"uuid": "^7.0.2",
"zone.js": "^0.10.3"

View File

@ -1,4 +1,4 @@
import {APP_BASE_HREF} from '@angular/common';
import {APP_BASE_HREF, PlatformLocation} from '@angular/common';
import {HTTP_INTERCEPTORS, HttpClientModule} from '@angular/common/http';
import {Injectable, NgModule} from '@angular/core';
import {FlexLayoutModule} from '@angular/flex-layout';
@ -63,6 +63,21 @@ export class ThisEnvironment implements AppEnvironment {
baseHref = environment.baseHref;
}
/**
* This function is used internal to get a string instance of the `<base href="" />` value from `index.html`.
* This is an exported function, instead of a private function or inline lambda, to prevent this error:
*
* `Error encountered resolving symbol values statically.`
* `Function calls are not supported.`
* `Consider replacing the function or lambda with a reference to an exported function.`
*
* @param platformLocation an Angular service used to interact with a browser's URL
* @return a string instance of the `<base href="" />` value from `index.html`
*/
export function getBaseHref(platformLocation: PlatformLocation): string {
return platformLocation.getBaseHrefFromDOM();
}
@NgModule({
declarations: [
AppComponent,
@ -133,6 +148,8 @@ export class ThisEnvironment implements AppEnvironment {
// {provide: APP_BASE_HREF, useValue: environment.baseHref},
{provide: HTTP_INTERCEPTORS, useClass: AuthInterceptor, multi: true},
{provide: HTTP_INTERCEPTORS, useClass: ErrorInterceptor, multi: true},
{provide: APP_BASE_HREF, useFactory: getBaseHref, deps: [PlatformLocation]
}
]
})
export class AppModule {

View File

@ -1,2 +1 @@
<app-sign-in *ngIf="!isSignedIn"></app-sign-in>
<app-workflow-spec-list *ngIf="isSignedIn"></app-workflow-spec-list>
<app-workflow-spec-list></app-workflow-spec-list>

View File

@ -70,13 +70,7 @@ export class SignInComponent implements OnInit {
localStorage.removeItem('token');
// For testing purposes, create a user to simulate login.
if (!this.environment.production) {
localStorage.setItem('prev_url', location.origin);
this.model.redirect_url = location.origin + '/session';
this.api.redirectToLogin(this.model.redirect_url, this.model);
} else {
this.error = new Error('This feature does not work in production.');
}
this.api.redirectToLogin();
}
// If this is production, verify the user and redirect to home page.

View File

@ -1,5 +1,6 @@
import {Component, OnInit} from '@angular/core';
import {ApiService} from 'sartography-workflow-lib';
import {Router} from '@angular/router';
@Component({
selector: 'app-sign-out',
@ -8,7 +9,7 @@ import {ApiService} from 'sartography-workflow-lib';
})
export class SignOutComponent implements OnInit {
constructor(private api: ApiService) {
constructor(private api: ApiService, private router: Router) {
localStorage.removeItem('token');
}
@ -16,6 +17,6 @@ export class SignOutComponent implements OnInit {
}
goHome() {
this.api.openUrl('/');
this.router.navigate(['/']);
}
}