reference type editor bug fix

This commit is contained in:
Efstratios Giannopoulos 2024-04-17 17:41:15 +03:00
parent c28c700eff
commit aaac7dfdf4
1 changed files with 18 additions and 8 deletions

View File

@ -1,4 +1,4 @@
import { Component, Input, OnInit } from '@angular/core'; import { Component, Input, OnChanges, OnInit, SimpleChanges } from '@angular/core';
import { FormArray, UntypedFormGroup } from '@angular/forms'; import { FormArray, UntypedFormGroup } from '@angular/forms';
import { ExternalFetcherApiHTTPMethodType } from '@app/core/common/enum/external-fetcher-api-http-method-type'; import { ExternalFetcherApiHTTPMethodType } from '@app/core/common/enum/external-fetcher-api-http-method-type';
import { ExternalFetcherSourceType } from '@app/core/common/enum/external-fetcher-source-type'; import { ExternalFetcherSourceType } from '@app/core/common/enum/external-fetcher-source-type';
@ -14,7 +14,7 @@ import { Guid } from '@common/types/guid';
templateUrl: 'external-fetcher-source.component.html', templateUrl: 'external-fetcher-source.component.html',
styleUrls: ['./external-fetcher-source.component.scss'] styleUrls: ['./external-fetcher-source.component.scss']
}) })
export class ExternalFetcherSourceComponent extends BaseComponent implements OnInit { export class ExternalFetcherSourceComponent extends BaseComponent implements OnInit, OnChanges {
@Input() formGroup: UntypedFormGroup = null; @Input() formGroup: UntypedFormGroup = null;
@Input() fieldsForm: any; @Input() fieldsForm: any;
@ -38,6 +38,16 @@ export class ExternalFetcherSourceComponent extends BaseComponent implements OnI
if (this.referenceTypeSourceIndex != null && (this.formGroup.get('items') as FormArray).length == 0) this.addStaticItem(); if (this.referenceTypeSourceIndex != null && (this.formGroup.get('items') as FormArray).length == 0) this.addStaticItem();
} }
ngOnChanges(changes: SimpleChanges) {
if (changes['referenceTypes'] || changes['formGroup']) {
if (this.referenceTypes != null && this.referenceTypes.length > 0) {
const referenceTypeDependencyIds: Guid[] = this.formGroup.get('referenceTypeDependencyIds')?.value;
if (referenceTypeDependencyIds && referenceTypeDependencyIds.length > 0 && this.referenceTypeSourceIndex != null) this.setReferenceTypeDependenciesMap(referenceTypeDependencyIds, this.referenceTypeSourceIndex);
}
}
}
private reApplyValidators(){ private reApplyValidators(){
ExternalFetcherBaseSourceConfigurationEditorModel.reapplyValidators( ExternalFetcherBaseSourceConfigurationEditorModel.reapplyValidators(
{ {