Skip to content

Commit c487c32

Browse files
authored
Action center: Categories of consent cell (#5737)
1 parent a42c0ff commit c487c32

File tree

7 files changed

+63
-14
lines changed

7 files changed

+63
-14
lines changed

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,9 @@ Changes can also be flagged with a GitHub label for tracking purposes. The URL o
2121

2222
## [Unreleased](https://github.com/ethyca/fides/compare/2.54.0...main)
2323

24+
### Added
25+
- Added a read-only consent category cell to Action Center aggregate system results table [#5737](https://github.com/ethyca/fides/pull/5737)
26+
2427
### Changed
2528
- Added frequency field to DataHubSchema integration config [#5716](https://github.com/ethyca/fides/pull/5716)
2629
- Added glossary_node field to DataHubSchema integration config [#5734](https://github.com/ethyca/fides/pull/5734)

clients/admin-ui/cypress/e2e/action-center.cy.ts

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -141,8 +141,7 @@ describe("Action center", () => {
141141
cy.getByTestId("pagination-btn").should("exist");
142142
cy.getByTestId("column-system_name").should("exist");
143143
cy.getByTestId("column-total_updates").should("exist");
144-
// TODO: [HJ-356] uncomment when data use column is implemented
145-
// cy.getByTestId("column-data_use").should("exist");
144+
cy.getByTestId("column-data_use").should("exist");
146145
cy.getByTestId("column-locations").should("exist");
147146
cy.getByTestId("column-domains").should("exist");
148147
cy.getByTestId("column-actions").should("exist");
@@ -153,15 +152,14 @@ describe("Action center", () => {
153152
cy.getByTestId("row-3-col-system_name").within(() => {
154153
cy.getByTestId("change-icon").should("exist"); // new system
155154
});
156-
// TODO: [HJ-356] uncomment when data use column is implemented
157-
/* // data use column should be empty for uncategorized assets
158-
cy.getByTestId("row-0-col-data_use").children().should("have.length", 0);
159-
cy.getByTestId("row-1-col-system_name").within(() => {
160-
cy.getByTestId("change-icon").should("not.exist"); // existing result
161-
cy.contains("Google Tag Manager").should("exist");
162-
}); */
163-
// TODO: [HJ-356] data use column should not be empty for other assets
164-
// cy.getByTestId("row-1-col-data_use").children().should("not.have.length", 0);
155+
// data use column should be empty for uncategorized assets
156+
cy.getByTestId("row-0-col-data_use").should("be.empty");
157+
// cy.getByTestId("row-1-col-system_name").within(() => {
158+
// cy.getByTestId("change-icon").should("not.exist"); // existing result
159+
// cy.contains("Google Tag Manager").should("exist");
160+
// });
161+
// data use column should not be empty for other assets
162+
cy.getByTestId("row-1-col-data_use").children().should("have.length", 1);
165163

166164
// multiple locations
167165
cy.getByTestId("row-2-col-locations").should("contain", "2 locations");

clients/admin-ui/cypress/fixtures/detection-discovery/activity-center/system-aggregate-results.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@
4646
"vendor_id": "fds.1046",
4747
"total_updates": 10,
4848
"locations": ["USA"],
49+
"data_uses": ["essential", "collect"],
4950
"domains": [
5051
"td.doubleclick.net",
5152
"www.google.com",

clients/admin-ui/src/features/data-discovery-and-detection/action-center/hooks/useDiscoveredSystemAggregateColumns.tsx

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import { ColumnDef, createColumnHelper } from "@tanstack/react-table";
22

33
import { DefaultCell } from "~/features/common/table/v2";
4+
import DiscoveredSystemDataUseCell from "~/features/data-discovery-and-detection/action-center/tables/cells/DiscoveredSystemDataUseCell";
45

56
import { DiscoveredSystemActionsCell } from "../tables/cells/DiscoveredSystemAggregateActionsCell";
67
import { DiscoveredSystemStatusCell } from "../tables/cells/DiscoveredSystemAggregateStatusCell";
@@ -26,15 +27,17 @@ export const useDiscoveredSystemAggregateColumns = (monitorId: string) => {
2627
header: "Assets",
2728
size: 80,
2829
}),
29-
/*
30-
// TODO: [HJ-356] uncomment when monitor supports categories of consent
3130
columnHelper.display({
3231
id: "data_use",
32+
cell: (props) => (
33+
<DiscoveredSystemDataUseCell system={props.row.original} />
34+
),
3335
header: "Categories of consent",
3436
meta: {
3537
width: "auto",
38+
disableRowClick: true,
3639
},
37-
}), */
40+
}),
3841
columnHelper.accessor((row) => row.locations, {
3942
id: "locations",
4043
cell: (props) => (
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
import useTaxonomies from "~/features/common/hooks/useTaxonomies";
2+
import { BadgeCellExpandable } from "~/features/common/table/v2/cells";
3+
import { MonitorSystemAggregate } from "~/features/data-discovery-and-detection/action-center/types";
4+
import isConsentCategory from "~/features/data-discovery-and-detection/action-center/utils/isConsentCategory";
5+
6+
const DiscoveredSystemDataUseCell = ({
7+
system,
8+
}: {
9+
system: MonitorSystemAggregate;
10+
}) => {
11+
const { getDataUseDisplayName } = useTaxonomies();
12+
const consentCategories =
13+
system.data_uses?.filter((use) => isConsentCategory(use)) ?? [];
14+
const cellValues = consentCategories.map((use) => ({
15+
label: getDataUseDisplayName(use),
16+
key: use,
17+
}));
18+
19+
return (
20+
<BadgeCellExpandable
21+
values={cellValues}
22+
bgColor="white"
23+
borderWidth="1px"
24+
borderColor="gray.200"
25+
/>
26+
);
27+
};
28+
29+
export default DiscoveredSystemDataUseCell;

clients/admin-ui/src/features/data-discovery-and-detection/action-center/types.d.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ export interface MonitorSystemAggregate {
2020
system_key: string | null; // null when the system is not a known system
2121
vendor_id: string;
2222
total_updates: 0;
23+
data_uses: string[];
2324
locations: string[];
2425
domains: string[];
2526
}
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
export const CONSENT_CATEGORIES = [
2+
"essential",
3+
"functional.service.improve",
4+
"personalize",
5+
"analytics",
6+
"marketing.advertising.first_party.targeted",
7+
"marketing.advertising.third_party.targeted",
8+
];
9+
10+
const isConsentCategory = (category: string): boolean => {
11+
return CONSENT_CATEGORIES.includes(category);
12+
};
13+
14+
export default isConsentCategory;

0 commit comments

Comments
 (0)