Skip to content

Commit

Permalink
chore(kamelets): Update kamelet boundaries definition and icons
Browse files Browse the repository at this point in the history
relates to: KaotoIO#110
  • Loading branch information
lordrip authored and igarashitm committed Nov 29, 2023
1 parent 5b722a7 commit 2e3485d
Show file tree
Hide file tree
Showing 10 changed files with 605 additions and 583 deletions.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

7 changes: 7 additions & 0 deletions packages/ui-tests/stories/Canvas.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import {
SourceCodeProvider,
VisibleFLowsContextResult,
VisibleFlowsContext,
kameletJson,
pipeJson,
} from '@kaoto-next/ui/testing';
import { Meta, StoryFn } from '@storybook/react';
Expand Down Expand Up @@ -40,6 +41,7 @@ const emptyCamelRouteJson = {
const camelRouteEntity = new CamelRouteVisualEntity(complexRouteMock.route);
const emptyCamelRouteEntity = new CamelRouteVisualEntity(emptyCamelRouteJson.route);
const pipeEntity = new PipeVisualEntity(pipeJson.spec!);
const kameletEntity = new CamelRouteVisualEntity(kameletJson.spec.template);
const emptyPipeEntity = new PipeVisualEntity(emptyPipeJson.spec!);

const ContextDecorator = (Story: StoryFn) => (
Expand Down Expand Up @@ -85,6 +87,11 @@ PipeVisualization.args = {
entities: [pipeEntity],
};

export const KameletVisualization = Template.bind({});
KameletVisualization.args = {
entities: [kameletEntity],
};

export const EmptyPipeVisualization = Template.bind({});
EmptyPipeVisualization.args = {
entities: [emptyPipeEntity],
Expand Down
1 change: 1 addition & 0 deletions packages/ui/src/components/IconResolver/IconResolver.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ interface IconResolverProps {
export const IconResolver: FunctionComponent<PropsWithChildren<IconResolverProps>> = (props) => {
switch (props.tile.type) {
case CatalogKind.Kamelet:
case CatalogKind.KameletBoundary:
return (
<img
className={props.className}
Expand Down
2 changes: 1 addition & 1 deletion packages/ui/src/models/camel-catalog-index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ export interface Catalogs {
languages: CatalogEntry;
dataformats: CatalogEntry;
kamelets: CatalogEntry;
'kamelets-boundaries': CatalogEntry;
kameletBoundaries: CatalogEntry;
patterns: CatalogEntry;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ export class CamelCatalogService {
dataformatName?: string,
): ICamelDataformatDefinition | undefined;
static getComponent(catalogKey: CatalogKind.Kamelet, componentName?: string): IKameletDefinition | undefined;
static getComponent(catalogKey: CatalogKind.KameletBoundary, componentName?: string): IKameletDefinition | undefined;
static getComponent(catalogKey: CatalogKind, componentName?: string): ComponentsCatalogTypes | undefined;
static getComponent(catalogKey: CatalogKind, componentName?: string): ComponentsCatalogTypes | undefined {
if (componentName === undefined) return undefined;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -114,10 +114,18 @@ export class CamelComponentSchemaService {
if (isDefined(camelElementLookup.componentName)) {
let catalogKind: CatalogKind = CatalogKind.Component;
let lookupName: string = camelElementLookup.componentName;
if (camelElementLookup.componentName.startsWith('kamelet:')) {

if (
camelElementLookup.componentName === 'kamelet:source' ||
camelElementLookup.componentName === 'kamelet:sink'
) {
catalogKind = CatalogKind.KameletBoundary;
lookupName = camelElementLookup.componentName.replace('kamelet:', '');
} else if (camelElementLookup.componentName.startsWith('kamelet:')) {
catalogKind = CatalogKind.Kamelet;
lookupName = camelElementLookup.componentName.replace('kamelet:', '');
}

if (isDefined(CamelCatalogService.getComponent(catalogKind, lookupName))) {
return camelElementLookup.componentName;
}
Expand Down
2 changes: 1 addition & 1 deletion packages/ui/src/providers/catalog.provider.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ export const CatalogLoaderProvider: FunctionComponent<PropsWithChildren<{ catalo
);
/** Camel Kamelets boundaries definitions list (CRDs) */
const kameletBoundariesFiles = CatalogSchemaLoader.fetchFile<ComponentsCatalog[CatalogKind.KameletBoundary]>(
`${props.catalogUrl}/${catalogIndex.catalogs['kamelets-boundaries'].file}`,
`${props.catalogUrl}/${catalogIndex.catalogs.kameletBoundaries.file}`,
);

const [
Expand Down
1 change: 1 addition & 0 deletions packages/ui/src/stubs/index.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
export * from './camel-route';
export * from './kamelet-binding-route';
export * from './kamelet-route';
export * from './pipe';
Loading

0 comments on commit 2e3485d

Please sign in to comment.