-
Notifications
You must be signed in to change notification settings - Fork 29
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
forms: improve diversity of fields #154
forms: improve diversity of fields #154
Conversation
8a9289f
to
89fb4fe
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you please fix the linter warnings?
invenio_administration/assets/semantic-ui/js/invenio_administration/src/formik/AdminForm.js
Show resolved
Hide resolved
..._administration/assets/semantic-ui/js/invenio_administration/src/components/DateFormatter.js
Show resolved
Hide resolved
invenio_administration/assets/semantic-ui/js/invenio_administration/src/formik/AdminForm.js
Outdated
Show resolved
Hide resolved
invenio_administration/assets/semantic-ui/js/invenio_administration/src/formik/AdminForm.js
Outdated
Show resolved
Hide resolved
invenio_administration/assets/semantic-ui/js/invenio_administration/src/formik/GenerateForm.js
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Left very minor comments, good job :)
* display empty value if field is None * add possibility to prefill fields with default value * add possibility to specify the width of table column (search view) * add render of checkbox, dropdown and textarea fields * closes inveniosoftware/invenio-banners#10
89fb4fe
to
145d578
Compare
{columns.map(([property, { text, order, width }], index) => { | ||
if (!width) { | ||
width = index === 0 ? undefined : index === 1 ? 4 : 3; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
Maybe in the future we need to find alternative methods to display the grid, as I had to do a custom back-end bound solution in the pages administration panel for it to look nice.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM! Just left one minor comment
options: formFieldConfig?.options || fieldSchema?.metadata?.options, | ||
rows: formFieldConfig?.rows || fieldSchema?.metadata?.rows, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
options: formFieldConfig?.options || fieldSchema?.metadata?.options, | |
rows: formFieldConfig?.rows || fieldSchema?.metadata?.rows, | |
options: formFieldConfig?.options, | |
rows: formFieldConfig?.rows, |
Minor: If I am not wrong the fieldSchema
is a json representation of the marshmallow schema, this will never have options and rows attributes, unless I am missing something.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You're totally right, marshmallow schema doesn't have rows and options, but it has metadata, to which we can
put anything we want. See here: https://github.com/inveniosoftware/invenio-banners/pull/15/files#diff-97da9b93fd82ecb3e421f77c8f0d82f16edeba13ed1b154cdc44572be3c37a3dR25
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah I see, was confused by the naming, we use metadata
as well for the record's metadata, but I don't have better alternatives, thanks for clarifying!
@@ -25,8 +25,11 @@ export const SearchResultsContainer = ({ | |||
<Table> | |||
<Table.Header> | |||
<Table.Row> | |||
{columns.map(([property, { text, order }], index) => { | |||
const width = index === 0 ? undefined : index === 1 ? 4 : 3; | |||
{columns.map(([property, { text, order, width }], index) => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Previews:
2.1 Render checkbox (Active) and dropdown (Category) fields.
2.2 Message field - text area
2.3 Prefill Start DateTime with default value (utcnow) and Active with True