Updates sartography-workflow-lib. Adds reference file editing screen. Fixes BPMN file update mechanism.
This commit is contained in:
parent
e3214aa5dd
commit
d5cfbf238d
|
@ -12291,9 +12291,9 @@
|
||||||
"integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg=="
|
"integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg=="
|
||||||
},
|
},
|
||||||
"sartography-workflow-lib": {
|
"sartography-workflow-lib": {
|
||||||
"version": "0.0.167",
|
"version": "0.0.170",
|
||||||
"resolved": "https://registry.npmjs.org/sartography-workflow-lib/-/sartography-workflow-lib-0.0.167.tgz",
|
"resolved": "https://registry.npmjs.org/sartography-workflow-lib/-/sartography-workflow-lib-0.0.170.tgz",
|
||||||
"integrity": "sha512-Ju6VehVOj6yjAYOTEN2PtFbWUXB6LTldaf5GO8iW2lx20Z+TGnrK0Lvgh1hv3/F+7yUqpcZjJvO+ppYahpURRA=="
|
"integrity": "sha512-bLj7scU+z2lafzPmbpAAqLoGJZX0e2t1PZq5C4sqWIU/vuq3xf5dQGFL7nOyWpfxGchxWjszi1+9LqC2PhSJtw=="
|
||||||
},
|
},
|
||||||
"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.167",
|
"sartography-workflow-lib": "^0.0.170",
|
||||||
"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"
|
||||||
|
|
|
@ -4,6 +4,8 @@ import {SessionRedirectComponent} from 'sartography-workflow-lib';
|
||||||
import {environment} from '../environments/environment.runtime';
|
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 {ProtocolBuilderComponent} from './protocol-builder/protocol-builder.component';
|
||||||
|
import {ReferenceFilesComponent} from './reference-files/reference-files.component';
|
||||||
import {SignInComponent} from './sign-in/sign-in.component';
|
import {SignInComponent} from './sign-in/sign-in.component';
|
||||||
import {SignOutComponent} from './sign-out/sign-out.component';
|
import {SignOutComponent} from './sign-out/sign-out.component';
|
||||||
|
|
||||||
|
@ -18,6 +20,14 @@ const routes: Routes = [
|
||||||
path: 'home',
|
path: 'home',
|
||||||
component: HomeComponent
|
component: HomeComponent
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
path: 'pb',
|
||||||
|
component: ProtocolBuilderComponent
|
||||||
|
},
|
||||||
|
{
|
||||||
|
path: 'reffiles',
|
||||||
|
component: ReferenceFilesComponent
|
||||||
|
},
|
||||||
{
|
{
|
||||||
path: 'modeler/:workflowSpecId',
|
path: 'modeler/:workflowSpecId',
|
||||||
component: ModelerComponent
|
component: ModelerComponent
|
||||||
|
|
|
@ -49,6 +49,8 @@ import {SignInComponent} from './sign-in/sign-in.component';
|
||||||
import {SignOutComponent} from './sign-out/sign-out.component';
|
import {SignOutComponent} from './sign-out/sign-out.component';
|
||||||
import {WorkflowSpecCardComponent} from './workflow-spec-card/workflow-spec-card.component';
|
import {WorkflowSpecCardComponent} from './workflow-spec-card/workflow-spec-card.component';
|
||||||
import {WorkflowSpecListComponent} from './workflow-spec-list/workflow-spec-list.component';
|
import {WorkflowSpecListComponent} from './workflow-spec-list/workflow-spec-list.component';
|
||||||
|
import { ProtocolBuilderComponent } from './protocol-builder/protocol-builder.component';
|
||||||
|
import { ReferenceFilesComponent } from './reference-files/reference-files.component';
|
||||||
|
|
||||||
@Injectable()
|
@Injectable()
|
||||||
export class ThisEnvironment implements AppEnvironment {
|
export class ThisEnvironment implements AppEnvironment {
|
||||||
|
@ -81,6 +83,8 @@ export class ThisEnvironment implements AppEnvironment {
|
||||||
HomeComponent,
|
HomeComponent,
|
||||||
WorkflowSpecCardComponent,
|
WorkflowSpecCardComponent,
|
||||||
ApiErrorsComponent,
|
ApiErrorsComponent,
|
||||||
|
ProtocolBuilderComponent,
|
||||||
|
ReferenceFilesComponent,
|
||||||
],
|
],
|
||||||
imports: [
|
imports: [
|
||||||
BrowserAnimationsModule,
|
BrowserAnimationsModule,
|
||||||
|
|
|
@ -47,8 +47,9 @@ export class NavbarComponent {
|
||||||
private _loadNavLinks() {
|
private _loadNavLinks() {
|
||||||
const displayName = this.user.display_name || this.user.first_name || this.user.last_name;
|
const displayName = this.user.display_name || this.user.first_name || this.user.last_name;
|
||||||
this.navLinks = [
|
this.navLinks = [
|
||||||
{path: '/', id: 'nav_home', label: 'Home'},
|
{path: '/home', id: 'nav_home', label: 'Configurator'},
|
||||||
{path: '/inbox', id: 'nav_inbox', label: 'Inbox'},
|
{path: '/pb', id: 'nav_pb', label: 'Protocol Builder Tester'},
|
||||||
|
{path: '/reffiles', id: 'nav_reffiles', label: 'Reference Files'},
|
||||||
{path: '/help', id: 'nav_help', label: 'Help'},
|
{path: '/help', id: 'nav_help', label: 'Help'},
|
||||||
{
|
{
|
||||||
id: 'nav_account', label: `${displayName} (${this.user.email_address})`,
|
id: 'nav_account', label: `${displayName} (${this.user.email_address})`,
|
||||||
|
|
|
@ -0,0 +1,4 @@
|
||||||
|
<div class="full-height" fxLayout="column" fxLayoutAlign="center center">
|
||||||
|
<h1>Protocol Builder Tester</h1>
|
||||||
|
<p>(Coming soon)</p>
|
||||||
|
</div>
|
|
@ -0,0 +1,25 @@
|
||||||
|
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
|
||||||
|
|
||||||
|
import { ProtocolBuilderComponent } from './protocol-builder.component';
|
||||||
|
|
||||||
|
describe('ProtocolBuilderComponentComponent', () => {
|
||||||
|
let component: ProtocolBuilderComponent;
|
||||||
|
let fixture: ComponentFixture<ProtocolBuilderComponent>;
|
||||||
|
|
||||||
|
beforeEach(async(() => {
|
||||||
|
TestBed.configureTestingModule({
|
||||||
|
declarations: [ ProtocolBuilderComponent ]
|
||||||
|
})
|
||||||
|
.compileComponents();
|
||||||
|
}));
|
||||||
|
|
||||||
|
beforeEach(() => {
|
||||||
|
fixture = TestBed.createComponent(ProtocolBuilderComponent);
|
||||||
|
component = fixture.componentInstance;
|
||||||
|
fixture.detectChanges();
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should create', () => {
|
||||||
|
expect(component).toBeTruthy();
|
||||||
|
});
|
||||||
|
});
|
|
@ -0,0 +1,15 @@
|
||||||
|
import { Component, OnInit } from '@angular/core';
|
||||||
|
|
||||||
|
@Component({
|
||||||
|
selector: 'app-protocol-builder',
|
||||||
|
templateUrl: './protocol-builder.component.html',
|
||||||
|
styleUrls: ['./protocol-builder.component.scss']
|
||||||
|
})
|
||||||
|
export class ProtocolBuilderComponent implements OnInit {
|
||||||
|
|
||||||
|
constructor() { }
|
||||||
|
|
||||||
|
ngOnInit(): void {
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,12 @@
|
||||||
|
<div class="container" fxLayout="column" fxLayoutGap="40px">
|
||||||
|
<h1>Reference Files</h1>
|
||||||
|
|
||||||
|
<div *ngFor="let refFile of referenceFiles" fxLayout="row" fxLayoutGap="40px">
|
||||||
|
<h3>{{refFile.name}}</h3>
|
||||||
|
<div class="file-buttons" fxLayout="row" fxLayoutGap="10px">
|
||||||
|
<button mat-icon-button (click)="downloadFile(refFile)" color="primary"><mat-icon>save_alt</mat-icon></button>
|
||||||
|
<button mat-icon-button (click)="openFileDialog(refFile)" color="primary"><mat-icon>edit</mat-icon></button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
|
@ -0,0 +1,25 @@
|
||||||
|
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
|
||||||
|
|
||||||
|
import { ReferenceFilesComponent } from './reference-files.component';
|
||||||
|
|
||||||
|
describe('ReferenceFilesComponent', () => {
|
||||||
|
let component: ReferenceFilesComponent;
|
||||||
|
let fixture: ComponentFixture<ReferenceFilesComponent>;
|
||||||
|
|
||||||
|
beforeEach(async(() => {
|
||||||
|
TestBed.configureTestingModule({
|
||||||
|
declarations: [ ReferenceFilesComponent ]
|
||||||
|
})
|
||||||
|
.compileComponents();
|
||||||
|
}));
|
||||||
|
|
||||||
|
beforeEach(() => {
|
||||||
|
fixture = TestBed.createComponent(ReferenceFilesComponent);
|
||||||
|
component = fixture.componentInstance;
|
||||||
|
fixture.detectChanges();
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should create', () => {
|
||||||
|
expect(component).toBeTruthy();
|
||||||
|
});
|
||||||
|
});
|
|
@ -0,0 +1,63 @@
|
||||||
|
import {Component, OnInit} from '@angular/core';
|
||||||
|
import {MatDialog} from '@angular/material/dialog';
|
||||||
|
import {MatSnackBar} from '@angular/material/snack-bar';
|
||||||
|
import * as fileSaver from 'file-saver';
|
||||||
|
import {ApiService, FileMeta, FileType} from 'sartography-workflow-lib';
|
||||||
|
import {OpenFileDialogComponent} from '../_dialogs/open-file-dialog/open-file-dialog.component';
|
||||||
|
import {OpenFileDialogData} from '../_interfaces/dialog-data';
|
||||||
|
|
||||||
|
@Component({
|
||||||
|
selector: 'app-reference-files',
|
||||||
|
templateUrl: './reference-files.component.html',
|
||||||
|
styleUrls: ['./reference-files.component.scss']
|
||||||
|
})
|
||||||
|
export class ReferenceFilesComponent implements OnInit {
|
||||||
|
referenceFiles: FileMeta[];
|
||||||
|
|
||||||
|
constructor(
|
||||||
|
private apiService: ApiService,
|
||||||
|
public dialog: MatDialog,
|
||||||
|
private snackBar: MatSnackBar,
|
||||||
|
) {
|
||||||
|
this._loadReferenceFiles();
|
||||||
|
}
|
||||||
|
|
||||||
|
ngOnInit(): void {
|
||||||
|
}
|
||||||
|
|
||||||
|
_loadReferenceFiles() {
|
||||||
|
this.apiService.listReferenceFiles().subscribe(f => this.referenceFiles = f);
|
||||||
|
}
|
||||||
|
|
||||||
|
openFileDialog(fm: FileMeta) {
|
||||||
|
this.apiService.getReferenceFile(fm.name).subscribe(oldFile => {
|
||||||
|
const dialogData: OpenFileDialogData = {
|
||||||
|
fileMetaId: fm.id,
|
||||||
|
file: new File([oldFile.body], fm.name, {
|
||||||
|
type: fm.content_type,
|
||||||
|
lastModified: parseInt(oldFile.headers.get('last-modified'), 10)
|
||||||
|
}),
|
||||||
|
mode: 'local',
|
||||||
|
fileTypes: [FileType.XLSX, FileType.XLS],
|
||||||
|
};
|
||||||
|
const dialogRef = this.dialog.open(OpenFileDialogComponent, {data: dialogData});
|
||||||
|
|
||||||
|
dialogRef.afterClosed().subscribe((data: OpenFileDialogData) => {
|
||||||
|
if (data && data.file) {
|
||||||
|
console.log('data', data);
|
||||||
|
this.apiService.updateReferenceFile(fm.name, data.file).subscribe(() => {
|
||||||
|
this._loadReferenceFiles();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
downloadFile(fm: FileMeta) {
|
||||||
|
this.apiService.getReferenceFile(fm.name).subscribe(response => {
|
||||||
|
const blob = new Blob([response.body], {type: fm.content_type});
|
||||||
|
fileSaver.saveAs(blob, fm.name);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue