mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-07-24 17:32:15 +00:00
[ACA-2956] Add event emitter when processDefinition selection changes (for both APS and CLOUD) (#5579)
This commit is contained in:
@@ -33,7 +33,8 @@
|
||||
id="processDefinitionName">
|
||||
<div class="adf-process-input-autocomplete">
|
||||
<mat-autocomplete #auto="matAutocomplete" id="processDefinitionOptions" [displayWith]="displayProcessNameOnDropdown" (optionSelected)="setProcessDefinitionOnForm($event.option.value)">
|
||||
<mat-option *ngFor="let processDef of filteredProcesses" [value]="getProcessDefinitionValue(processDef)">
|
||||
<mat-option *ngFor="let processDef of filteredProcesses" [value]="getProcessDefinitionValue(processDef)"
|
||||
(click)="processDefinitionSelectionChanged(processDef)">
|
||||
{{ getProcessDefinitionValue(processDef) }}
|
||||
</mat-option>
|
||||
</mat-autocomplete>
|
||||
|
@@ -534,5 +534,14 @@ describe('StartProcessCloudComponent', () => {
|
||||
fixture.detectChanges();
|
||||
expect(processInstanceName.valid).toBeTruthy();
|
||||
});
|
||||
|
||||
it('should emit processDefinitionSelection event when a process definition is selected', (done) => {
|
||||
component.processDefinitionSelection.subscribe((processDefinition) => {
|
||||
expect(processDefinition).toEqual(fakeProcessDefinitions[0]);
|
||||
done();
|
||||
});
|
||||
fixture.detectChanges();
|
||||
selectOptionByName(fakeProcessDefinitions[0].name);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
@@ -88,6 +88,10 @@ export class StartProcessCloudComponent implements OnChanges, OnInit, OnDestroy
|
||||
@Output()
|
||||
formContentClicked: EventEmitter<ContentLinkModel> = new EventEmitter();
|
||||
|
||||
/** Emitted when process definition selection changes. */
|
||||
@Output()
|
||||
processDefinitionSelection: EventEmitter<ProcessDefinitionCloud> = new EventEmitter<ProcessDefinitionCloud>();
|
||||
|
||||
processDefinitionList: ProcessDefinitionCloud[] = [];
|
||||
processDefinitionCurrent: ProcessDefinitionCloud;
|
||||
errorMessageId: string = '';
|
||||
@@ -312,6 +316,10 @@ export class StartProcessCloudComponent implements OnChanges, OnInit, OnDestroy
|
||||
this.formContentClicked.emit(content);
|
||||
}
|
||||
|
||||
processDefinitionSelectionChanged(processDefinition) {
|
||||
this.processDefinitionSelection.emit(processDefinition);
|
||||
}
|
||||
|
||||
ngOnDestroy() {
|
||||
this.onDestroy$.next(true);
|
||||
this.onDestroy$.complete();
|
||||
|
Reference in New Issue
Block a user