Skip to content

Commit 956a98c

Browse files
committed
[NAB-359] - Task ref with multiple init values
- disable tasks that contain taskRef as dataRef
1 parent 9201b63 commit 956a98c

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

src/app/modeler/data-mode/task-ref-init-field/task-ref-init-field.component.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
/>
2121
<mat-autocomplete #auto="matAutocomplete" (optionSelected)="selectInit($event)">
2222
@for (task of tasks; track task) {
23-
<mat-option [value]="task.id">{{ task.label?.value }} [{{ task.id }}]</mat-option>
23+
<mat-option [value]="task.id" [disabled]="isReferenced(task)">{{ task.label?.value }} [{{ task.id }}]</mat-option>
2424
}
2525
</mat-autocomplete>
2626
</mat-form-field>

src/app/modeler/data-mode/task-ref-init-field/task-ref-init-field.component.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import {MatFormField, MatLabel, MatPrefix} from '@angular/material/form-field';
55
import {MatInput} from '@angular/material/input';
66
import {FormControl, ReactiveFormsModule} from '@angular/forms';
77
import {ModelService} from '../../services/model/model.service';
8-
import {DataVariable, I18nWithDynamic} from '@netgrif/petriflow';
8+
import {DataVariable, I18nWithDynamic, Transition} from '@netgrif/petriflow';
99
import {MatChipInputEvent} from '@angular/material/chips';
1010
import {MatAutocompleteSelectedEvent} from '@angular/material/autocomplete';
1111

@@ -43,7 +43,7 @@ export class TaskRefInitFieldComponent {
4343
this.taskRefFormControl.setValue(null);
4444
}
4545

46-
get tasks() {
46+
get tasks(): Transition[] {
4747
return this._modelService.model.getTransitions().filter(t => {
4848
return !this.taskRef.inits.some(init => init.value === t.id);
4949
}).sort((t1, t2) => {
@@ -68,4 +68,8 @@ export class TaskRefInitFieldComponent {
6868
const taskTitle = task.label.value ? `${task.label.value} ` : '';
6969
return `${taskTitle} [${taskId}]`;
7070
}
71+
72+
isReferenced(task: Transition): boolean {
73+
return task.dataGroups.some(group => !!group.getDataRef(this.taskRef.id));
74+
}
7175
}

0 commit comments

Comments
 (0)