diff --git a/e2e/src/app.e2e-spec.ts b/e2e/src/app.e2e-spec.ts index e46324d..950e019 100644 --- a/e2e/src/app.e2e-spec.ts +++ b/e2e/src/app.e2e-spec.ts @@ -13,7 +13,7 @@ describe('workspace-project App', () => { }); it('should click sign-in and navigate to home screen', () => { - page.clickAndExpectRoute('#sign_in', '/'); + page.clickAndExpectRoute('#sign_in', '/home'); expect(page.getElements('app-workflow-spec-list').count()).toBeGreaterThan(0); expect(page.getElements('app-file-list').count()).toBeGreaterThan(0); }); diff --git a/package-lock.json b/package-lock.json index c953076..121dff5 100644 --- a/package-lock.json +++ b/package-lock.json @@ -12291,9 +12291,9 @@ "integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==" }, "sartography-workflow-lib": { - "version": "0.0.149", - "resolved": "https://registry.npmjs.org/sartography-workflow-lib/-/sartography-workflow-lib-0.0.149.tgz", - "integrity": "sha512-OieEYhYCbJSWxYkG9F+MwxJ3XtnlBoNwZjJW3J3UAgdRYMPWHHTJ1EXNzhVtYB93nw7/opOr0x6E/XS8CtQgSQ==" + "version": "0.0.151", + "resolved": "https://registry.npmjs.org/sartography-workflow-lib/-/sartography-workflow-lib-0.0.151.tgz", + "integrity": "sha512-eU0l/Qao0YgZF274IMk30oWFqEVvkZFaybYA1yUiBPVSGncnvGadYEuPXmuRdQ2Bqyl2/VmueZ5YFCQehQaemQ==" }, "sass": { "version": "1.23.3", diff --git a/package.json b/package.json index 5eaabcc..8e85b95 100644 --- a/package.json +++ b/package.json @@ -52,7 +52,7 @@ "ngx-file-drop": "^8.0.8", "ngx-markdown": "^9.0.0", "rxjs": "~6.5.4", - "sartography-workflow-lib": "^0.0.149", + "sartography-workflow-lib": "^0.0.151", "tslib": "^1.11.1", "uuid": "^7.0.2", "zone.js": "^0.10.3" diff --git a/src/app/app-routing.module.ts b/src/app/app-routing.module.ts index e525627..a2848ec 100644 --- a/src/app/app-routing.module.ts +++ b/src/app/app-routing.module.ts @@ -1,6 +1,7 @@ import {NgModule} from '@angular/core'; import {RouterModule, Routes} from '@angular/router'; import {SessionRedirectComponent} from 'sartography-workflow-lib'; +import {environment} from '../environments/environment.runtime'; import {HomeComponent} from './home/home.component'; import {ModelerComponent} from './modeler/modeler.component'; import {SignInComponent} from './sign-in/sign-in.component'; @@ -10,6 +11,11 @@ import {SignOutComponent} from './sign-out/sign-out.component'; const routes: Routes = [ { path: '', + pathMatch: 'full', + redirectTo: environment.homeRoute, + }, + { + path: 'home', component: HomeComponent }, { diff --git a/src/app/app.module.ts b/src/app/app.module.ts index 8065a8e..c70a131 100644 --- a/src/app/app.module.ts +++ b/src/app/app.module.ts @@ -52,6 +52,7 @@ import {WorkflowSpecListComponent} from './workflow-spec-list/workflow-spec-list @Injectable() export class ThisEnvironment implements AppEnvironment { + homeRoute = environment.homeRoute; production = environment.production; api = environment.api; irbUrl = environment.irbUrl; diff --git a/src/app/sign-in/sign-in.component.ts b/src/app/sign-in/sign-in.component.ts index 9a00b16..f0e521e 100644 --- a/src/app/sign-in/sign-in.component.ts +++ b/src/app/sign-in/sign-in.component.ts @@ -57,8 +57,7 @@ export class SignInComponent implements OnInit { constructor( @Inject('APP_ENVIRONMENT') private environment: AppEnvironment, private router: Router, - private api: ApiService, - private platformLocation: PlatformLocation + private api: ApiService ) { } @@ -72,7 +71,7 @@ export class SignInComponent implements OnInit { // For testing purposes, create a user to simulate login. if (!this.environment.production) { - this.model.redirect_url = this.platformLocation.href + 'session'; + this.model.redirect_url = location.origin + '/session'; this.api.openSession(this.model); } else { this.error = new Error('This feature does not work in production.'); diff --git a/src/environments/environment.runtime.ts b/src/environments/environment.runtime.ts index 1ced5bf..9166476 100644 --- a/src/environments/environment.runtime.ts +++ b/src/environments/environment.runtime.ts @@ -2,8 +2,14 @@ import {AppEnvironment} from 'sartography-workflow-lib'; declare var ENV; +const envHas = (key, temp): boolean => (ENV && (ENV[key] !== null) && (ENV[key] !== undefined) && (ENV[key] !== temp)); + export const environment: AppEnvironment = { - production: ENV && ENV.production === '$PRODUCTION' ? false : (ENV.production === 'true'), - api: ENV && ENV.api === '$API_URL' ? 'http://localhost:5000/v1.0' : ENV.api, - irbUrl: ENV && ENV.irbUrl === '$IRB_URL' ? 'http://localhost:5001' : ENV.irbUrl, + homeRoute: envHas('homeRoute', '$HOME_ROUTE') ? ENV.homeRoute : 'home', + production: envHas('production', '$PRODUCTION') ? (ENV.production === 'true') : false, + api: envHas('api', '$API_URL') ? ENV.api : 'http://localhost:5000/v1.0', + irbUrl: envHas('irbUrl', '$IRB_URL') ? ENV.irbUrl : 'http://localhost:5001', }; + + + diff --git a/src/index.html b/src/index.html index 5636e09..93426f9 100644 --- a/src/index.html +++ b/src/index.html @@ -6,6 +6,7 @@