Skip to content

Commit

Permalink
fix(1586): Consumer only endpoints missing in canvas selection
Browse files Browse the repository at this point in the history
  • Loading branch information
tplevko authored and lordrip committed Oct 23, 2024
1 parent 2cd46db commit 5f983b2
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ describe('CamelComponentFilterService', () => {
describe('getCamelCompatibleComponents', () => {
it('should not provide ProducerOnly components', () => {
const filterFn = CamelComponentFilterService.getCamelCompatibleComponents(AddStepMode.ReplaceStep, {
path: 'from',
path: 'route.from',
processorName: 'from' as keyof ProcessorDefinition,
label: 'timer',
});
Expand All @@ -31,7 +31,7 @@ describe('CamelComponentFilterService', () => {

it('should not provide consumerOnly components', () => {
const filterFn = CamelComponentFilterService.getCamelCompatibleComponents(AddStepMode.ReplaceStep, {
path: 'from.steps.2.to',
path: 'route.from.steps.2.to',
processorName: 'to',
label: 'log',
});
Expand All @@ -49,7 +49,7 @@ describe('CamelComponentFilterService', () => {
const filterFn = CamelComponentFilterService.getCamelCompatibleComponents(
AddStepMode.InsertSpecialChildStep,
{
path: 'from.steps.0.choice',
path: 'route.from.steps.0.choice',
processorName: 'choice',
label: 'Choice',
},
Expand All @@ -63,7 +63,7 @@ describe('CamelComponentFilterService', () => {
const filterFn = CamelComponentFilterService.getCamelCompatibleComponents(
AddStepMode.InsertSpecialChildStep,
{
path: 'from.steps.0.choice',
path: 'route.from.steps.0.choice',
processorName: 'choice',
label: 'Choice',
},
Expand All @@ -89,7 +89,7 @@ describe('CamelComponentFilterService', () => {

it('scenario for a new step before an existing step', () => {
const filterFn = CamelComponentFilterService.getCamelCompatibleComponents(AddStepMode.PrependStep, {
path: 'from.steps.0.to',
path: 'route.from.steps.0.to',
processorName: 'to',
label: 'timer',
});
Expand All @@ -105,7 +105,7 @@ describe('CamelComponentFilterService', () => {

it('scenario for a new step after an existing step', () => {
const filterFn = CamelComponentFilterService.getCamelCompatibleComponents(AddStepMode.AppendStep, {
path: 'from.steps.1.to',
path: 'route.from.steps.1.to',
processorName: 'to',
label: 'timer',
});
Expand All @@ -123,7 +123,7 @@ describe('CamelComponentFilterService', () => {
describe('getKameletCompatibleComponents', () => {
it('should not provide ProducerOnly components', () => {
const filterFn = CamelComponentFilterService.getKameletCompatibleComponents(AddStepMode.ReplaceStep, {
path: 'from',
path: 'template.from',
processorName: 'from' as keyof ProcessorDefinition,
label: 'timer',
});
Expand All @@ -138,7 +138,7 @@ describe('CamelComponentFilterService', () => {

it('should not provide consumerOnly components', () => {
const filterFn = CamelComponentFilterService.getKameletCompatibleComponents(AddStepMode.ReplaceStep, {
path: 'from.steps.2.to',
path: 'template.from.steps.2.to',
processorName: 'to',
label: 'log',
});
Expand All @@ -157,7 +157,7 @@ describe('CamelComponentFilterService', () => {
const filterFn = CamelComponentFilterService.getKameletCompatibleComponents(
AddStepMode.InsertSpecialChildStep,
{
path: 'from.steps.0.choice',
path: 'template.from.steps.0.choice',
processorName: 'choice',
label: 'Choice',
},
Expand All @@ -171,7 +171,7 @@ describe('CamelComponentFilterService', () => {
const filterFn = CamelComponentFilterService.getKameletCompatibleComponents(
AddStepMode.InsertSpecialChildStep,
{
path: 'from.steps.0.choice',
path: 'template.from.steps.0.choice',
processorName: 'choice',
label: 'Choice',
},
Expand All @@ -183,7 +183,7 @@ describe('CamelComponentFilterService', () => {

it('scenario for a new step before an existing step', () => {
const filterFn = CamelComponentFilterService.getKameletCompatibleComponents(AddStepMode.PrependStep, {
path: 'from.steps.0.to',
path: 'template.from.steps.0.to',
processorName: 'to',
label: 'timer',
});
Expand All @@ -200,7 +200,7 @@ describe('CamelComponentFilterService', () => {

it('scenario for a new step after an existing step', () => {
const filterFn = CamelComponentFilterService.getKameletCompatibleComponents(AddStepMode.AppendStep, {
path: 'from.steps.1.to',
path: 'template.from.steps.1.to',
processorName: 'to',
label: 'timer',
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,10 @@ export class CamelComponentFilterService {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
definition?: any,
): TileFilter {
if (mode === AddStepMode.ReplaceStep && visualEntityData.path === 'from') {
if (
mode === AddStepMode.ReplaceStep &&
(visualEntityData.path === 'route.from' || visualEntityData.path === 'template.from')
) {
/**
* For the `from` step we want to show only components which are not `producerOnly`,
* as this mean that they can be used only as a producer.
Expand Down Expand Up @@ -89,7 +92,7 @@ export class CamelComponentFilterService {
const camelComponentFilter = this.getCamelCompatibleComponents(mode, visualEntityData, definition);

/** For the `from` step we want to add kamelet:source and leverage the existing getCamelCompatibleComponents method */
if (mode === AddStepMode.ReplaceStep && visualEntityData.path === 'from') {
if (mode === AddStepMode.ReplaceStep && visualEntityData.path === 'template.from') {
return (item: ITile) => {
return (item.type === CatalogKind.Kamelet && item.name === 'source') || camelComponentFilter(item);
};
Expand Down

0 comments on commit 5f983b2

Please sign in to comment.