mirror of
https://github.com/sartography/cr-connect-bpmn.git
synced 2025-02-22 05:08:32 +00:00
fixes adding and removing libraries from a spec
This commit is contained in:
parent
50bd604583
commit
20661576fd
@ -105,7 +105,7 @@ export class WorkflowSpecDialogComponent {
|
||||
{
|
||||
key: 'category_id',
|
||||
type: 'select',
|
||||
defaultValue: this.data.category_id,
|
||||
defaultValue: this.data.category_name,
|
||||
templateOptions: {
|
||||
label: 'Category',
|
||||
placeholder: 'Category of workflow specification',
|
||||
|
@ -22,7 +22,7 @@ export interface WorkflowSpecDialogData {
|
||||
id: string;
|
||||
display_name: string;
|
||||
description: string;
|
||||
category_id: number;
|
||||
category_name: string;
|
||||
display_order: number;
|
||||
standalone: boolean;
|
||||
library: boolean;
|
||||
|
@ -10,7 +10,7 @@ import {
|
||||
styleUrls: ['./library-list.component.scss']
|
||||
})
|
||||
export class LibraryListComponent implements OnInit, OnChanges {
|
||||
@Input() workflowSpecId: string;
|
||||
@Input() workflowSpec: WorkflowSpec;
|
||||
@Input() showAll: boolean;
|
||||
workflowLibraries: WorkflowSpec[];
|
||||
|
||||
@ -32,9 +32,7 @@ export class LibraryListComponent implements OnInit, OnChanges {
|
||||
|
||||
isChecked(libraryspec): boolean {
|
||||
let checked = false;
|
||||
for (const item of libraryspec.parents) {
|
||||
checked = checked || (item.id === this.workflowSpecId);
|
||||
}
|
||||
checked = checked || this.workflowSpec.libraries.indexOf(libraryspec.id) >= 0 ;
|
||||
return checked;
|
||||
}
|
||||
|
||||
@ -44,11 +42,11 @@ export class LibraryListComponent implements OnInit, OnChanges {
|
||||
|
||||
updateItem(library: WorkflowSpec , checked: boolean) {
|
||||
if (checked) {
|
||||
this.api.deleteWorkflowLibrary(this.workflowSpecId, library.id).subscribe(() => {
|
||||
this.api.deleteWorkflowLibrary(this.workflowSpec.id, library.id).subscribe(() => {
|
||||
this._loadWorkflowLibraries();
|
||||
});
|
||||
} else {
|
||||
this.api.addWorkflowLibrary(this.workflowSpecId, library.id).subscribe(() => {
|
||||
this.api.addWorkflowLibrary(this.workflowSpec.id, library.id).subscribe(() => {
|
||||
this._loadWorkflowLibraries();
|
||||
});
|
||||
}
|
||||
@ -59,5 +57,8 @@ export class LibraryListComponent implements OnInit, OnChanges {
|
||||
this.api.getWorkflowSpecificationLibraries().subscribe(wfs => {
|
||||
this.workflowLibraries = wfs;
|
||||
});
|
||||
this.api.getWorkflowSpecification(this.workflowSpec.id).subscribe(spec => {
|
||||
this.workflowSpec = spec;
|
||||
});
|
||||
}
|
||||
}
|
||||
|
@ -2,7 +2,7 @@ import {Component} 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, FileParams, FileType, getFileType, isNumberDefined} from 'sartography-workflow-lib';
|
||||
import {ApiService, FileMeta, FileParams, FileType, getFileType} from 'sartography-workflow-lib';
|
||||
import {OpenFileDialogComponent} from '../_dialogs/open-file-dialog/open-file-dialog.component';
|
||||
import {OpenFileDialogData} from '../_interfaces/dialog-data';
|
||||
|
||||
|
@ -26,7 +26,7 @@
|
||||
<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>
|
||||
<app-library-list [showAll]="showAll" [workflowSpec]="workflowSpec"></app-library-list>
|
||||
</div>
|
||||
</mat-card-content>
|
||||
<mat-card-actions>
|
||||
|
@ -116,7 +116,7 @@ export class WorkflowSpecListComponent implements OnInit {
|
||||
id: selectedSpec ? selectedSpec.id : '',
|
||||
display_name: selectedSpec ? selectedSpec.display_name : '',
|
||||
description: selectedSpec ? selectedSpec.description : '',
|
||||
category_id: selectedSpec ? selectedSpec.category_id : null,
|
||||
category_name: selectedSpec ? selectedSpec.category_name : null,
|
||||
display_order: hasDisplayOrder ? selectedSpec.display_order : 0,
|
||||
standalone: selectedSpec ? selectedSpec.standalone : null,
|
||||
library: selectedSpec ? selectedSpec.library : (state === 'library' ? true : null),
|
||||
@ -274,9 +274,9 @@ export class WorkflowSpecListComponent implements OnInit {
|
||||
cat.workflow_specs = this.workflowSpecs
|
||||
.filter(wf => {
|
||||
if (searchSpecName) {
|
||||
return (wf.category_id === cat.id) && wf.display_name.toLowerCase().includes(searchSpecName.toLowerCase());
|
||||
return (wf.category_name === cat.display_name) && wf.display_name.toLowerCase().includes(searchSpecName.toLowerCase());
|
||||
} else {
|
||||
return wf.category_id === cat.id;
|
||||
return wf.category_name === cat.display_name;
|
||||
}
|
||||
})
|
||||
cat.workflow_specs.sort((x,y) => x.display_order - y.display_order);
|
||||
@ -311,7 +311,7 @@ export class WorkflowSpecListComponent implements OnInit {
|
||||
id: data.id,
|
||||
display_name: data.display_name,
|
||||
description: data.description,
|
||||
category_id: data.category_id,
|
||||
category_name: data.category_name,
|
||||
standalone: data.standalone,
|
||||
library: data.library,
|
||||
};
|
||||
|
Loading…
x
Reference in New Issue
Block a user