From 24213e64fea9f29d18123ce698b14818d2cb5a91 Mon Sep 17 00:00:00 2001 From: Pavneet Singh Saund Date: Thu, 7 Sep 2023 11:16:08 +0200 Subject: [PATCH] Rename configuration to settings --- .../connectionDetails/configuration/index.tsx | 4 +-- .../ActionToolbar.tsx | 0 .../SettingsContainer.tsx} | 20 ++++++------- .../SettingsForm.tsx} | 30 +++++++++---------- .../SettingsFormContent.tsx} | 6 ++-- 5 files changed, 30 insertions(+), 30 deletions(-) rename Source/SelfService/Web/integrations/connection/connectionDetails/configuration/{configuration => settings}/ActionToolbar.tsx (100%) rename Source/SelfService/Web/integrations/connection/connectionDetails/configuration/{configuration/ConfigurationContainer.tsx => settings/SettingsContainer.tsx} (74%) rename Source/SelfService/Web/integrations/connection/connectionDetails/configuration/{configuration/ConnectorConfigurationForm.tsx => settings/SettingsForm.tsx} (82%) rename Source/SelfService/Web/integrations/connection/connectionDetails/configuration/{configuration/ExporterConfigurationSection.tsx => settings/SettingsFormContent.tsx} (76%) diff --git a/Source/SelfService/Web/integrations/connection/connectionDetails/configuration/index.tsx b/Source/SelfService/Web/integrations/connection/connectionDetails/configuration/index.tsx index 60666d3a9..66a51f43b 100644 --- a/Source/SelfService/Web/integrations/connection/connectionDetails/configuration/index.tsx +++ b/Source/SelfService/Web/integrations/connection/connectionDetails/configuration/index.tsx @@ -3,7 +3,7 @@ import React, { } from 'react'; import { SetupContainer } from './setup/SetupContainer'; -import { ConfigurationContainer } from './configuration/ConfigurationContainer'; +import { SettingsContainer } from './settings/SettingsContainer'; import { DataSyncConfigurationContainer } from './realtimeUpdates/DataSyncConfigurationContainer'; export const ConfigurationView = () => { @@ -12,7 +12,7 @@ export const ConfigurationView = () => { <> {/* TODO: Only show configuration section after the deployment type is set ? */} - + ); diff --git a/Source/SelfService/Web/integrations/connection/connectionDetails/configuration/configuration/ActionToolbar.tsx b/Source/SelfService/Web/integrations/connection/connectionDetails/configuration/settings/ActionToolbar.tsx similarity index 100% rename from Source/SelfService/Web/integrations/connection/connectionDetails/configuration/configuration/ActionToolbar.tsx rename to Source/SelfService/Web/integrations/connection/connectionDetails/configuration/settings/ActionToolbar.tsx diff --git a/Source/SelfService/Web/integrations/connection/connectionDetails/configuration/configuration/ConfigurationContainer.tsx b/Source/SelfService/Web/integrations/connection/connectionDetails/configuration/settings/SettingsContainer.tsx similarity index 74% rename from Source/SelfService/Web/integrations/connection/connectionDetails/configuration/configuration/ConfigurationContainer.tsx rename to Source/SelfService/Web/integrations/connection/connectionDetails/configuration/settings/SettingsContainer.tsx index 302e46cad..419c9c1ef 100644 --- a/Source/SelfService/Web/integrations/connection/connectionDetails/configuration/configuration/ConfigurationContainer.tsx +++ b/Source/SelfService/Web/integrations/connection/connectionDetails/configuration/settings/SettingsContainer.tsx @@ -6,24 +6,24 @@ import { useSnackbar } from 'notistack'; import { ContentContainer, ContentHeader } from '@dolittle/design-system/'; import { useConnectionsIdGet } from '../../../../../apis/integrations/connectionsApi.hooks'; import { useConnectionIdFromRoute } from '../../../../routes.hooks'; -import { ExporterConfigurationSection } from './ExporterConfigurationSection'; -import { ConnectorConfigurationForm, ConnectorConfigurationFormRef, ConnectorConfigurationFormSaveState } from './ConnectorConfigurationForm'; +import { SettingsFormContent } from './SettingsFormContent'; +import { SettingsForm, SettingsFormRef, SettingsFormSaveState } from './SettingsForm'; import { ActionToolbar } from './ActionToolbar'; -export const ConfigurationContainer = () => { +export const SettingsContainer = () => { const [canEdit, setEditMode] = useState(false); - const [lastSaveState, setLastSaveState] = useState(); + const [lastSaveState, setLastSaveState] = useState(); const { enqueueSnackbar } = useSnackbar(); const connectionId = useConnectionIdFromRoute(); const query = useConnectionsIdGet({ id: connectionId }); - const formRef = useRef(null); + const formRef = useRef(null); const connection = query.data?.value; const links = query.data?.links || []; - const handleSaveState = (saveState: ConnectorConfigurationFormSaveState) => { + const handleSaveState = (saveState: SettingsFormSaveState) => { setLastSaveState(saveState); saveState.forEach((state) => { if (state.status === 'success') { @@ -35,7 +35,7 @@ export const ConfigurationContainer = () => { }); }; - const handleOnSaved = (saveState: ConnectorConfigurationFormSaveState): void => { + const handleOnSaved = (saveState: SettingsFormSaveState): void => { if (saveState.every((state) => state.status === 'success')) { setEditMode(false); } @@ -52,7 +52,7 @@ export const ConfigurationContainer = () => { return ( - { /> } /> - - + + ); }; diff --git a/Source/SelfService/Web/integrations/connection/connectionDetails/configuration/configuration/ConnectorConfigurationForm.tsx b/Source/SelfService/Web/integrations/connection/connectionDetails/configuration/settings/SettingsForm.tsx similarity index 82% rename from Source/SelfService/Web/integrations/connection/connectionDetails/configuration/configuration/ConnectorConfigurationForm.tsx rename to Source/SelfService/Web/integrations/connection/connectionDetails/configuration/settings/SettingsForm.tsx index eaaf1294f..d18bd669a 100644 --- a/Source/SelfService/Web/integrations/connection/connectionDetails/configuration/configuration/ConnectorConfigurationForm.tsx +++ b/Source/SelfService/Web/integrations/connection/connectionDetails/configuration/settings/SettingsForm.tsx @@ -12,7 +12,7 @@ import { useConnectionsIdConfigurationExporterStrictCertificateValidationPost } //TODO: Can this be replaced with using `watch` from react-hook-form? -const useForceSubscribeToIsDirtyStateChanges = (currentForm: FormRef | undefined) => { +const useForceSubscribeToIsDirtyStateChanges = (currentForm: FormRef | undefined) => { useEffect(() => { if (currentForm) { const { isDirty } = currentForm.getFieldState('strictCertificateValidation', currentForm.formState); @@ -29,33 +29,33 @@ export type ConfigurationSaveActionState = export type ConfigurationFormSaveAction = { name: ConfigurationSaveActionName } & ConfigurationSaveActionState; -export type ConnectorConfigurationFormSaveState = ConfigurationFormSaveAction[]; +export type SettingsFormSaveState = ConfigurationFormSaveAction[]; -export type ConnectorConfigurationFormRef = { +export type SettingsFormRef = { reset: (keepDefault: boolean) => void; }; -export type ConnectorConfigurationFormParameters = { +export type SettingsFormParameters = { strictCertificateValidation: boolean; }; -export type ConnectorConfigurationFormProps = { +export type SettingsFormProps = { connectionId: string; connection: ConnectionModel - onSaved?: (saveState: ConnectorConfigurationFormSaveState) => void; + onSaved?: (saveState: SettingsFormSaveState) => void; children?: React.ReactNode; }; -export const ConnectorConfigurationForm = React.forwardRef(({ +export const SettingsForm = React.forwardRef(({ connectionId, connection, onSaved, children -}: ConnectorConfigurationFormProps, - ref: React.Ref +}: SettingsFormProps, + ref: React.Ref ) => { - const [currentForm, setCurrentForm] = useState>(); - const [lastSaveState, setLastSaveState] = useState(); + const [currentForm, setCurrentForm] = useState>(); + const [lastSaveState, setLastSaveState] = useState(); const formRef = useCallback((ref) => { if (ref) { setCurrentForm(ref); @@ -80,7 +80,7 @@ export const ConnectorConfigurationForm = React.forwardRef ( + const defaultValues: SettingsFormParameters = useMemo(() => ( { strictCertificateValidation: connection.strictCertificateValidation || false, } @@ -99,7 +99,7 @@ export const ConnectorConfigurationForm = React.forwardRef = useCallback((data) => { + const handleSave: SubmitHandler = useCallback((data) => { if (!connectionId || !currentForm) { return; } @@ -143,7 +143,7 @@ export const ConnectorConfigurationForm = React.forwardRef + initialValues={defaultValues} onSubmit={(data, event) => handleSave(data, event)} fRef={formRef} @@ -153,4 +153,4 @@ export const ConnectorConfigurationForm = React.forwardRef { +export const SettingsFormContent = ({ canEdit }: SettingsFormContentProps) => { return ( <>