Skip to content

Commit

Permalink
Update D&D integration form behavior (#5023)
Browse files Browse the repository at this point in the history
  • Loading branch information
jpople authored Jun 26, 2024
1 parent 2804f06 commit 1f464b5
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 24 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ The types of changes are:

### Changed
- Changed discovery monitor form behavior around execution date/time selection [#5017](https://github.com/ethyca/fides/pull/5017)
- Changed integration form behavior when errors occur [#5023](https://github.com/ethyca/fides/pull/5023)

### Fixed
- Fixed intermittent connection issues with Redshift by increasing timeout and preferring SSL in test connections [#4981](https://github.com/ethyca/fides/pull/4981)
Expand Down
4 changes: 3 additions & 1 deletion clients/admin-ui/cypress/e2e/integration-management.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,9 @@ describe("Integration management for data detection & discovery", () => {
});

it("should be able to add a new integration with secrets", () => {
cy.intercept("PATCH", "/api/v1/connection").as("patchConnection");
cy.intercept("PATCH", "/api/v1/connection", { statusCode: 200 }).as(
"patchConnection"
);
cy.intercept("PUT", "/api/v1/connection/*/secret*").as(
"putConnectionSecrets"
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -110,37 +110,38 @@ const ConfigureIntegrationForm = ({
} this integration. Please try again.`
);
toast({ status: "error", description: patchErrorMsg });
} else {
return;
}
if (!values.secrets) {
toast({
status: "success",
description: `Integration ${
isEditing ? "updated" : "created"
} successfully`,
});
return;
}
// if provided, update secrets with separate request
if (values.secrets) {
const secretsResult = await updateConnectionSecretsMutationTrigger({
connection_key: connectionPayload.key,
secrets: values.secrets,
});
if (isErrorResult(secretsResult)) {
const secretsErrorMsg = getErrorMessage(
secretsResult.error,
`An error occurred while ${
isEditing ? "updating" : "creating"
} this integration secret. Please try again.`
);
toast({ status: "error", description: secretsErrorMsg });
} else {
toast({
status: "success",
description: `Integration secret ${
isEditing ? "updated" : "created"
} successfully`,
});
}
const secretsResult = await updateConnectionSecretsMutationTrigger({
connection_key: connectionPayload.key,
secrets: values.secrets,
});
if (isErrorResult(secretsResult)) {
const secretsErrorMsg = getErrorMessage(
secretsResult.error,
`An error occurred while ${
isEditing ? "updating" : "creating"
} this integration's secret. Please try again.`
);
toast({ status: "error", description: secretsErrorMsg });
return;
}
toast({
status: "success",
description: `Integration secret ${
isEditing ? "updated" : "created"
} successfully`,
});
onCancel();
};

Expand Down
3 changes: 2 additions & 1 deletion clients/admin-ui/src/features/system/system.slice.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import { baseApi } from "~/features/common/api.slice";
import {
BulkPutConnectionConfiguration,
ConnectionConfigurationResponse,
CreateConnectionConfigurationWithSecrets,
System,
SystemResponse,
TestStatusMessage,
Expand Down Expand Up @@ -114,7 +115,7 @@ const systemApi = baseApi.injectEndpoints({
{
systemFidesKey: string;
connectionConfigs: Omit<
ConnectionConfigurationResponse,
CreateConnectionConfigurationWithSecrets,
"created_at"
>[];
}
Expand Down

0 comments on commit 1f464b5

Please sign in to comment.