Skip to content

Conversation

@longshuicy
Copy link
Member

@longshuicy longshuicy commented Jul 27, 2022

Post definition with supported field widget name will now automatically populate the frontend to construct such form.
Supported widgetType includes Select, TextField, DateTimePicker. If not supported widgetType was provided, the frontend fallback is TextField

e.g.

{
    "name" : "Unit",
    "description" : "Unit",
    "context" : {
        "doi" : "https://schema.org/QuantitativeValue"
    },
    "fields" : [
        {
            "name" : "unit",
            "list" : false,
            "widgetType": "Select",
            "config": {
                 "type" : "enum",
                 "options": ["Ampere", "Kelvin", "Second"]
            },
            "required" : true
        }
    ]
}

More examples see backend/data/metadata/definitions folder

image

@longshuicy longshuicy changed the title WIP: 54 add widget type field and break the current widget into smaller components 54 add widget type field and break the current widget into smaller components Aug 11, 2022
@longshuicy
Copy link
Member Author

Ready to be reviewed

@longshuicy longshuicy marked this pull request as ready for review August 11, 2022 21:22
@tcnichol
Copy link
Contributor

tcnichol commented Aug 23, 2022

Question, I was testing this with a file trying to add metadata of each type. For coordinates, I notice that if I try to input this:
Screen Shot 2022-08-23 at 3 42 31 PM

it ends up like this:

Screen Shot 2022-08-23 at 3 42 37 PM

am i using that metadata field wrong? I made sure that I had the most recent one from /data/metadata in my db.

@longshuicy
Copy link
Member Author

Question, I was testing this with a file trying to add metadata of each type. For coordinates, I notice that if I try to input this: Screen Shot 2022-08-23 at 3 42 31 PM

it ends up like this:

Screen Shot 2022-08-23 at 3 42 37 PM

am i using that metadata field wrong? I made sure that I had the most recent one from /data/metadata in my db.

might be related to this specific field is a list of tuples; the backend might not parse it correctly... let me investigate a bit

@longshuicy
Copy link
Member Author

Question, I was testing this with a file trying to add metadata of each type. For coordinates, I notice that if I try to input this: Screen Shot 2022-08-23 at 3 42 31 PM
it ends up like this:
Screen Shot 2022-08-23 at 3 42 37 PM
am i using that metadata field wrong? I made sure that I had the most recent one from /data/metadata in my db.

might be related to this specific field is a list of tuples; the backend might not parse it correctly... let me investigate a bit

I realize this need to have a dynamic input widgets on the frontend; might not worth the effort for now since it's just a demonstration.

"required" : true
}
]
} No newline at end of file
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's not test this for now. This needs to work with an interactive map widget

Copy link
Contributor

@max-zilla max-zilla left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Read through the changes and tested on a fresh database by adding the definitions in data/metadata (except coordinates) and going through each one in a new dataset adding+editing, it all looked good.

@max-zilla
Copy link
Contributor

max-zilla commented Sep 7, 2022

resolved small merge conflict on .gitignore

@lmarini lmarini requested a review from arunapa September 9, 2022 21:11
@lmarini lmarini merged commit 491089a into main Sep 14, 2022
@lmarini lmarini deleted the 54-add-widget-type-field-and-break-the-current-widget-into-smaller-components branch September 14, 2022 14:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

add widget type field and break the current widget into smaller components

5 participants