Browse Source

refactoring

pull/12976/head
mpetrov 2 years ago
parent
commit
47232a629b
  1. 19
      ui-ngx/src/app/modules/home/components/calculated-fields/calculated-fields-table-config.ts

19
ui-ngx/src/app/modules/home/components/calculated-fields/calculated-fields-table-config.ts

@ -263,18 +263,17 @@ export class CalculatedFieldsTableConfig extends EntityTableConfig<CalculatedFie
} }
private updateImportedCalculatedField(calculatedField: CalculatedField): CalculatedField { private updateImportedCalculatedField(calculatedField: CalculatedField): CalculatedField {
const updatedArguments = Object.keys(calculatedField.configuration.arguments).reduce((acc, key) => {
const arg = calculatedField.configuration.arguments[key];
acc[key] = arg.refEntityId?.entityType === ArgumentEntityType.Tenant
? { ...arg, refEntityId: { id: this.tenantId, entityType: ArgumentEntityType.Tenant } }
: arg;
return acc;
}, {});
return { return {
...calculatedField, ...calculatedField,
configuration: { configuration: { ...calculatedField.configuration, arguments: updatedArguments }
...calculatedField.configuration,
arguments: Object.keys(calculatedField.configuration.arguments).reduce((acc, key) => {
const arg = calculatedField.configuration.arguments[key];
acc[key] = arg.refEntityId?.entityType === ArgumentEntityType.Tenant
? { ...arg, refEntityId: { id: this.tenantId, entityType: ArgumentEntityType.Tenant } }
: arg;
return acc;
}, {})
}
} }
} }

Loading…
Cancel
Save