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

Paging for TCF overlay #4463

Merged
merged 12 commits into from
Dec 1, 2023
Merged

Paging for TCF overlay #4463

merged 12 commits into from
Dec 1, 2023

Conversation

allisonking
Copy link
Contributor

@allisonking allisonking commented Nov 27, 2023

Closes https://ethyca.atlassian.net/browse/PROD-1369

Description Of Changes

https://www.loom.com/share/c568d4b4a975487195b1124eb23d4aec?sid=2512d35a-7672-406b-932d-7d2066257fe5

Code Changes

  • Add hook usePaging for easy paging logic across components
  • Unit test for helper method chunkItems
  • Add paging to embedded vendor sections of Purposes and Features
  • Add paging to Vendors section
  • Make vendor info banner more responsive when there are large numbers so we aren't overflowing
  • Cypress tests

Steps to Confirm

  • Run fidesplus + admin-ui and add all compass systems via bulk add
  • Start up the privacy center via turbo dev
  • Visit http://localhost:3000/fides-js-demo.html?geolocation=fr-id
  • Change your screen size so you can see the vendor info banner responding
  • Open up the modal and click into Purposes or Features and page through the embedded vendors
  • Page through the Vendor tab

Pre-Merge Checklist

  • All CI Pipelines Succeeded
  • Issue Requirements are Met
  • Update CHANGELOG.md

Copy link

vercel bot commented Nov 27, 2023

The latest updates on your projects. Learn more about Vercel for Git ↗︎

1 Ignored Deployment
Name Status Preview Comments Updated (UTC)
fides-plus-nightly ⬜️ Ignored (Inspect) Visit Preview Dec 1, 2023 8:02pm

Copy link

cypress bot commented Nov 27, 2023

Passing run #5442 ↗︎

0 4 0 0 Flakiness 0

Details:

Merge f752856 into 19ff5fc...
Project: fides Commit: 4f17d0487f ℹ️
Status: Passed Duration: 00:34 💡
Started: Dec 1, 2023 8:12 PM Ended: Dec 1, 2023 8:13 PM

Review all test suite changes for PR #4463 ↗︎

@@ -129,6 +118,8 @@ const TcfPurposes = ({
onChange({ newEnabledIds, modelType: activeData.purposeModelType })
}
renderToggleChild={(purpose) => <PurposeDetails purpose={purpose} />}
// This key forces a rerender when legal basis changes, which allows paging to reset properly
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oh very cool!

const declarations: GvlDataDeclarations | undefined =
// @ts-ignore this type doesn't exist in v2.2 but does in v3
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

unrelated to this PR, but moved the ts-ignore down since it's this line that needs it

@@ -226,34 +281,18 @@ const TcfVendors = ({
const [activeLegalBasisOption, setActiveLegalBasisOption] = useState(
LEGAL_BASIS_OPTIONS[0]
);
const activeData: {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is mostly moving the contents of the vendor data to a child component. This allows us to think of the toggles ("consent" vs "legitimate interest") as top level filters, which inform what data gets shown in the child component. We need either the legal basis filter or paging to be top level (we page through by legal basis)

.map((_, i) => `ctl_${i}`);
const VENDOR_IDS = [...GVL_IDS, ...SYSTEM_IDS];

beforeEach(() => {
Copy link
Contributor Author

@allisonking allisonking Nov 30, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this beforeEach is large in order to get us set up with a lot of vendors in all the right places. but it means the tests that follow are more readable!

@allisonking allisonking marked this pull request as ready for review November 30, 2023 15:48
@adamsachs
Copy link
Contributor

adamsachs commented Nov 30, 2023

UAT tested and looking really good functionally. went thru all the AC from the jira ticket and ensured things looked good locally after adding all 1k+ vendors from compass. screenshot below shows the paging on the "vendors" tab, but other tabs were also checked. everything was snappy on the FE (the BE did take a while to provide the overlay contents, but that's expected and will be mitigated by caching and other future performance improvements) 👍

update: the one piece of this that's still not working is saving consent preferences in this state of 1k+ systems/vendors. That has nothing to do with the paging functionality or with the changes in this PR specifically. it's a BE issue that is captured in https://ethyca.atlassian.net/browse/PROD-1472. it was just surfaced when UAT testing this feature.

image

Copy link
Contributor

@eastandwestwind eastandwestwind left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great work on this @allisonking ! I like how you've component-ized the PagingButtons so that we can use this in other places in the future too 🚀


// Add lots of vendors so that we can page
VENDOR_IDS.forEach((id, idx) => {
const { record, relationship, embedded } = mockTcfVendorObjects({
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ohhh this is awesome, thanks for adding this comprehensive testing!

* 2. `relationship`: a filled out TCFVendorRelationships object
* 3. `embedded`: an EmbeddedVendor object which goes inside Purposes and Features
*/
export const mockTcfVendorObjects = (
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🌟

@allisonking
Copy link
Contributor Author

Updated vendor label stacking (context):

Screen.Recording.2023-12-01.at.2.57.22.PM.mov

@allisonking allisonking merged commit 6ebfb5d into main Dec 1, 2023
@allisonking allisonking deleted the aking/prod-1369/tcf-paging branch December 1, 2023 20:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants