From 37938116a0ff6b5c8e1487b132d4596c3c6d54b2 Mon Sep 17 00:00:00 2001 From: Allison King Date: Fri, 16 Jun 2023 11:44:30 -0400 Subject: [PATCH 1/2] Initialize based on cookie instead of window (#3597) --- CHANGELOG.md | 1 + clients/fides-js/src/components/Overlay.tsx | 8 +++----- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 931ec0b8b7..07b0d6a7a4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -70,6 +70,7 @@ The types of changes are: - Fix NextJS errors & warnings for Cookie House sample app [#3411](https://github.com/ethyca/fides/pull/3411) - Fix bug where `fides-js` toggles were not reflecting changes from rejecting or accepting all notices [#3522](https://github.com/ethyca/fides/pull/3522) - Remove the `fides-js` banner from tab order when it is hidden and move the overlay components to the top of the tab order. [#3510](https://github.com/ethyca/fides/pull/3510) +- Fix bug where `fides-js` toggle states did not always initialize properly [#3597](https://github.com/ethyca/fides/pull/3597) ### Changed diff --git a/clients/fides-js/src/components/Overlay.tsx b/clients/fides-js/src/components/Overlay.tsx index a33c60bc09..fc79e6a768 100644 --- a/clients/fides-js/src/components/Overlay.tsx +++ b/clients/fides-js/src/components/Overlay.tsx @@ -42,12 +42,10 @@ const Overlay: FunctionComponent = ({ const [bannerIsOpen, setBannerIsOpen] = useState(false); const initialEnabledNoticeKeys = useMemo( - () => - Object.keys(window.Fides.consent).filter( - (key) => window.Fides.consent[key] - ), - [] + () => Object.keys(cookie.consent).filter((key) => cookie.consent[key]), + [cookie.consent] ); + const [draftEnabledNoticeKeys, setDraftEnabledNoticeKeys] = useState< Array >(initialEnabledNoticeKeys); From 07d5355292bcbba47068a2659276d2a340ec7f5e Mon Sep 17 00:00:00 2001 From: Andrew Jackson Date: Fri, 16 Jun 2023 16:12:22 -0400 Subject: [PATCH 2/2] Update dataset dropdown api calls (#3565) --- CHANGELOG.md | 3 +- .../src/features/dataset/dataset.slice.ts | 11 ++++++++ .../datastore-connection.slice.ts | 6 ++-- .../forms/ConnectorParametersForm.tsx | 5 +++- .../DatasetConfigField/DatasetConfigField.tsx | 28 ++++++++++++++----- .../fields/DatasetConfigField/YamlEditor.tsx | 4 +++ .../api/v1/endpoints/connection_endpoints.py | 4 ++- .../v1/endpoints/test_dataset_endpoints.py | 4 ++- 8 files changed, 51 insertions(+), 14 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 07b0d6a7a4..7b0fee76b5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -58,7 +58,8 @@ The types of changes are: - Add ability to close `fides-js` banner and modal via a button or ESC [#3411](https://github.com/ethyca/fides/pull/3411) - Add ability to open the `fides-js` modal from a link on the host site [#3411](https://github.com/ethyca/fides/pull/3411) - GPC preferences are automatically applied via `fides-js` [#3411](https://github.com/ethyca/fides/pull/3411) -- Add new dataset route that has additinonal filters [#3558](https://github.com/ethyca/fides/pull/3558) +- Add new dataset route that has additional filters [#3558](https://github.com/ethyca/fides/pull/3558) +- Update dataset dropdown to use new api filter [#3565](https://github.com/ethyca/fides/pull/3565) ### Fixed diff --git a/clients/admin-ui/src/features/dataset/dataset.slice.ts b/clients/admin-ui/src/features/dataset/dataset.slice.ts index 1ca28987d2..f569271451 100644 --- a/clients/admin-ui/src/features/dataset/dataset.slice.ts +++ b/clients/admin-ui/src/features/dataset/dataset.slice.ts @@ -33,6 +33,16 @@ const datasetApi = baseApi.injectEndpoints({ query: () => ({ url: `dataset/` }), providesTags: () => ["Datasets"], }), + getAllFilteredDatasets: build.query< + Dataset[], + { onlyUnlinkedDatasets: boolean } + >({ + query: ({ onlyUnlinkedDatasets }) => ({ + url: `/filter/dataset`, + params: { only_unlinked_datasets: onlyUnlinkedDatasets }, + }), + providesTags: () => ["Datasets"], + }), getDatasetByKey: build.query({ query: (key) => ({ url: `dataset/${key}` }), providesTags: () => ["Dataset"], @@ -90,6 +100,7 @@ const datasetApi = baseApi.injectEndpoints({ export const { useGetAllDatasetsQuery, + useGetAllFilteredDatasetsQuery, useGetDatasetByKeyQuery, useUpdateDatasetMutation, useUpsertDatasetsMutation, diff --git a/clients/admin-ui/src/features/datastore-connections/datastore-connection.slice.ts b/clients/admin-ui/src/features/datastore-connections/datastore-connection.slice.ts index b31b5f9878..905d62720d 100644 --- a/clients/admin-ui/src/features/datastore-connections/datastore-connection.slice.ts +++ b/clients/admin-ui/src/features/datastore-connections/datastore-connection.slice.ts @@ -332,7 +332,7 @@ export const datastoreConnectionApi = baseApi.injectEndpoints({ method: "PATCH", body: params.dataset_pairs, }), - invalidatesTags: () => ["Datastore Connection"], + invalidatesTags: () => ["Datastore Connection", "Datasets"], }), patchDatastoreConnection: build.mutation< DatastoreConnectionResponse, @@ -343,7 +343,7 @@ export const datastoreConnectionApi = baseApi.injectEndpoints({ method: "PATCH", body: [params], }), - invalidatesTags: () => ["Datastore Connection"], + invalidatesTags: () => ["Datastore Connection", "Datasets"], }), patchDatastoreConnections: build.mutation({ query: ({ key, name, disabled, connection_type, access }) => ({ @@ -351,7 +351,7 @@ export const datastoreConnectionApi = baseApi.injectEndpoints({ method: "PATCH", body: [{ key, name, disabled, connection_type, access }], }), - invalidatesTags: () => ["Datastore Connection"], + invalidatesTags: () => ["Datastore Connection", "Datasets"], }), updateDatastoreConnectionSecrets: build.mutation< DatastoreConnectionSecretsResponse, diff --git a/clients/admin-ui/src/features/datastore-connections/system_portal_config/forms/ConnectorParametersForm.tsx b/clients/admin-ui/src/features/datastore-connections/system_portal_config/forms/ConnectorParametersForm.tsx index 1fcbf4e867..415977d279 100644 --- a/clients/admin-ui/src/features/datastore-connections/system_portal_config/forms/ConnectorParametersForm.tsx +++ b/clients/admin-ui/src/features/datastore-connections/system_portal_config/forms/ConnectorParametersForm.tsx @@ -383,7 +383,10 @@ const ConnectorParametersForm: React.FC = ({ {[SystemType.SAAS, SystemType.DATABASE].indexOf( connectionOption.type ) > -1 && !isCreatingConnectionConfig ? ( - + ) : null}