[codex] Add locality relation entry history#1194
Merged
Merged
Conversation
4c8ec49 to
e9e8722
Compare
Contributor
There was a problem hiding this comment.
Pull request overview
This PR extends the existing field-level update history UI to support entry-level history for relation/list rows (e.g., locality sedimentary structure, collecting method, museum/project links, locality synonyms, and species synonyms) by reusing the existing popover pattern and adding a read-mode row actions slot to detail tables.
Changes:
- Refactors
FieldUpdateHistoryinto a reusable popover and addsEntryUpdateHistorythat can match relation-entry update logs (includingpk_datamatching). - Adds
renderReadRowActionssupport toEditableTableso read-mode tables can show per-row actions (history icon, etc.). - Integrates entry-history actions into multiple Locality and Species relation tabs and adds targeted frontend tests for matching and click propagation.
Reviewed changes
Copilot reviewed 9 out of 9 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| frontend/src/components/DetailView/common/FieldUpdateHistory.tsx | Refactors history popover and adds entry-level history matching (including pk_data support). |
| frontend/src/components/DetailView/common/EditableTable.tsx | Adds a read-mode row action slot and ensures row actions can coexist with row navigation. |
| frontend/src/components/Locality/Tabs/LithologyTab.tsx | Adds entry-history row action for sedimentary structure rows. |
| frontend/src/components/Locality/Tabs/TaphonomyTab.tsx | Adds entry-history row action for collecting method rows. |
| frontend/src/components/Locality/Tabs/MuseumTab.tsx | Adds entry-history row action for museum relation rows. |
| frontend/src/components/Locality/Tabs/ProjectTab.tsx | Adds entry-history row action for project relation rows. |
| frontend/src/components/Locality/Tabs/LocalityTab.tsx | Adds entry-history row action for locality synonym rows. |
| frontend/src/components/Species/Tabs/SynonymTab.tsx | Adds entry-history row action for species synonym rows. |
| frontend/src/tests/components/DetailView/FieldUpdateHistory.test.tsx | Adds focused tests for entry-history matching and row-click propagation behavior. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+90
to
+104
| const encodedPkSegment = getEncodedPkSegment(rowValue) | ||
|
|
||
| return collectUpdateContainers(data).flatMap(container => | ||
| container.updates | ||
| .filter(log => { | ||
| if (log.table_name !== tableName) return false | ||
|
|
||
| const pkData = getPkData(log) | ||
| const pkDataMatches = encodedPkSegment && typeof pkData === 'string' ? pkData.includes(encodedPkSegment) : false | ||
| if (pkDataMatches) return true | ||
|
|
||
| if (columnName && log.column_name !== columnName) return false | ||
|
|
||
| return valuesMatch(log.new_data, rowValue) || valuesMatch(log.old_data, rowValue) | ||
| }) |
Comment on lines
+298
to
+306
| return ( | ||
| <UpdateHistoryPopover | ||
| idPrefix={[tableName, columnName, formatValue(rowValue)].filter(Boolean).join('-')} | ||
| title={`${label} entry history`} | ||
| tooltip={`Show entry history for ${label}`} | ||
| ariaLabel={`Show entry history for ${label}`} | ||
| updates={updates} | ||
| onOpen={handleOpen} | ||
| /> |
Comment on lines
31
to
+34
| isObject(value) && 'column_name' in value && 'log_action' in value | ||
|
|
||
| const getPkData = (log: UpdateLog) => (log as unknown as { pk_data?: unknown }).pk_data | ||
|
|
Comment on lines
134
to
141
| const restrictionIndicator = ({ row }: { row: MRT_Row<T> }) => { | ||
| if (!checkRowRestriction || !checkRowRestriction(row.original)) return null | ||
|
|
||
| return ( | ||
| <Tooltip placement="top" title="This item has restricted visibility"> | ||
| <PolicyIcon aria-label="Restricted visibility indicator" color="primary" fontSize="medium" /> | ||
| </Tooltip> | ||
| ) |
e9e8722 to
146aeeb
Compare
Collaborator
Author
|
Addressed Copilot's feedback in
Validation rerun:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
pk_datawhen available so the popover can show all update rows for the entry, not only the identifier column.Root Cause / Context
Locality and species relation rows already have update log data in their detail update containers, but read-mode relation tables had no row-level affordance for surfacing entry add/remove/update logs. Field-level history from #1183 did not cover relation/list entries.
Occurrence rows (
now_ls) are intentionally left for the separate occurrence-history work because they need richer locality/species update matching than these direct relation rows.Validation
cd frontend && npm test -- --runTestsByPath src/tests/components/DetailView/FieldUpdateHistory.test.tsx --runInBandnpm run lint:frontendnpm run tsc:frontendnpm run lintand rootnpm run tscsuccessfully after the expanded scope.Closes #1191