From a24f3f6ed4e92ba4753b50fd35abd52077342024 Mon Sep 17 00:00:00 2001 From: Lucano Vera Date: Thu, 18 Jul 2024 16:52:21 -0300 Subject: [PATCH] PROD-2409 By default, don't show data categories that are disabled (#5102) Co-authored-by: Lucano Vera --- CHANGELOG.md | 2 ++ clients/admin-ui/cypress/e2e/discovery-detection.cy.ts | 4 ++-- .../common/dropdown/TaxonomySelectDropdown.tsx | 10 +++++++++- 3 files changed, 13 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index b5e94ac096..fe8b35340d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -30,6 +30,8 @@ The types of changes are: - Endpoints for listing systems (GET /system) and datasets (GET /dataset) now support optional pagination [#5071](https://github.com/ethyca/fides/pull/5071) - Messaging page will now show a notice about using global mode [#5090](https://github.com/ethyca/fides/pull/5090) - Changed behavior of project selection modal in discovery monitor form [#5092](https://github.com/ethyca/fides/pull/5092) +- Data category selector for Discovery results won't show disabled categories [#5102](https://github.com/ethyca/fides/pull/5102) + ### Developer Experience - Upgrade to React 18 and Chakra 2, including other dependencies [#5036](https://github.com/ethyca/fides/pull/5036) diff --git a/clients/admin-ui/cypress/e2e/discovery-detection.cy.ts b/clients/admin-ui/cypress/e2e/discovery-detection.cy.ts index a8396e81aa..4f18bee31b 100644 --- a/clients/admin-ui/cypress/e2e/discovery-detection.cy.ts +++ b/clients/admin-ui/cypress/e2e/discovery-detection.cy.ts @@ -348,8 +348,8 @@ describe("discovery and detection", () => { it("allows classifications to be changed using the dropdown", () => { cy.intercept("GET", "/api/v1/data_category", [ - { fides_key: "system" }, - { fides_key: "user.contact" }, + { fides_key: "system", active: true }, + { fides_key: "user.contact", active: true }, ]); cy.intercept("PATCH", "/api/v1/plus/discovery-monitor/*/results").as( "patchClassification" diff --git a/clients/admin-ui/src/features/common/dropdown/TaxonomySelectDropdown.tsx b/clients/admin-ui/src/features/common/dropdown/TaxonomySelectDropdown.tsx index ca18d5d67c..9e7009974f 100644 --- a/clients/admin-ui/src/features/common/dropdown/TaxonomySelectDropdown.tsx +++ b/clients/admin-ui/src/features/common/dropdown/TaxonomySelectDropdown.tsx @@ -45,13 +45,21 @@ const Option = ({ data, setValue }: OptionProps) => { interface TaxonomySelectDropdownProps { onChange: (selectedOption: TaxonomySelectOption) => void; menuIsOpen?: boolean; + showDisabled?: boolean; } const TaxonomySelectDropdown = ({ onChange, menuIsOpen, + showDisabled = false, }: TaxonomySelectDropdownProps) => { const { getDataCategoryDisplayName, getDataCategories } = useTaxonomies(); - const dataCategories = getDataCategories(); + + const getActiveDataCategories = () => + getDataCategories().filter((c) => c.active); + + const dataCategories = showDisabled + ? getDataCategories() + : getActiveDataCategories(); const options: Options = dataCategories.map( (category) => ({