[ACA-3235] FE - Should not include invisible fields in payload on Start/Save adf-form. (#5681)

* [ACA-3235] FE - Should not include invisible fields in payload on Start/Save adf-form.

* * Added unit test to the recent changes
This commit is contained in:
siva kumar
2020-05-13 14:56:12 +05:30
committed by GitHub
parent 78a91f9424
commit 6da489a7ff
5 changed files with 581 additions and 1 deletions

View File

@@ -20,7 +20,7 @@ import { LogService } from '../../services/log.service';
import { Injectable } from '@angular/core';
import moment from 'moment-es6';
import { Observable, from, throwError } from 'rxjs';
import { FormFieldModel, FormModel, TabModel, ContainerModel } from '../components/widgets/core/index';
import { FormFieldModel, FormModel, TabModel, ContainerModel, FormFieldTypes } from '../components/widgets/core/index';
import { TaskProcessVariableModel } from '../models/task-process-variable.model';
import { WidgetVisibilityModel, WidgetTypeEnum } from '../models/widget-visibility.model';
import { map, catchError } from 'rxjs/operators';
@@ -323,6 +323,22 @@ export class WidgetVisibilityService {
return res || {};
}
removeInvisibleFormValues(formModel: FormModel) {
if (formModel) {
formModel.getFormFields().map((field: FormFieldModel) => {
if (field.type !== FormFieldTypes.CONTAINER) {
if (!field.isVisible) {
delete formModel.values[field.id];
} else {
field.updateForm();
}
}
return field;
});
}
return formModel;
}
private isValidOperator(operator: string): boolean {
return operator !== undefined;
}