Skip to content

Commit

Permalink
feat: send policy default values on init
Browse files Browse the repository at this point in the history
  • Loading branch information
Okhelifi committed Jul 2, 2024
1 parent b20ae66 commit 579d449
Showing 1 changed file with 16 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -88,12 +88,7 @@ export class GioPolicyStudioStepFormComponent implements OnChanges, OnInit, OnDe
});

this.stepForm.valueChanges.pipe(takeUntil(this.unsubscribe$)).subscribe(() => {
this.stepChange.emit({
...this.step,
description: this.stepForm?.get('description')?.value,
condition: this.stepForm?.get('condition')?.value ?? undefined,
configuration: this.stepForm?.get('configuration')?.value,
});
this.emitStepChange();
});

this.stepForm.statusChanges.pipe(takeUntil(this.unsubscribe$)).subscribe(valid => {
Expand All @@ -107,8 +102,21 @@ export class GioPolicyStudioStepFormComponent implements OnChanges, OnInit, OnDe

public onJsonSchemaReady(isReady: boolean) {
// When ready and if the form is valid, emit
if (isReady && this.stepForm?.status === 'VALID') {
this.isValid.emit(true);
if (isReady) {
this.emitStepChange();

if (this.stepForm?.status === 'VALID') {
this.isValid.emit(true);
}
}
}

public emitStepChange(): void {
this.stepChange.emit({
...this.step,
description: this.stepForm?.get('description')?.value,
condition: this.stepForm?.get('condition')?.value ?? undefined,
configuration: this.stepForm?.get('configuration')?.value,
});
}
}

0 comments on commit 579d449

Please sign in to comment.