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', () => {
|
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-workflow-spec-list').count()).toBeGreaterThan(0);
|
||||||
expect(page.getElements('app-file-list').count()).toBeGreaterThan(0);
|
expect(page.getElements('app-file-list').count()).toBeGreaterThan(0);
|
||||||
});
|
});
|
||||||
|
|
|
@ -12291,9 +12291,9 @@
|
||||||
"integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg=="
|
"integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg=="
|
||||||
},
|
},
|
||||||
"sartography-workflow-lib": {
|
"sartography-workflow-lib": {
|
||||||
"version": "0.0.149",
|
"version": "0.0.151",
|
||||||
"resolved": "https://registry.npmjs.org/sartography-workflow-lib/-/sartography-workflow-lib-0.0.149.tgz",
|
"resolved": "https://registry.npmjs.org/sartography-workflow-lib/-/sartography-workflow-lib-0.0.151.tgz",
|
||||||
"integrity": "sha512-OieEYhYCbJSWxYkG9F+MwxJ3XtnlBoNwZjJW3J3UAgdRYMPWHHTJ1EXNzhVtYB93nw7/opOr0x6E/XS8CtQgSQ=="
|
"integrity": "sha512-eU0l/Qao0YgZF274IMk30oWFqEVvkZFaybYA1yUiBPVSGncnvGadYEuPXmuRdQ2Bqyl2/VmueZ5YFCQehQaemQ=="
|
||||||
},
|
},
|
||||||
"sass": {
|
"sass": {
|
||||||
"version": "1.23.3",
|
"version": "1.23.3",
|
||||||
|
|
|
@ -52,7 +52,7 @@
|
||||||
"ngx-file-drop": "^8.0.8",
|
"ngx-file-drop": "^8.0.8",
|
||||||
"ngx-markdown": "^9.0.0",
|
"ngx-markdown": "^9.0.0",
|
||||||
"rxjs": "~6.5.4",
|
"rxjs": "~6.5.4",
|
||||||
"sartography-workflow-lib": "^0.0.149",
|
"sartography-workflow-lib": "^0.0.151",
|
||||||
"tslib": "^1.11.1",
|
"tslib": "^1.11.1",
|
||||||
"uuid": "^7.0.2",
|
"uuid": "^7.0.2",
|
||||||
"zone.js": "^0.10.3"
|
"zone.js": "^0.10.3"
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
import {NgModule} from '@angular/core';
|
import {NgModule} from '@angular/core';
|
||||||
import {RouterModule, Routes} from '@angular/router';
|
import {RouterModule, Routes} from '@angular/router';
|
||||||
import {SessionRedirectComponent} from 'sartography-workflow-lib';
|
import {SessionRedirectComponent} from 'sartography-workflow-lib';
|
||||||
|
import {environment} from '../environments/environment.runtime';
|
||||||
import {HomeComponent} from './home/home.component';
|
import {HomeComponent} from './home/home.component';
|
||||||
import {ModelerComponent} from './modeler/modeler.component';
|
import {ModelerComponent} from './modeler/modeler.component';
|
||||||
import {SignInComponent} from './sign-in/sign-in.component';
|
import {SignInComponent} from './sign-in/sign-in.component';
|
||||||
|
@ -10,6 +11,11 @@ import {SignOutComponent} from './sign-out/sign-out.component';
|
||||||
const routes: Routes = [
|
const routes: Routes = [
|
||||||
{
|
{
|
||||||
path: '',
|
path: '',
|
||||||
|
pathMatch: 'full',
|
||||||
|
redirectTo: environment.homeRoute,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
path: 'home',
|
||||||
component: HomeComponent
|
component: HomeComponent
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|
|
@ -52,6 +52,7 @@ import {WorkflowSpecListComponent} from './workflow-spec-list/workflow-spec-list
|
||||||
|
|
||||||
@Injectable()
|
@Injectable()
|
||||||
export class ThisEnvironment implements AppEnvironment {
|
export class ThisEnvironment implements AppEnvironment {
|
||||||
|
homeRoute = environment.homeRoute;
|
||||||
production = environment.production;
|
production = environment.production;
|
||||||
api = environment.api;
|
api = environment.api;
|
||||||
irbUrl = environment.irbUrl;
|
irbUrl = environment.irbUrl;
|
||||||
|
|
|
@ -57,8 +57,7 @@ export class SignInComponent implements OnInit {
|
||||||
constructor(
|
constructor(
|
||||||
@Inject('APP_ENVIRONMENT') private environment: AppEnvironment,
|
@Inject('APP_ENVIRONMENT') private environment: AppEnvironment,
|
||||||
private router: Router,
|
private router: Router,
|
||||||
private api: ApiService,
|
private api: ApiService
|
||||||
private platformLocation: PlatformLocation
|
|
||||||
) {
|
) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -72,7 +71,7 @@ export class SignInComponent implements OnInit {
|
||||||
|
|
||||||
// For testing purposes, create a user to simulate login.
|
// For testing purposes, create a user to simulate login.
|
||||||
if (!this.environment.production) {
|
if (!this.environment.production) {
|
||||||
this.model.redirect_url = this.platformLocation.href + 'session';
|
this.model.redirect_url = location.origin + '/session';
|
||||||
this.api.openSession(this.model);
|
this.api.openSession(this.model);
|
||||||
} else {
|
} else {
|
||||||
this.error = new Error('This feature does not work in production.');
|
this.error = new Error('This feature does not work in production.');
|
||||||
|
|
|
@ -2,8 +2,14 @@ import {AppEnvironment} from 'sartography-workflow-lib';
|
||||||
|
|
||||||
declare var ENV;
|
declare var ENV;
|
||||||
|
|
||||||
|
const envHas = (key, temp): boolean => (ENV && (ENV[key] !== null) && (ENV[key] !== undefined) && (ENV[key] !== temp));
|
||||||
|
|
||||||
export const environment: AppEnvironment = {
|
export const environment: AppEnvironment = {
|
||||||
production: ENV && ENV.production === '$PRODUCTION' ? false : (ENV.production === 'true'),
|
homeRoute: envHas('homeRoute', '$HOME_ROUTE') ? ENV.homeRoute : 'home',
|
||||||
api: ENV && ENV.api === '$API_URL' ? 'http://localhost:5000/v1.0' : ENV.api,
|
production: envHas('production', '$PRODUCTION') ? (ENV.production === 'true') : false,
|
||||||
irbUrl: ENV && ENV.irbUrl === '$IRB_URL' ? 'http://localhost:5001' : ENV.irbUrl,
|
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="/">
|
<base href="/">
|
||||||
<script>
|
<script>
|
||||||
const ENV = {
|
const ENV = {
|
||||||
|
homeRoute: '$HOME_ROUTE',
|
||||||
production: '$PRODUCTION',
|
production: '$PRODUCTION',
|
||||||
api: '$API_URL',
|
api: '$API_URL',
|
||||||
irbUrl: '$IRB_URL',
|
irbUrl: '$IRB_URL',
|
||||||
|
|
Loading…
Reference in New Issue