From c900422206fd48dfa5bb19a2ad3d1514a3d85040 Mon Sep 17 00:00:00 2001 From: Aaron Louie Date: Tue, 2 Jun 2020 21:12:03 -0400 Subject: [PATCH 1/6] Catches and displays API Errors in the UI --- package-lock.json | 6 +- package.json | 2 +- src/app/_interfaces/dialog-data.ts | 4 -- src/app/api-errors/api-errors.component.html | 21 ------- src/app/api-errors/api-errors.component.scss | 16 ------ .../api-errors/api-errors.component.spec.ts | 57 ------------------- src/app/api-errors/api-errors.component.ts | 30 ---------- src/app/app.component.ts | 9 +-- src/app/app.module.ts | 2 +- src/app/modeler/modeler.component.ts | 2 +- .../workflow-spec-list.component.spec.ts | 2 +- .../workflow-spec-list.component.ts | 2 +- 12 files changed, 13 insertions(+), 140 deletions(-) delete mode 100644 src/app/api-errors/api-errors.component.html delete mode 100644 src/app/api-errors/api-errors.component.scss delete mode 100644 src/app/api-errors/api-errors.component.spec.ts delete mode 100644 src/app/api-errors/api-errors.component.ts diff --git a/package-lock.json b/package-lock.json index f934e6d..14d6923 100644 --- a/package-lock.json +++ b/package-lock.json @@ -12299,9 +12299,9 @@ "integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==" }, "sartography-workflow-lib": { - "version": "0.0.236", - "resolved": "https://registry.npmjs.org/sartography-workflow-lib/-/sartography-workflow-lib-0.0.236.tgz", - "integrity": "sha512-A6gK1cNgouONigYKH82wUW4VjXEL35eyCVTEP+CK3OYBF75dZAs1sSwOCzGAo82cPvmb55OqK8wbuZ3/7OYAdw==" + "version": "0.0.240", + "resolved": "https://registry.npmjs.org/sartography-workflow-lib/-/sartography-workflow-lib-0.0.240.tgz", + "integrity": "sha512-Jn3VbXrXtbjbQJswQ1QxD8rlxkULH8kDZs27OVZR82TJjkvysfcytIdZAS8o8CtnjIepVadpdLiUu8LNZ0VEDQ==" }, "sass": { "version": "1.23.3", diff --git a/package.json b/package.json index bf0559c..d77a3c7 100644 --- a/package.json +++ b/package.json @@ -54,7 +54,7 @@ "ngx-file-drop": "^8.0.8", "ngx-markdown": "^9.0.0", "rxjs": "~6.5.4", - "sartography-workflow-lib": "0.0.236", + "sartography-workflow-lib": "0.0.240", "tslib": "^1.11.1", "uuid": "^7.0.2", "zone.js": "^0.10.3" diff --git a/src/app/_interfaces/dialog-data.ts b/src/app/_interfaces/dialog-data.ts index cd0dea0..efd92fb 100644 --- a/src/app/_interfaces/dialog-data.ts +++ b/src/app/_interfaces/dialog-data.ts @@ -49,7 +49,3 @@ export interface DeleteWorkflowSpecCategoryDialogData { confirm: boolean; category: WorkflowSpecCategory; } - -export interface ApiErrorsBottomSheetData { - apiErrors: ApiError[]; -} diff --git a/src/app/api-errors/api-errors.component.html b/src/app/api-errors/api-errors.component.html deleted file mode 100644 index f51de56..0000000 --- a/src/app/api-errors/api-errors.component.html +++ /dev/null @@ -1,21 +0,0 @@ -
-

Workflow Specification Errors

- - -
- - -

{{e.code}}

-

{{e.status_code}}

-
{{e.task_name}} ({{e.task_id}})
-
Task ID: {{e.task_id}}
-
Task Name: {{e.task_name}}
-
File: {{e.file_name}}
-
Tag: {{e.tag}}
- -
- {{e.message}} -
-
-
-
diff --git a/src/app/api-errors/api-errors.component.scss b/src/app/api-errors/api-errors.component.scss deleted file mode 100644 index eda4773..0000000 --- a/src/app/api-errors/api-errors.component.scss +++ /dev/null @@ -1,16 +0,0 @@ -@import "../../config"; - -::ng-deep mat-list-item.api-error, mat-list-item.api-error:hover { - border-left: 4px solid $brand-warning; - background-color: $brand-warning-light; - cursor: default; - - .mat-line { - text-overflow: initial; - height: auto; - - code { - white-space: normal; - } - } -} diff --git a/src/app/api-errors/api-errors.component.spec.ts b/src/app/api-errors/api-errors.component.spec.ts deleted file mode 100644 index 73864c4..0000000 --- a/src/app/api-errors/api-errors.component.spec.ts +++ /dev/null @@ -1,57 +0,0 @@ -import { async, ComponentFixture, TestBed } from '@angular/core/testing'; -import {MAT_BOTTOM_SHEET_DATA, MatBottomSheetRef} from '@angular/material/bottom-sheet'; -import {MatIconModule} from '@angular/material/icon'; -import {MatListModule} from '@angular/material/list'; - -import { ApiErrorsComponent } from './api-errors.component'; - -describe('ApiErrorsComponent', () => { - let component: ApiErrorsComponent; - let fixture: ComponentFixture; - - beforeEach(async(() => { - TestBed.configureTestingModule({ - declarations: [ - ApiErrorsComponent - ], - imports: [ - MatIconModule, - MatListModule, - ], - providers: [ - { - provide: MatBottomSheetRef, - useValue: { - dismiss: (dialogResult: any) => { - } - } - }, - {provide: MAT_BOTTOM_SHEET_DATA, useValue: {apiErrors: [{ - status_code: 400, - code: 'error_code' - }]}}, - ] - - }) - .compileComponents(); - })); - - beforeEach(() => { - fixture = TestBed.createComponent(ApiErrorsComponent); - component = fixture.componentInstance; - fixture.detectChanges(); - }); - - it('should create', () => { - expect(component).toBeTruthy(); - expect(component.data).toBeTruthy(); - expect(component.apiErrors).toBeTruthy(); - }); - - it('should dismiss', () => { - const dismissSpy = spyOn((component as any)._bottomSheetRef, 'dismiss').and.stub(); - component.dismiss(new MouseEvent('click')); - expect(dismissSpy).toHaveBeenCalled(); - }); - -}); diff --git a/src/app/api-errors/api-errors.component.ts b/src/app/api-errors/api-errors.component.ts deleted file mode 100644 index af16458..0000000 --- a/src/app/api-errors/api-errors.component.ts +++ /dev/null @@ -1,30 +0,0 @@ -import {Component, Inject, OnInit} from '@angular/core'; -import {MAT_BOTTOM_SHEET_DATA, MatBottomSheetRef} from '@angular/material/bottom-sheet'; -import {ApiError} from 'sartography-workflow-lib/lib/types/api'; -import {ApiErrorsBottomSheetData} from '../_interfaces/dialog-data'; - -@Component({ - selector: 'app-api-errors', - templateUrl: './api-errors.component.html', - styleUrls: ['./api-errors.component.scss'] -}) -export class ApiErrorsComponent implements OnInit { - apiErrors: ApiError[]; - - constructor( - @Inject(MAT_BOTTOM_SHEET_DATA) public data: ApiErrorsBottomSheetData, - private _bottomSheetRef: MatBottomSheetRef - ) { - if (data && data.apiErrors && data.apiErrors.length > 0) { - this.apiErrors = data.apiErrors; - } - } - - ngOnInit(): void { - } - - dismiss(event: MouseEvent) { - this._bottomSheetRef.dismiss(); - event.preventDefault(); - } -} diff --git a/src/app/app.component.ts b/src/app/app.component.ts index 0d1947f..bc36c18 100644 --- a/src/app/app.component.ts +++ b/src/app/app.component.ts @@ -1,5 +1,5 @@ -import {Component} from '@angular/core'; -import {ApiService, GoogleAnalyticsService} from 'sartography-workflow-lib'; +import {Component, Inject} from '@angular/core'; +import {ApiService, AppEnvironment, GoogleAnalyticsService} from 'sartography-workflow-lib'; @Component({ selector: 'app-root', @@ -10,10 +10,11 @@ export class AppComponent { title = 'CR Connect Configuration'; constructor( + @Inject('APP_ENVIRONMENT') private environment: AppEnvironment, private apiService: ApiService, - private googleAnalyticsService: GoogleAnalyticsService + private googleAnalyticsService: GoogleAnalyticsService, ) { - this.googleAnalyticsService.init(); + this.googleAnalyticsService.init(this.environment.googleAnalyticsKey); } get isSignedIn() { diff --git a/src/app/app.module.ts b/src/app/app.module.ts index dd3b0d5..6e78bbc 100644 --- a/src/app/app.module.ts +++ b/src/app/app.module.ts @@ -21,6 +21,7 @@ import {BrowserModule} from '@angular/platform-browser'; import {BrowserAnimationsModule} from '@angular/platform-browser/animations'; import {FormlyModule} from '@ngx-formly/core'; import { + ApiErrorsComponent, AppEnvironment, AuthInterceptor, ErrorInterceptor, @@ -38,7 +39,6 @@ import {OpenFileDialogComponent} from './_dialogs/open-file-dialog/open-file-dia import {WorkflowSpecCategoryDialogComponent} from './_dialogs/workflow-spec-category-dialog/workflow-spec-category-dialog.component'; import {WorkflowSpecDialogComponent} from './_dialogs/workflow-spec-dialog/workflow-spec-dialog.component'; import {GetIconCodePipe} from './_pipes/get-icon-code.pipe'; -import {ApiErrorsComponent} from './api-errors/api-errors.component'; import {AppRoutingModule} from './app-routing.module'; import {AppComponent} from './app.component'; import {DiagramComponent} from './diagram/diagram.component'; diff --git a/src/app/modeler/modeler.component.ts b/src/app/modeler/modeler.component.ts index 6d53c8a..60b9914 100644 --- a/src/app/modeler/modeler.component.ts +++ b/src/app/modeler/modeler.component.ts @@ -5,6 +5,7 @@ import {MatDialog} from '@angular/material/dialog'; import {MatSnackBar} from '@angular/material/snack-bar'; import {ActivatedRoute, Params, Router} from '@angular/router'; import { + ApiErrorsComponent, ApiService, FileMeta, FileType, @@ -19,7 +20,6 @@ import {OpenFileDialogComponent} from '../_dialogs/open-file-dialog/open-file-di import {BpmnWarning} from '../_interfaces/bpmn-warning'; import {FileMetaDialogData, NewFileDialogData, OpenFileDialogData} from '../_interfaces/dialog-data'; import {ImportEvent} from '../_interfaces/import-event'; -import {ApiErrorsComponent} from '../api-errors/api-errors.component'; import {DiagramComponent} from '../diagram/diagram.component'; @Component({ diff --git a/src/app/workflow-spec-list/workflow-spec-list.component.spec.ts b/src/app/workflow-spec-list/workflow-spec-list.component.spec.ts index fd65069..f9fe120 100644 --- a/src/app/workflow-spec-list/workflow-spec-list.component.spec.ts +++ b/src/app/workflow-spec-list/workflow-spec-list.component.spec.ts @@ -13,6 +13,7 @@ import {RouterTestingModule} from '@angular/router/testing'; import createClone from 'rfdc'; import {of} from 'rxjs'; import { + ApiErrorsComponent, ApiService, MockEnvironment, mockWorkflowSpec0, @@ -34,7 +35,6 @@ import { WorkflowSpecDialogData } from '../_interfaces/dialog-data'; import {GetIconCodePipe} from '../_pipes/get-icon-code.pipe'; -import {ApiErrorsComponent} from '../api-errors/api-errors.component'; import {FileListComponent} from '../file-list/file-list.component'; import {WorkflowSpecListComponent} from './workflow-spec-list.component'; diff --git a/src/app/workflow-spec-list/workflow-spec-list.component.ts b/src/app/workflow-spec-list/workflow-spec-list.component.ts index 0f5770b..39c5f71 100644 --- a/src/app/workflow-spec-list/workflow-spec-list.component.ts +++ b/src/app/workflow-spec-list/workflow-spec-list.component.ts @@ -21,7 +21,7 @@ import { WorkflowSpecCategoryDialogData, WorkflowSpecDialogData } from '../_interfaces/dialog-data'; -import {ApiErrorsComponent} from '../api-errors/api-errors.component'; +import {ApiErrorsComponent} from 'sartography-workflow-lib'; export interface WorkflowSpecCategoryGroup { From 2b3f6d14d4eddedb0d194ce5963c2c4ced8e4f93 Mon Sep 17 00:00:00 2001 From: Aaron Louie Date: Tue, 2 Jun 2020 21:52:15 -0400 Subject: [PATCH 2/6] Adds favicon. Displays error codes in more human-readable fashion. --- package-lock.json | 6 +++--- package.json | 2 +- src/assets/icons/favicon.ico | Bin 0 -> 1150 bytes src/index.html | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) create mode 100644 src/assets/icons/favicon.ico diff --git a/package-lock.json b/package-lock.json index 14d6923..23cb729 100644 --- a/package-lock.json +++ b/package-lock.json @@ -12299,9 +12299,9 @@ "integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==" }, "sartography-workflow-lib": { - "version": "0.0.240", - "resolved": "https://registry.npmjs.org/sartography-workflow-lib/-/sartography-workflow-lib-0.0.240.tgz", - "integrity": "sha512-Jn3VbXrXtbjbQJswQ1QxD8rlxkULH8kDZs27OVZR82TJjkvysfcytIdZAS8o8CtnjIepVadpdLiUu8LNZ0VEDQ==" + "version": "0.0.243", + "resolved": "https://registry.npmjs.org/sartography-workflow-lib/-/sartography-workflow-lib-0.0.243.tgz", + "integrity": "sha512-a9HfXSEws4EQLa0MDZCq9BkhVKtxytBp9UBsorsCsCpXLz5rmgiW9EkKRHqLYInWgoQkw9cPOcZDjFXx1Kn2qQ==" }, "sass": { "version": "1.23.3", diff --git a/package.json b/package.json index d77a3c7..1d3a8c7 100644 --- a/package.json +++ b/package.json @@ -54,7 +54,7 @@ "ngx-file-drop": "^8.0.8", "ngx-markdown": "^9.0.0", "rxjs": "~6.5.4", - "sartography-workflow-lib": "0.0.240", + "sartography-workflow-lib": "0.0.243", "tslib": "^1.11.1", "uuid": "^7.0.2", "zone.js": "^0.10.3" diff --git a/src/assets/icons/favicon.ico b/src/assets/icons/favicon.ico new file mode 100644 index 0000000000000000000000000000000000000000..df273c392dca933e2dd19b38d75b5b42d9dd3b5b GIT binary patch literal 1150 zcma*m&r8#B9LMqZFzDdHf#6k-9mdE%K=3Xpd=K8DK?Q1oCJa*&>Y_JmMI-tF36jkU z3W=o|)HHj#(s z5#?WF4nwZIK{|spmN9`-xQdgwj&WRZ`7zQ%l9-@S=P~2M6uRl$GKjS~TF|)4!Z_+=w>&pLI z{}cVR=2Pe#{Q8Rb9VYP&+JpKkzY5*0&cXNB-n*eQ*V%UBIQlS*UJOEaHi~|9;R4b) z3f+_TA$QP$6Hr`QOEKl4x6uZz^#tmF4L+7|syCMjwP~LZLgjGZ1ocz61E}Sxc zWFK>+!ejR48Q+YH(Ak%vx1NLU>+s(GX0e!AGFhuvUUl(!RS?wLg5Z3_Y@yDqcrXY` G4Q9Kh-7f - + From 987f2c2fc874cc2b8b5859d563420bfe61251a4d Mon Sep 17 00:00:00 2001 From: Aaron Louie Date: Tue, 2 Jun 2020 22:05:31 -0400 Subject: [PATCH 3/6] Cleans up visual design of API Error display --- package-lock.json | 6 +++--- package.json | 2 +- src/app/app.module.ts | 3 --- 3 files changed, 4 insertions(+), 7 deletions(-) diff --git a/package-lock.json b/package-lock.json index 23cb729..5995620 100644 --- a/package-lock.json +++ b/package-lock.json @@ -12299,9 +12299,9 @@ "integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==" }, "sartography-workflow-lib": { - "version": "0.0.243", - "resolved": "https://registry.npmjs.org/sartography-workflow-lib/-/sartography-workflow-lib-0.0.243.tgz", - "integrity": "sha512-a9HfXSEws4EQLa0MDZCq9BkhVKtxytBp9UBsorsCsCpXLz5rmgiW9EkKRHqLYInWgoQkw9cPOcZDjFXx1Kn2qQ==" + "version": "0.0.245", + "resolved": "https://registry.npmjs.org/sartography-workflow-lib/-/sartography-workflow-lib-0.0.245.tgz", + "integrity": "sha512-URKgZNxDgVx3iJ4l9+GAeO3KUZfqoSzKY7ViGZLyzJ73BAZsOScviAQV2EM2aJ6DuGJyqlTbIUjPpewgH//uBA==" }, "sass": { "version": "1.23.3", diff --git a/package.json b/package.json index 1d3a8c7..871c328 100644 --- a/package.json +++ b/package.json @@ -54,7 +54,7 @@ "ngx-file-drop": "^8.0.8", "ngx-markdown": "^9.0.0", "rxjs": "~6.5.4", - "sartography-workflow-lib": "0.0.243", + "sartography-workflow-lib": "0.0.245", "tslib": "^1.11.1", "uuid": "^7.0.2", "zone.js": "^0.10.3" diff --git a/src/app/app.module.ts b/src/app/app.module.ts index 6e78bbc..d8fcd97 100644 --- a/src/app/app.module.ts +++ b/src/app/app.module.ts @@ -21,7 +21,6 @@ import {BrowserModule} from '@angular/platform-browser'; import {BrowserAnimationsModule} from '@angular/platform-browser/animations'; import {FormlyModule} from '@ngx-formly/core'; import { - ApiErrorsComponent, AppEnvironment, AuthInterceptor, ErrorInterceptor, @@ -97,7 +96,6 @@ export function getBaseHref(platformLocation: PlatformLocation): string { WorkflowSpecListComponent, HomeComponent, WorkflowSpecCardComponent, - ApiErrorsComponent, ProtocolBuilderComponent, ReferenceFilesComponent, ], @@ -129,7 +127,6 @@ export function getBaseHref(platformLocation: PlatformLocation): string { ], bootstrap: [AppComponent], entryComponents: [ - ApiErrorsComponent, DeleteFileDialogComponent, DeleteWorkflowSpecDialogComponent, DeleteWorkflowSpecCategoryDialogComponent, From 5dd130fb2e181e044654363a444bfe1e690c5360 Mon Sep 17 00:00:00 2001 From: Aaron Louie Date: Tue, 2 Jun 2020 22:15:17 -0400 Subject: [PATCH 4/6] Fixed import in sartography-workflow-lib --- package-lock.json | 6 +++--- package.json | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/package-lock.json b/package-lock.json index 5995620..1b66dce 100644 --- a/package-lock.json +++ b/package-lock.json @@ -12299,9 +12299,9 @@ "integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==" }, "sartography-workflow-lib": { - "version": "0.0.245", - "resolved": "https://registry.npmjs.org/sartography-workflow-lib/-/sartography-workflow-lib-0.0.245.tgz", - "integrity": "sha512-URKgZNxDgVx3iJ4l9+GAeO3KUZfqoSzKY7ViGZLyzJ73BAZsOScviAQV2EM2aJ6DuGJyqlTbIUjPpewgH//uBA==" + "version": "0.0.246", + "resolved": "https://registry.npmjs.org/sartography-workflow-lib/-/sartography-workflow-lib-0.0.246.tgz", + "integrity": "sha512-haOW3AN2REVPnwdQfxJrO7xme/qfy43f9SaoEBKJ+ttwyiMbR2OkcM/ab4uhpBx/kmg9zYknyN7qIMjjRKNIKQ==" }, "sass": { "version": "1.23.3", diff --git a/package.json b/package.json index 871c328..b3f84ac 100644 --- a/package.json +++ b/package.json @@ -54,7 +54,7 @@ "ngx-file-drop": "^8.0.8", "ngx-markdown": "^9.0.0", "rxjs": "~6.5.4", - "sartography-workflow-lib": "0.0.245", + "sartography-workflow-lib": "0.0.246", "tslib": "^1.11.1", "uuid": "^7.0.2", "zone.js": "^0.10.3" From 431973f2b9de75cce7257d1f66f617c53e53477a Mon Sep 17 00:00:00 2001 From: Aaron Louie Date: Tue, 2 Jun 2020 23:10:31 -0400 Subject: [PATCH 5/6] Fixes broken favicon and file icons when baseHref is not '/' --- package-lock.json | 6 +++--- package.json | 2 +- src/assets/icons/favicon.ico | Bin 1150 -> 0 bytes src/favicon.ico | Bin 5430 -> 1150 bytes src/index.html | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) delete mode 100644 src/assets/icons/favicon.ico diff --git a/package-lock.json b/package-lock.json index 1b66dce..8ca33f2 100644 --- a/package-lock.json +++ b/package-lock.json @@ -12299,9 +12299,9 @@ "integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==" }, "sartography-workflow-lib": { - "version": "0.0.246", - "resolved": "https://registry.npmjs.org/sartography-workflow-lib/-/sartography-workflow-lib-0.0.246.tgz", - "integrity": "sha512-haOW3AN2REVPnwdQfxJrO7xme/qfy43f9SaoEBKJ+ttwyiMbR2OkcM/ab4uhpBx/kmg9zYknyN7qIMjjRKNIKQ==" + "version": "0.0.247", + "resolved": "https://registry.npmjs.org/sartography-workflow-lib/-/sartography-workflow-lib-0.0.247.tgz", + "integrity": "sha512-JAt+GC/I3C+mGPNJ+n2eCjVjXcCRQ9UZQmUQTeaHKXacfhb3AK1aM0qAYA+UCQgZiZaPeTH5hJRkbQOJD5aKfg==" }, "sass": { "version": "1.23.3", diff --git a/package.json b/package.json index b3f84ac..76902a2 100644 --- a/package.json +++ b/package.json @@ -54,7 +54,7 @@ "ngx-file-drop": "^8.0.8", "ngx-markdown": "^9.0.0", "rxjs": "~6.5.4", - "sartography-workflow-lib": "0.0.246", + "sartography-workflow-lib": "0.0.247", "tslib": "^1.11.1", "uuid": "^7.0.2", "zone.js": "^0.10.3" diff --git a/src/assets/icons/favicon.ico b/src/assets/icons/favicon.ico deleted file mode 100644 index df273c392dca933e2dd19b38d75b5b42d9dd3b5b..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1150 zcma*m&r8#B9LMqZFzDdHf#6k-9mdE%K=3Xpd=K8DK?Q1oCJa*&>Y_JmMI-tF36jkU z3W=o|)HHj#(s z5#?WF4nwZIK{|spmN9`-xQdgwj&WRZ`7zQ%l9-@S=P~2M6uRl$GKjS~TF|)4!Z_+=w>&pLI z{}cVR=2Pe#{Q8Rb9VYP&+JpKkzY5*0&cXNB-n*eQ*V%UBIQlS*UJOEaHi~|9;R4b) z3f+_TA$QP$6Hr`QOEKl4x6uZz^#tmF4L+7|syCMjwP~LZLgjGZ1ocz61E}Sxc zWFK>+!ejR48Q+YH(Ak%vx1NLU>+s(GX0e!AGFhuvUUl(!RS?wLg5Z3_Y@yDqcrXY` G4Q9Kh-7fY_JmMI-tF36jkU z3W=o|)HHj#(s z5#?WF4nwZIK{|spmN9`-xQdgwj&WRZ`7zQ%l9-@S=P~2M6uRl$GKjS~TF|)4!Z_+=w>&pLI z{}cVR=2Pe#{Q8Rb9VYP&+JpKkzY5*0&cXNB-n*eQ*V%UBIQlS*UJOEaHi~|9;R4b) z3f+_TA$QP$6Hr`QOEKl4x6uZz^#tmF4L+7|syCMjwP~LZLgjGZ1ocz61E}Sxc zWFK>+!ejR48Q+YH(Ak%vx1NLU>+s(GX0e!AGFhuvUUl(!RS?wLg5Z3_Y@yDqcrXY` G4Q9Kh-7f}`90e12m8T*36WoeDLA&SD_hw{H^wM!cl_RWcVA!I+x87ee975; z@4kD^=bYPn&pmG@(+JZ`rqQEKxW<}RzhW}I!|ulN=fmjVi@x{p$cC`)5$a!)X&U+blKNvN5tg=uLvuLnuqRM;Yc*swiexsoh#XPNu{9F#c`G zQLe{yWA(Y6(;>y|-efAy11k<09(@Oo1B2@0`PtZSkqK&${ zgEY}`W@t{%?9u5rF?}Y7OL{338l*JY#P!%MVQY@oqnItpZ}?s z!r?*kwuR{A@jg2Chlf0^{q*>8n5Ir~YWf*wmsh7B5&EpHfd5@xVaj&gqsdui^spyL zB|kUoblGoO7G(MuKTfa9?pGH0@QP^b#!lM1yHWLh*2iq#`C1TdrnO-d#?Oh@XV2HK zKA{`eo{--^K&MW66Lgsktfvn#cCAc*(}qsfhrvOjMGLE?`dHVipu1J3Kgr%g?cNa8 z)pkmC8DGH~fG+dlrp(5^-QBeEvkOvv#q7MBVLtm2oD^$lJZx--_=K&Ttd=-krx(Bb zcEoKJda@S!%%@`P-##$>*u%T*mh+QjV@)Qa=Mk1?#zLk+M4tIt%}wagT{5J%!tXAE;r{@=bb%nNVxvI+C+$t?!VJ@0d@HIyMJTI{vEw0Ul ze(ha!e&qANbTL1ZneNl45t=#Ot??C0MHjjgY8%*mGisN|S6%g3;Hlx#fMNcL<87MW zZ>6moo1YD?P!fJ#Jb(4)_cc50X5n0KoDYfdPoL^iV`k&o{LPyaoqMqk92wVM#_O0l z09$(A-D+gVIlq4TA&{1T@BsUH`Bm=r#l$Z51J-U&F32+hfUP-iLo=jg7Xmy+WLq6_tWv&`wDlz#`&)Jp~iQf zZP)tu>}pIIJKuw+$&t}GQuqMd%Z>0?t%&BM&Wo^4P^Y z)c6h^f2R>X8*}q|bblAF?@;%?2>$y+cMQbN{X$)^R>vtNq_5AB|0N5U*d^T?X9{xQnJYeU{ zoZL#obI;~Pp95f1`%X3D$Mh*4^?O?IT~7HqlWguezmg?Ybq|7>qQ(@pPHbE9V?f|( z+0xo!#m@Np9PljsyxBY-UA*{U*la#8Wz2sO|48_-5t8%_!n?S$zlGe+NA%?vmxjS- zHE5O3ZarU=X}$7>;Okp(UWXJxI%G_J-@IH;%5#Rt$(WUX?6*Ux!IRd$dLP6+SmPn= z8zjm4jGjN772R{FGkXwcNv8GBcZI#@Y2m{RNF_w8(Z%^A*!bS*!}s6sh*NnURytky humW;*g7R+&|Ledvc- - + From 29339c5709ce4e23d28e6d65919f9a84ce2cc52c Mon Sep 17 00:00:00 2001 From: Aaron Louie Date: Tue, 2 Jun 2020 23:27:41 -0400 Subject: [PATCH 6/6] Injects Google Analytics tag via environment variable. Prevents gtag race condition from sporadically causing failing unit tests --- package-lock.json | 6 +++--- package.json | 2 +- src/environments/environment.runtime.ts | 2 +- src/environments/environment.spec.ts | 15 ++++++++++++++- 4 files changed, 19 insertions(+), 6 deletions(-) diff --git a/package-lock.json b/package-lock.json index 8ca33f2..01d4b6f 100644 --- a/package-lock.json +++ b/package-lock.json @@ -12299,9 +12299,9 @@ "integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==" }, "sartography-workflow-lib": { - "version": "0.0.247", - "resolved": "https://registry.npmjs.org/sartography-workflow-lib/-/sartography-workflow-lib-0.0.247.tgz", - "integrity": "sha512-JAt+GC/I3C+mGPNJ+n2eCjVjXcCRQ9UZQmUQTeaHKXacfhb3AK1aM0qAYA+UCQgZiZaPeTH5hJRkbQOJD5aKfg==" + "version": "0.0.248", + "resolved": "https://registry.npmjs.org/sartography-workflow-lib/-/sartography-workflow-lib-0.0.248.tgz", + "integrity": "sha512-zajKeap3wRa1dhG+pB+MFHvu0v8DgsvB4G0Q27fsPM8uuNEuvglf2w583KITe9SpNbqMCraFj5vGXAcAiiJNmw==" }, "sass": { "version": "1.23.3", diff --git a/package.json b/package.json index 76902a2..60ace36 100644 --- a/package.json +++ b/package.json @@ -54,7 +54,7 @@ "ngx-file-drop": "^8.0.8", "ngx-markdown": "^9.0.0", "rxjs": "~6.5.4", - "sartography-workflow-lib": "0.0.247", + "sartography-workflow-lib": "0.0.248", "tslib": "^1.11.1", "uuid": "^7.0.2", "zone.js": "^0.10.3" diff --git a/src/environments/environment.runtime.ts b/src/environments/environment.runtime.ts index 21c6088..d78d92b 100644 --- a/src/environments/environment.runtime.ts +++ b/src/environments/environment.runtime.ts @@ -10,5 +10,5 @@ export const environment: AppEnvironment = { api: _has(ENV, 'api', '$API_URL') ? ENV.api : 'http://localhost:5000/v1.0', irbUrl: _has(ENV, 'irbUrl', '$IRB_URL') ? ENV.irbUrl : 'http://localhost:5001', title: _has(ENV, 'title', '$TITLE') ? ENV.title : 'Research Ramp-Up Toolkit Configurator', - googleAnalyticsKey: _has(ENV, 'googleAnalyticsKey', '$GOOGLE_ANALYTICS_KEY') ? ENV.title : 'UA-168203235-5', + googleAnalyticsKey: _has(ENV, 'googleAnalyticsKey', '$GOOGLE_ANALYTICS_KEY') ? ENV.googleAnalyticsKey : 'UA-168203235-5', }; diff --git a/src/environments/environment.spec.ts b/src/environments/environment.spec.ts index f5ffbe4..7c4126e 100644 --- a/src/environments/environment.spec.ts +++ b/src/environments/environment.spec.ts @@ -1,4 +1,3 @@ -import {AppEnvironment} from 'sartography-workflow-lib'; import {_has, environment} from './environment.runtime'; declare var ENV; @@ -10,6 +9,8 @@ describe('Environments', () => { expect(environment.api).toEqual('apiRoot'); expect(environment.irbUrl).toEqual('irbUrl'); expect(environment.homeRoute).toEqual('home'); + expect(environment.title).toEqual('Research Ramp-Up Toolkit Configurator'); + expect(environment.googleAnalyticsKey).toEqual('UA-168203235-5'); }); it('should check if environment variables are defined', () => { @@ -18,31 +19,43 @@ describe('Environments', () => { production: '$PRODUCTION', api: '$API_URL', irbUrl: '$IRB_URL', + title: '$TITLE', + googleAnalyticsKey: '$GOOGLE_ANALYTICS_KEY', }; expect(_has(env, 'homeRoute', '$HOME_ROUTE')).toBeFalse(); expect(_has(env, 'production', '$PRODUCTION')).toBeFalse(); expect(_has(env, 'api', '$API_URL')).toBeFalse(); expect(_has(env, 'irbUrl', '$IRB_URL')).toBeFalse(); + expect(_has(env, 'title', '$TITLE')).toBeFalse(); + expect(_has(env, 'googleAnalyticsKey', '$GOOGLE_ANALYTICS_KEY')).toBeFalse(); env.homeRoute = undefined; env.production = undefined; env.api = undefined; env.irbUrl = undefined; + env.title = undefined; + env.googleAnalyticsKey = undefined; expect(_has(env, 'homeRoute', '$HOME_ROUTE')).toBeFalse(); expect(_has(env, 'production', '$PRODUCTION')).toBeFalse(); expect(_has(env, 'api', '$API_URL')).toBeFalse(); expect(_has(env, 'irbUrl', '$IRB_URL')).toBeFalse(); + expect(_has(env, 'title', '$TITLE')).toBeFalse(); + expect(_has(env, 'googleAnalyticsKey', '$GOOGLE_ANALYTICS_KEY')).toBeFalse(); env.homeRoute = 'something'; env.production = 'something'; env.api = 'something'; env.irbUrl = 'something'; + env.title = 'something'; + env.googleAnalyticsKey = 'something'; expect(_has(env, 'homeRoute', '$HOME_ROUTE')).toBeTrue(); expect(_has(env, 'production', '$PRODUCTION')).toBeTrue(); expect(_has(env, 'api', '$API_URL')).toBeTrue(); expect(_has(env, 'irbUrl', '$IRB_URL')).toBeTrue(); + expect(_has(env, 'title', '$TITLE')).toBeTrue(); + expect(_has(env, 'googleAnalyticsKey', '$GOOGLE_ANALYTICS_KEY')).toBeTrue(); }); });