Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PROD-1899 Move-admin-UI-away-from-using-unpaginated-system-and-dataset-APIs-where-possible #5135

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
8064fd6
PROD-1397 Update models
Jul 15, 2024
d89581a
PROD-1397 Update system page to a table ui and using paginated endpoints
Jul 15, 2024
23fe1c1
PROD-1397 Add search bar and edit/delete icons
Jul 15, 2024
cf46f4a
PROD-1397 Add column table
Jul 15, 2024
55ff6ef
PROD-1397 Fix lint issues
Jul 15, 2024
e61939b
PROD-1397 Update tests
Jul 15, 2024
75795f2
PROD-1397 Update smoke test
Jul 16, 2024
b733845
PROD-1397 Update tests
Jul 16, 2024
126dc18
PROD-1397 Fix smoke test
Jul 16, 2024
533ee42
PROD-1397 Change page title
Jul 16, 2024
cdb4ca9
PROD-1397 Update changelog
Jul 16, 2024
fb57ed9
Merge branch 'main' of github.com:ethyca/fides into PROD-1397-Update-…
Jul 16, 2024
a9a6ec0
PROD-1397 Update system nav title
Jul 16, 2024
3dda204
PROD-1397 Update unit tests
Jul 16, 2024
b8c8105
Merge branch 'main' of github.com:ethyca/fides into PROD-1397-Update-…
Jul 16, 2024
977dd83
PROD-1397 Fix tests
Jul 17, 2024
2bfa908
Merge branch 'PROD-1397-Update-systems-page-with-Table-view' of githu…
Jul 17, 2024
7a8503b
PROD-1899 WIP
Jul 17, 2024
875a005
Update branch with main
Jul 29, 2024
e34f044
PROD-1899 Add back selectallsystem selector until selectActiveClassif…
Jul 30, 2024
e1c23ad
PROD-1899 Remove system classification page, table, test and related …
Jul 30, 2024
b94284f
PROD-1899 Update tests
Jul 30, 2024
b63d28b
PROD-1899 Removed unused component
Jul 30, 2024
52c9856
PROD-1899 Add back FE validation for systems with the same name using…
Jul 30, 2024
520d324
PROD-1899 Update changelog
Jul 30, 2024
f900e8d
PROD-1899 Fix edit system validation
Jul 30, 2024
ba8bad6
Remove console log
Jul 30, 2024
e4df0cb
Merge branch 'main' of github.com:ethyca/fides into PROD-1899-Move-ad…
Jul 30, 2024
5204ada
Update clients/admin-ui/src/features/configure-consent/AddVendor.tsx
lucanovera Jul 31, 2024
0549872
Merge branch 'main' of github.com:ethyca/fides into PROD-1899-Move-ad…
Jul 31, 2024
41c78d6
Merge branch 'PROD-1899-Move-admin-UI-away-from-using-unpaginated-sys…
Jul 31, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ The types of changes are:
- Serve GVL languages as they are requested [#5112](https://github.com/ethyca/fides/pull/5112)
- Changed text on system integrations tab to direct to new integration management [#5097](https://github.com/ethyca/fides/pull/5097)
- Updates to consent experience styling [#5085](https://github.com/ethyca/fides/pull/5085)
- Improve performance by removing the need to load every system into redux store [#5135](https://github.com/ethyca/fides/pull/5135)
- Use the `user_id` from a Segment Trait instead of an `email` when deleting a user in Segment [#5004](https://github.com/ethyca/fides/pull/5004)
- Moves some endpoints for property-specific messaging from OSS -> plus [#5069](https://github.com/ethyca/fides/pull/5069)
- Text changes in monitor config table and form [#5142](https://github.com/ethyca/fides/pull/5142)
Expand Down
3 changes: 1 addition & 2 deletions clients/admin-ui/cypress/e2e/routes.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ describe("Routes", () => {
describe("permissions", () => {
beforeEach(() => {
// For these tests, let's say we always have systems and connectors
cy.intercept("GET", "/api/v1/system", {
cy.intercept("GET", "/api/v1/system*", {
fixture: "systems/systems.json",
}).as("getSystems");
cy.intercept("GET", "/api/v1/connection*", {
Expand All @@ -29,7 +29,6 @@ describe("Routes", () => {
cy.assumeRole(RoleRegistryEnum.OWNER);
cy.visit("/");
cy.visit(ADD_SYSTEMS_ROUTE);
cy.wait("@getSystems");
cy.getByTestId("add-systems");
cy.visit("/privacy-requests");
cy.getByTestId("privacy-requests");
Expand Down
147 changes: 0 additions & 147 deletions clients/admin-ui/cypress/e2e/systems-classify.cy.ts

This file was deleted.

2 changes: 0 additions & 2 deletions clients/admin-ui/cypress/e2e/user-management.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -371,7 +371,6 @@ describe("User management", () => {
beforeEach(() => {
cy.visit(`/user-management/profile/${USER_1_ID}`);
cy.getByTestId("tab-Permissions").click();
cy.wait("@getSystems");
cy.wait("@getUserManagedSystems");
});

Expand All @@ -391,7 +390,6 @@ describe("User management", () => {
beforeEach(() => {
cy.visit(`/user-management/profile/${USER_1_ID}`);
cy.getByTestId("tab-Permissions").click();
cy.wait("@getSystems");
cy.wait("@getUserManagedSystems");
cy.getByTestId("assign-systems-delete-table");
});
Expand Down
4 changes: 2 additions & 2 deletions clients/admin-ui/src/features/common/CommonSubscriptions.tsx
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import { useAppSelector } from "~/app/hooks";
import { useGetHealthQuery } from "~/features/common/health.slice";
import { useGetHealthQuery as useGetPlusHealthQuery } from "~/features/plus/plus.slice";
import { useGetAllSystemsQuery } from "~/features/system/system.slice";
import { useGetSystemsQuery } from "~/features/system";
import { selectThisUsersScopes } from "~/features/user-management";

const useCommonSubscriptions = () => {
useGetHealthQuery();
useGetPlusHealthQuery();
useGetAllSystemsQuery();
useGetSystemsQuery({ page: 1, size: 1 }); // used to preload systems count on selectSystemsCount
useAppSelector(selectThisUsersScopes);
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { type RootState } from "~/app/store";
import { selectHealth } from "~/features/common/health.slice";
import { selectInitialConnections } from "~/features/datastore-connections";
import { selectHealth as selectPlusHealth } from "~/features/plus/plus.slice";
import { selectAllSystems } from "~/features/system";
import { selectSystemsCount } from "~/features/system";
import flagDefaults from "~/flags.json";

import { configureFlags, flagsForEnv } from "./config";
Expand Down Expand Up @@ -146,7 +146,7 @@ export type Features = {
export const useFeatures = (): Features => {
const health = useAppSelector(selectHealth);
const plusHealth = useAppSelector(selectPlusHealth);
const allSystems = useAppSelector(selectAllSystems);
const systemsCount = useAppSelector(selectSystemsCount);
const initialConnections = useAppSelector(selectInitialConnections);

const version = health?.version;
Expand All @@ -163,8 +163,6 @@ export const useFeatures = (): Features => {

const tcf = plusHealth ? !!plusHealth.tcf.enabled : false;

const systemsCount = allSystems?.length ?? 0;

const connectionsCount = initialConnections?.total ?? 0;

const { flags } = useFlags();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,10 @@ import {
import { Form, Formik, FormikHelpers } from "formik";
import React, { useEffect, useMemo, useState } from "react";

import { useAppSelector } from "~/app/hooks";
import {
useGetAllSystemsQuery,
useUpdateSystemMutation,
} from "~/features/system";
import { selectAllSystems } from "~/features/system/system.slice";
import { DataFlow, System } from "~/types/api";

const defaultInitialValues = {
Expand All @@ -53,8 +51,7 @@ export const DataFlowAccordionForm = ({
const dataFlowSystemsModal = useDisclosure();
const [updateSystemMutationTrigger] = useUpdateSystemMutation();

useGetAllSystemsQuery();
const systems = useAppSelector(selectAllSystems);
const { data: systems = [] } = useGetAllSystemsQuery();

const initialDataFlows = useMemo(() => {
let dataFlows = isIngress ? system.ingress : system.egress;
Expand Down
17 changes: 1 addition & 16 deletions clients/admin-ui/src/features/config-wizard/ScanResults.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,19 +20,14 @@ import { useAPIHelper } from "~/features/common/hooks";
import { useSystemOrDatamapRoute } from "~/features/common/hooks/useSystemOrDatamapRoute";
import WarningModal from "~/features/common/modals/WarningModal";
import { SystemsCheckboxTable } from "~/features/common/SystemsCheckboxTable";
import {
setSystemsToClassify,
useUpsertSystemsMutation,
} from "~/features/system";
import { useUpsertSystemsMutation } from "~/features/system";
import { System } from "~/types/api";

import {
changeStep,
reset,
selectAddSystemsMethod,
selectSystemsForReview,
} from "./config-wizard.slice";
import { SystemMethods } from "./types";

const ALL_COLUMNS: ColumnMetadata[] = [
{ name: "Name", attribute: "name" },
Expand All @@ -55,7 +50,6 @@ const ScanResults = () => {
const [selectedSystems, setSelectedSystems] = useState<System[]>(systems);
const [selectedColumns, setSelectedColumns] =
useState<ColumnMetadata[]>(ALL_COLUMNS);
const method = useAppSelector(selectAddSystemsMethod);
const { handleError } = useAPIHelper();

/**
Expand All @@ -77,15 +71,6 @@ const ScanResults = () => {
return handleError(response.error);
}

/*
* Eventually, all scanners will go through some sort of classify flow.
* But for now, only the data flow scanner does
*/
if (method === SystemMethods.DATA_FLOW) {
dispatch(setSystemsToClassify(selectedSystems));
return navigateAndReset("/classify-systems");
}

return navigateAndReset(systemOrDatamapRoute);
};

Expand Down
20 changes: 14 additions & 6 deletions clients/admin-ui/src/features/configure-consent/AddVendor.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,10 @@ import {
selectDictEntry,
useGetAllDictionaryEntriesQuery,
} from "~/features/plus/plus.slice";
import { selectAllSystems, useCreateSystemMutation } from "~/features/system";
import {
useCreateSystemMutation,
useLazyGetSystemsQuery,
} from "~/features/system";
import {
selectLockedForGVL,
selectSuggestions,
Expand Down Expand Up @@ -64,25 +67,30 @@ const AddVendor = ({

const dispatch = useAppDispatch();

const systems = useAppSelector(selectAllSystems);
const [getSystemQueryTrigger] = useLazyGetSystemsQuery();

const ValidationSchema = useMemo(
() =>
Yup.object().shape({
name: Yup.string()
.required()
.label("Vendor name")
.test("is-unique", "", (value, context) => {
const takenSystemNames = systems.map((s) => s.name);
if (takenSystemNames.some((name) => name === value)) {
.test("is-unique", "", async (value, context) => {
const { data } = await getSystemQueryTrigger({
page: 1,
size: 10,
search: value,
});
const similarSystemNames = data?.items || [];
if (similarSystemNames.some((s) => s.name === value)) {
return context.createError({
message: `You already have a vendor called "${value}". Please specify a unique name for this vendor.`,
});
}
return true;
}),
}),
[systems]
[getSystemQueryTrigger]
);

// Subscribe and get dictionary values
Expand Down
15 changes: 0 additions & 15 deletions clients/admin-ui/src/features/plus/plus.slice.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ import {
} from "~/features/dataset/dataset.slice";
import { CreateSaasConnectionConfig } from "~/features/datastore-connections";
import { CreateSaasConnectionConfigResponse } from "~/features/datastore-connections/types";
import { selectSystemsToClassify } from "~/features/system";
import {
AllowList,
AllowListUpdate,
Expand Down Expand Up @@ -507,15 +506,6 @@ export const selectDatasetClassifyInstances = createSelector(
({ data: instances }) => instances ?? emptyClassifyInstances
);

export const selectSystemClassifyInstances = createSelector(
[(state) => state, selectSystemsToClassify],
(state, systems) =>
plusApi.endpoints.getAllClassifyInstances.select({
resource_type: GenerateTypes.SYSTEMS,
fides_keys: systems?.map((s) => s.fides_key),
})(state)?.data ?? emptyClassifyInstances
);

const emptyClassifyInstanceMap: Map<string, ClassifyInstanceResponseValues> =
new Map();

Expand All @@ -537,11 +527,6 @@ export const selectDatasetClassifyInstanceMap = createSelector(
(instances) => instancesToMap(instances)
);

export const selectSystemClassifyInstanceMap = createSelector(
selectSystemClassifyInstances,
(instances) => instancesToMap(instances)
);

/**
* This is the root of ClassifyInstance selectors that parallel the dataset's structure. These used
* the cached getClassifyDataset response state, which is a query using the "active" dataset's
Expand Down
Loading
Loading