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

Move config wizard system forms to system directory #1097

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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 @@ -34,6 +34,7 @@ The types of changes are:

* Changed behavior of `load_default_taxonomy` to append instead of upsert [#1040](https://github.com/ethyca/fides/pull/1040)
* Changed behavior of adding privacy declarations to decouple the actions of the "add" and "next" buttons [#1086](https://github.com/ethyca/fides/pull/1086)
* Moved system related UI components from the `config-wizard` directory to the `system` directory [#1097](https://github.com/ethyca/fides/pull/1097)

### Fixed

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@ import React from "react";

import { useAppDispatch, useAppSelector } from "~/app/hooks";
import { CloseSolidIcon } from "~/features/common/Icon";
import DescribeSystemStep from "~/features/system/DescribeSystemStep";
import PrivacyDeclarationStep from "~/features/system/PrivacyDeclarationStep";
import ReviewSystemStep from "~/features/system/ReviewSystemStep";
import SystemRegisterSuccess from "~/features/system/SystemRegisterSuccess";
import { System } from "~/types/api";

import HorizontalStepper from "../common/HorizontalStepper";
Expand All @@ -19,12 +23,8 @@ import {
setSystemToCreate,
} from "./config-wizard.slice";
import { HORIZONTAL_STEPS, STEPS } from "./constants";
import DescribeSystemsForm from "./DescribeSystemsForm";
import OrganizationInfoForm from "./OrganizationInfoForm";
import PrivacyDeclarationForm from "./PrivacyDeclarationForm";
import ReviewSystemForm from "./ReviewSystemForm";
import ScanResultsForm from "./ScanResultsForm";
import SystemRegisterSuccess from "./SystemRegisterSuccess";
import ViewYourDataMapPage from "./ViewYourDataMapPage";

const ConfigWizardWalkthrough = () => {
Expand Down Expand Up @@ -81,22 +81,22 @@ const ConfigWizardWalkthrough = () => {
/>
) : null}
{reviewStep === 1 && (
<DescribeSystemsForm
<DescribeSystemStep
onCancel={handleCancelSetup}
onSuccess={handleSuccess}
abridged
/>
)}
{reviewStep === 2 && system && (
<PrivacyDeclarationForm
<PrivacyDeclarationStep
system={system}
onCancel={handleCancelSetup}
onSuccess={handleSuccess}
abridged
/>
)}
{reviewStep === 3 && system && (
<ReviewSystemForm
<ReviewSystemStep
system={system}
onCancel={handleCancelSetup}
onSuccess={() => dispatch(changeReviewStep())}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ interface Props {
abridged?: boolean;
}

const DescribeSystemsForm = ({ onCancel, onSuccess, abridged }: Props) => {
const DescribeSystemStep = ({ onCancel, onSuccess, abridged }: Props) => {
const [createSystem] = useCreateSystemMutation();
const [isLoading, setIsLoading] = useState(false);
const { data: systems } = useGetAllSystemsQuery();
Expand Down Expand Up @@ -217,4 +217,4 @@ const DescribeSystemsForm = ({ onCancel, onSuccess, abridged }: Props) => {
</Formik>
);
};
export default DescribeSystemsForm;
export default DescribeSystemStep;
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import {
} from "~/features/common/form/inputs";
import { enumToOptions } from "~/features/common/helpers";
import QuestionTooltip from "~/features/common/QuestionTooltip";
import type { FormValues } from "~/features/config-wizard/DescribeSystemsForm";
import type { FormValues } from "~/features/system/DescribeSystemStep";
import { DataResponsibilityTitle } from "~/types/api";

const dataResponsibilityOptions = enumToOptions(DataResponsibilityTitle);
Expand Down
14 changes: 7 additions & 7 deletions clients/ctl/admin-ui/src/features/system/ManualSystemFlow.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@ import { useState } from "react";

import { System } from "~/types/api";

import DescribeSystemsForm from "../config-wizard/DescribeSystemsForm";
import PrivacyDeclarationForm from "../config-wizard/PrivacyDeclarationForm";
import ReviewSystemForm from "../config-wizard/ReviewSystemForm";
import SystemRegisterSuccess from "../config-wizard/SystemRegisterSuccess";
import DescribeSystemStep from "./DescribeSystemStep";
import PrivacyDeclarationStep from "./PrivacyDeclarationStep";
import ReviewSystemStep from "./ReviewSystemStep";
import SystemRegisterSuccess from "./SystemRegisterSuccess";

const STEPS = ["Describe", "Declare", "Review"];

Expand Down Expand Up @@ -72,20 +72,20 @@ const ManualSystemFlow = () => {
</GridItem>
<GridItem w="75%">
{currentStepIndex === 0 ? (
<DescribeSystemsForm
<DescribeSystemStep
onSuccess={handleSuccess}
onCancel={returnToNew}
/>
) : null}
{currentStepIndex === 1 && newSystem ? (
<PrivacyDeclarationForm
<PrivacyDeclarationStep
system={newSystem}
onSuccess={handleSuccess}
onCancel={returnToNew}
/>
) : null}
{currentStepIndex === 2 && newSystem ? (
<ReviewSystemForm
<ReviewSystemStep
system={newSystem}
onCancel={returnToNew}
onSuccess={() => setCurrentStepIndex(currentStepIndex + 1)}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,30 +5,15 @@ import {
AccordionItem,
AccordionPanel,
Box,
Grid,
GridItem,
Stack,
Text,
} from "@fidesui/react";
import { ReactNode } from "react";

import TaxonomyEntityTag from "~/features/taxonomy/TaxonomyEntityTag";
import { PrivacyDeclaration } from "~/types/api";

const DeclarationItem = ({
label,
children,
}: {
label: string;
children: ReactNode;
}) => (
<Grid templateColumns="1fr 2fr" data-testid={`declaration-${label}`}>
<GridItem>
<Text color="gray.600">{label}</Text>
</GridItem>
<GridItem>{children}</GridItem>
</Grid>
);
import { DeclarationItem } from "./form-layout";

interface Props {
privacyDeclaration: PrivacyDeclaration;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,11 @@ import React, { Fragment, useState } from "react";
import * as Yup from "yup";

import { useAppSelector } from "~/app/hooks";
import {
CustomMultiSelect,
CustomSelect,
CustomTextInput,
} from "~/features/common/form/inputs";
import { getErrorMessage, isErrorResult } from "~/features/common/helpers";
import { AddIcon } from "~/features/common/Icon";
import {
Expand All @@ -26,14 +31,9 @@ import {
} from "~/features/taxonomy/taxonomy.slice";
import { PrivacyDeclaration, System } from "~/types/api";

import {
CustomMultiSelect,
CustomSelect,
CustomTextInput,
} from "../common/form/inputs";
import PrivacyDeclarationFormExtension from "../system/PrivacyDeclarationFormExtension";
import { useUpdateSystemMutation } from "../system/system.slice";
import PrivacyDeclarationAccordion from "./PrivacyDeclarationAccordion";
import PrivacyDeclarationFormExtension from "./PrivacyDeclarationFormExtension";
import { useUpdateSystemMutation } from "./system.slice";

type FormValues = PrivacyDeclaration;

Expand Down Expand Up @@ -63,7 +63,7 @@ interface Props {
abridged?: boolean;
}

const PrivacyDeclarationForm = ({
const PrivacyDeclarationStep = ({
system,
onCancel,
onSuccess,
Expand Down Expand Up @@ -274,4 +274,4 @@ const PrivacyDeclarationForm = ({
);
};

export default PrivacyDeclarationForm;
export default PrivacyDeclarationStep;
Original file line number Diff line number Diff line change
@@ -1,25 +1,9 @@
import { Box, FormLabel, Grid, GridItem, Text } from "@fidesui/react";
import React, { ReactNode } from "react";
import { Box, FormLabel, Text } from "@fidesui/react";

import TaxonomyEntityTag from "~/features/taxonomy/TaxonomyEntityTag";
import { System } from "~/types/api";

export const ReviewItem = ({
label,
children,
}: {
label: string;
children: ReactNode;
}) => (
<Grid templateColumns="1fr 2fr" data-testid={`review-${label}`}>
<GridItem>
<FormLabel fontWeight="semibold" m={0}>
{label}:
</FormLabel>
</GridItem>
<GridItem>{children}</GridItem>
</Grid>
);
import { ReviewItem } from "./form-layout";

const ReviewSystemFormExtension = ({ system }: { system: System }) => (
<>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,11 @@ import {
import { Form, Formik } from "formik";
import React, { Fragment } from "react";

import ReviewSystemFormExtension, {
ReviewItem,
} from "~/features/system/ReviewSystemFormExtension";
import ReviewSystemFormExtension from "~/features/system/ReviewSystemFormExtension";
import { System } from "~/types/api";

import TaxonomyEntityTag from "../taxonomy/TaxonomyEntityTag";
import { ReviewItem } from "./form-layout";
import PrivacyDeclarationAccordion from "./PrivacyDeclarationAccordion";

interface Props {
Expand All @@ -25,7 +24,7 @@ interface Props {
abridged?: boolean;
}

const ReviewSystemForm = ({ system, onCancel, onSuccess, abridged }: Props) => {
const ReviewSystemStep = ({ system, onCancel, onSuccess, abridged }: Props) => {
const handleSubmit = () => {
onSuccess();
};
Expand Down Expand Up @@ -100,4 +99,4 @@ const ReviewSystemForm = ({ system, onCancel, onSuccess, abridged }: Props) => {
</Formik>
);
};
export default ReviewSystemForm;
export default ReviewSystemStep;
34 changes: 34 additions & 0 deletions clients/ctl/admin-ui/src/features/system/form-layout.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
import { FormLabel, Grid, GridItem, Text } from "@fidesui/react";
import React, { ReactNode } from "react";

export const ReviewItem = ({
label,
children,
}: {
label: string;
children: ReactNode;
}) => (
<Grid templateColumns="1fr 2fr" data-testid={`review-${label}`}>
<GridItem>
<FormLabel fontWeight="semibold" m={0}>
{label}:
</FormLabel>
</GridItem>
<GridItem>{children}</GridItem>
</Grid>
);

export const DeclarationItem = ({
label,
children,
}: {
label: string;
children: ReactNode;
}) => (
<Grid templateColumns="1fr 2fr" data-testid={`declaration-${label}`}>
<GridItem>
<Text color="gray.600">{label}</Text>
</GridItem>
<GridItem>{children}</GridItem>
</Grid>
);