From 4205af3bcbde3f1aa392c6412f15e675246da8b5 Mon Sep 17 00:00:00 2001 From: eastandwestwind Date: Thu, 20 Jun 2024 17:54:41 +0200 Subject: [PATCH 1/3] fix table cell formatting for vendors --- .../src/features/common/table/v2/cells.tsx | 32 +++++++++++++++++ .../src/features/common/table/v2/index.ts | 1 + .../ConsentManagementTable.tsx | 34 +++++++++++++++---- .../datamap/reporting/DatamapReportTable.tsx | 2 +- 4 files changed, 62 insertions(+), 7 deletions(-) diff --git a/clients/admin-ui/src/features/common/table/v2/cells.tsx b/clients/admin-ui/src/features/common/table/v2/cells.tsx index 293fe7fde3..624a5bf00d 100644 --- a/clients/admin-ui/src/features/common/table/v2/cells.tsx +++ b/clients/admin-ui/src/features/common/table/v2/cells.tsx @@ -94,6 +94,38 @@ export const BadgeCell = ({ ); +export const BadgeCellCount = ({ + count, + singSuffix, + plSuffix, + ...badgeProps +}: { + count: number; + singSuffix?: string; + plSuffix?: string; +} & BadgeProps) => { + // Expanded case, list every value as a badge + let badge = null; + if (count === 1) { + badge = ( + + {count} + {singSuffix ? ` ${singSuffix}` : null} + + ); + } + // Collapsed case, summarize the values in one badge + else { + badge = ( + + {count} + {plSuffix ? ` ${plSuffix}` : null} + + ); + } + return {badge}; +}; + export const GroupCountBadgeCell = ({ value, suffix, diff --git a/clients/admin-ui/src/features/common/table/v2/index.ts b/clients/admin-ui/src/features/common/table/v2/index.ts index 883a8b6864..7b6bd7bf65 100644 --- a/clients/admin-ui/src/features/common/table/v2/index.ts +++ b/clients/admin-ui/src/features/common/table/v2/index.ts @@ -1,5 +1,6 @@ export { BadgeCell, + BadgeCellCount, DefaultCell, DefaultHeaderCell, GroupCountBadgeCell, diff --git a/clients/admin-ui/src/features/configure-consent/ConsentManagementTable.tsx b/clients/admin-ui/src/features/configure-consent/ConsentManagementTable.tsx index 0029897c5f..f4d0e9c3dd 100644 --- a/clients/admin-ui/src/features/configure-consent/ConsentManagementTable.tsx +++ b/clients/admin-ui/src/features/configure-consent/ConsentManagementTable.tsx @@ -6,7 +6,7 @@ import { } from "@tanstack/react-table"; import { useFeatures } from "common/features"; import { - BadgeCell, + BadgeCellCount, DefaultCell, DefaultHeaderCell, FidesTableV2, @@ -163,33 +163,55 @@ export const ConsentManagementTable = () => { columnHelper.accessor((row) => row.data_uses, { id: "tcf_purpose", cell: (props) => ( - + ), header: (props) => , }), columnHelper.accessor((row) => row.data_uses, { id: "data_uses", cell: (props) => ( - + ), header: (props) => , }), columnHelper.accessor((row) => row.legal_bases, { id: "legal_bases", - cell: (props) => , + cell: (props) => ( + + ), header: (props) => , }), columnHelper.accessor((row) => row.consent_categories, { id: "consent_categories", cell: (props) => ( - + ), header: (props) => , }), columnHelper.accessor((row) => row.cookies, { id: "cookies", cell: (props) => ( - + ), header: (props) => , }), diff --git a/clients/admin-ui/src/features/datamap/reporting/DatamapReportTable.tsx b/clients/admin-ui/src/features/datamap/reporting/DatamapReportTable.tsx index c8e997baba..06ca3db368 100644 --- a/clients/admin-ui/src/features/datamap/reporting/DatamapReportTable.tsx +++ b/clients/admin-ui/src/features/datamap/reporting/DatamapReportTable.tsx @@ -786,7 +786,7 @@ export const DatamapReportTable = () => { id: COLUMN_IDS.RESPONSIBILITY, cell: (props) => ( From c0b55c95e1abc0bd37c5ec926a1fb82360b707cb Mon Sep 17 00:00:00 2001 From: eastandwestwind Date: Thu, 20 Jun 2024 17:58:33 +0200 Subject: [PATCH 2/3] adds to changelog --- CHANGELOG.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index fdff7218d0..4abdbd00f3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -46,7 +46,8 @@ The types of changes are: - Fixed validations for privacy declaration taxonomy labels when creating/updating a System [#4982](https://github.com/ethyca/fides/pull/4982) - Allow property-specific messaging to work with non-custom templates [#4986](https://github.com/ethyca/fides/pull/4986) - Fixed an issue where config object was being passed twice to `fides.js` output [#5010](https://github.com/ethyca/fides/pull/5010) -- Disabling Fides initializtion now also disables GPP initialization [#5010](https://github.com/ethyca/fides/pull/5010) +- Disabling Fides initialization now also disables GPP initialization [#5010](https://github.com/ethyca/fides/pull/5010) +- Fixes Vendor table formatting [#5013](https://github.com/ethyca/fides/pull/5013) ## [2.38.1](https://github.com/ethyca/fides/compare/2.38.0...2.38.1) From bab04f12d91e5dab4c05520899d5ae1d627970dc Mon Sep 17 00:00:00 2001 From: eastandwestwind Date: Thu, 20 Jun 2024 18:01:04 +0200 Subject: [PATCH 3/3] clarify code comment --- clients/admin-ui/src/features/common/table/v2/cells.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/clients/admin-ui/src/features/common/table/v2/cells.tsx b/clients/admin-ui/src/features/common/table/v2/cells.tsx index 624a5bf00d..a591195657 100644 --- a/clients/admin-ui/src/features/common/table/v2/cells.tsx +++ b/clients/admin-ui/src/features/common/table/v2/cells.tsx @@ -104,7 +104,7 @@ export const BadgeCellCount = ({ singSuffix?: string; plSuffix?: string; } & BadgeProps) => { - // Expanded case, list every value as a badge + // If count is 1, display count with singular suffix let badge = null; if (count === 1) { badge = ( @@ -114,7 +114,7 @@ export const BadgeCellCount = ({ ); } - // Collapsed case, summarize the values in one badge + // If count is 0 or > 1, display count with plural suffix else { badge = (