[ACA-3273] - fix start process empty message (#5689)

* [ACA-3273] - fix start process empty message

* revert licenses changes

Co-authored-by: Silviu Popa <p3701014@L3700101120.ness.com>
This commit is contained in:
Silviu Popa
2020-05-13 03:17:48 +03:00
committed by GitHub
parent da82180814
commit 171089d1d6
3 changed files with 81 additions and 63 deletions

View File

@@ -3,11 +3,12 @@
<mat-card-title class="adf-title">{{'ADF_CLOUD_PROCESS_LIST.ADF_CLOUD_START_PROCESS.FORM.TITLE' | translate}}
</mat-card-title>
<mat-card-content *ngIf="!isProcessDefinitionsEmpty(); else emptyProcessDefinitionsList">
<mat-card-content>
<mat-card-subtitle id="error-message" *ngIf="errorMessageId">
{{ errorMessageId | translate }}
</mat-card-subtitle>
<div *ngIf="!isProcessDefinitionsEmpty(); else emptyProcessDefinitionsList">
<form [formGroup]="processForm">
<mat-form-field class="adf-process-input-container" [floatLabel]="'always'">
<mat-label>{{ 'ADF_CLOUD_PROCESS_LIST.ADF_CLOUD_START_PROCESS.FORM.LABEL.TYPE' | translate }}</mat-label>
@@ -70,6 +71,7 @@
</adf-cloud-form-custom-outcomes>
</adf-cloud-form>
</ng-container>
</div>
</mat-card-content>
@@ -86,7 +88,7 @@
</ng-template>
<ng-template #emptyProcessDefinitionsList>
<mat-card-content>
<mat-card-content *ngIf="processDefinitionLoaded">
<mat-card-subtitle class="error-message" id="no-process-message">
{{ 'ADF_CLOUD_PROCESS_LIST.ADF_CLOUD_START_PROCESS.NO_PROCESS_DEFINITIONS' | translate | uppercase}}
</mat-card-subtitle>

View File

@@ -736,5 +736,18 @@ describe('StartProcessCloudComponent', () => {
fixture.detectChanges();
selectOptionByName(fakeProcessDefinitions[0].name);
});
it('should wait for process definition to be loaded before showing the empty process definition message', () => {
component.processDefinitionLoaded = false;
fixture.detectChanges();
let noProcessElement = fixture.nativeElement.querySelector('#no-process-message');
expect(noProcessElement).toBeNull();
getDefinitionsSpy.and.returnValue(of([]));
component.loadProcessDefinitions();
fixture.detectChanges();
noProcessElement = fixture.nativeElement.querySelector('#no-process-message');
expect(noProcessElement).not.toBeNull();
});
});
});

View File

@@ -104,6 +104,7 @@ export class StartProcessCloudComponent implements OnChanges, OnInit, OnDestroy
disableStartButton: boolean = true;
protected onDestroy$ = new Subject<boolean>();
processDefinitionLoaded = false;
constructor(private startProcessCloudService: StartProcessCloudService,
private formBuilder: FormBuilder) {
@@ -233,7 +234,9 @@ export class StartProcessCloudComponent implements OnChanges, OnInit, OnDestroy
this.resetErrorMessage();
this.startProcessCloudService.getProcessDefinitions(this.appName)
.pipe(takeUntil(this.onDestroy$))
.pipe(
tap(() => this.processDefinitionLoaded = true),
takeUntil(this.onDestroy$))
.subscribe((processDefinitionRepresentations: ProcessDefinitionCloud[]) => {
this.processDefinitionList = processDefinitionRepresentations;
if (processDefinitionRepresentations.length === 1) {