You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by ma...@apache.org on 2023/10/18 00:12:43 UTC

[camel-karavan] branch main updated: Fix Component image in Designer

This is an automated email from the ASF dual-hosted git repository.

marat pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/camel-karavan.git


The following commit(s) were added to refs/heads/main by this push:
     new df4742ae Fix Component image in Designer
df4742ae is described below

commit df4742ae2d74fc3d082167a5d6133048a0e12eeb
Author: Marat Gubaidullin <ma...@talismancloud.io>
AuthorDate: Tue Oct 17 20:12:35 2023 -0400

    Fix Component image in Designer
---
 karavan-designer/public/example/demo.camel.yaml    | 80 ++++------------------
 karavan-designer/src/designer/utils/CamelUi.tsx    | 19 ++---
 karavan-space/src/designer/utils/CamelUi.tsx       | 19 ++---
 .../src/main/webui/src/designer/utils/CamelUi.tsx  | 19 ++---
 4 files changed, 36 insertions(+), 101 deletions(-)

diff --git a/karavan-designer/public/example/demo.camel.yaml b/karavan-designer/public/example/demo.camel.yaml
index a431e891..3c682878 100644
--- a/karavan-designer/public/example/demo.camel.yaml
+++ b/karavan-designer/public/example/demo.camel.yaml
@@ -1,70 +1,20 @@
 - route:
-    id: route-a7ac
+    id: route-fbf9
     from:
-      uri: sql
-      id: from-82ca
-- route:
-    id: route-1a95
-    from:
-      uri: kamelet:aws-sqs-source
-      id: from-c57c
-      steps:
-        - log:
-            message: ${body}
-            id: log-8ec1
-        - choice:
-            when:
-              - expression: {}
-                id: when-ba60
-            otherwise:
-              id: otherwise-630f
-            id: choice-a534
-        - log:
-            message: ${body}
-            id: log-beae
-        - dynamicRouter:
-            expression: {}
-            id: dynamicRouter-079a
-- route:
-    id: route-4530
-    from:
-      uri: kamelet:azure-cosmosdb-source
-      id: from-ea00
+      uri: kamelet:beer-source
+      id: from-9d5b
       steps:
-        - choice:
-            when:
-              - expression: {}
-                id: when-1755
-                steps:
-                  - loop:
-                      expression: {}
-                      id: loop-967a
-              - expression: {}
-                id: when-16be
-                steps:
-                  - log:
-                      message: ${body}
-                      id: log-fb70
-                  - pollEnrich:
-                      expression: {}
-                      id: pollEnrich-2f03
-            otherwise:
-              id: otherwise-331b
-              steps:
-                - log:
-                    message: ${body}
-                    id: log-29e1
-                - process:
-                    id: process-857f
-            id: choice-cc9a
+        - to:
+            uri: activemq
+            id: to-0fd2
+        - to:
+            uri: asterisk
+            id: to-b9ca
+        - to:
+            uri: aws2-ec2
+            id: to-3c6a
 - route:
-    id: route-24d3
+    id: route-605c
     from:
-      uri: kamelet:cassandra-source
-      id: from-bf6e
-      steps:
-        - process:
-            id: process-2d45
-        - log:
-            message: ${body}
-            id: log-1919
+      uri: activemq
+      id: from-3131
\ No newline at end of file
diff --git a/karavan-designer/src/designer/utils/CamelUi.tsx b/karavan-designer/src/designer/utils/CamelUi.tsx
index 6b3f7093..ac791920 100644
--- a/karavan-designer/src/designer/utils/CamelUi.tsx
+++ b/karavan-designer/src/designer/utils/CamelUi.tsx
@@ -25,7 +25,6 @@ import {
     RegistryBeanDefinition,
     RouteConfigurationDefinition,
     RouteDefinition,
-    SagaDefinition,
     ToDefinition
 } from "karavan-core/lib/model/CamelDefinition";
 import {CamelElement, Integration} from "karavan-core/lib/model/IntegrationDefinition";
@@ -35,7 +34,8 @@ import {
     ApiIcon,
     AwsIcon,
     AzureIcon,
-    BlockchainIcon, CassandraIcon,
+    BlockchainIcon,
+    CassandraIcon,
     ChatIcon,
     ChoiceIcon,
     CloudIcon,
@@ -57,7 +57,8 @@ import {
     Intercept,
     InterceptFrom,
     InterceptSendToEndpoint,
-    IotIcon, KafkaIcon,
+    IotIcon,
+    KafkaIcon,
     KubernetesIcon,
     MachineLearningIcon,
     MailIcon,
@@ -81,7 +82,8 @@ import {
     SplitIcon,
     SpringIcon,
     TerminalIcon,
-    TestingIcon, ToIcon,
+    TestingIcon,
+    ToIcon,
     TransformationIcon,
     ValidationIcon,
     WebserviceIcon,
@@ -90,7 +92,6 @@ import {
 import React from "react";
 import {TopologyUtils} from "karavan-core/lib/api/TopologyUtils";
 import {CamelDisplayUtil} from "karavan-core/lib/api/CamelDisplayUtil";
-import {renderToStaticMarkup} from "react-dom/server";
 
 const StepElements: string[] = [
     "AggregateDefinition",
@@ -698,13 +699,7 @@ export class CamelUi {
         const uri = (element as any).uri;
         const component = ComponentApi.findByName(uri);
         if (component) {
-            const reactElement = CamelUi.getIconForComponent(component.component.title, component.component.label);
-            const icon = 'data:image/svg+xml,' + encodeURI(renderToStaticMarkup((reactElement)))
-            return (
-                <svg className="icon">
-                    <image href={icon} className="icon"/>
-                </svg>
-            )
+            return CamelUi.getIconForComponent(component.component.title, component.component.label)
         } else if (["FromDefinition", "KameletDefinition"].includes(element.dslName)) {
             const icon = k ? k.icon() : externalIcon;
             return  (
diff --git a/karavan-space/src/designer/utils/CamelUi.tsx b/karavan-space/src/designer/utils/CamelUi.tsx
index 6b3f7093..ac791920 100644
--- a/karavan-space/src/designer/utils/CamelUi.tsx
+++ b/karavan-space/src/designer/utils/CamelUi.tsx
@@ -25,7 +25,6 @@ import {
     RegistryBeanDefinition,
     RouteConfigurationDefinition,
     RouteDefinition,
-    SagaDefinition,
     ToDefinition
 } from "karavan-core/lib/model/CamelDefinition";
 import {CamelElement, Integration} from "karavan-core/lib/model/IntegrationDefinition";
@@ -35,7 +34,8 @@ import {
     ApiIcon,
     AwsIcon,
     AzureIcon,
-    BlockchainIcon, CassandraIcon,
+    BlockchainIcon,
+    CassandraIcon,
     ChatIcon,
     ChoiceIcon,
     CloudIcon,
@@ -57,7 +57,8 @@ import {
     Intercept,
     InterceptFrom,
     InterceptSendToEndpoint,
-    IotIcon, KafkaIcon,
+    IotIcon,
+    KafkaIcon,
     KubernetesIcon,
     MachineLearningIcon,
     MailIcon,
@@ -81,7 +82,8 @@ import {
     SplitIcon,
     SpringIcon,
     TerminalIcon,
-    TestingIcon, ToIcon,
+    TestingIcon,
+    ToIcon,
     TransformationIcon,
     ValidationIcon,
     WebserviceIcon,
@@ -90,7 +92,6 @@ import {
 import React from "react";
 import {TopologyUtils} from "karavan-core/lib/api/TopologyUtils";
 import {CamelDisplayUtil} from "karavan-core/lib/api/CamelDisplayUtil";
-import {renderToStaticMarkup} from "react-dom/server";
 
 const StepElements: string[] = [
     "AggregateDefinition",
@@ -698,13 +699,7 @@ export class CamelUi {
         const uri = (element as any).uri;
         const component = ComponentApi.findByName(uri);
         if (component) {
-            const reactElement = CamelUi.getIconForComponent(component.component.title, component.component.label);
-            const icon = 'data:image/svg+xml,' + encodeURI(renderToStaticMarkup((reactElement)))
-            return (
-                <svg className="icon">
-                    <image href={icon} className="icon"/>
-                </svg>
-            )
+            return CamelUi.getIconForComponent(component.component.title, component.component.label)
         } else if (["FromDefinition", "KameletDefinition"].includes(element.dslName)) {
             const icon = k ? k.icon() : externalIcon;
             return  (
diff --git a/karavan-web/karavan-app/src/main/webui/src/designer/utils/CamelUi.tsx b/karavan-web/karavan-app/src/main/webui/src/designer/utils/CamelUi.tsx
index 6b3f7093..ac791920 100644
--- a/karavan-web/karavan-app/src/main/webui/src/designer/utils/CamelUi.tsx
+++ b/karavan-web/karavan-app/src/main/webui/src/designer/utils/CamelUi.tsx
@@ -25,7 +25,6 @@ import {
     RegistryBeanDefinition,
     RouteConfigurationDefinition,
     RouteDefinition,
-    SagaDefinition,
     ToDefinition
 } from "karavan-core/lib/model/CamelDefinition";
 import {CamelElement, Integration} from "karavan-core/lib/model/IntegrationDefinition";
@@ -35,7 +34,8 @@ import {
     ApiIcon,
     AwsIcon,
     AzureIcon,
-    BlockchainIcon, CassandraIcon,
+    BlockchainIcon,
+    CassandraIcon,
     ChatIcon,
     ChoiceIcon,
     CloudIcon,
@@ -57,7 +57,8 @@ import {
     Intercept,
     InterceptFrom,
     InterceptSendToEndpoint,
-    IotIcon, KafkaIcon,
+    IotIcon,
+    KafkaIcon,
     KubernetesIcon,
     MachineLearningIcon,
     MailIcon,
@@ -81,7 +82,8 @@ import {
     SplitIcon,
     SpringIcon,
     TerminalIcon,
-    TestingIcon, ToIcon,
+    TestingIcon,
+    ToIcon,
     TransformationIcon,
     ValidationIcon,
     WebserviceIcon,
@@ -90,7 +92,6 @@ import {
 import React from "react";
 import {TopologyUtils} from "karavan-core/lib/api/TopologyUtils";
 import {CamelDisplayUtil} from "karavan-core/lib/api/CamelDisplayUtil";
-import {renderToStaticMarkup} from "react-dom/server";
 
 const StepElements: string[] = [
     "AggregateDefinition",
@@ -698,13 +699,7 @@ export class CamelUi {
         const uri = (element as any).uri;
         const component = ComponentApi.findByName(uri);
         if (component) {
-            const reactElement = CamelUi.getIconForComponent(component.component.title, component.component.label);
-            const icon = 'data:image/svg+xml,' + encodeURI(renderToStaticMarkup((reactElement)))
-            return (
-                <svg className="icon">
-                    <image href={icon} className="icon"/>
-                </svg>
-            )
+            return CamelUi.getIconForComponent(component.component.title, component.component.label)
         } else if (["FromDefinition", "KameletDefinition"].includes(element.dslName)) {
             const icon = k ? k.icon() : externalIcon;
             return  (