Skip to content

Commit

Permalink
Add "reclassify" button to discovery tables (#5574)
Browse files Browse the repository at this point in the history
  • Loading branch information
jpople authored Dec 18, 2024
1 parent ebbd5d8 commit 4157ac5
Show file tree
Hide file tree
Showing 4 changed files with 36 additions and 3 deletions.
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,12 @@ The types of changes are:
- Added new erasure tests for BigQuery Enterprise [#5554](https://github.com/ethyca/fides/pull/5554)
- Added new `has_next` parameter for the `link` pagination strategy [#5596](https://github.com/ethyca/fides/pull/5596)
- Added a `DBCache` model for database-backed caching [#5613](https://github.com/ethyca/fides/pull/5613)
- Adds "reclassify" button to discovery result tables [#5574](https://github.com/ethyca/fides/pull/5574)

### Changed
- Adjusted Ant's Select component colors and icon [#5594](https://github.com/ethyca/fides/pull/5594)
- Replaced taxonomies page with new UI based on an interactive tree visualization [#5602](https://github.com/ethyca/fides/pull/5602)


### Fixed
- Fixing quickstart.py script [#5585](https://github.com/ethyca/fides/pull/5585)
- Removed unnecessary double notification when updating database integrations [#5612](https://github.com/ethyca/fides/pull/5612)
Expand Down
9 changes: 9 additions & 0 deletions clients/admin-ui/cypress/e2e/discovery-detection.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -322,6 +322,15 @@ describe("discovery and detection", () => {
"test_dataset_1",
);
});

it("should be able to reclassify", () => {
cy.getByTestId(
"row-my_bigquery_monitor.prj-bigquery-418515.test_dataset_1",
).within(() => {
cy.getByTestId("action-Reclassify").click();
cy.wait("@confirmResource");
});
});
});

describe("table-level view", () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,7 @@ const discoveryDetectionApi = baseApi.injectEndpoints({
ResourceActionQueryParams & {
monitor_config_id: string;
unmute_children?: boolean;
start_classification?: boolean;
classify_monitored_resources?: boolean;
}
>({
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
import { CheckIcon, HStack, ViewOffIcon } from "fidesui";
import { CheckIcon, HStack, RepeatIcon, ViewOffIcon } from "fidesui";

import { useAlert } from "~/features/common/hooks";
import { DiscoveryMonitorItem } from "~/features/data-discovery-and-detection/types/DiscoveryMonitorItem";
import getResourceName from "~/features/data-discovery-and-detection/utils/getResourceName";
import { DiffStatus } from "~/types/api";

import ActionButton from "../../ActionButton";
import {
useConfirmResourceMutation,
useMuteResourceMutation,
usePromoteResourceMutation,
} from "../../discovery-detection.slice";
Expand All @@ -15,12 +17,15 @@ interface DiscoveryItemActionsProps {
}

const DiscoveryItemActionsCell = ({ resource }: DiscoveryItemActionsProps) => {
const [confirmResourceMutation, { isLoading: confirmIsLoading }] =
useConfirmResourceMutation();
const [promoteResourceMutation, { isLoading: promoteIsLoading }] =
usePromoteResourceMutation();
const [muteResourceMutation, { isLoading: muteIsLoading }] =
useMuteResourceMutation();

const anyActionIsLoading = promoteIsLoading || muteIsLoading;
const anyActionIsLoading =
promoteIsLoading || muteIsLoading || confirmIsLoading;

const {
diff_status: diffStatus,
Expand Down Expand Up @@ -85,6 +90,24 @@ const DiscoveryItemActionsCell = ({ resource }: DiscoveryItemActionsProps) => {
loading={muteIsLoading}
/>
)}
<ActionButton
title="Reclassify"
icon={<RepeatIcon />}
onClick={async () => {
await confirmResourceMutation({
staged_resource_urn: resource.urn,
monitor_config_id: resource.monitor_config_id!,
start_classification: true,
classify_monitored_resources: true,
});
successAlert(
`Reclassification of ${getResourceName(resource) || "the resource"} has begun. The results may take some time to appear in the “Data discovery“ tab.`,
`Reclassification started`,
);
}}
disabled={anyActionIsLoading}
loading={confirmIsLoading}
/>
</HStack>
);
};
Expand Down

0 comments on commit 4157ac5

Please sign in to comment.