CentreForDigitalHumanities / CentreForDigitalHumanities/readit-interface
Use FlatItem as a universal payload currency between views
- Dominant language
- TypeScript
- Stars
- 1
- Forks
- 0
- PR merge metrics
- No merged PRs in 30d
Description
Our `Node` model class is general enough to represent any RDF resource. It is, however, rather inconvenient for direct usage in views, especially when relations need to be traversed. I created `FlatItem` as an adapter to address this, and as of #366, it is flexible enough that you can throw anything from our own `/item` graph into it. It understands the Web Annotations data model as well as our own conventions around it and it collects linked data automatically. It can also be used for feature detection; for example, if a flat item has an `item` attribute but no `annotation`, you know that it must be a bare item in the narrow sense (instance of an ontology class). Furthermore, its counterpart `FlatItemCollection` can keep track of focus, which is currently used in `AnnotationListPanel` but not in `RelatedItemsPanel` (where focus tracking is currently buggy).
For consistency and convenience, hence general maintainability, I think we should use `FlatItem` wherever this is at least as convenient as using a bare `Node`. Would you agree, @BeritJanssen and @JeltevanBoheemen?
We could address this gradually in an on-off fashion similar to #230. Below is a list of views of which I'm reasonably sure that converting to `FlatItem` would be an improvement; there might be others. For some views with less-obvious locations, I've added the current location in parentheses; these might change in the future due to #290.
- [ ] `BasePicker` and `RangePicker` (`frontend/src/forms`)
- [ ] `ExternalResourcesPanel`
- [x] `LdItemEditPanel`
- [ ] `RelatedItemsPanel` (this one is a bit complicated and might require substantial changes, see also #228)
- [x] `ItemSummaryBlock` (`frontend/src/utilities`, currently `Node`/`FlatItem` hybrid)
- [x] `Label` (`frontend/src/utilities`)
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.