Skip to content

Commit

Permalink
fix: hide 'run in docker' & fix areAllFieldsBoolean type guard
Browse files Browse the repository at this point in the history
  • Loading branch information
alashchev17 committed Dec 11, 2024
1 parent f178a75 commit fc0b910
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@ export const IntegrationAvailability: FC<IntegrationAvailabilityProps> = ({
onChange(fieldName, checked);
};

// TODO: temporal solution to hide the switch for isolated mode
if (fieldName === "when_isolated") return null;

return (
<Flex style={{ marginBottom: "0.75rem" }}>
<Flex align="center" justify="between">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ function areAllFieldsBoolean(json: unknown): json is Record<string, boolean> {
return (
typeof json === "object" &&
json !== null &&
Object.entries(json).every((value) => typeof value === "boolean")
Object.values(json).every((value) => typeof value === "boolean")
);
}

Expand Down Expand Up @@ -82,11 +82,20 @@ export const IntegrationForm: FC<IntegrationFormProps> = ({
);

useEffect(() => {
debugIntegrations(
`[DEBUG]: integration.data?.integr_values.available &&
typeof integration.data.integr_values.available === "object" &&
areAllFieldsBoolean(integration.data.integr_values.available): `,
integration.data?.integr_values.available &&
typeof integration.data.integr_values.available === "object" &&
areAllFieldsBoolean(integration.data.integr_values.available),
);
if (
integration.data?.integr_values.available &&
typeof integration.data.integr_values.available === "object" &&
areAllFieldsBoolean(integration.data.integr_values.available)
) {
debugIntegrations(`[DEBUG]: updating availabilityValues`);
Object.entries(integration.data.integr_values.available).forEach(
([key, value]) => {
handleAvailabilityChange(key, value);
Expand Down
1 change: 1 addition & 0 deletions src/components/IntegrationsView/IntegrationsView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -254,6 +254,7 @@ export const IntegrationsView: FC<IntegrationViewProps> = ({
setCurrentNotConfiguredIntegration(null);
setIsDisabledIntegrationForm(true);
}
setAvailabilityValues({});
information && dispatch(clearInformation());
globalError && dispatch(clearError());
dispatch(integrationsApi.util.resetApiState());
Expand Down

0 comments on commit fc0b910

Please sign in to comment.