Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(1586): Consumer only endpoints missing in canvas selection #1588

Merged
merged 1 commit into from
Oct 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading