Skip to content

Commit

Permalink
Validate a standalone dataset (#5549)
Browse files Browse the repository at this point in the history
  • Loading branch information
galvana authored Dec 4, 2024
1 parent a28ae2f commit 966a0e3
Show file tree
Hide file tree
Showing 39 changed files with 2,323 additions and 28 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ The types of changes are:
- Added new column for Action Type in privacy request event logs [#5546](https://github.com/ethyca/fides/pull/5546)
- Added `fides_consent_override` option in FidesJS SDK [#5541](https://github.com/ethyca/fides/pull/5541)
- Added new `script` ConsentMethod in FidesJS SDK for tracking automated consent [#5541](https://github.com/ethyca/fides/pull/5541)
- Added a new page under system integrations to run standalone dataset tests (Fidesplus) [#5549](https://github.com/ethyca/fides/pull/5549)

### Changed
- Adding hashes to system tab URLs [#5535](https://github.com/ethyca/fides/pull/5535)
Expand Down
2 changes: 2 additions & 0 deletions clients/admin-ui/src/app/store.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ import { propertySlice } from "~/features/properties";
import { systemSlice } from "~/features/system";
import { dictSuggestionsSlice } from "~/features/system/dictionary-form/dict-suggestion.slice";
import { taxonomySlice } from "~/features/taxonomy";
import { datasetTestSlice } from "~/features/test-datasets";
import { userManagementSlice } from "~/features/user-management";

/**
Expand Down Expand Up @@ -79,6 +80,7 @@ const reducer = {
[dataSubjectsSlice.name]: dataSubjectsSlice.reducer,
[dataUseSlice.name]: dataUseSlice.reducer,
[datasetSlice.name]: datasetSlice.reducer,
[datasetTestSlice.name]: datasetTestSlice.reducer,
[datastoreConnectionSlice.name]: datastoreConnectionSlice.reducer,
[discoveryDetectionSlice.name]: discoveryDetectionSlice.reducer,
[featuresSlice.name]: featuresSlice.reducer,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ const ConnectorParametersForm = ({
isSubmitting = false,
onSaveClick,
onTestConnectionClick,
testButtonLabel = "Test connection",
testButtonLabel = "Test integration",
}: ConnectorParametersFormProps) => {
const mounted = useRef(false);
const { handleError } = useAPIHelper();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -380,6 +380,40 @@ export const datastoreConnectionApi = baseApi.injectEndpoints({
}),
invalidatesTags: () => ["Datastore Connection"],
}),
testDatastoreConnectionDatasets: build.mutation<
{ privacy_request_id: string },
{
connection_key: string;
dataset_key: string;
input_data: Record<string, any>;
}
>({
query: (params) => ({
url: `${CONNECTION_ROUTE}/${params.connection_key}/dataset/${params.dataset_key}/test`,
method: "POST",
body: params.input_data,
}),
}),
getDatasetInputs: build.query<
any,
{ connectionKey: string; datasetKey: string }
>({
query: ({ connectionKey, datasetKey }) => ({
url: `${CONNECTION_ROUTE}/${connectionKey}/dataset/${datasetKey}/inputs`,
method: "GET",
}),
providesTags: () => ["Datastore Connection"],
}),
getDatasetReachability: build.query<
{ reachable: boolean; details: string },
{ connectionKey: string; datasetKey: string }
>({
query: ({ connectionKey, datasetKey }) => ({
url: `${CONNECTION_ROUTE}/${connectionKey}/dataset/${datasetKey}/reachability`,
method: "GET",
}),
providesTags: () => ["Datastore Connection"],
}),
}),
});

Expand All @@ -402,6 +436,9 @@ export const {
usePatchDatastoreConnectionsMutation,
useUpdateDatastoreConnectionSecretsMutation,
usePatchDatastoreConnectionSecretsMutation,
useTestDatastoreConnectionDatasetsMutation,
useGetDatasetInputsQuery,
useGetDatasetReachabilityQuery,
} = datastoreConnectionApi;

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import {
DatastoreConnectionSecretsResponse,
} from "datastore-connections/types";
import { Box, Flex, Spacer, useToast, UseToastOptions } from "fidesui";
import router from "next/router";
import { useMemo, useState } from "react";

import { useAppDispatch, useAppSelector } from "~/app/hooks";
Expand Down Expand Up @@ -391,6 +392,10 @@ export const ConnectorParameters = ({
},
);

const handleTestDatasetsClick = () => {
router.push(`/systems/configure/${systemFidesKey}/test-datasets`);
};

const {
isSubmitting,
isAuthorizing,
Expand Down Expand Up @@ -450,6 +455,7 @@ export const ConnectorParameters = ({
isAuthorizing={isAuthorizing}
onSaveClick={handleSubmit}
onTestConnectionClick={handleTestConnectionClick}
onTestDatasetsClick={handleTestDatasetsClick}
onAuthorizeConnectionClick={handleAuthorization}
connectionOption={connectionOption}
connectionConfig={connectionConfig}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,10 @@ type ConnectorParametersFormProps = {
* Parent callback when Test Connection is clicked
*/
onTestConnectionClick: (value: TestConnectionResponse) => void;
/**
* Parent callback when Test Dataset is clicked
*/
onTestDatasetsClick: () => void;
/**
* Text for the test button. Defaults to "Test connection"
*/
Expand All @@ -86,6 +90,7 @@ export const ConnectorParametersForm = ({
isAuthorizing = false,
onSaveClick,
onTestConnectionClick,
onTestDatasetsClick,
onAuthorizeConnectionClick,
testButtonLabel = "Test integration",
connectionOption,
Expand Down Expand Up @@ -517,6 +522,11 @@ export const ConnectorParametersForm = ({
{testButtonLabel}
</Button>
) : null}
{isPlusEnabled && !_.isEmpty(initialDatasets) && (
<Button onClick={() => onTestDatasetsClick()}>
Test datasets
</Button>
)}
{connectionOption.authorization_required && !authorized ? (
<Button
loading={isAuthorizing}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -540,6 +540,21 @@ export const privacyRequestApi = baseApi.injectEndpoints({
url: `privacy-request/${privacy_request_id}/access-results`,
}),
}),
getFilteredResults: build.query<
{
privacy_request_id: string;
status: PrivacyRequestStatus;
results: {
[key: string]: Array<Record<string, any>>;
};
},
{ privacy_request_id: string }
>({
query: ({ privacy_request_id }) => ({
method: "GET",
url: `privacy-request/${privacy_request_id}/filtered-results`,
}),
}),
}),
});

Expand Down Expand Up @@ -570,6 +585,7 @@ export const {
useCreateMessagingConfigurationSecretsMutation,
useCreateTestConnectionMessageMutation,
useGetPrivacyRequestAccessResultsQuery,
useGetFilteredResultsQuery,
} = privacyRequestApi;

export type CORSOrigins = Pick<SecurityApplicationConfig, "cors_origins">;
Expand Down
Loading

0 comments on commit 966a0e3

Please sign in to comment.