From 76b68f9ecfd47fb13439ba1dc30491a938681700 Mon Sep 17 00:00:00 2001 From: "Ricardo M." Date: Fri, 30 Aug 2024 12:46:18 +0200 Subject: [PATCH] chore(CanvasForm): Move CanvasForm to dedicated folder --- .../Visualization/Canvas/CanvasSideBar.tsx | 2 +- .../Canvas/{ => Form}/CanvasForm.scss | 0 .../Canvas/{ => Form}/CanvasForm.test.tsx | 20 +++++++++---------- .../Canvas/{ => Form}/CanvasForm.tsx | 11 +++++----- .../{ => Form}/Form.components.test.tsx | 8 ++++---- .../Canvas/{ => Form}/Form.eips.test.tsx | 8 ++++---- .../Canvas/{ => Form}/Form.kamelets.test.tsx | 8 ++++---- .../__snapshots__/CanvasForm.test.tsx.snap | 0 8 files changed, 29 insertions(+), 28 deletions(-) rename packages/ui/src/components/Visualization/Canvas/{ => Form}/CanvasForm.scss (100%) rename packages/ui/src/components/Visualization/Canvas/{ => Form}/CanvasForm.test.tsx (97%) rename packages/ui/src/components/Visualization/Canvas/{ => Form}/CanvasForm.tsx (85%) rename packages/ui/src/components/Visualization/Canvas/{ => Form}/Form.components.test.tsx (87%) rename packages/ui/src/components/Visualization/Canvas/{ => Form}/Form.eips.test.tsx (87%) rename packages/ui/src/components/Visualization/Canvas/{ => Form}/Form.kamelets.test.tsx (87%) rename packages/ui/src/components/Visualization/Canvas/{ => Form}/__snapshots__/CanvasForm.test.tsx.snap (100%) diff --git a/packages/ui/src/components/Visualization/Canvas/CanvasSideBar.tsx b/packages/ui/src/components/Visualization/Canvas/CanvasSideBar.tsx index f87eb8c84..2f60c8de9 100644 --- a/packages/ui/src/components/Visualization/Canvas/CanvasSideBar.tsx +++ b/packages/ui/src/components/Visualization/Canvas/CanvasSideBar.tsx @@ -1,7 +1,7 @@ import { TopologySideBar } from '@patternfly/react-topology'; import { FunctionComponent } from 'react'; import { ErrorBoundary } from '../../ErrorBoundary'; -import { CanvasForm } from './CanvasForm'; +import { CanvasForm } from './Form/CanvasForm'; import { CanvasNode } from './canvas.models'; import './CanvasSideBar.scss'; import { FilteredFieldProvider } from '../../../providers'; diff --git a/packages/ui/src/components/Visualization/Canvas/CanvasForm.scss b/packages/ui/src/components/Visualization/Canvas/Form/CanvasForm.scss similarity index 100% rename from packages/ui/src/components/Visualization/Canvas/CanvasForm.scss rename to packages/ui/src/components/Visualization/Canvas/Form/CanvasForm.scss diff --git a/packages/ui/src/components/Visualization/Canvas/CanvasForm.test.tsx b/packages/ui/src/components/Visualization/Canvas/Form/CanvasForm.test.tsx similarity index 97% rename from packages/ui/src/components/Visualization/Canvas/CanvasForm.test.tsx rename to packages/ui/src/components/Visualization/Canvas/Form/CanvasForm.test.tsx index d555fe998..dae0888d9 100644 --- a/packages/ui/src/components/Visualization/Canvas/CanvasForm.test.tsx +++ b/packages/ui/src/components/Visualization/Canvas/Form/CanvasForm.test.tsx @@ -11,22 +11,22 @@ import { IKameletDefinition, KameletVisualEntity, KaotoSchemaDefinition, -} from '../../../models'; -import { IVisualizationNode, VisualComponentSchema } from '../../../models/visualization/base-visual-entity'; -import { VisualFlowsApi } from '../../../models/visualization/flows/support/flows-visibility'; +} from '../../../../models'; +import { IVisualizationNode, VisualComponentSchema } from '../../../../models/visualization/base-visual-entity'; +import { VisualFlowsApi } from '../../../../models/visualization/flows/support/flows-visibility'; import { CanvasFormTabsContext, CanvasFormTabsProvider, VisibleFlowsContext, VisibleFlowsProvider, -} from '../../../providers'; -import { EntitiesContext, EntitiesProvider } from '../../../providers/entities.provider'; -import { camelRouteJson, kameletJson } from '../../../stubs'; -import { getFirstCatalogMap } from '../../../stubs/test-load-catalog'; -import { ROOT_PATH } from '../../../utils'; +} from '../../../../providers'; +import { EntitiesContext, EntitiesProvider } from '../../../../providers/entities.provider'; +import { camelRouteJson, kameletJson } from '../../../../stubs'; +import { getFirstCatalogMap } from '../../../../stubs/test-load-catalog'; +import { ROOT_PATH } from '../../../../utils'; import { CanvasForm } from './CanvasForm'; -import { CanvasNode } from './canvas.models'; -import { FlowService } from './flow.service'; +import { CanvasNode } from '../canvas.models'; +import { FlowService } from '../flow.service'; describe('CanvasForm', () => { let camelRouteVisualEntity: CamelRouteVisualEntity; diff --git a/packages/ui/src/components/Visualization/Canvas/CanvasForm.tsx b/packages/ui/src/components/Visualization/Canvas/Form/CanvasForm.tsx similarity index 85% rename from packages/ui/src/components/Visualization/Canvas/CanvasForm.tsx rename to packages/ui/src/components/Visualization/Canvas/Form/CanvasForm.tsx index 3deb11968..1fdd13af0 100644 --- a/packages/ui/src/components/Visualization/Canvas/CanvasForm.tsx +++ b/packages/ui/src/components/Visualization/Canvas/Form/CanvasForm.tsx @@ -1,11 +1,11 @@ import { Card, CardBody, CardHeader } from '@patternfly/react-core'; import { FunctionComponent, useCallback, useContext, useEffect, useMemo, useRef } from 'react'; -import { VisibleFlowsContext } from '../../../providers'; -import { ErrorBoundary } from '../../ErrorBoundary'; -import { CanvasNode } from './canvas.models'; +import { VisibleFlowsContext } from '../../../../providers'; +import { ErrorBoundary } from '../../../ErrorBoundary'; +import { CanvasNode } from '../canvas.models'; import './CanvasForm.scss'; -import { CanvasFormBody } from './Form/CanvasFormBody'; -import { CanvasFormHeader } from './Form/CanvasFormHeader'; +import { CanvasFormBody } from './CanvasFormBody'; +import { CanvasFormHeader } from './CanvasFormHeader'; interface CanvasFormProps { selectedNode: CanvasNode; @@ -29,6 +29,7 @@ export const CanvasForm: FunctionComponent = (props) => { /** Store the flow's initial Id */ useEffect(() => { flowIdRef.current = props.selectedNode.data?.vizNode?.getId(); + // eslint-disable-next-line react-hooks/exhaustive-deps }, []); const onClose = useCallback(() => { diff --git a/packages/ui/src/components/Visualization/Canvas/Form.components.test.tsx b/packages/ui/src/components/Visualization/Canvas/Form/Form.components.test.tsx similarity index 87% rename from packages/ui/src/components/Visualization/Canvas/Form.components.test.tsx rename to packages/ui/src/components/Visualization/Canvas/Form/Form.components.test.tsx index 9ec9178a6..4f616426c 100644 --- a/packages/ui/src/components/Visualization/Canvas/Form.components.test.tsx +++ b/packages/ui/src/components/Visualization/Canvas/Form/Form.components.test.tsx @@ -2,10 +2,10 @@ import { AutoField, AutoFields, AutoForm } from '@kaoto-next/uniforms-patternfly import catalogLibrary from '@kaoto/camel-catalog/index.json'; import { CatalogLibrary } from '@kaoto/camel-catalog/types'; import { render } from '@testing-library/react'; -import { CamelCatalogService, CatalogKind, ICamelComponentDefinition } from '../../../models'; -import { getFirstCatalogMap } from '../../../stubs/test-load-catalog'; -import { SchemaService } from '../../Form'; -import { CustomAutoFieldDetector } from '../../Form/CustomAutoField'; +import { CamelCatalogService, CatalogKind, ICamelComponentDefinition } from '../../../../models'; +import { getFirstCatalogMap } from '../../../../stubs/test-load-catalog'; +import { SchemaService } from '../../../Form'; +import { CustomAutoFieldDetector } from '../../../Form/CustomAutoField'; describe('Form - components', () => { let componentCatalogMap: Record; diff --git a/packages/ui/src/components/Visualization/Canvas/Form.eips.test.tsx b/packages/ui/src/components/Visualization/Canvas/Form/Form.eips.test.tsx similarity index 87% rename from packages/ui/src/components/Visualization/Canvas/Form.eips.test.tsx rename to packages/ui/src/components/Visualization/Canvas/Form/Form.eips.test.tsx index afa13489a..28aa22d64 100644 --- a/packages/ui/src/components/Visualization/Canvas/Form.eips.test.tsx +++ b/packages/ui/src/components/Visualization/Canvas/Form/Form.eips.test.tsx @@ -2,10 +2,10 @@ import { AutoField, AutoFields, AutoForm } from '@kaoto-next/uniforms-patternfly import catalogLibrary from '@kaoto/camel-catalog/index.json'; import { CatalogLibrary } from '@kaoto/camel-catalog/types'; import { render } from '@testing-library/react'; -import { CamelCatalogService, CatalogKind, ICamelProcessorDefinition } from '../../../models'; -import { getFirstCatalogMap } from '../../../stubs/test-load-catalog'; -import { SchemaService } from '../../Form'; -import { CustomAutoFieldDetector } from '../../Form/CustomAutoField'; +import { CamelCatalogService, CatalogKind, ICamelProcessorDefinition } from '../../../../models'; +import { getFirstCatalogMap } from '../../../../stubs/test-load-catalog'; +import { SchemaService } from '../../../Form'; +import { CustomAutoFieldDetector } from '../../../Form/CustomAutoField'; describe('Form - EIPs', () => { let patternCatalogMap: Record; diff --git a/packages/ui/src/components/Visualization/Canvas/Form.kamelets.test.tsx b/packages/ui/src/components/Visualization/Canvas/Form/Form.kamelets.test.tsx similarity index 87% rename from packages/ui/src/components/Visualization/Canvas/Form.kamelets.test.tsx rename to packages/ui/src/components/Visualization/Canvas/Form/Form.kamelets.test.tsx index 82349c2fe..2ce032253 100644 --- a/packages/ui/src/components/Visualization/Canvas/Form.kamelets.test.tsx +++ b/packages/ui/src/components/Visualization/Canvas/Form/Form.kamelets.test.tsx @@ -2,10 +2,10 @@ import { AutoField, AutoFields, AutoForm } from '@kaoto-next/uniforms-patternfly import catalogLibrary from '@kaoto/camel-catalog/index.json'; import { CatalogLibrary } from '@kaoto/camel-catalog/types'; import { render } from '@testing-library/react'; -import { CamelCatalogService, CatalogKind, IKameletDefinition } from '../../../models'; -import { getFirstCatalogMap } from '../../../stubs/test-load-catalog'; -import { SchemaService } from '../../Form'; -import { CustomAutoFieldDetector } from '../../Form/CustomAutoField'; +import { CamelCatalogService, CatalogKind, IKameletDefinition } from '../../../../models'; +import { getFirstCatalogMap } from '../../../../stubs/test-load-catalog'; +import { SchemaService } from '../../../Form'; +import { CustomAutoFieldDetector } from '../../../Form/CustomAutoField'; describe('Form - Kamelets', () => { let kameletCatalogMap: Record; diff --git a/packages/ui/src/components/Visualization/Canvas/__snapshots__/CanvasForm.test.tsx.snap b/packages/ui/src/components/Visualization/Canvas/Form/__snapshots__/CanvasForm.test.tsx.snap similarity index 100% rename from packages/ui/src/components/Visualization/Canvas/__snapshots__/CanvasForm.test.tsx.snap rename to packages/ui/src/components/Visualization/Canvas/Form/__snapshots__/CanvasForm.test.tsx.snap