metadata updates are now sent to the server, but the format is still wrong

This commit is contained in:
Art Lowel
2019-12-10 18:30:19 +01:00
parent b705e4a0f6
commit 4cdb1370e2
7 changed files with 29 additions and 7 deletions

View File

@@ -228,7 +228,7 @@ export class FormBuilderService extends DynamicFormService {
}
hasArrayGroupValue(model: DynamicFormControlModel): boolean {
return model && (this.isListGroup(model) || model.type === DYNAMIC_FORM_CONTROL_TYPE_TAG);
return model && (this.isListGroup(model) || model.type === DYNAMIC_FORM_CONTROL_TYPE_TAG || model.type === DYNAMIC_FORM_CONTROL_TYPE_ARRAY);
}
hasMappedGroupValue(model: DynamicFormControlModel): boolean {
@@ -285,11 +285,16 @@ export class FormBuilderService extends DynamicFormService {
return isNotEmpty(fieldModel) ? formGroup.get(this.getPath(fieldModel)) : null;
}
/**
* Note (discovered while debugging) this is not the ID as used in the form,
* but the first part of the path needed in a patch operation:
* e.g. add foo/0 -> the id is 'foo'
*/
getId(model: DynamicPathable): string {
let tempModel: DynamicFormControlModel;
if (this.isArrayGroup(model as DynamicFormControlModel)) {
return model.index.toString();
return hasValue((model as any).metadataKey) ? (model as any).metadataKey : model.index.toString();
} else if (this.isModelInCustomGroup(model as DynamicFormControlModel)) {
tempModel = (model as any).parent;
} else {