Fixes #410,411

also:

* Several linting errors - I upgraded webstorm and this seemed to have fixed the problems that I was having.

* UI fixes for the left hand side

* Speedup for development - use start:dev in the configuration rather than start
This commit is contained in:
Kelly McDonald 2021-08-24 08:53:16 -04:00
parent a32a77fcbc
commit f0207540ee
12 changed files with 851 additions and 992 deletions

View File

@ -53,6 +53,15 @@
"scripts": [] "scripts": []
}, },
"configurations": { "configurations": {
"development": {
"buildOptimizer": false,
"optimization": false,
"vendorChunk": true,
"extractLicenses": false,
"sourceMap": true,
"namedChunks": true
},
"production": { "production": {
"optimization": { "optimization": {
"scripts": true, "scripts": true,
@ -144,7 +153,11 @@
"configurations": { "configurations": {
"production": { "production": {
"browserTarget": "cr-connect-bpmn:build:production" "browserTarget": "cr-connect-bpmn:build:production"
},
"development": {
"browserTarget": "cr-connect-bpmn:build:development"
} }
} }
}, },
"extract-i18n": { "extract-i18n": {

1745
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -7,9 +7,11 @@
"scripts": { "scripts": {
"ng": "ng", "ng": "ng",
"start": "ng serve", "start": "ng serve",
"start:dev": "ng serve --configuration development",
"build": "ng build", "build": "ng build",
"build:prod": "ng build --configuration=production --configuration production --base-href=__REPLACE_ME_WITH_BASE_HREF__ --deploy-url=__REPLACE_ME_WITH_DEPLOY_URL__", "build:prod": "ng build --configuration=production --configuration production --base-href=__REPLACE_ME_WITH_BASE_HREF__ --deploy-url=__REPLACE_ME_WITH_DEPLOY_URL__",
"build:staging": "ng build --configuration=staging --configuration production --base-href=__REPLACE_ME_WITH_BASE_HREF__ --deploy-url=__REPLACE_ME_WITH_DEPLOY_URL__", "build:staging": "ng build --configuration=staging --configuration production --base-href=__REPLACE_ME_WITH_BASE_HREF__ --deploy-url=__REPLACE_ME_WITH_DEPLOY_URL__",
"build:dev": "ng build --configuration=development",
"build:test": "ng build --configuration=test", "build:test": "ng build --configuration=test",
"test": "ng test", "test": "ng test",
"test:coverage": "ng test --codeCoverage=true --watch=false --browsers=ChromeHeadless", "test:coverage": "ng test --codeCoverage=true --watch=false --browsers=ChromeHeadless",

View File

@ -4,23 +4,15 @@ import EMAIL_REGEX from './email.regex';
import PHONE_REGEX from './phone.regex'; import PHONE_REGEX from './phone.regex';
import URL_REGEX from './url.regex'; import URL_REGEX from './url.regex';
export const EmailValidator = (control: FormControl): ValidationErrors => { export const EmailValidator = (control: FormControl): ValidationErrors => !control.value || EMAIL_REGEX.test(control.value) ? null : {email: true};
return !control.value || EMAIL_REGEX.test(control.value) ? null : {email: true};
};
export const EmailValidatorMessage = (err, field: FormlyFieldConfig) => `"${field.formControl.value}" is not a valid email address`; export const EmailValidatorMessage = (err, field: FormlyFieldConfig) => `"${field.formControl.value}" is not a valid email address`;
export const UrlValidator = (control: FormControl): ValidationErrors => { export const UrlValidator = (control: FormControl): ValidationErrors => !control.value || URL_REGEX.test(control.value) ? null : {url: true};
return !control.value || URL_REGEX.test(control.value) ? null : {url: true};
};
export const UrlValidatorMessage = (err, field: FormlyFieldConfig) => { export const UrlValidatorMessage = (err, field: FormlyFieldConfig) => `We cannot save "${field.formControl.value}". Please provide the full path, including http:// or https://`;
return `We cannot save "${field.formControl.value}". Please provide the full path, including http:// or https://`;
};
export const PhoneValidator = (control: FormControl): ValidationErrors => { export const PhoneValidator = (control: FormControl): ValidationErrors => !control.value || PHONE_REGEX.test(control.value) ? null : {phone: true};
return !control.value || PHONE_REGEX.test(control.value) ? null : {phone: true};
};
export const PhoneValidatorMessage = (err, field: FormlyFieldConfig) => `"${field.formControl.value}" is not a valid phone number`; export const PhoneValidatorMessage = (err, field: FormlyFieldConfig) => `"${field.formControl.value}" is not a valid phone number`;
@ -42,9 +34,9 @@ export const MinValidationMessage = (err, field) => `This value should be more t
export const MaxValidationMessage = (err, field) => `This value should be less than ${field.templateOptions.max}`; export const MaxValidationMessage = (err, field) => `This value should be less than ${field.templateOptions.max}`;
export const ShowError = (field: FieldType) => field.formControl && export const ShowError = (field: FieldType) => field.formControl &&
field.formControl.invalid && field.formControl.invalid &&
( (
field.formControl.dirty || field.formControl.dirty ||
(field.options && field.options.parentForm && field.options.parentForm.submitted) || (field.options && field.options.parentForm && field.options.parentForm.submitted) ||
(field.field && field.field.validation && field.field.validation.show) (field.field && field.field.validation && field.field.validation.show)
); );

View File

@ -1,5 +1,3 @@
import { FileType } from 'sartography-workflow-lib'; import { FileType } from 'sartography-workflow-lib';
export const getDiagramTypeFromXml = (xml: string): FileType => { export const getDiagramTypeFromXml = (xml: string): FileType =>(xml && /dmn\.xsd|dmndi:DMNDiagram/.test(xml) ? FileType.DMN : FileType.BPMN);
return (xml && /dmn\.xsd|dmndi:DMNDiagram/.test(xml) ? FileType.DMN : FileType.BPMN);
};

View File

@ -1,9 +1,10 @@
<div class="file-list"> <div class="file-list">
<mat-list> <mat-list>
<mat-list-item <mat-list-item
*ngFor="let fm of workflowLibraries" *ngFor="let fm of getCurrentItems()"
> >
<mat-checkbox (click)="updateItem(fm,isChecked(fm))" [checked]="isChecked(fm)">{{fm.display_name}}</mat-checkbox>
<mat-checkbox (click)="updateItem(fm,isChecked(fm))" [checked]="isChecked(fm)">{{fm.display_name}}</mat-checkbox>
</mat-list-item> </mat-list-item>
</mat-list> </mat-list>
</div> </div>

View File

@ -11,11 +11,14 @@ import {
}) })
export class LibraryListComponent implements OnInit, OnChanges { export class LibraryListComponent implements OnInit, OnChanges {
@Input() workflowSpecId: string; @Input() workflowSpecId: string;
@Input() showAll: boolean;
workflowLibraries: WorkflowSpec[]; workflowLibraries: WorkflowSpec[];
constructor( constructor(
private api: ApiService, private api: ApiService,
) { ) {
this.showAll = false;
this.workflowLibraries =[];
} }
ngOnInit() { ngOnInit() {
@ -35,6 +38,10 @@ export class LibraryListComponent implements OnInit, OnChanges {
return checked; return checked;
} }
getCurrentItems(){
return this.workflowLibraries.filter((item)=> this.isChecked(item) || this.showAll)
}
updateItem(library: WorkflowSpec , checked: boolean) { updateItem(library: WorkflowSpec , checked: boolean) {
if (checked) { if (checked) {
this.api.deleteWorkflowLibrary(this.workflowSpecId, library.id).subscribe(() => { this.api.deleteWorkflowLibrary(this.workflowSpecId, library.id).subscribe(() => {

View File

@ -26,8 +26,11 @@
<h4>Workflow Spec Files</h4> <h4>Workflow Spec Files</h4>
<app-file-list [workflowSpec]="workflowSpec"></app-file-list> <app-file-list [workflowSpec]="workflowSpec"></app-file-list>
<div *ngIf="!workflowSpec.library"> <div *ngIf="!workflowSpec.library">
<h4>Included Libraries</h4> <h4 class="library-list">
<app-library-list [workflowSpecId]="workflowSpec.id"></app-library-list> <mat-icon (click)="expandToggle()" class="expand" *ngIf="!showAll">chevron_right</mat-icon>
<mat-icon (click)="expandToggle()" class="expand" *ngIf="showAll">expand_more</mat-icon>
Included Libraries</h4>
<app-library-list [showAll]="showAll" [workflowSpecId]="workflowSpec.id"></app-library-list>
</div> </div>
</mat-card-content> </mat-card-content>
<mat-card-actions> <mat-card-actions>

View File

@ -48,3 +48,11 @@ mat-card {
} }
} }
.library-list{
margin-top: 2rem;
}
.expand{
margin-right: 5px;
}

View File

@ -1,5 +1,6 @@
import {Component, Input, TemplateRef} from '@angular/core'; import {Component, Input, TemplateRef} from '@angular/core';
import {ApiService, WorkflowSpec} from 'sartography-workflow-lib'; import { WorkflowSpec} from 'sartography-workflow-lib';
@Component({ @Component({
selector: 'app-workflow-spec-card', selector: 'app-workflow-spec-card',
@ -9,9 +10,11 @@ import {ApiService, WorkflowSpec} from 'sartography-workflow-lib';
export class WorkflowSpecCardComponent { export class WorkflowSpecCardComponent {
@Input() workflowSpec: WorkflowSpec; @Input() workflowSpec: WorkflowSpec;
@Input() actionButtons: TemplateRef<any>; @Input() actionButtons: TemplateRef<any>;
showAll: boolean;
constructor( constructor(
private api: ApiService
) { ) {
} }
expandToggle() {
this.showAll = !this.showAll;
}
} }

View File

@ -36,9 +36,13 @@
<h4>Libraries</h4> <h4>Libraries</h4>
</mat-panel-title> </mat-panel-title>
</mat-expansion-panel-header> </mat-expansion-panel-header>
<ng-container *ngFor="let wfs of workflowLibraries" class="workflow-spec" fxLayout="row" fxLayoutGap="10px" fxLayoutAlign="start center"> <mat-list>
<span [ngClass]="{'spec_menu_item':true, 'library-selected': selectedSpec && wfs.id === selectedSpec.id}" (click)="selectSpec(wfs)">{{wfs.display_name}}</span> <mat-list-item *ngFor="let wfs of workflowLibraries" class="workflow-spec" fxLayout="row" fxLayoutGap="10px" fxLayoutAlign="start center">
</ng-container> <div>
<span [ngClass]="{'library_item':true, 'spec_menu_item':true, 'library-selected': selectedSpec && wfs.id === selectedSpec.id}" (click)="selectSpec(wfs)">{{wfs.display_name}}</span>
</div>
</mat-list-item>
</mat-list>
</mat-expansion-panel> </mat-expansion-panel>
</mat-accordion> </mat-accordion>

View File

@ -54,6 +54,10 @@
cursor: pointer; cursor: pointer;
} }
.library_item {
padding: 10px;
}
.spec_menu_item { .spec_menu_item {
flex-flow: row; flex-flow: row;
display: inline-block; display: inline-block;
@ -74,7 +78,6 @@
} }
} }
.library-selected { .library-selected {
font-weight: bold; font-weight: bold;
} }