Skip to content

Commit

Permalink
fix(ui): connect: transforms json is not displaying at edit panel (#377)
Browse files Browse the repository at this point in the history
close #364
  • Loading branch information
polarising-java authored Aug 28, 2020
1 parent 20eb5fd commit 8c908c9
Showing 1 changed file with 12 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ class ConnectConfigs extends Form {
formData[definition.name] = this.getConfigValue(definition.name);
this.schema[definition.name] = this.handleDefinition(definition);
if (definition.name === 'transforms') {
formData['transformsprops'] = '{}';
formData['transformsprops'] = this.getTransformAdditionalProperties() || '{}';
this.schema['transformsprops'] = Joi.object().required();
}
});
Expand All @@ -87,6 +87,17 @@ class ConnectConfigs extends Form {
return existingConfig ? configs[existingConfig] : '';
};

getTransformAdditionalProperties() {
const { configs } = this.state;
const filtered = Object.keys(configs).filter(configKey => configKey.startsWith('transforms.'))
.reduce((obj, configKey) => {
obj[configKey] = configs[configKey];
return obj;
}, {});
return JSON.stringify(filtered, null, 2);
};


handleDefinition = definition => {
let def = '';
if (definition.required) {
Expand Down

0 comments on commit 8c908c9

Please sign in to comment.