Skip to content
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

Epic: React GridField #463

Closed
12 tasks
tractorcow opened this issue Mar 13, 2018 · 8 comments
Closed
12 tasks

Epic: React GridField #463

tractorcow opened this issue Mar 13, 2018 · 8 comments
Labels

Comments

@tractorcow
Copy link
Contributor

tractorcow commented Mar 13, 2018

Placeholder for the list of stories to be written for GridField in react.

GridField core

GridField components:

  • GridField delete component
  • GridField publish component
  • GridField search component
  • GridField pagination component
  • GridField order component (may be a part of core gridfield and not component maybe?)

Note: You'll need the zenhub.com browser extension to see the storycards in this epic

Related

@chillu
Copy link
Member

chillu commented Mar 13, 2018

Just getting my head around what customisation a GridField would need to support. I think there's two types: Built-in customisations, and third-party customisations. I suspect we can get a lot of mileage by just making the built-ins work well, but we need to at least have an architecture for the level of flexibility required for third-party customisations.

Use cases:

  • Cell casting (e.g. dates, currencies)
  • Cell formatting (e.g. breadcrumbs, truncation, thumbnails, strikethrough for deleted records)
  • Add columns (e.g. checkboxes for batch select, select additional columns)
  • Row presentation (e.g. view as thumbnail grid, grouping, summary rows)
  • Row and cell behaviour (e.g. inline form fields, expandable inline edit form, drag-to-reorder, conditional selection of items)
  • Row action behaviour (e.g. confirmation dialog on actions, conditional detail edit form links)
  • New actions above/below table (e.g. export button, batch action dropdown, custom "add new" selector)
  • Header/footer presentation (e.g. add subtitle, change pagination summary)
  • Modify GraphQL query (e.g. inline search, change sort order, pagination)
  • Modify data loading behaviour (e.g. replace pagination with infinite scrolling)
  • Modify layout (e.g. move pagination bar to top)

Some notable existing third party customisations:

@chillu
Copy link
Member

chillu commented Mar 13, 2018

A few design goals from my perspective:

  • GridField relies on GraphQL for data. This means every DataObject managed through the CMS needs to be exposed via GraphQL.
  • Simpler data transformation should default to injected JavaScript logic (e.g. showing linked breadcrumbs in a cell)
  • Complex data transformation should use GraphQL resolvers (e.g. count number of published child pages)
  • GridField PHP code produces a declarative form schema, and defers any data handling to JavaScript.
  • GridField presentation can be customised through declarative components
  • Writing custom GridField components requires JavaScript compilation
  • Most GridField customisations (e.g. field casting) do not require JavaScript compilation
  • GridField data handling can be customised through injected GraphQL query modifications and injected Redux state modifications

Assumptions:

  • It is not feasible for a React GridField PHP API to be fully backwards compatible with the current GridField, but we'll try to keep upgrade pains minimal
  • GraphQL endpoints are fast enough to improve the overall CMS UX, even when managing 50+ types (see Cache GraphQL Schema issue)
  • A React GridField will completely replace the current PHP GridField, there is no "compatibility mode" once we switch to fully React-powered forms

Current data handling requirements in GridField (by using the SilverStripe ORM):

  • Filter by DataObject fields
  • Manage relationship (has_many, many_many)
  • Select fields on joined tables
  • View fields from custom DataObject getters
  • Aggregate fields on joined tables
  • Filter by fields on joined tables
  • Filter by callback
  • Compose filters as nested conditionals
  • View custom SS_List collection of DataObject
  • View custom SS_List collection of ViewableData
  • Enforce permissions

I think solving the DataList vs. GraphQL vs. GridField architecture is actually more important than how we represent components in the form schema, and what APIs we provide to build and customise these (lots of this has already been solved by the likes of Griddle).

@chillu
Copy link
Member

chillu commented Jun 10, 2018

Damian has started a PoC: https://github.com/tractorcow/react-gridfield

@madmatt
Copy link
Member

madmatt commented Sep 19, 2018

Has there been work done looking at existing React data table implementations? There seems to be quite a few out there already, some with tons of functionality...

They might be challenging to implement in the CMS though...

@sunnysideup
Copy link

Please make sure to also make it look good so that people will actually feel great about using it.

@patricknelson
Copy link
Contributor

Documenting here, for search purposes (for those without Zenhub extension*), that this also impacts SilverStripe's use of entwine, which is on the roadmap for removal per #411 (comment). If another ticket is ever created on Github to track the removal of entwine at all, I'd love to know (please note that in this thread)!

* Note: I didn't install the extension considering the privacy concerns, so I'm not sure what details are contained therein.

@ScopeyNZ
Copy link
Contributor

ScopeyNZ commented Dec 10, 2019

Just want to note also that although entwine is set for removal, you are still welcome to create modules that include and use entwine. Using entwine on the CMS interface after its removal will be very hacky though - the interface should be entirely React driven.

Also, the timeframe is very long on this removal 😅

@chillu chillu changed the title React GridField (epic) Epic: React GridField Dec 14, 2020
@maxime-rainville
Copy link
Contributor

Yeah. That's not happening anytime soon.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

7 participants