Adds environment variable that determines which route is used as "home"
This commit is contained in:
parent
961caecb11
commit
8dbcacfb4a
|
@ -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);
|
||||
});
|
||||
|
|
|
@ -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",
|
||||
|
|
|
@ -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"
|
||||
|
|
|
@ -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
|
||||
},
|
||||
{
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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.');
|
||||
|
|
|
@ -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',
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -6,6 +6,7 @@
|
|||
<base href="/">
|
||||
<script>
|
||||
const ENV = {
|
||||
homeRoute: '$HOME_ROUTE',
|
||||
production: '$PRODUCTION',
|
||||
api: '$API_URL',
|
||||
irbUrl: '$IRB_URL',
|
||||
|
|
Loading…
Reference in New Issue