Made value not required property in Transformation Rule Node debug metadata

This commit is contained in:
mpetrov 2024-11-07 15:00:31 +02:00
parent 26c22610a7
commit 13a3605ced
2 changed files with 7 additions and 19 deletions

View File

@ -25,7 +25,7 @@
placeholder="{{ (keyPlaceholderText ? keyPlaceholderText : 'key-val.key') | translate }}"/>
</mat-form-field>
<mat-form-field class="mat-block flex-1" subscriptSizing="{{ subscriptSizing }}">
<input [formControl]="keyValControl.get('value')" matInput required
<input [formControl]="keyValControl.get('value')" matInput
placeholder="{{ (valuePlaceholderText ? valuePlaceholderText : 'key-val.value') | translate }}"/>
</mat-form-field>
<button mat-icon-button color="primary"

View File

@ -20,12 +20,12 @@ import {
ControlValueAccessor,
UntypedFormArray,
UntypedFormBuilder,
UntypedFormControl,
UntypedFormGroup,
NG_VALIDATORS,
NG_VALUE_ACCESSOR,
Validator,
Validators
Validators,
ValidationErrors
} from '@angular/forms';
import { PageComponent } from '@shared/components/page.component';
import { Store } from '@ngrx/store';
@ -118,7 +118,7 @@ export class KeyValMapComponent extends PageComponent implements ControlValueAcc
if (Object.prototype.hasOwnProperty.call(keyValMap, property)) {
keyValsControls.push(this.fb.group({
key: [property, [Validators.required]],
value: [keyValMap[property], [Validators.required]]
value: [keyValMap[property]]
}));
}
}
@ -139,24 +139,12 @@ export class KeyValMapComponent extends PageComponent implements ControlValueAcc
const keyValsFormArray = this.kvListFormGroup.get('keyVals') as UntypedFormArray;
keyValsFormArray.push(this.fb.group({
key: ['', [Validators.required]],
value: ['', [Validators.required]]
value: ['']
}));
}
public validate(c: UntypedFormControl) {
const kvList: {key: string; value: string}[] = this.kvListFormGroup.get('keyVals').value;
let valid = true;
for (const entry of kvList) {
if (!entry.key || !entry.value) {
valid = false;
break;
}
}
return (valid) ? null : {
keyVals: {
valid: false,
},
};
validate(): ValidationErrors | null {
return this.kvListFormGroup.valid ? null : { invalid: true };
}
private updateModel() {