Revert "Made value not required property in Transformation Rule Node debug metadata"
This reverts commit 13a3605ced986a4bd9c8f562cee7b7407e6c8ec8.
This commit is contained in:
parent
9d033e6ecf
commit
2f73b16fa0
@ -25,7 +25,7 @@
|
|||||||
placeholder="{{ (keyPlaceholderText ? keyPlaceholderText : 'key-val.key') | translate }}"/>
|
placeholder="{{ (keyPlaceholderText ? keyPlaceholderText : 'key-val.key') | translate }}"/>
|
||||||
</mat-form-field>
|
</mat-form-field>
|
||||||
<mat-form-field class="mat-block flex-1" subscriptSizing="{{ subscriptSizing }}">
|
<mat-form-field class="mat-block flex-1" subscriptSizing="{{ subscriptSizing }}">
|
||||||
<input [formControl]="keyValControl.get('value')" matInput
|
<input [formControl]="keyValControl.get('value')" matInput required
|
||||||
placeholder="{{ (valuePlaceholderText ? valuePlaceholderText : 'key-val.value') | translate }}"/>
|
placeholder="{{ (valuePlaceholderText ? valuePlaceholderText : 'key-val.value') | translate }}"/>
|
||||||
</mat-form-field>
|
</mat-form-field>
|
||||||
<button mat-icon-button color="primary"
|
<button mat-icon-button color="primary"
|
||||||
|
|||||||
@ -20,12 +20,12 @@ import {
|
|||||||
ControlValueAccessor,
|
ControlValueAccessor,
|
||||||
UntypedFormArray,
|
UntypedFormArray,
|
||||||
UntypedFormBuilder,
|
UntypedFormBuilder,
|
||||||
|
UntypedFormControl,
|
||||||
UntypedFormGroup,
|
UntypedFormGroup,
|
||||||
NG_VALIDATORS,
|
NG_VALIDATORS,
|
||||||
NG_VALUE_ACCESSOR,
|
NG_VALUE_ACCESSOR,
|
||||||
Validator,
|
Validator,
|
||||||
Validators,
|
Validators
|
||||||
ValidationErrors
|
|
||||||
} from '@angular/forms';
|
} from '@angular/forms';
|
||||||
import { PageComponent } from '@shared/components/page.component';
|
import { PageComponent } from '@shared/components/page.component';
|
||||||
import { Store } from '@ngrx/store';
|
import { Store } from '@ngrx/store';
|
||||||
@ -118,7 +118,7 @@ export class KeyValMapComponent extends PageComponent implements ControlValueAcc
|
|||||||
if (Object.prototype.hasOwnProperty.call(keyValMap, property)) {
|
if (Object.prototype.hasOwnProperty.call(keyValMap, property)) {
|
||||||
keyValsControls.push(this.fb.group({
|
keyValsControls.push(this.fb.group({
|
||||||
key: [property, [Validators.required]],
|
key: [property, [Validators.required]],
|
||||||
value: [keyValMap[property]]
|
value: [keyValMap[property], [Validators.required]]
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -139,12 +139,24 @@ export class KeyValMapComponent extends PageComponent implements ControlValueAcc
|
|||||||
const keyValsFormArray = this.kvListFormGroup.get('keyVals') as UntypedFormArray;
|
const keyValsFormArray = this.kvListFormGroup.get('keyVals') as UntypedFormArray;
|
||||||
keyValsFormArray.push(this.fb.group({
|
keyValsFormArray.push(this.fb.group({
|
||||||
key: ['', [Validators.required]],
|
key: ['', [Validators.required]],
|
||||||
value: ['']
|
value: ['', [Validators.required]]
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
|
|
||||||
validate(): ValidationErrors | null {
|
public validate(c: UntypedFormControl) {
|
||||||
return this.kvListFormGroup.valid ? null : { invalid: true };
|
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,
|
||||||
|
},
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
private updateModel() {
|
private updateModel() {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user