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

[#569, #570] Organization setup #719

Merged
merged 49 commits into from
Jun 8, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
49 commits
Select commit Hold shift + click to select a range
ff085f0
Initial
May 23, 2022
5236d16
Put wizard on own route temp
May 25, 2022
925bee9
Merge branch 'main' into config-page
LKCSmith May 25, 2022
e28af1f
Resolve missing component
May 25, 2022
3d6f78e
Lint
May 25, 2022
a584cc8
Lint again
May 25, 2022
f07cb07
Merge branch 'main' into config-page
May 26, 2022
7ea95b5
Initial
May 26, 2022
5e561b4
Move setup to features under config wizard directory
May 26, 2022
19ee00a
Lint
May 26, 2022
68479d3
Fix conflicts
May 26, 2022
8185fe8
Add modal component
May 26, 2022
3f422bb
Setup
May 26, 2022
77a5dc0
Start stepper and tooltips
May 27, 2022
5c2ca81
Pr feedback;
May 27, 2022
f152284
Merge branch 'main' into config-page
May 27, 2022
72401ab
Adjust after merge main;
May 27, 2022
cb654cb
Remove comment
May 27, 2022
5ed9223
Lint
May 27, 2022
151b347
Merge conflicts
May 28, 2022
1016879
Route
May 28, 2022
b68bdd4
Add icons for stepper
May 28, 2022
73257b5
First step
May 28, 2022
3a90856
Divider
May 28, 2022
2ef98cf
Stepper circles
May 30, 2022
f20e080
Some layout changes;
May 30, 2022
d960a36
Adjust
May 30, 2022
4e1d648
Fix conflicts
Jun 1, 2022
a9e0ca4
Add circle icon and set-up header without username
Jun 1, 2022
128f7e3
Page split
Jun 1, 2022
a38c8f0
More css changes
Jun 1, 2022
7a4e347
Tooltip fix
Jun 1, 2022
c386478
Form validation
Jun 1, 2022
816387d
Walkthrough stepper logic
Jun 1, 2022
d914580
Lint
Jun 1, 2022
68555e9
Merge branch 'main' into organization-setup
Jun 1, 2022
1d09755
PR Feedback
Jun 6, 2022
5001ec7
Lint
Jun 6, 2022
4fa665a
Add organization slice
Jun 6, 2022
1cf5c84
Slice
Jun 6, 2022
f72aa1d
lint
Jun 6, 2022
028cfd5
Slice
Jun 7, 2022
e23a390
Link
Jun 7, 2022
b30514f
API
Jun 7, 2022
a7f74ab
Lint
Jun 7, 2022
89ce85d
Merge branch 'main' into organization-setup
Jun 7, 2022
434a62a
PR Feedback
Jun 8, 2022
975c8ed
Remove number from call
Jun 8, 2022
03f45d1
Lint
Jun 8, 2022
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
59 changes: 37 additions & 22 deletions clients/admin-ui/src/features/common/Header.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,10 @@ import NextLink from "next/link";
import { signOut } from "next-auth/react";
import React from "react";

import { UserIcon } from "./Icon";
import { QuestionIcon, UserIcon } from "./Icon";

interface HeaderProps {
username: string;
username?: string;
}

const Header: React.FC<HeaderProps> = ({ username }) => (
Expand All @@ -37,27 +37,42 @@ const Header: React.FC<HeaderProps> = ({ username }) => (
</Link>
</NextLink>
<Flex alignItems="center">
<Menu>
<MenuButton as={Button} size="sm" variant="ghost">
<UserIcon color="gray.700" />
</MenuButton>
<MenuList shadow="xl">
<Stack px={3} py={2} spacing={0}>
<Text fontWeight="medium">{username}</Text>
<Text fontSize="sm" color="gray.600">
Administrator
</Text>
</Stack>
<MenuDivider />
<MenuItem
px={3}
_focus={{ color: "complimentary.500", bg: "gray.100" }}
onClick={() => signOut()}
{username ? (
<Menu>
<MenuButton as={Button} size="sm" variant="ghost">
<UserIcon color="gray.700" />
</MenuButton>

<MenuList shadow="xl">
<Stack px={3} py={2} spacing={0}>
<Text fontWeight="medium">{username}</Text>
<Text fontSize="sm" color="gray.600">
Administrator
</Text>
</Stack>
<MenuDivider />
<MenuItem
px={3}
_focus={{ color: "complimentary.500", bg: "gray.100" }}
onClick={() => signOut()}
>
Sign out
</MenuItem>
</MenuList>
</Menu>
) : (
<>
<QuestionIcon boxSize={5} />
<Link
href="https://ethyca.github.io/fides/1.6.0/"
isExternal
color="gray.700"
fontWeight="400"
>
Sign out
</MenuItem>
</MenuList>
</Menu>
Get help (Fides community)
</Link>
</>
)}
</Flex>
</Flex>
</header>
Expand Down
7 changes: 7 additions & 0 deletions clients/admin-ui/src/features/common/Icon/Question.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import { createIcon } from "@fidesui/react";

export default createIcon({
displayName: "UserIcon",
viewBox: "0 0 19 18",
d: "M9.43359 1.5C5.29102 1.5 1.93359 4.85742 1.93359 9C1.93359 13.1426 5.29102 16.5 9.43359 16.5C13.5762 16.5 16.9336 13.1426 16.9336 9C16.9336 4.85742 13.5762 1.5 9.43359 1.5ZM9.43359 13.2188C8.90625 13.2188 8.49609 12.8086 8.49609 12.2812C8.49609 11.7539 8.87988 11.3438 9.43359 11.3438C9.93457 11.3438 10.3711 11.7539 10.3711 12.2812C10.3711 12.8086 9.93457 13.2188 9.43359 13.2188ZM11.458 9.05859L10.1367 9.87891V9.9375C10.1367 10.3184 9.81445 10.6406 9.43359 10.6406C9.05273 10.6406 8.73047 10.3184 8.73047 9.9375V9.46875C8.73047 9.23438 8.84766 9 9.08203 8.85352L10.752 7.85742C10.957 7.74023 11.0742 7.53516 11.0742 7.30078C11.0742 6.94922 10.7549 6.65625 10.4033 6.65625H8.90625C8.52832 6.65625 8.26172 6.94922 8.26172 7.30078C8.26172 7.68164 7.93945 8.00391 7.55859 8.00391C7.17773 8.00391 6.85547 7.68164 6.85547 7.30078C6.85547 6.1582 7.76367 5.25 8.87988 5.25H10.377C11.5723 5.25 12.4805 6.1582 12.4805 7.30078C12.4805 8.00391 12.0996 8.67773 11.458 9.05859Z",
});
18 changes: 18 additions & 0 deletions clients/admin-ui/src/features/common/Icon/StepperCircle.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import { createIcon } from "@fidesui/react";

export default createIcon({
displayName: "StepperCircleIcon",
viewBox: "0 0 24 24",
path: (
<svg
width="24"
height="24"
viewBox="0 0 24 24"
fill="none"
xmlns="http://www.w3.org/2000/svg"
>
<circle cx="12" cy="12" r="9" stroke="#EDF2F7" strokeWidth="2" />
<circle cx="12" cy="12" r="4" fill="#EDF2F7" />
</svg>
),
});
17 changes: 17 additions & 0 deletions clients/admin-ui/src/features/common/Icon/VerticalLine.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import { createIcon } from "@fidesui/react";

export default createIcon({
displayName: "VerticalLineIcon",
viewBox: "0 0 2 49",
path: (
<svg
width="2"
height="49"
viewBox="0 0 2 49"
fill="none"
xmlns="http://www.w3.org/2000/svg"
>
<line x1="1" y1="0.125" x2="1" y2="49" stroke="#EDF2F7" strokeWidth="2" />
</svg>
),
});
3 changes: 3 additions & 0 deletions clients/admin-ui/src/features/common/Icon/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,8 @@ export { default as CloseSolidIcon } from "./CloseSolid";
export { default as DownloadSolidIcon } from "./DownloadSolid";
export { default as GearIcon } from "./Gear";
export { default as MoreIcon } from "./More";
export { default as QuestionIcon } from "./Question";
export { default as SearchLineIcon } from "./SearchLine";
export { default as StepperCircleIcon } from "./StepperCircle";
export { default as UserIcon } from "./User";
export { default as VerticalLineIcon } from "./VerticalLine";
37 changes: 37 additions & 0 deletions clients/admin-ui/src/features/common/Stepper.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
import { Box, Stack, Text } from "@fidesui/react";
import React from "react";

import { StepperCircleIcon, VerticalLineIcon } from "./Icon";

interface Props {
activeStep: number | null;
steps: { number: number; name: string }[];
}

const Stepper = ({ activeStep, steps }: Props) => (
<Stack direction={["column", "row"]} w="100%">
<Stack alignItems="center" direction="column" spacing={0}>
{steps.map((step) => (
<React.Fragment key={step.number}>
<StepperCircleIcon
boxSize={8}
stroke={activeStep === step.number ? "secondary.500" : "inherit"}
/>
{step.number !== steps.length ? (
<VerticalLineIcon boxSize={20} />
) : null}
</React.Fragment>
))}
</Stack>
<Stack direction="column" justify="space-between">
{steps.map((step) => (
<Box key={step.name}>
<Text color="gray.800">Step {step.number}</Text>
<Text color="gray.500">{step.name}</Text>
</Box>
))}
</Stack>
</Stack>
);

export default Stepper;
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
import { Box, Button, Divider, Stack } from "@fidesui/react";
import { useRouter } from "next/router";
import React, { useState } from "react";

import { CloseSolidIcon } from "~/features/common/Icon";

import Stepper from "../common/Stepper";
import STEPS from "./constants";
import OrganizationInfoForm from "./OrganizationInfoForm";

const ConfigWizardWalkthrough = () => {
const router = useRouter();
const [step, setStep] = useState<number>(1);

const handleCancelSetup = () => {
// Save progress
allisonking marked this conversation as resolved.
Show resolved Hide resolved
router.push("/");
};

const handleChangeStep = (formStep: number) => {
// Save info between steps for submission to API with all info
// or are they different api calls at each step?
allisonking marked this conversation as resolved.
Show resolved Hide resolved
if (formStep && step !== STEPS.length) {
setStep(formStep + 1);
}
};

return (
<>
<Box bg="white">
<Button
bg="transparent"
fontWeight="500"
m={2}
ml={6}
onClick={handleCancelSetup}
>
<CloseSolidIcon /> Cancel setup
</Button>
</Box>
<Divider orientation="horizontal" />
<Stack direction={["column", "row"]}>
<Stack bg="white" height="100vh" maxW="60%">
<Stack mt={10} mb={10} direction="row" spacing="24px">
<Box>
<Stepper activeStep={step} steps={STEPS} />
</Box>
{step === 1 ? (
<OrganizationInfoForm
handleChangeStep={(organizationStep: number) =>
LKCSmith marked this conversation as resolved.
Show resolved Hide resolved
handleChangeStep(organizationStep)
}
/>
) : null}
</Stack>
</Stack>
</Stack>
</>
);
};

export default ConfigWizardWalkthrough;
Loading