diff --git a/package-lock.json b/package-lock.json index f934e6d..01d4b6f 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.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 bf0559c..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.236", + "sartography-workflow-lib": "0.0.248", "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..d8fcd97 100644 --- a/src/app/app.module.ts +++ b/src/app/app.module.ts @@ -38,7 +38,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'; @@ -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, 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 { 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(); }); }); diff --git a/src/favicon.ico b/src/favicon.ico index 8081c7c..df273c3 100644 Binary files a/src/favicon.ico and b/src/favicon.ico differ diff --git a/src/index.html b/src/index.html index e33289a..1c3c70e 100644 --- a/src/index.html +++ b/src/index.html @@ -16,7 +16,7 @@ - +