From 762c337dc91c917ec02d5cca739d07384fcc53c2 Mon Sep 17 00:00:00 2001 From: "Ricardo M." Date: Wed, 20 Mar 2024 15:37:03 +0100 Subject: [PATCH] chore: Move supporting classes to `support` folder As preparation to reorganize Visual entities classes, the first step is to move the non-visual classes to the `support` folder. --- .../Visualization/ContextToolbar/FlowType/NewFlow.tsx | 2 +- .../ContextToolbar/Flows/FlowsList.test.tsx | 8 ++++---- .../ContextToolbar/Flows/FlowsMenu.test.tsx | 2 +- .../Visualization/ContextToolbar/Flows/FlowsMenu.tsx | 2 +- packages/ui/src/models/camel/camel-route-resource.ts | 2 +- packages/ui/src/models/camel/kamelet-resource.ts | 10 +++++----- packages/ui/src/models/camel/pipe-resource.ts | 2 +- .../flows/{ => support}/flow-templates-service.ts | 8 ++++---- .../flows/{ => support}/flows-visibility.ts | 0 packages/ui/src/providers/visible-flows.provider.tsx | 6 +++++- 10 files changed, 23 insertions(+), 19 deletions(-) rename packages/ui/src/models/visualization/flows/{ => support}/flow-templates-service.ts (69%) rename packages/ui/src/models/visualization/flows/{ => support}/flows-visibility.ts (100%) diff --git a/packages/ui/src/components/Visualization/ContextToolbar/FlowType/NewFlow.tsx b/packages/ui/src/components/Visualization/ContextToolbar/FlowType/NewFlow.tsx index c2fa5e2f7..66c935355 100644 --- a/packages/ui/src/components/Visualization/ContextToolbar/FlowType/NewFlow.tsx +++ b/packages/ui/src/components/Visualization/ContextToolbar/FlowType/NewFlow.tsx @@ -3,7 +3,7 @@ import { PlusIcon } from '@patternfly/react-icons'; import { FunctionComponent, PropsWithChildren, useCallback, useContext, useState } from 'react'; import { useEntityContext } from '../../../../hooks/useEntityContext/useEntityContext'; import { SourceSchemaType } from '../../../../models/camel'; -import { FlowTemplateService } from '../../../../models/visualization/flows/flow-templates-service'; +import { FlowTemplateService } from '../../../../models/visualization/flows/support/flow-templates-service'; import { SourceCodeApiContext } from '../../../../providers'; import { VisibleFlowsContext } from '../../../../providers/visible-flows.provider'; import { FlowTypeSelector } from './FlowTypeSelector'; diff --git a/packages/ui/src/components/Visualization/ContextToolbar/Flows/FlowsList.test.tsx b/packages/ui/src/components/Visualization/ContextToolbar/Flows/FlowsList.test.tsx index f4af19a46..ef0d23d89 100644 --- a/packages/ui/src/components/Visualization/ContextToolbar/Flows/FlowsList.test.tsx +++ b/packages/ui/src/components/Visualization/ContextToolbar/Flows/FlowsList.test.tsx @@ -1,11 +1,11 @@ -import { FlowsList } from './FlowsList'; import { act, fireEvent, render } from '@testing-library/react'; +import { EntitiesContextResult } from '../../../../hooks'; import { SourceSchemaType } from '../../../../models/camel'; import { CamelRouteVisualEntity } from '../../../../models/visualization/flows'; +import { IVisibleFlows, VisualFlowsApi } from '../../../../models/visualization/flows/support/flows-visibility'; import { EntitiesContext } from '../../../../providers/entities.provider'; -import { EntitiesContextResult } from '../../../../hooks'; -import { IVisibleFlows, VisualFlowsApi } from '../../../../models/visualization/flows/flows-visibility'; -import { VisibleFlowsContext, VisibleFLowsContextResult } from '../../../../providers/visible-flows.provider'; +import { VisibleFLowsContextResult, VisibleFlowsContext } from '../../../../providers/visible-flows.provider'; +import { FlowsList } from './FlowsList'; const getContextValue = () => { return { diff --git a/packages/ui/src/components/Visualization/ContextToolbar/Flows/FlowsMenu.test.tsx b/packages/ui/src/components/Visualization/ContextToolbar/Flows/FlowsMenu.test.tsx index eda17cf82..fca828f7b 100644 --- a/packages/ui/src/components/Visualization/ContextToolbar/Flows/FlowsMenu.test.tsx +++ b/packages/ui/src/components/Visualization/ContextToolbar/Flows/FlowsMenu.test.tsx @@ -2,7 +2,7 @@ import { act, fireEvent, render } from '@testing-library/react'; import { EntitiesContextResult } from '../../../../hooks'; import { SourceSchemaType } from '../../../../models/camel'; import { CamelRouteVisualEntity } from '../../../../models/visualization/flows'; -import { IVisibleFlows } from '../../../../models/visualization/flows/flows-visibility'; +import { IVisibleFlows } from '../../../../models/visualization/flows/support/flows-visibility'; import { EntitiesContext } from '../../../../providers/entities.provider'; import { VisibleFLowsContextResult, VisibleFlowsContext } from '../../../../providers/visible-flows.provider'; import { FlowsMenu } from './FlowsMenu'; diff --git a/packages/ui/src/components/Visualization/ContextToolbar/Flows/FlowsMenu.tsx b/packages/ui/src/components/Visualization/ContextToolbar/Flows/FlowsMenu.tsx index 0fa231e9c..feee66f4b 100644 --- a/packages/ui/src/components/Visualization/ContextToolbar/Flows/FlowsMenu.tsx +++ b/packages/ui/src/components/Visualization/ContextToolbar/Flows/FlowsMenu.tsx @@ -1,7 +1,7 @@ import { Badge, Icon, MenuToggle, MenuToggleAction, MenuToggleElement, Select } from '@patternfly/react-core'; import { ListIcon } from '@patternfly/react-icons'; import { FunctionComponent, Ref, useCallback, useContext, useState } from 'react'; -import { getVisibleFlowsInformation } from '../../../../models/visualization/flows/flows-visibility'; +import { getVisibleFlowsInformation } from '../../../../models/visualization/flows/support/flows-visibility'; import { VisibleFlowsContext } from '../../../../providers/visible-flows.provider'; import { FlowsList } from './FlowsList'; diff --git a/packages/ui/src/models/camel/camel-route-resource.ts b/packages/ui/src/models/camel/camel-route-resource.ts index fd6d9f6f6..a8a2a2183 100644 --- a/packages/ui/src/models/camel/camel-route-resource.ts +++ b/packages/ui/src/models/camel/camel-route-resource.ts @@ -5,10 +5,10 @@ import { AddStepMode } from '../visualization/base-visual-entity'; import { CamelRouteVisualEntity, isCamelFrom, isCamelRoute } from '../visualization/flows'; import { CamelErrorHandlerVisualEntity } from '../visualization/flows/camel-error-handler-visual-entity'; import { CamelOnExceptionVisualEntity } from '../visualization/flows/camel-on-exception-visual-entity'; -import { FlowTemplateService } from '../visualization/flows/flow-templates-service'; import { NonVisualEntity } from '../visualization/flows/non-visual-entity'; import { CamelComponentFilterService } from '../visualization/flows/support/camel-component-filter.service'; import { CamelRouteVisualEntityData } from '../visualization/flows/support/camel-component-types'; +import { FlowTemplateService } from '../visualization/flows/support/flow-templates-service'; import { BeansEntity, isBeans } from '../visualization/metadata'; import { BeansAwareResource, CamelResource } from './camel-resource'; import { BaseCamelEntity } from './entities'; diff --git a/packages/ui/src/models/camel/kamelet-resource.ts b/packages/ui/src/models/camel/kamelet-resource.ts index 729feaba9..4e0db2881 100644 --- a/packages/ui/src/models/camel/kamelet-resource.ts +++ b/packages/ui/src/models/camel/kamelet-resource.ts @@ -2,17 +2,17 @@ import set from 'lodash/set'; import { TileFilter } from '../../public-api'; import { IKameletDefinition } from '../kamelets-catalog'; import { AddStepMode } from '../visualization/base-visual-entity'; -import { FlowTemplateService } from '../visualization/flows/flow-templates-service'; import { CamelComponentFilterService } from '../visualization/flows/support/camel-component-filter.service'; import { CamelRouteVisualEntityData } from '../visualization/flows/support/camel-component-types'; -import { KameletVisualEntity } from './../visualization/flows/kamelet-visual-entity'; -import { CamelKResource } from './camel-k-resource'; -import { SourceSchemaType } from './source-schema-type'; -import { RouteTemplateBeansAwareResource } from './camel-resource'; +import { FlowTemplateService } from '../visualization/flows/support/flow-templates-service'; import { RouteTemplateBeansEntity, RouteTemplateBeansParentType, } from '../visualization/metadata/routeTemplateBeansEntity'; +import { KameletVisualEntity } from './../visualization/flows/kamelet-visual-entity'; +import { CamelKResource } from './camel-k-resource'; +import { RouteTemplateBeansAwareResource } from './camel-resource'; +import { SourceSchemaType } from './source-schema-type'; export class KameletResource extends CamelKResource implements RouteTemplateBeansAwareResource { private flow: KameletVisualEntity; diff --git a/packages/ui/src/models/camel/pipe-resource.ts b/packages/ui/src/models/camel/pipe-resource.ts index 6c91e2015..553f90c71 100644 --- a/packages/ui/src/models/camel/pipe-resource.ts +++ b/packages/ui/src/models/camel/pipe-resource.ts @@ -3,7 +3,7 @@ import { ITile, TileFilter } from '../../components/Catalog/Catalog.models'; import { CatalogKind } from '../catalog-kind'; import { AddStepMode, IVisualizationNodeData } from '../visualization/base-visual-entity'; import { PipeVisualEntity } from '../visualization/flows'; -import { FlowTemplateService } from '../visualization/flows/flow-templates-service'; +import { FlowTemplateService } from '../visualization/flows/support/flow-templates-service'; import { PipeErrorHandlerEntity } from '../visualization/metadata/pipeErrorHandlerEntity'; import { CamelKResource } from './camel-k-resource'; import { BaseCamelEntity, PipeSpecErrorHandler } from './entities'; diff --git a/packages/ui/src/models/visualization/flows/flow-templates-service.ts b/packages/ui/src/models/visualization/flows/support/flow-templates-service.ts similarity index 69% rename from packages/ui/src/models/visualization/flows/flow-templates-service.ts rename to packages/ui/src/models/visualization/flows/support/flow-templates-service.ts index 5935c0f96..2d498acaf 100644 --- a/packages/ui/src/models/visualization/flows/flow-templates-service.ts +++ b/packages/ui/src/models/visualization/flows/support/flow-templates-service.ts @@ -1,8 +1,8 @@ import { parse } from 'yaml'; -import { SourceSchemaType } from '../../camel/source-schema-type'; -import { kameletTemplate } from './templates/kamelet'; -import { pipeTemplate } from './templates/pipe'; -import { routeTemplate } from './templates/route'; +import { SourceSchemaType } from '../../../camel/source-schema-type'; +import { kameletTemplate } from '../templates/kamelet'; +import { pipeTemplate } from '../templates/pipe'; +import { routeTemplate } from '../templates/route'; export class FlowTemplateService { static getFlowTemplate = (type: SourceSchemaType) => { diff --git a/packages/ui/src/models/visualization/flows/flows-visibility.ts b/packages/ui/src/models/visualization/flows/support/flows-visibility.ts similarity index 100% rename from packages/ui/src/models/visualization/flows/flows-visibility.ts rename to packages/ui/src/models/visualization/flows/support/flows-visibility.ts diff --git a/packages/ui/src/providers/visible-flows.provider.tsx b/packages/ui/src/providers/visible-flows.provider.tsx index a30b4613d..855c721c8 100644 --- a/packages/ui/src/providers/visible-flows.provider.tsx +++ b/packages/ui/src/providers/visible-flows.provider.tsx @@ -1,5 +1,9 @@ import { FunctionComponent, PropsWithChildren, createContext, useContext, useEffect, useMemo, useReducer } from 'react'; -import { IVisibleFlows, VisibleFlowsReducer, VisualFlowsApi } from '../models/visualization/flows/flows-visibility'; +import { + IVisibleFlows, + VisibleFlowsReducer, + VisualFlowsApi, +} from '../models/visualization/flows/support/flows-visibility'; import { EntitiesContext } from './entities.provider'; export interface VisibleFLowsContextResult {