Repository navigation
Closed
Labels
User InterfaceRelated to the frontend / User Interface
Milestone
Description
reimplement the existing "API forms" framework in react
### Tasks
- [x] Add framework for launching and rendering modal
- [x] Implement permission checks
- [x] Extract form data from API OPTIONS endpoint
- [x] Extract existing model data from API before rendering
- [x] Implement "string" input
- [x] Implement "number" input
- [x] Implement "select" (choice) input
- [x] Implement "date" input
- [x] Implement "API select" input
- [x] Implement "boolean" input
- [x] Allow icons to be added to fields
- [x] Validation based on metadata provided via API
- [x] Implement onChange callback
- [x] Handle form submission errors
- [x] Handle "processing" / "loading" states
- [x] Custom cancel / submit text
- [x] Handle initial value for related model fields
- [x] Implement custom render functions for related model fields
- [x] Handle "onSuccess" callback - redirect or reload, etc
- [x] Handle non-field errors
- [x] Handle file upload / image upload
- [ ] Implement "adjustFilters" callback for related model fields
- [ ] Allow form data to be passed separately to form (e.g. to "duplicate" and edit an existing item)
- [ ] Custom validation types (min / max / length / etc)
- [ ] Implement "datetime" input
- [ ] Handle different form upload modes (get / post / patch / delete)
- [ ] Implement "persistent" dialogs which remain after submission
- [ ] Handle creation of secondary modals
- [ ] allow "focus field" to be specified (or select first field)
- [ ] Support "groups" within each form
- [ ] Support "auto fill" for related fields with only one available item
- [ ] Make "footer" (buttons etc) stick to the bottom of the modal (no scroll) - https://github.com/orgs/mantinedev/discussions/1141
Metadata
Metadata
Assignees
Labels
User InterfaceRelated to the frontend / User Interface
Activity
wolflu05 commentedon Jul 27, 2023
I would like to extend this a bit:
SchrodingersGat commentedon Jul 27, 2023
wolflu05 commentedon Jul 27, 2023
Sub forms
They are an array of other form definitions that are rendered indented. Maybe also collapsable if they want to.
Generic Django Views
I tried to provide the idea a bit in #5295 . If I want to have a form defined from the backend I currently have no type hints and generic views to do so, I need to implement them again and again. I imagine having a View where I can define the form inputs somewhere in the class or via a getter and this view automatically handles advertisement via OPTIONS and calls a function like formSubmit. It should also handle api choices fields.
Dependent settings
This is for choices fields. Sometimes one choice field needs the value of other fields to calculate the choices. E.g. useful for providing the machine first and then conditionally get the specific machines printing form.
Array list
Just an input to provide a list. You start with one input, then there is a button + where you can add some inputs and each input has a delete button to remove it.
SchrodingersGat commentedon Jul 27, 2023
Use either a DRF serializer or Django model, and it will be taken care of for you. Check out metadata.py - this is where most of the magic happens. All of the current "front end" forms are constructed from that data.
SchrodingersGat commentedon Jul 27, 2023
Choice fields can specify a "choicesFunc" method, which gets us some of the way there. However your advanced usage probably comes after this PR is merged in (as a starting point)
wolflu05 commentedon Jul 27, 2023
I still think we need something generic with our own options. I don't think that DRF serializers have e.g. dependent options, sub forms, and also a lot of the stuff you Implement.
matmair commentedon Jul 27, 2023
If it touches the python API I wold probaly move it to another PR as we probably need to bump the API version
SchrodingersGat commentedon Jul 27, 2023
This issue (and linked PR) are only to re-implement functionality we already have in the "classic" UI
wolflu05 commentedon Sep 20, 2023
We could probably implement an icon picker like the emoji keyboard on phones / the glyphs keyboard from iOS and maybe I bit more dense.
github-actions commentedon Nov 20, 2023
This issue seems stale. Please react to show this is still important.
wolflu05 commentedon Nov 20, 2023
not stale
github-actions commentedon Jan 20, 2024
This issue seems stale. Please react to show this is still important.
SchrodingersGat commentedon Jan 20, 2024
Not stale, long running issue in progress
XanderLuciano commentedon Mar 13, 2024
Big +1 on this, the ability to click "submit" without having to scroll to the bottom is a killer advantage of the old UI vs. the new UI currently
Also, I know the old UI also handles "enter" as a modal form submission. This behavior also should be kept / added to the new UI.
This is a task I'm interested in submitting a PR for.
EDIT: Related Issue: https://github.com/orgs/mantinedev/discussions/1141
matmair commentedon May 7, 2024
@SchrodingersGat is this still open/relevant and are the action items on top all still valid?
SchrodingersGat commentedon May 7, 2024
This is sufficiently advanced that we can close it out. Nice work everyone :)