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 2022/10/06 05:26:58 UTC

[camel-karavan] 03/04: Fix #486

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

commit 3c6b699bb5836fa15507bde446e880cb3d3ee368
Author: Marat Gubaidullin <ma...@gmail.com>
AuthorDate: Thu Oct 6 01:04:10 2022 -0400

    Fix #486
---
 karavan-core/src/core/model/KameletModels.ts       |  4 +++
 .../src/designer/route/DslSelector.tsx             |  1 -
 karavan-designer/src/designer/utils/CamelUi.tsx    | 30 ++++++++++++----------
 3 files changed, 20 insertions(+), 15 deletions(-)

diff --git a/karavan-core/src/core/model/KameletModels.ts b/karavan-core/src/core/model/KameletModels.ts
index 81a7d5f..33acf65 100644
--- a/karavan-core/src/core/model/KameletModels.ts
+++ b/karavan-core/src/core/model/KameletModels.ts
@@ -101,6 +101,10 @@ export class KameletModel {
     return this.spec.definition.title;
   }
 
+  description(): string {
+    return this.spec.definition.description;
+  }
+
   properties(): any {
     return this.spec.definition.properties;
   }
diff --git a/karavan-designer/src/designer/route/DslSelector.tsx b/karavan-designer/src/designer/route/DslSelector.tsx
index c3d8644..7aa267d 100644
--- a/karavan-designer/src/designer/route/DslSelector.tsx
+++ b/karavan-designer/src/designer/route/DslSelector.tsx
@@ -165,7 +165,6 @@ export class DslSelector extends React.Component<Props, State> {
                 }
                 actions={{}}>
                 <PageSection variant={this.props.dark ? "darker" : "light"}>
-
                     <Gallery key={"gallery-" + labelText} hasGutter className="dsl-gallery">
                         {CamelUi.getSelectorModelsForParentFiltered(parentDsl, labelText, this.props.showSteps)
                             .filter((dsl: DslMetaModel) => this.checkFilter(dsl))
diff --git a/karavan-designer/src/designer/utils/CamelUi.tsx b/karavan-designer/src/designer/utils/CamelUi.tsx
index bd707b9..40252a9 100644
--- a/karavan-designer/src/designer/utils/CamelUi.tsx
+++ b/karavan-designer/src/designer/utils/CamelUi.tsx
@@ -159,20 +159,22 @@ export class CamelUi {
 
     static getKameletDslMetaModel = (type: 'source' | "sink" | "action"): DslMetaModel[] => {
         return KameletApi.getKamelets().filter((k) => k.metadata.labels["camel.apache.org/kamelet.type"] === type)
-            .map((k) =>
-                    new DslMetaModel({
-                        dsl: type === 'source' ? "FromDefinition" : "ToDefinition",
-                        uri: "kamelet:" + k.metadata.name,
-                        labels: k.type(),
-                        navigation: "kamelet",
-                        type: k.type(),
-                        name: k.metadata.name,
-                        title: k.title(),
-                        description: k.title(),
-                        version: k.version(),
-                        supportLevel: k.metadata.annotations["camel.apache.org/kamelet.support.level"],
-                    })
-            );
+            .map((k) => {
+                const descriptionLines = k.description().split("\n");
+                const description = descriptionLines.at(0);
+                return new DslMetaModel({
+                    dsl: type === 'source' ? "FromDefinition" : "ToDefinition",
+                    uri: "kamelet:" + k.metadata.name,
+                    labels: k.type(),
+                    navigation: "kamelet",
+                    type: k.type(),
+                    name: k.metadata.name,
+                    title: k.title(),
+                    description: description,
+                    version: k.version(),
+                    supportLevel: k.metadata.annotations["camel.apache.org/kamelet.support.level"],
+                })
+            });
     }
 
     static nameFromTitle = (title: string): string => {