Skip to content

Commit

Permalink
Merging in main
Browse files Browse the repository at this point in the history
  • Loading branch information
galvana committed Mar 6, 2023
2 parents a54957a + e5edd4f commit 93c73c5
Show file tree
Hide file tree
Showing 79 changed files with 1,811 additions and 635 deletions.
2 changes: 1 addition & 1 deletion .fides/systems.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ system:
- fides_db

# System Info
- fides_key: privacy_request_fullfillment
- fides_key: privacy_request_fulfillment
name: Fides Privacy Request Fulfillment
organization_fides_key: default_organization
description: Privacy request fufillment.
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/backend_checks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,7 @@ jobs:
matrix:
python_version: ["3.8.14", "3.9.14", "3.10.7"]
runs-on: ubuntu-latest
timeout-minutes: 15
timeout-minutes: 20
# In PRs run with the "unsafe" label, or run on a "push" event to main
if: contains(github.event.pull_request.labels.*.name, 'run unsafe ci checks') || github.event_name == 'push'
steps:
Expand Down Expand Up @@ -232,7 +232,7 @@ jobs:
matrix:
python_version: ["3.8.14", "3.9.14", "3.10.7"]
runs-on: ubuntu-latest
timeout-minutes: 15
timeout-minutes: 20
# In PRs run with the "unsafe" label, or run on a "push" event to main
if: contains(github.event.pull_request.labels.*.name, 'run unsafe ci checks') || github.event_name == 'push'
steps:
Expand Down Expand Up @@ -263,7 +263,7 @@ jobs:
External-SaaS-Connectors:
needs: Build
runs-on: ubuntu-latest
timeout-minutes: 15
timeout-minutes: 20
# In PRs run with the "unsafe" label, or run on a "push" event to main
if: contains(github.event.pull_request.labels.*.name, 'run unsafe ci checks') || github.event_name == 'push'
permissions:
Expand All @@ -290,7 +290,7 @@ jobs:
uses: actions/checkout@v3

- name: Get Vault Token
uses: hashicorp/vault-action@v2.4.2
uses: hashicorp/vault-action@v2.5.0
with:
url: ${{ secrets.VAULT_ADDR }}
namespace: ${{ secrets.VAULT_NAMESPACE }}
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/frontend_checks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ jobs:
node-version: [16.x]
steps:
- name: Checkout
uses: actions/checkout@v2
uses: actions/checkout@v3

- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
Expand Down Expand Up @@ -118,7 +118,7 @@ jobs:
node-version: [16.x]
steps:
- name: Checkout
uses: actions/checkout@v2
uses: actions/checkout@v3

- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
Expand Down
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ The types of changes are:
* Access and erasure support for Delighted [#2244](https://github.com/ethyca/fides/pull/2244)
* Improve "Upload a new dataset YAML" [#1531](https://github.com/ethyca/fides/pull/2258)
* Access and erasure support for Yotpo [#2708](https://github.com/ethyca/fides/pull/2708)
* Allow SendGrid template usage [#2728](https://github.com/ethyca/fides/pull/2728)
* Added ConnectorRunner to simplify SaaS connector testing [#1795](https://github.com/ethyca/fides/pull/1795)

### Changed
Expand All @@ -44,7 +45,9 @@ The types of changes are:
* Add warning to 'fides deploy' when installed outside of a virtual environment [#2641](https://github.com/ethyca/fides/pull/2641)
* Redesigned the default/init config file to be auto-documented. Also updates the `fides init` logic and analytics consent logic [#2694](https://github.com/ethyca/fides/pull/2694)
* Change how config creation/import is handled across the application [#2622](https://github.com/ethyca/fides/pull/2622)
* Update the CLI aesthetics & docstrings [#2703](https://github.com/ethyca/fides/pull/2703)
* Updates Roles->Scopes Mapping [#2744](https://github.com/ethyca/fides/pull/2744)
* Return user scopes as an enum, as well as total scopes [#2741](https://github.com/ethyca/fides/pull/2741)

### Developer Experience

Expand Down
45 changes: 36 additions & 9 deletions clients/admin-ui/cypress/e2e/privacy-requests.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -138,33 +138,60 @@ describe("Privacy Requests", () => {
cy.getByTestId("option-local").click();
cy.wait("@createConfigurationSettings").then((interception) => {
const { body } = interception.request;
expect(body.fides.storage.active_default_storage_type).to.eql("local");
expect(body.storage.active_default_storage_type).to.eql("local");
});

cy.wait("@createStorage").then((interception) => {
const { body } = interception.request;
expect(body.type).to.eql("local");
expect(body.format).to.eql("json");
});

cy.contains("Configure active storage type saved successfully");
cy.contains("Configure storage type details saved successfully");
});

it("Can configure S3 storage", () => {
cy.getByTestId("option-s3").click();
cy.wait("@createConfigurationSettings").then((interception) => {
const { body } = interception.request;
expect(body.fides.storage.active_default_storage_type).to.eql("s3");
expect(body.storage.active_default_storage_type).to.eql("s3");
});
cy.wait("@getStorageDetails");
});
});

describe("Message Configuration", () => {
beforeEach(() => {
cy.visit("/privacy-requests/configure/messaging");
});

it("Can configure Mailgun email", () => {
cy.getByTestId("option-mailgun").click();
cy.getByTestId("input-domain").type("test-domain");
cy.getByTestId("save-btn").click();
cy.wait("@createStorage").then((interception) => {
cy.wait("@createMessagingConfiguration").then((interception) => {
const { body } = interception.request;
expect(body.type).to.eql("s3");
expect(body.service_type).to.eql("MAILGUN");
cy.contains(
"Mailgun email successfully updated. You can now enter your security key."
);
});
});

it("Can configure Twilio email", () => {
cy.getByTestId("option-twilio-email").click();
cy.getByTestId("input-email").type("test-email");
cy.getByTestId("save-btn").click();
cy.wait("@createMessagingConfiguration").then(() => {
cy.contains(
"Twilio email successfully updated. You can now enter your security key."
);
});
});

it("Can configure Twilio SMS", () => {
cy.getByTestId("option-twilio-sms").click();
cy.wait("@createMessagingConfiguration").then(() => {
cy.contains("Messaging provider saved successfully.");
});
cy.contains("S3 storage credentials successfully updated.");
cy.contains("Configure active storage type saved successfully.");
});
});
});
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"details": {
"domain": "test-domain",
"is_eu_domain": "false"
},
"service_type": "MAILGUN"
}
4 changes: 4 additions & 0 deletions clients/admin-ui/cypress/support/stubs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,10 @@ export const stubPrivacyRequestsConfigurationCrud = () => {
cy.intercept("PUT", "/api/v1/storage/default/*/secret", {
fixture: "/privacy-requests/settings_configuration.json",
}).as("createStorageSecrets");

cy.intercept("PUT", "/api/v1/messaging/default", {
fixture: "/privacy-requests/messaging_configuration.json",
}).as("createMessagingConfiguration");
};

export const CONNECTION_STRING =
Expand Down
28 changes: 19 additions & 9 deletions clients/admin-ui/src/features/common/Layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,24 @@ const Layout = ({
}) => {
const features = useFeatures();
const router = useRouter();
const { data: activeMessagingProvider } =
useGetActiveMessagingProviderQuery();
const { data: activeStorage } = useGetActiveStorageQuery();
const showConfigurationNotificationBanner =
(!activeStorage || !activeMessagingProvider) &&
features.flags.privacyRequestsConfiguration &&
(router.pathname === "/privacy-requests" ||
router.pathname === "/datastore-connection");
const isValidNotificationRoute =
router.pathname === "/privacy-requests" ||
router.pathname === "/datastore-connection";
const skip = !(
features.flags.privacyRequestsConfiguration && isValidNotificationRoute
);

const { data: activeMessagingProvider } = useGetActiveMessagingProviderQuery(
undefined,
{ skip }
);

const { data: activeStorage } = useGetActiveStorageQuery(undefined, {
skip,
});

const showNotificationBanner =
(!activeMessagingProvider || !activeStorage) && isValidNotificationRoute;

return (
<div data-testid={title}>
Expand All @@ -50,7 +60,7 @@ const Layout = ({
<NavSideBar />
</Box>
<Flex direction="column" flex={1} minWidth={0}>
{showConfigurationNotificationBanner ? (
{showNotificationBanner ? (
<ConfigurationNotificationBanner />
) : null}
{children}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,15 @@ import { useState } from "react";
import { CustomTextInput } from "~/features/common/form/inputs";
import { isErrorResult } from "~/features/common/helpers";
import { useAlert, useAPIHelper } from "~/features/common/hooks";
import { messagingProviders } from "~/features/privacy-requests/constants";
import {
useCreateMessagingConfigurationMutation,
useCreateMessagingConfigurationSecretsMutation,
useGetMessagingConfigurationDetailsQuery,
} from "~/features/privacy-requests/privacy-requests.slice";

import TestMessagingProviderConnectionButton from "./TestMessagingProviderConnectionButton";

type ConnectionStep = "" | "apiKey" | "testConnection";

const MailgunEmailConfiguration = () => {
Expand All @@ -19,7 +22,7 @@ const MailgunEmailConfiguration = () => {
useState<ConnectionStep>("");
const { handleError } = useAPIHelper();
const { data: messagingDetails } = useGetMessagingConfigurationDetailsQuery({
type: "mailgun",
type: messagingProviders.mailgun,
});
const [createMessagingConfiguration] =
useCreateMessagingConfigurationMutation();
Expand All @@ -28,7 +31,7 @@ const MailgunEmailConfiguration = () => {

const handleMailgunConfiguration = async (value: { domain: string }) => {
const result = await createMessagingConfiguration({
type: "mailgun",
service_type: messagingProviders.mailgun,
details: {
is_eu_domain: "false",
domain: value.domain,
Expand All @@ -49,13 +52,17 @@ const MailgunEmailConfiguration = () => {
api_key: string;
}) => {
const result = await createMessagingConfigurationSecrets({
mailgun_api_key: value.api_key,
details: {
mailgun_api_key: value.api_key,
},
service_type: messagingProviders.mailgun,
});

if (isErrorResult(result)) {
handleError(result.error);
} else {
successAlert(`Mailgun security key successfully updated.`);
setConfigurationStep("testConnection");
}
};

Expand All @@ -64,7 +71,7 @@ const MailgunEmailConfiguration = () => {
};

const initialAPIKeyValue = {
api_key: messagingDetails?.key ?? "",
api_key: "",
};

return (
Expand All @@ -76,19 +83,22 @@ const MailgunEmailConfiguration = () => {
<Formik
initialValues={initialValues}
onSubmit={handleMailgunConfiguration}
enableReinitialize
>
{({ isSubmitting, resetForm }) => (
{({ isSubmitting, handleReset }) => (
<Form>
<Stack mt={5} spacing={5}>
<CustomTextInput
name="domain"
label="Domain"
placeholder="Enter domain"
data-testid="option-twilio-domain"
isRequired
/>
</Stack>
<Box mt={10}>
<Button
onClick={() => resetForm()}
onClick={handleReset}
mr={2}
size="sm"
variant="outline"
Expand All @@ -109,10 +119,10 @@ const MailgunEmailConfiguration = () => {
)}
</Formik>
</Stack>
{configurationStep === "apiKey" ? (
// TODO: configurationStep === "testConnection" will be set after https://github.com/ethyca/fides/issues/2237
{configurationStep === "apiKey" ||
configurationStep === "testConnection" ? (
<>
<Divider />
<Divider mt={10} />
<Heading fontSize="md" fontWeight="semibold" mt={10}>
Security key
</Heading>
Expand All @@ -121,37 +131,46 @@ const MailgunEmailConfiguration = () => {
initialValues={initialAPIKeyValue}
onSubmit={handleMailgunAPIKeyConfiguration}
>
{({ isSubmitting, resetForm }) => (
{({ isSubmitting, handleReset }) => (
<Form>
<CustomTextInput
name="api_key"
label="API key"
placeholder="Optional"
type="password"
isRequired
/>
<Button
onClick={() => resetForm()}
mr={2}
size="sm"
variant="outline"
>
Cancel
</Button>
<Button
isDisabled={isSubmitting}
type="submit"
colorScheme="primary"
size="sm"
data-testid="save-btn"
>
Save
</Button>
<Box mt={10}>
<Button
onClick={handleReset}
mr={2}
size="sm"
variant="outline"
>
Cancel
</Button>
<Button
isDisabled={isSubmitting}
type="submit"
colorScheme="primary"
size="sm"
data-testid="save-btn"
>
Save
</Button>
</Box>
</Form>
)}
</Formik>
</Stack>
</>
) : null}
{configurationStep === "testConnection" ? (
<TestMessagingProviderConnectionButton
messagingDetails={
messagingDetails || { service_type: messagingProviders.mailgun }
}
/>
) : null}
</Box>
);
};
Expand Down
Loading

0 comments on commit 93c73c5

Please sign in to comment.