Skip to content

Commit

Permalink
Fix #1417
Browse files Browse the repository at this point in the history
  • Loading branch information
mgubaidullin committed Sep 16, 2024
1 parent 8bddb93 commit 37a2929
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,11 @@ import {DslMetaModel} from "../utils/DslMetaModel";
import {CamelUtil} from "karavan-core/lib/api/CamelUtil";
import {
ChoiceDefinition,
FromDefinition, JsonDataFormat,
FromDefinition, GroovyExpression, JsonDataFormat,
LogDefinition,
MarshalDefinition,
RouteConfigurationDefinition,
RouteDefinition, UnmarshalDefinition
RouteDefinition, SplitDefinition, UnmarshalDefinition
} from "karavan-core/lib/model/CamelDefinition";
import {CamelElement, MetadataLabels} from "karavan-core/lib/model/IntegrationDefinition";
import {CamelDefinitionApiExt} from "karavan-core/lib/api/CamelDefinitionApiExt";
Expand Down Expand Up @@ -283,6 +283,12 @@ export function useRouteDesignerHook() {
// eslint-disable-next-line no-template-curly-in-string
(step as LogDefinition).message = "${body}";
}
if (step.dslName === 'SplitDefinition') {
const split = (step as SplitDefinition);
if (split.expression?.groovy !== undefined && (split.expression?.groovy as GroovyExpression).expression === "") {
(split.expression?.groovy as GroovyExpression).expression = 'body';
}
}
if (step.dslName === 'ChoiceDefinition') {
(step as ChoiceDefinition).when?.push(CamelDefinitionApi.createStep('WhenDefinition', undefined));
(step as ChoiceDefinition).otherwise = CamelDefinitionApi.createStep('OtherwiseDefinition', undefined);
Expand Down
10 changes: 8 additions & 2 deletions karavan-designer/src/designer/route/useRouteDesignerHook.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,11 @@ import {DslMetaModel} from "../utils/DslMetaModel";
import {CamelUtil} from "karavan-core/lib/api/CamelUtil";
import {
ChoiceDefinition,
FromDefinition, JsonDataFormat,
FromDefinition, GroovyExpression, JsonDataFormat,
LogDefinition,
MarshalDefinition,
RouteConfigurationDefinition,
RouteDefinition, UnmarshalDefinition
RouteDefinition, SplitDefinition, UnmarshalDefinition
} from "karavan-core/lib/model/CamelDefinition";
import {CamelElement, MetadataLabels} from "karavan-core/lib/model/IntegrationDefinition";
import {CamelDefinitionApiExt} from "karavan-core/lib/api/CamelDefinitionApiExt";
Expand Down Expand Up @@ -283,6 +283,12 @@ export function useRouteDesignerHook() {
// eslint-disable-next-line no-template-curly-in-string
(step as LogDefinition).message = "${body}";
}
if (step.dslName === 'SplitDefinition') {
const split = (step as SplitDefinition);
if (split.expression?.groovy !== undefined && (split.expression?.groovy as GroovyExpression).expression === "") {
(split.expression?.groovy as GroovyExpression).expression = 'body';
}
}
if (step.dslName === 'ChoiceDefinition') {
(step as ChoiceDefinition).when?.push(CamelDefinitionApi.createStep('WhenDefinition', undefined));
(step as ChoiceDefinition).otherwise = CamelDefinitionApi.createStep('OtherwiseDefinition', undefined);
Expand Down
10 changes: 8 additions & 2 deletions karavan-space/src/designer/route/useRouteDesignerHook.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,11 @@ import {DslMetaModel} from "../utils/DslMetaModel";
import {CamelUtil} from "karavan-core/lib/api/CamelUtil";
import {
ChoiceDefinition,
FromDefinition, JsonDataFormat,
FromDefinition, GroovyExpression, JsonDataFormat,
LogDefinition,
MarshalDefinition,
RouteConfigurationDefinition,
RouteDefinition, UnmarshalDefinition
RouteDefinition, SplitDefinition, UnmarshalDefinition
} from "karavan-core/lib/model/CamelDefinition";
import {CamelElement, MetadataLabels} from "karavan-core/lib/model/IntegrationDefinition";
import {CamelDefinitionApiExt} from "karavan-core/lib/api/CamelDefinitionApiExt";
Expand Down Expand Up @@ -283,6 +283,12 @@ export function useRouteDesignerHook() {
// eslint-disable-next-line no-template-curly-in-string
(step as LogDefinition).message = "${body}";
}
if (step.dslName === 'SplitDefinition') {
const split = (step as SplitDefinition);
if (split.expression?.groovy !== undefined && (split.expression?.groovy as GroovyExpression).expression === "") {
(split.expression?.groovy as GroovyExpression).expression = 'body';
}
}
if (step.dslName === 'ChoiceDefinition') {
(step as ChoiceDefinition).when?.push(CamelDefinitionApi.createStep('WhenDefinition', undefined));
(step as ChoiceDefinition).otherwise = CamelDefinitionApi.createStep('OtherwiseDefinition', undefined);
Expand Down

0 comments on commit 37a2929

Please sign in to comment.