Merge branch 'rrt/dev' into dev

This commit is contained in:
Aaron Louie 2020-06-02 23:29:54 -04:00
commit f5a2e6c3df
16 changed files with 28 additions and 145 deletions

6
package-lock.json generated
View File

@ -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",

View File

@ -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"

View File

@ -49,7 +49,3 @@ export interface DeleteWorkflowSpecCategoryDialogData {
confirm: boolean;
category: WorkflowSpecCategory;
}
export interface ApiErrorsBottomSheetData {
apiErrors: ApiError[];
}

View File

@ -1,21 +0,0 @@
<div fxLayout="row">
<h2>Workflow Specification Errors</h2>
<span fxFlex></span>
<button mat-icon-button (click)="dismiss($event)"><mat-icon>close</mat-icon></button>
</div>
<mat-list>
<mat-list-item *ngFor="let e of apiErrors" class="api-error" [ngStyle]="{'height': 'auto'}">
<h3 mat-line *ngIf="e.status_code">{{e.code}}</h3>
<h4 mat-line *ngIf="e.code">{{e.status_code}}</h4>
<div mat-line *ngIf="e.task_name && e.task_id">{{e.task_name}} ({{e.task_id}})</div>
<div mat-line *ngIf="e.task_id && !e.task_name">Task ID: {{e.task_id}}</div>
<div mat-line *ngIf="!e.task_id && e.task_name">Task Name: {{e.task_name}}</div>
<div mat-line *ngIf="e.file_name">File: {{e.file_name}}</div>
<div mat-line *ngIf="e.tag">Tag: {{e.tag}}</div>
<ng-container *ngIf="e.message">
<div mat-line>
<code *ngIf="e.message">{{e.message}}</code>
</div>
</ng-container>
</mat-list-item>
</mat-list>

View File

@ -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;
}
}
}

View File

@ -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<ApiErrorsComponent>;
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();
});
});

View File

@ -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<ApiErrorsComponent>
) {
if (data && data.apiErrors && data.apiErrors.length > 0) {
this.apiErrors = data.apiErrors;
}
}
ngOnInit(): void {
}
dismiss(event: MouseEvent) {
this._bottomSheetRef.dismiss();
event.preventDefault();
}
}

View File

@ -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() {

View File

@ -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,

View File

@ -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({

View File

@ -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';

View File

@ -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 {

View File

@ -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',
};

View File

@ -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();
});
});

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.3 KiB

After

Width:  |  Height:  |  Size: 1.1 KiB

View File

@ -16,7 +16,7 @@
</script>
<meta content="width=device-width, initial-scale=1" name="viewport">
<meta name="google-site-verification" content="KBn1RBc_UR6VF025kfjl_fRlIoLufSHL5JIkwE_xrOc" />
<link href="favicon.ico" rel="icon" type="image/x-icon">
<link href="favicon.ico?v=1" rel="icon" type="image/x-icon">
<link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">
<link rel="stylesheet" href="https://use.typekit.net/kwp6dli.css">
<link href="assets/css/diagram-js.css" rel="stylesheet">