Make a separate area to show the workflow-specs that are marked as 'Libraries'

This commit is contained in:
Kelly McDonald 2021-08-02 09:31:12 -04:00
parent 9307c32d0d
commit 887efa2982
6 changed files with 69 additions and 3 deletions

View File

@ -55,7 +55,7 @@
"ngx-markdown": "^9.1.1", "ngx-markdown": "^9.1.1",
"protractor": "^7.0.0", "protractor": "^7.0.0",
"rxjs": "~6.5.4", "rxjs": "~6.5.4",
"sartography-workflow-lib": "0.0.522", "sartography-workflow-lib": "0.0.532",
"tslib": "^1.13.0", "tslib": "^1.13.0",
"uuid": "^7.0.2", "uuid": "^7.0.2",
"zone.js": "^0.10.3" "zone.js": "^0.10.3"

View File

@ -101,6 +101,17 @@ export class WorkflowSpecDialogComponent {
indeterminate: false, indeterminate: false,
}, },
}, },
{
key: 'library',
type: 'checkbox',
defaultValue: this.data.library,
templateOptions: {
label: 'Library',
description: 'Is this a library workflow?',
required: true,
indeterminate: false,
},
},
]; ];
}); });
} }

View File

@ -26,6 +26,7 @@ export interface WorkflowSpecDialogData {
category_id: number; category_id: number;
display_order: number; display_order: number;
standalone: boolean; standalone: boolean;
library: boolean;
} }
export interface WorkflowSpecCategoryDialogData { export interface WorkflowSpecCategoryDialogData {

View File

@ -26,7 +26,45 @@
</div> </div>
</ng-container> </ng-container>
<mat-divider></mat-divider> <mat-divider></mat-divider>
<ng-container>
<div class="category">
<h4>Libraries</h4>
<mat-list>
<mat-list-item *ngFor="let wfs of workflowLibraries" class="workflow-spec" fxLayout="row" fxLayoutGap="10px" fxLayoutAlign="start center">
<a [ngClass]="{'spec_menu_item':true, 'spec-selected': wfs.id == selectedSpec.id}" (click)="selectSpec(wfs)">{{wfs.display_name}}</a>
<span class="spec-actions" fxLayout="row" fxLayoutGap="10px">
<button
mat-icon-button
title="Move up"
color="primary"
>
<mat-icon>arrow_upward</mat-icon>
</button>
<button
mat-icon-button
title="Move down"
color="primary"
>
<mat-icon>arrow_downward</mat-icon>
</button>
</span>
<!--
<ng-container *ngTemplateOutlet="workflowSpecCard; context: {wfs: wfs, cat: cat}"></ng-container>
-->
</mat-list-item>
</mat-list>
</div>
</ng-container>
<mat-divider></mat-divider>
<ng-container>
<div class="category">
<h4>Categories</h4>
</div>
<mat-divider></mat-divider>
<mat-accordion class="example-headers-align" multi="false"> <mat-accordion class="example-headers-align" multi="false">
<ng-container *ngFor="let cat of workflowSpecsByCategory"> <ng-container *ngFor="let cat of workflowSpecsByCategory">
@ -108,6 +146,7 @@
</div> </div>
</ng-container> </ng-container>
</mat-accordion> </mat-accordion>
</ng-container>
</mat-drawer> </mat-drawer>
<div class="content"> <div class="content">

View File

@ -141,7 +141,8 @@ describe('WorkflowSpecListComponent', () => {
description: '', description: '',
category_id: 0, category_id: 0,
display_order: 0, display_order: 0,
standalone: false standalone: false,
library: false
}; };
const _upsertWorkflowSpecificationSpy = spyOn((component as any), '_upsertWorkflowSpecification') const _upsertWorkflowSpecificationSpy = spyOn((component as any), '_upsertWorkflowSpecification')

View File

@ -44,6 +44,7 @@ export interface WorkflowSpecCategoryGroup {
}) })
export class WorkflowSpecListComponent implements OnInit { export class WorkflowSpecListComponent implements OnInit {
workflowSpecs: WorkflowSpec[] = []; workflowSpecs: WorkflowSpec[] = [];
workflowLibraries: WorkflowSpec[] = [];
selectedSpec: WorkflowSpec; selectedSpec: WorkflowSpec;
masterStatusSpec: WorkflowSpec; masterStatusSpec: WorkflowSpec;
selectedCat: WorkflowSpecCategory; selectedCat: WorkflowSpecCategory;
@ -72,6 +73,7 @@ export class WorkflowSpecListComponent implements OnInit {
this._loadWorkflowSpecCategories(); this._loadWorkflowSpecCategories();
} }
}); });
this._loadWorkflowLibraries();
this.searchField = new FormControl(); this.searchField = new FormControl();
this.searchField.valueChanges.subscribe(value => { this.searchField.valueChanges.subscribe(value => {
this._loadWorkflowSpecs(null, value); this._loadWorkflowSpecs(null, value);
@ -118,6 +120,7 @@ export class WorkflowSpecListComponent implements OnInit {
category_id: selectedSpec ? selectedSpec.category_id : null, category_id: selectedSpec ? selectedSpec.category_id : null,
display_order: hasDisplayOrder ? selectedSpec.display_order : 0, display_order: hasDisplayOrder ? selectedSpec.display_order : 0,
standalone: selectedSpec ? selectedSpec.standalone : null, standalone: selectedSpec ? selectedSpec.standalone : null,
library: selectedSpec ? selectedSpec.library : null,
}; };
@ -221,8 +224,17 @@ export class WorkflowSpecListComponent implements OnInit {
this.workflowSpecsByCategory[i + 1].workflow_specs = []; this.workflowSpecsByCategory[i + 1].workflow_specs = [];
}); });
this._loadWorkflowSpecs(selectedSpecName); this._loadWorkflowSpecs(selectedSpecName);
this._loadWorkflowLibraries();
}); });
} }
private _loadWorkflowLibraries() {
this.api.getWorkflowSpecificationLibraries().subscribe(wfs => {
this.workflowLibraries = wfs;
});
}
private _loadWorkflowSpecs(selectedSpecName: String = null, searchSpecName: String = null) { private _loadWorkflowSpecs(selectedSpecName: String = null, searchSpecName: String = null) {
this.api.getWorkflowSpecList().subscribe(wfs => { this.api.getWorkflowSpecList().subscribe(wfs => {
@ -269,7 +281,8 @@ export class WorkflowSpecListComponent implements OnInit {
description: data.description, description: data.description,
category_id: data.category_id, category_id: data.category_id,
display_order: data.display_order, display_order: data.display_order,
standalone: data.standalone standalone: data.standalone,
library: data.library
}; };
if (isNew) { if (isNew) {
@ -304,6 +317,7 @@ export class WorkflowSpecListComponent implements OnInit {
private _updateWorkflowSpec(specId: string, newSpec: WorkflowSpec) { private _updateWorkflowSpec(specId: string, newSpec: WorkflowSpec) {
this.api.updateWorkflowSpecification(specId, newSpec).subscribe(_ => { this.api.updateWorkflowSpecification(specId, newSpec).subscribe(_ => {
this._loadWorkflowLibraries();
this._loadWorkflowSpecs(); this._loadWorkflowSpecs();
this._displayMessage('Saved changes to workflow spec.'); this._displayMessage('Saved changes to workflow spec.');
}); });