Migrate to cubicwebjs
This MR contains most of the work and experiments carried on react-admin for CubicWeb. There is still some work needed before merge.
I created this MR to have early review on the code.
What has been done
- Migrate the old codebase to the new cubicwebjs api. We are now using the Schema abstraction class to interact with CubicWeb's schema. React Admin's dataProvider has been ported to the new api.
- Validate attributes. Attribute constraints are now exposed in the schema and react-admin input validators are generated from those. The regular expression constraint is not supported yet as the syntax slightly differs from the python backend to JavaScript. We rely on backend validation on form submit for now.
-
Create a custom
ReferenceInput
to edit CubicWeb's relations. As CubicWeb has very complex relations the default component was not satisfying. This new component provides the following features:- Selecting new elements from a list. This list is fully functional and has support for filters, pagination, searching, ... This uses the same component as the main list views.
- Creating new elements. Using a nested form the user can create new elements for the relation. This allows creating elements linked by a composition relation. Right now only one nested form has been tested, but the dataProvider could potentially support more nesting levels. More testing needed.
-
Create a custom
ReferenceArrayInput
. Similar to the customReferenceInput
component described above, this new component allows users to select and create new elements in relation accepting multiple elements (cardinality+
and*
). -
Migrate from react-admin v3 to v4. As this new version is due very soon, we felt it was the right choice to migrate while
ra-cubicweb
is still a work in progress. - Handle basic errors. Thanks to the backend now exposing error, we are now able to display to the user a popup with the error message.
- Unit testing. Basic unit tests were written to ensure the most critical functions were working as intended.
The rest of the work will be done in separate MRs.
Edited by Arnaud Vergnet