Skip to content

Commit

Permalink
PROD-2529 Fix wrong system count on datamap (#5151)
Browse files Browse the repository at this point in the history
Co-authored-by: Lucano Vera <[email protected]>
Co-authored-by: Jason Gill <[email protected]>
  • Loading branch information
3 people authored Aug 2, 2024
1 parent 0a7ad9b commit 6467c69
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,8 @@ The types of changes are:
- Fixed Admin UI issue where banner would disappear in Experience Preview with GPC enabled [#5131](https://github.com/ethyca/fides/pull/5131)
- Fixed not being able to edit a monitor from scheduled to not scheduled [#5114](https://github.com/ethyca/fides/pull/5114)
- Migrating missing Fideslang 2.0 data categories [#5073](https://github.com/ethyca/fides/pull/5073)
- Fixed wrong system count on Datamap page [#5151](https://github.com/ethyca/fides/pull/5151)


## [2.41.0](https://github.com/ethyca/fides/compare/2.40.0...2.41.0)

Expand Down
12 changes: 10 additions & 2 deletions clients/admin-ui/src/features/datamap/SettingsBar.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { Button, Flex, Tag, Text, useDisclosure } from "fidesui";
import React, { useContext } from "react";
import { uniq } from "lodash";
import React, { useContext, useMemo } from "react";

import { useFeatures } from "~/features/common/features";
import QuestionTooltip from "~/features/common/QuestionTooltip";
Expand Down Expand Up @@ -28,11 +29,18 @@ const SettingsBar = () => {
const { tableInstance } = useContext(DatamapTableContext);
const { systemsCount: totalSystemsCount, dictionaryService: compassEnabled } =
useFeatures();

const rowModel = tableInstance?.getRowModel();
const uniqueSystemKeysFromFilteredRows = useMemo(() => {
const rows = rowModel?.rows || [];
return uniq(rows?.map((row) => row.original["system.fides_key"]));
}, [rowModel]);

if (!tableInstance) {
return null;
}

const filteredSystemsCount = tableInstance.getRowModel().rows.length || 0;
const filteredSystemsCount = uniqueSystemKeysFromFilteredRows.length;
const totalFiltersApplied = tableInstance.getState().columnFilters.length;

return (
Expand Down

0 comments on commit 6467c69

Please sign in to comment.