diff --git a/packages/ui/src/components/Form/schema.service.ts b/packages/ui/src/components/Form/schema.service.ts
index a13489b2d..611bf6fc3 100644
--- a/packages/ui/src/components/Form/schema.service.ts
+++ b/packages/ui/src/components/Form/schema.service.ts
@@ -4,9 +4,21 @@ import { filterDOMProps, FilterDOMPropsKeys } from 'uniforms';
import { JSONSchemaBridge } from 'uniforms-bridge-json-schema';
export class SchemaService {
+ static readonly DROPDOWN_PLACEHOLDER = 'Select an option...';
+ static readonly OMIT_FORM_FIELDS = [
+ 'from',
+ 'expression',
+ 'dataFormatType',
+ 'outputs',
+ 'steps',
+ 'when',
+ 'otherwise',
+ 'doCatch',
+ 'doFinally',
+ 'uri',
+ ];
private readonly ajv: Ajv;
private readonly FILTER_DOM_PROPS = ['$comment', 'additionalProperties'];
- static readonly DROPDOWN_PLACEHOLDER = 'Select an option...';
constructor() {
this.ajv = new Ajv({
diff --git a/packages/ui/src/components/Visualization/Canvas/CanvasForm.test.tsx b/packages/ui/src/components/Visualization/Canvas/CanvasForm.test.tsx
index 3fd5a22ea..aee8891a4 100644
--- a/packages/ui/src/components/Visualization/Canvas/CanvasForm.test.tsx
+++ b/packages/ui/src/components/Visualization/Canvas/CanvasForm.test.tsx
@@ -22,7 +22,6 @@ import { act } from 'react-dom/test-utils';
import { RouteDefinition } from '@kaoto-next/camel-catalog/types';
describe('CanvasForm', () => {
- const omitFields = ['expression', 'dataFormatType', 'outputs', 'steps', 'when', 'otherwise', 'doCatch', 'doFinally'];
const schemaService = new SchemaService();
const schema = {
@@ -179,11 +178,12 @@ describe('CanvasForm', () => {
} as RouteDefinition;
const entity = new CamelRouteVisualEntity(camelRoute);
const rootNode: IVisualizationNode = entity.toVizNode();
+ const setHeaderNode = rootNode.getChildren()![0].getChildren()![0];
const selectedNode = {
id: '1',
type: 'node',
data: {
- vizNode: rootNode.getChildren()![0],
+ vizNode: setHeaderNode,
},
};
@@ -242,11 +242,12 @@ describe('CanvasForm', () => {
} as RouteDefinition;
const entity = new CamelRouteVisualEntity(camelRoute);
const rootNode: IVisualizationNode = entity.toVizNode();
+ const setHeaderNode = rootNode.getChildren()![0].getChildren()![0];
const selectedNode = {
id: '1',
type: 'node',
data: {
- vizNode: rootNode.getChildren()![0],
+ vizNode: setHeaderNode,
},
};
@@ -306,11 +307,12 @@ describe('CanvasForm', () => {
} as RouteDefinition;
const entity = new CamelRouteVisualEntity(camelRoute);
const rootNode: IVisualizationNode = entity.toVizNode();
+ const marshalNode = rootNode.getChildren()![0].getChildren()![0];
const selectedNode = {
id: '1',
type: 'node',
data: {
- vizNode: rootNode.getChildren()![0],
+ vizNode: marshalNode,
},
};
@@ -339,6 +341,7 @@ describe('CanvasForm', () => {
expect(camelRoute.from.steps[0].marshal!.avro).toBeDefined();
expect(camelRoute.from.steps[0].marshal!.id).toEqual('modified');
});
+
it('main form => dataformat', async () => {
const camelRoute = {
from: {
@@ -354,11 +357,12 @@ describe('CanvasForm', () => {
} as RouteDefinition;
const entity = new CamelRouteVisualEntity(camelRoute);
const rootNode: IVisualizationNode = entity.toVizNode();
+ const marshalNode = rootNode.getChildren()![0].getChildren()![0];
const selectedNode = {
id: '1',
type: 'node',
data: {
- vizNode: rootNode.getChildren()![0],
+ vizNode: marshalNode,
},
};
@@ -405,11 +409,12 @@ describe('CanvasForm', () => {
} as RouteDefinition;
const entity = new CamelRouteVisualEntity(camelRoute);
const rootNode: IVisualizationNode = entity.toVizNode();
+ const loadBalanceNode = rootNode.getChildren()![0].getChildren()![0];
const selectedNode = {
id: '1',
type: 'node',
data: {
- vizNode: rootNode.getChildren()![0],
+ vizNode: loadBalanceNode,
},
};
@@ -438,6 +443,7 @@ describe('CanvasForm', () => {
expect(camelRoute.from.steps[0].loadBalance!.weighted).toBeDefined();
expect(camelRoute.from.steps[0].loadBalance!.id).toEqual('modified');
});
+
it('main form => loadbalancer', async () => {
const camelRoute = {
from: {
@@ -453,11 +459,12 @@ describe('CanvasForm', () => {
} as RouteDefinition;
const entity = new CamelRouteVisualEntity(camelRoute);
const rootNode: IVisualizationNode = entity.toVizNode();
+ const loadBalanceNode = rootNode.getChildren()![0].getChildren()![0];
const selectedNode = {
id: '1',
type: 'node',
data: {
- vizNode: rootNode.getChildren()![0],
+ vizNode: loadBalanceNode,
},
};
@@ -503,7 +510,7 @@ describe('CanvasForm', () => {
render(
{}}>
-
+
,
);
@@ -526,7 +533,7 @@ describe('CanvasForm', () => {
render(
{}}>
-
+
,
);
@@ -549,7 +556,7 @@ describe('CanvasForm', () => {
render(
{}}>
-
+
,
);
diff --git a/packages/ui/src/components/Visualization/Canvas/CanvasForm.tsx b/packages/ui/src/components/Visualization/Canvas/CanvasForm.tsx
index de9f0a3a2..1b30e26fc 100644
--- a/packages/ui/src/components/Visualization/Canvas/CanvasForm.tsx
+++ b/packages/ui/src/components/Visualization/Canvas/CanvasForm.tsx
@@ -17,19 +17,6 @@ interface CanvasFormProps {
selectedNode: CanvasNode;
}
-const omitFields = [
- 'from',
- 'expression',
- 'dataFormatType',
- 'outputs',
- 'steps',
- 'when',
- 'otherwise',
- 'doCatch',
- 'doFinally',
- 'uri',
-];
-
export const CanvasForm: FunctionComponent = (props) => {
const entitiesContext = useContext(EntitiesContext);
const formRef = useRef();
@@ -103,7 +90,7 @@ export const CanvasForm: FunctionComponent = (props) => {
onChange={handleOnChangeIndividualProp}
data-testid="autoform"
>
-
+
diff --git a/packages/ui/src/components/Visualization/Canvas/__snapshots__/Canvas.test.tsx.snap b/packages/ui/src/components/Visualization/Canvas/__snapshots__/Canvas.test.tsx.snap
index cf5eef3eb..faccbf313 100644
--- a/packages/ui/src/components/Visualization/Canvas/__snapshots__/Canvas.test.tsx.snap
+++ b/packages/ui/src/components/Visualization/Canvas/__snapshots__/Canvas.test.tsx.snap
@@ -613,6 +613,53 @@ exports[`Canvas should render correctly 1`] = `