Skip to content

Commit

Permalink
Changes based on PR feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
galvana committed Jul 31, 2023
1 parent 74bcb8e commit 3b6bd51
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -283,8 +283,7 @@ const ConnectorParametersForm: React.FC<ConnectorParametersFormProps> = ({

const handleAuthorizeConnectionClick = async (
values: ConnectionConfigFormValues,
// @ts-ignore
props: FormikProps<Values>
props: FormikProps<ConnectionConfigFormValues>
) => {
const errors = await props.validateForm();

Expand All @@ -296,8 +295,9 @@ const ConnectorParametersForm: React.FC<ConnectorParametersFormProps> = ({
onAuthorizeConnectionClick(processedValues);
};

// @ts-ignore
const handleTestConnectionClick = async (props: FormikProps<Values>) => {
const handleTestConnectionClick = async (
props: FormikProps<ConnectionConfigFormValues>
) => {
const errors = await props.validateForm();

if (Object.keys(errors).length > 0) {
Expand All @@ -318,8 +318,7 @@ const ConnectorParametersForm: React.FC<ConnectorParametersFormProps> = ({
validateOnBlur={false}
validateOnChange={false}
>
{/* @ts-ignore */}
{(props: FormikProps<Values>) => {
{(props: FormikProps<ConnectionConfigFormValues>) => {
const authorized = !props.dirty && connectionConfig?.authorized;
return (
<Form noValidate>
Expand Down Expand Up @@ -353,7 +352,9 @@ const ConnectorParametersForm: React.FC<ConnectorParametersFormProps> = ({
display="flex"
isRequired
isInvalid={
props.errors.instance_key && props.touched.instance_key
!!(
props.errors.instance_key && props.touched.instance_key
)
}
>
{getFormLabel("instance_key", "Integration Identifier")}
Expand Down
4 changes: 3 additions & 1 deletion clients/admin-ui/src/pages/systems/configure/[id].tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ import {
} from "~/features/system";
import EditSystemFlow from "~/features/system/EditSystemFlow";

const INTEGRATION_TAB_INDEX = 3; // this needs to be updated if the order of the tabs changes

const ConfigureSystem: NextPage = () => {
const toast = useToast();
const router = useRouter();
Expand Down Expand Up @@ -62,7 +64,7 @@ const ConfigureSystem: NextPage = () => {
// replace the current history entry
router.replace(newUrl, undefined, { shallow: true });

setInitialTabIndex(3);
setInitialTabIndex(INTEGRATION_TAB_INDEX);
}
}, [router, toast]);

Expand Down
9 changes: 6 additions & 3 deletions src/fides/api/api/v1/endpoints/system.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
upsert_system,
validate_privacy_declarations,
)
from fides.api.models.connectionconfig import ConnectionConfig
from fides.api.models.connectionconfig import ConnectionConfig, ConnectionType
from fides.api.models.sql_models import System # type: ignore[attr-defined]
from fides.api.oauth.system_manager_oauth_util import (
verify_oauth_client_for_system_from_fides_key,
Expand Down Expand Up @@ -160,7 +160,7 @@ def patch_connection_secrets(
"""

system = get_system(db, fides_key)
connection_config = get_connection_config_or_error(
connection_config: ConnectionConfig = get_connection_config_or_error(
db, system.connection_configs.key
)
# Inserts unchanged sensitive values. The FE does not send masked values sensitive secrets.
Expand All @@ -181,7 +181,10 @@ def patch_connection_secrets(
# Deauthorize an OAuth connection when the secrets are updated. This is necessary because
# the existing access tokens may not be valid anymore. This only applies to SaaS connection
# configurations that use the "oauth2_authorization_code" authentication strategy.
if connection_config.authorized:
if (
connection_config.authorized
and connection_config.connection_type == ConnectionType.saas
):
del connection_config.secrets["access_token"]

# Save validated secrets, regardless of whether they've been verified.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -781,7 +781,7 @@ def test_get_connection_configs(
"created_at",
"disabled",
"description",
"authorized"
"authorized",
}

assert connection["key"] == "my_postgres_db_1"
Expand Down Expand Up @@ -1193,7 +1193,7 @@ def test_get_connection_config(
"description",
"saas_config",
"secrets",
"authorized"
"authorized",
}

assert response_body["key"] == "my_postgres_db_1"
Expand Down

0 comments on commit 3b6bd51

Please sign in to comment.