Skip to content

Commit

Permalink
Merge pull request #360 from bento-platform/fix/edit-dats-form
Browse files Browse the repository at this point in the history
fix: stringify dats_file json in dataset edit form
  • Loading branch information
v-rocheleau authored Feb 2, 2024
2 parents 47d1253 + 687ae26 commit 729f592
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/components/datasets/DatasetForm.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,11 @@ const DatasetForm = ({ style, initialValue, form }) => {
})(<Input.TextArea placeholder={"Name\[email protected]"} />)}
</Item>
<Item label="DATS File">
{/* TODO: add dats from drop-box. Prettier JSON free form input?*/}
{form.getFieldDecorator("dats_file", {
initialValue: initialValue?.dats_file || "",
initialValue: initialValue?.dats_file
? JSON.stringify(initialValue.dats_file, null, 2)
: "",
rules: [{ required: true }, { validator: validateJson }, { min: 2 }],
})(<Input.TextArea />)}
</Item>
Expand Down Expand Up @@ -75,7 +78,7 @@ DatasetForm.propTypes = {
description: PropTypes.string,
contact_info: PropTypes.string,
data_use: DATA_USE_PROP_TYPE_SHAPE, // TODO: Shared shape for data use
dats_file: PropTypes.string,
dats_file: PropTypes.object,
}),
};

Expand Down

0 comments on commit 729f592

Please sign in to comment.