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

Dsr error handling configure alerts #1895

Merged
merged 95 commits into from
Dec 14, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
95 commits
Select commit Hold shift + click to select a range
2bc9411
1203 - Individually select and reprocess DSRs that have errored #1203
chriscalhoun1974 Oct 12, 2022
07ef901
Merge branch 'main' into 1203-individually-select-and-reprocess-DSRs-…
chriscalhoun1974 Oct 12, 2022
1a82824
Fix Typescript errors for consent cookie
NevilleS Oct 15, 2022
c22dee2
Merge branch 'main' into 1203-individually-select-and-reprocess-DSRs-…
chriscalhoun1974 Oct 15, 2022
42f693e
Merge remote-tracking branch 'origin/ns-fix-consent-typescript-errors…
chriscalhoun1974 Oct 16, 2022
28d3e33
Merge branch 'main' into 1203-individually-select-and-reprocess-DSRs-…
chriscalhoun1974 Oct 17, 2022
9099cef
Add bulk restart from failure endpoint endpoint
Oct 17, 2022
68a8fa1
Fix mypy error
Oct 17, 2022
d446fe7
Merge remote-tracking branch 'origin/ps-bulk-reprocess' into 1203-ind…
chriscalhoun1974 Oct 18, 2022
776e79f
1205 - Bulk select and reprocess DSRs that have errored
chriscalhoun1974 Oct 19, 2022
9af2ae3
1205 - Bulk select and reprocess DSRs that have errored
chriscalhoun1974 Oct 19, 2022
4585016
Added generated api models
chriscalhoun1974 Oct 19, 2022
43c986a
Updated CHANGELOG.md file
chriscalhoun1974 Oct 19, 2022
3c96ac6
Resolved bug with clicking a single Error status checkbox not uncheck…
chriscalhoun1974 Oct 19, 2022
b7854cb
Added additional toast notifications for DSR Error bulk reprocessing
chriscalhoun1974 Oct 20, 2022
9688452
Merge branch 'main' into dsr-error-handling-reprocess
chriscalhoun1974 Oct 20, 2022
3b85284
Code review feedback
chriscalhoun1974 Oct 21, 2022
e412d0e
Code review feedback
chriscalhoun1974 Oct 21, 2022
4231e29
Code review feedback
chriscalhoun1974 Oct 21, 2022
460298a
Code review feedback
chriscalhoun1974 Oct 21, 2022
89de341
Code review feedback: Refactoring
chriscalhoun1974 Oct 21, 2022
6ee717b
Update to userAlert hook
chriscalhoun1974 Oct 21, 2022
b31c35f
Merge branch 'main' into dsr-error-handling-reprocess
chriscalhoun1974 Oct 21, 2022
a31df96
Merge branch 'main' into dsr-error-handling-reprocess
chriscalhoun1974 Oct 24, 2022
596d446
Rollback package-lock.json file commit
chriscalhoun1974 Oct 24, 2022
d03e980
Revert "Merge remote-tracking branch 'origin/ps-bulk-reprocess' into …
chriscalhoun1974 Oct 24, 2022
dd7c5c3
Merge branch 'main' into dsr-error-handling-reprocess
chriscalhoun1974 Oct 24, 2022
156c602
Resolve high security vulnerability NPM dependency (npm audit fix)
chriscalhoun1974 Oct 24, 2022
0c73359
Changed the casing on the Create new connection button
chriscalhoun1974 Oct 24, 2022
97dee20
Changed the casing on the Delete connection button
chriscalhoun1974 Oct 24, 2022
3fb2671
Added More button and Configure Alerts drawer
chriscalhoun1974 Oct 25, 2022
a6e95d6
Merge branch 'main' into dsr-error-handling-configure-alerts
chriscalhoun1974 Oct 25, 2022
ffc67ae
Code review feedback
chriscalhoun1974 Oct 25, 2022
0f41b74
Merge branch 'main' into dsr-error-handling-reprocess
chriscalhoun1974 Oct 25, 2022
b8a717b
Merge branch 'dsr-error-handling-reprocess' into dsr-error-handling-c…
chriscalhoun1974 Oct 25, 2022
ee1b4b4
Updated ConfigureAlerts component
chriscalhoun1974 Oct 25, 2022
e89e569
Merge branch 'main' into dsr-error-handling-configure-alerts
chriscalhoun1974 Oct 27, 2022
3b5a1b4
Merge branch 'main' into dsr-error-handling-configure-alerts
chriscalhoun1974 Oct 28, 2022
831d786
1492 - DSR configure alters (FE)
chriscalhoun1974 Oct 31, 2022
5080eec
Merge branch 'main' into dsr-error-handling-configure-alerts
chriscalhoun1974 Oct 31, 2022
a093c14
Merge branch 'main' into dsr-error-handling-configure-alerts
chriscalhoun1974 Oct 31, 2022
0e09725
Added configureAlertsFlag feature flag
chriscalhoun1974 Oct 31, 2022
d04e990
Updates to ConfigureAlerts component
chriscalhoun1974 Nov 1, 2022
d99c48b
Updates to ConfigureAlerts component
chriscalhoun1974 Nov 1, 2022
900dc83
WIP
Nov 3, 2022
6c86ea3
Merge branch 'main' into dsr-error-handling-configure-alerts
chriscalhoun1974 Nov 4, 2022
556f6e6
Merge branch 'main' into dsr-error-handling-configure-alerts
chriscalhoun1974 Nov 7, 2022
5de5297
1492 - DSR configure alerts (FE)
chriscalhoun1974 Nov 7, 2022
eea8706
Add routes
Nov 7, 2022
ca6e0c6
Merge remote-tracking branch 'origin/main' into ps-error-email-alerts
Nov 7, 2022
2dab40f
Fix database model
Nov 8, 2022
66271a7
1492 - DSR configure alerts (FE)
chriscalhoun1974 Nov 9, 2022
4d2265e
1492 - DSR configure alerts (FE)
chriscalhoun1974 Nov 9, 2022
ac0b2f5
1218 - DSR Notifications (toast)
chriscalhoun1974 Nov 9, 2022
4ddf970
Merge branch 'main' into dsr-error-handling-configure-alerts
chriscalhoun1974 Nov 9, 2022
378952c
Merge remote-tracking branch 'origin/main' into ps-error-email-alerts
Nov 14, 2022
fa8c6f6
Merge alembic heads
Nov 14, 2022
9dba14b
Add table to track error message send status
Nov 15, 2022
74eed91
Merge remote-tracking branch 'origin/main' into ps-error-email-alerts
Nov 15, 2022
73c708d
Dispatch email
Nov 16, 2022
5514c32
Add notification info endpoint tests
Nov 16, 2022
4a356d8
Fix circular dependency
Nov 16, 2022
1d7a4cd
Merge branch 'main' into dsr-error-handling-configure-alerts
chriscalhoun1974 Nov 16, 2022
add8d79
Refactor to remove circular import
Nov 16, 2022
27608c2
Add tests
Nov 16, 2022
01691fe
Add postman routes
Nov 16, 2022
3484251
Annotate tables
Nov 16, 2022
12f650b
Update changelog
Nov 16, 2022
a6e7a35
1218 - DSR Notifications (toast)
chriscalhoun1974 Nov 18, 2022
1be9371
Merge branch 'main' into dsr-error-handling-configure-alerts
chriscalhoun1974 Nov 18, 2022
bf5c887
Merge branch 'main' into dsr-error-handling-configure-alerts
chriscalhoun1974 Nov 22, 2022
9cd53ac
Merge branch 'main' into dsr-error-handling-configure-alerts
chriscalhoun1974 Nov 23, 2022
26c5721
Merge branch 'main' into dsr-error-handling-configure-alerts
chriscalhoun1974 Nov 28, 2022
3dda877
Merge remote-tracking branch 'origin/ps-error-email-alerts' into dsr-…
chriscalhoun1974 Nov 28, 2022
f8ef6ac
Wiring up FE to use DSR configure alerts (BE)#1493
chriscalhoun1974 Nov 29, 2022
79448f4
Merge branch 'main' into dsr-error-handling-configure-alerts
chriscalhoun1974 Nov 29, 2022
c23b13a
Updated CHANGELOG.md file
chriscalhoun1974 Nov 29, 2022
dba5868
Updated CHANGELOG.md file
chriscalhoun1974 Nov 29, 2022
da57728
Updated CHANGELOG.md file
chriscalhoun1974 Nov 29, 2022
860a92a
Merge branch 'main' into dsr-error-handling-configure-alerts
chriscalhoun1974 Nov 30, 2022
847cb0d
Merge remote-tracking branch 'origin/main' into dsr-error-handling-co…
Dec 1, 2022
a4ac0d5
Merge alembic heads
Dec 1, 2022
207f292
Merge remote-tracking branch 'origin/main' into ps-error-email-alerts
Dec 2, 2022
7555fb6
Fix errors after merging main
Dec 2, 2022
c147050
Restore lost functionality after merging main
Dec 2, 2022
15ddb5a
Merge branch 'ps-error-email-alerts' into dsr-error-handling-configur…
Dec 2, 2022
e0d0f5b
Merge branch 'main' into dsr-error-handling-configure-alerts
chriscalhoun1974 Dec 6, 2022
18489e7
Bug fixes
chriscalhoun1974 Dec 8, 2022
8f25768
Applied prettier formatting
chriscalhoun1974 Dec 8, 2022
7bd0c08
Merge branch 'main' into dsr-error-handling-configure-alerts
chriscalhoun1974 Dec 8, 2022
dca4995
Merge from main branch
chriscalhoun1974 Dec 9, 2022
8d91085
Remove duplicate function
Dec 9, 2022
792db51
Merge branch 'main' into dsr-error-handling-configure-alerts
chriscalhoun1974 Dec 14, 2022
09e6325
Removed configureAlertsFlag release flag
chriscalhoun1974 Dec 14, 2022
68dce06
Updated CHANGELOG.md file
chriscalhoun1974 Dec 14, 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
9 changes: 8 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,12 @@ The types of changes are:

## [Unreleased](https://github.com/ethyca/fides/compare/2.2.2...main)

### Added
* Send email alerts on privacy request failures once the specified threshold is reached. [#1793](https://github.com/ethyca/fides/pull/1793)
* DSR Notifications (toast) [#1895](https://github.com/ethyca/fides/pull/1895)
* DSR configure alerts btn [#1895](https://github.com/ethyca/fides/pull/1895)
* DSR configure alters (FE) [#1895](https://github.com/ethyca/fides/pull/1895)

### Changed

* Updated to use `loguru` logging library throughout codebase [#2031](https://github.com/ethyca/fides/pull/2031)
Expand Down Expand Up @@ -68,6 +74,7 @@ The types of changes are:
* Enable the onboarding flow [#1836](https://github.com/ethyca/fides/pull/1836)
* Access and erasure support for Fullstory API [#1821](https://github.com/ethyca/fides/pull/1821)
* Add function to poll privacy request for completion [#1860](https://github.com/ethyca/fides/pull/1860)
* Added rescan flow for the data flow scanner [#1844](https://github.com/ethyca/fides/pull/1844)
* Add rescan flow for the data flow scanner [#1844](https://github.com/ethyca/fides/pull/1844)
* Add Fides connector to support parent-child Fides deployments [#1861](https://github.com/ethyca/fides/pull/1861)
* Classification UI now polls for updates to classifications [#1908](https://github.com/ethyca/fides/pull/1908)
Expand Down Expand Up @@ -96,7 +103,7 @@ The types of changes are:
### Added

* Classification flow for system data flows
* Classification is now triggered as part of data flow scanning
* Classification is now triggered as part of data flow scanning
* Include `ingress` and `egress` fields on system export and `datamap/` endpoint [#1740](https://github.com/ethyca/fides/pull/1740)
* Repeatable unique identifier for dataset fides_keys and metadata [#1786](https://github.com/ethyca/fides/pull/1786)
* Adds SMS support for identity verification notifications [#1726](https://github.com/ethyca/fides/pull/1726)
Expand Down
44 changes: 32 additions & 12 deletions clients/admin-ui/src/features/common/hooks/useAlert.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import {
useToast,
UseToastOptions,
} from "@fidesui/react";
import { MouseEventHandler } from "react";

/**
* Custom hook for toast notifications
Expand All @@ -24,12 +25,16 @@ export const useAlert = () => {
const errorAlert = (
description: string | JSX.Element,
title?: string,
options?: UseToastOptions
addedOptions?: UseToastOptions
) => {
toast({
...options,
position: options?.position || DEFAULT_POSITION,
render: ({ onClose }) => (
const options = {
...addedOptions,
position: addedOptions?.position || DEFAULT_POSITION,
render: ({
onClose,
}: {
onClose: MouseEventHandler<HTMLButtonElement> | undefined;
}) => (
<Alert alignItems="normal" status="error">
<AlertIcon />
<Box>
Expand All @@ -45,7 +50,13 @@ export const useAlert = () => {
/>
</Alert>
),
});
};

if (addedOptions?.id && toast.isActive(addedOptions.id)) {
toast.update(addedOptions.id, options);
} else {
toast(options);
}
};

/**
Expand All @@ -55,12 +66,16 @@ export const useAlert = () => {
const successAlert = (
description: string,
title?: string,
options?: UseToastOptions
addedOptions?: UseToastOptions
) => {
toast({
...options,
position: options?.position || DEFAULT_POSITION,
render: ({ onClose }) => (
const options = {
...addedOptions,
position: addedOptions?.position || DEFAULT_POSITION,
render: ({
onClose,
}: {
onClose: MouseEventHandler<HTMLButtonElement> | undefined;
}) => (
<Alert alignItems="normal" status="success" variant="subtle">
<AlertIcon />
<Box>
Expand All @@ -76,7 +91,12 @@ export const useAlert = () => {
/>
</Alert>
),
});
};
if (addedOptions?.id && toast.isActive(addedOptions.id)) {
toast.update(addedOptions.id, options);
} else {
toast(options);
}
};

return { errorAlert, successAlert };
Expand Down
113 changes: 113 additions & 0 deletions clients/admin-ui/src/features/privacy-requests/EmailChipList.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,113 @@
import {
FormControl,
FormErrorMessage,
FormLabel,
forwardRef,
Input,
Tag,
TagCloseButton,
TagLabel,
VStack,
Wrap,
} from "@fidesui/react";
import { FieldArrayRenderProps } from "formik";
import React, { useState } from "react";

const EMAIL_REGEXP = /^[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,4}$/i;
const isValidEmail = (email: string) => EMAIL_REGEXP.test(email);

type EmailChipListProps = {
isRequired: boolean;
};

const EmailChipList = forwardRef(
(
{
isRequired = false,
...props
}: FieldArrayRenderProps & EmailChipListProps,
ref
) => {
const { emails }: { emails: string[] } = props.form.values;
const [inputValue, setInputValue] = useState("");

const emailChipExists = (email: string) => emails.includes(email);

const addEmails = (emailsToAdd: string[]) => {
const validatedEmails = emailsToAdd
.map((e) => e.trim())
.filter((email) => isValidEmail(email) && !emailChipExists(email));
validatedEmails.forEach((email) => props.push(email));
setInputValue("");
};

const handleChange = (event: React.ChangeEvent<HTMLInputElement>) => {
setInputValue(event.target.value);
};

const handleKeyDown = (event: React.KeyboardEvent<HTMLInputElement>) => {
if (["Enter", "Tab", ","].includes(event.key)) {
event.preventDefault();
addEmails([inputValue]);
}
};

const handlePaste = (event: React.ClipboardEvent<HTMLInputElement>) => {
event.preventDefault();
const pastedData = event.clipboardData.getData("text");
const pastedEmails = pastedData.split(",");
addEmails(pastedEmails);
};

return (
<FormControl
alignItems="baseline"
display="inline-flex"
isInvalid={!!props.form.errors[props.name]}
isRequired={isRequired}
>
<FormLabel fontSize="md" htmlFor="email">
Email
</FormLabel>
<VStack align="flex-start" w="inherit">
{/* @ts-ignore */}
<Input
autoComplete="off"
placeholder="Type or paste email addresses separated by commas and press `Enter` or `Tab`..."
onChange={handleChange}
onKeyDown={handleKeyDown}
onPaste={handlePaste}
ref={ref}
size="sm"
type="email"
value={inputValue}
/>
<FormErrorMessage>{props.form.errors[props.name]}</FormErrorMessage>
{emails.length > 0 && (
<Wrap spacing={1} mb={3} pt="8px">
{emails.map((email, index) => (
<Tag
key={email}
borderRadius="full"
backgroundColor="primary.400"
color="white"
size="sm"
variant="solid"
>
<TagLabel>{email}</TagLabel>
<TagCloseButton
onClick={() => {
props.remove(index);
}}
/>
</Tag>
))}
</Wrap>
)}
</VStack>
</FormControl>
);
}
);

export default EmailChipList;
62 changes: 7 additions & 55 deletions clients/admin-ui/src/features/privacy-requests/RequestTable.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import { Checkbox, Flex, Table, Tbody, Th, Thead, Tr } from "@fidesui/react";
import { debounce } from "common/utils";
import React, { useCallback, useEffect, useRef, useState } from "react";
import React, { useCallback, useEffect } from "react";

import { useAppDispatch, useAppSelector } from "~/app/hooks";

Expand All @@ -14,26 +13,13 @@ import {
} from "./privacy-requests.slice";
import RequestRow from "./RequestRow";
import SortRequestButton from "./SortRequestButton";
import { PrivacyRequest, PrivacyRequestParams } from "./types";
import { PrivacyRequest } from "./types";

type RequestTableProps = {
requests?: PrivacyRequest[];
};

const useRequestTable = () => {
const RequestTable: React.FC = () => {
const dispatch = useAppDispatch();
const filters = useAppSelector(selectPrivacyRequestFilters);
const [cachedFilters, setCachedFilters] = useState(filters);
const updateCachedFilters = useRef(
debounce(
(updatedFilters: React.SetStateAction<PrivacyRequestParams>) =>
setCachedFilters(updatedFilters),
250
)
);

const { checkAll, errorRequests } = useAppSelector(selectRetryRequests);
const { data, isFetching } = useGetAllPrivacyRequestsQuery(cachedFilters);
const { data, isFetching } = useGetAllPrivacyRequestsQuery(filters);
const { items: requests, total } = data || { items: [], total: 0 };

const getErrorRequests = useCallback(
Expand Down Expand Up @@ -75,40 +61,10 @@ const useRequestTable = () => {
};

useEffect(() => {
updateCachedFilters.current(filters);
if (isFetching && filters.status?.includes("error")) {
dispatch(setRetryRequests({ checkAll: false, errorRequests: [] }));
}
}, [dispatch, filters, isFetching]);

return {
...filters,
checkAll,
errorRequests,
handleCheckChange,
handleNextPage,
handlePreviousPage,
handleCheckAll,
isFetching,
requests,
total,
};
};

const RequestTable: React.FC<RequestTableProps> = () => {
const {
checkAll,
errorRequests,
handleCheckChange,
handleNextPage,
handlePreviousPage,
handleCheckAll,
isFetching,
page,
requests,
size,
total,
} = useRequestTable();
}, [dispatch, filters.status, isFetching]);

return (
<>
Expand Down Expand Up @@ -153,8 +109,8 @@ const RequestTable: React.FC<RequestTableProps> = () => {
</Tbody>
</Table>
<PaginationFooter
page={page}
size={size}
page={filters.page}
size={filters.size}
total={total}
handleNextPage={handleNextPage}
handlePreviousPage={handlePreviousPage}
Expand All @@ -163,8 +119,4 @@ const RequestTable: React.FC<RequestTableProps> = () => {
);
};

RequestTable.defaultProps = {
requests: [],
};

export default RequestTable;
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,18 @@ import React from "react";
import { useAppSelector } from "~/app/hooks";

import { selectRetryRequests } from "../privacy-requests.slice";
import MoreButton from "./MoreButton";
import ReprocessButton from "./ReprocessButton";

const ActionButtons: React.FC = () => {
const { errorRequests } = useAppSelector(selectRetryRequests);

return errorRequests?.length > 0 ? (
return (
<ButtonGroup flexDirection="row" size="sm" spacing="8px" variant="outline">
<ReprocessButton />
{errorRequests?.length > 0 && <ReprocessButton />}
<MoreButton />
</ButtonGroup>
) : null;
);
};

export default ActionButtons;
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
import {
Box,
Button,
Menu,
MenuButton,
MenuList,
MenuProps,
} from "@fidesui/react";

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

import ConfigureAlerts from "../drawers/ConfigureAlerts";

type MoreButtonProps = {
menuProps?: MenuProps;
};

const MoreButton: React.FC<MoreButtonProps> = ({
menuProps,
}: MoreButtonProps) => (
<Box>
<Menu {...menuProps}>
<MenuButton
as={Button}
fontWeight="normal"
rightIcon={<ArrowDownLineIcon />}
size="sm"
variant="outline"
_active={{
bg: "none",
}}
_hover={{
bg: "none",
}}
>
More
</MenuButton>
<MenuList fontSize="sm">
{/* MenuItems are not rendered unless Menu is open */}
<ConfigureAlerts />
</MenuList>
</Menu>
</Box>
);

export default MoreButton;
Loading