Edit taxonomy form
Closes https://github.com/ethyca/fides/issues/857, closes https://github.com/ethyca/fides/issues/855
Code Changes
- [x] Rename
DataCategoryTagcomponent toTaxonomyEntityTagand refactor it a little to share more code - [x] Hook up the AccordionTree edit button to trigger stuff
- [x] Also subtle design thing I didn't notice the first time around: when a field is being edited, it turns purple in the accordion tree
- [x] A few tweaks to the inputs in
inputs.tsx, one to include a disabled state, and one to add a grid option to the CustomTextArea component - [x] Add PUT call to each taxonomy slice
- [x] Add
EditTaxonomyFormcomponent for the edit form, reusable between each taxonomy type - [x] Remove all the individual taxonomy tab components in favor of a more generalized approach
- [x] I'm not sure if this pattern is the best, as it involves passing custom hooks as props, but it works well and keeps thing pretty clean. Open to other suggestions if it's weird though!
- [x]
hooks.tsfile for getting info about each type of taxonomy, including labels, queries, mutations, and in the future tooltips can go here too.
- [x] Cypress tests for editing a taxonomy form (for each type of taxonomy)
Steps to Confirm
- [ ]
nox -s dev - [ ] Navigate to
localhost:3000/taxonomy - [ ] Hover over one of the items and click "Edit"
- [ ] Fill out the form and click "Update"
Pre-Merge Checklist
- [x] All CI Pipelines Succeeded
- Documentation Updated:
- [ ] documentation complete, or draft/outline provided (tag docs-team to complete/review on this branch)
- [ ] documentation issue created (tag docs-team to complete issue separately)
- [x] Issue Requirements are Met
- [ ] Relevant Follow-Up Issues Created
- [x] Update
CHANGELOG.md
Description Of Changes
These taxonomy pages are all very similar but operate on slightly different data. However, they all have a few fields in common, which are the ones that are editable. This means we can mostly use the same component and pull out the parts that are unique:
- Copy (i.e. "Modify data categories" vs. "Modify data subjects")
- Tooltips (TODO, as there's no tooltip copy yet)
- Endpoint calls (i.e.
/api/v1/data_categoryvs/api/v1/data_subject)
The pattern I went for was that EditTaxonomyForm.tsx and TaxonomyTabContent.tsx stay agnostic of which taxonomy field they are operating on. Instead, custom hooks pull in all of the unique parts into an object with properties that are the same across the taxonomies. When the tabs are being created, we pass in each custom hook as a prop, and then everything renders nicely.
An alternative which seems more natural would be to call each hook and then pass its data into each TaxonomyTabContent.tsx, but this would remove the lazy loading the tabs provide us (only loading the data when a tab is clicked on).
https://user-images.githubusercontent.com/24641006/184692153-6634cf85-323e-43c9-ae69-a41b4699b230.mov
Not sure what's going on with the pytest external test 😕
@allisonking good news, the test is passing again! bad news....the merge conflicts 🙃
@allisonking do we need a follow-up issue for the tooltips TODO?