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 2024/02/07 00:57:54 UTC
(camel-karavan) 03/05: Fix #1109
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 9ae1ab4a4d7626f696d4e3cea52ac83c1f7b8470
Author: Marat Gubaidullin <ma...@talismancloud.io>
AuthorDate: Tue Feb 6 19:11:19 2024 -0500
Fix #1109
---
karavan-space/src/designer/KaravanDesigner.tsx | 2 ++
karavan-space/src/designer/route/DslConnections.tsx | 14 ++++++++++++--
karavan-space/src/designer/utils/InfrastructureAPI.ts | 5 +++++
3 files changed, 19 insertions(+), 2 deletions(-)
diff --git a/karavan-space/src/designer/KaravanDesigner.tsx b/karavan-space/src/designer/KaravanDesigner.tsx
index 11bf8b6c..05831a38 100644
--- a/karavan-space/src/designer/KaravanDesigner.tsx
+++ b/karavan-space/src/designer/KaravanDesigner.tsx
@@ -48,6 +48,7 @@ interface Props {
onSaveCustomCode: (name: string, code: string) => void
onGetCustomCode: (name: string, javaType: string) => Promise<string | undefined>
onSavePropertyPlaceholder: (key: string, value: string) => void
+ onInternalConsumerClick: (uri: string, name: string) => void
filename: string
yaml: string
dark: boolean
@@ -74,6 +75,7 @@ export function KaravanDesigner(props: Props) {
InfrastructureAPI.setOnGetCustomCode(props.onGetCustomCode);
InfrastructureAPI.setOnSave(props.onSave);
InfrastructureAPI.setOnSavePropertyPlaceholder(props.onSavePropertyPlaceholder);
+ InfrastructureAPI.setOnInternalConsumerClick(props.onInternalConsumerClick);
setSelectedStep(undefined);
const i = makeIntegration(props.yaml, props.filename);
diff --git a/karavan-space/src/designer/route/DslConnections.tsx b/karavan-space/src/designer/route/DslConnections.tsx
index 0cfb4d78..ebb89933 100644
--- a/karavan-space/src/designer/route/DslConnections.tsx
+++ b/karavan-space/src/designer/route/DslConnections.tsx
@@ -24,6 +24,9 @@ import {CamelDefinitionApiExt} from "karavan-core/lib/api/CamelDefinitionApiExt"
import {TopologyUtils} from "karavan-core/lib/api/TopologyUtils";
import {CamelElement} from "karavan-core/lib/model/IntegrationDefinition";
import {v4 as uuidv4} from "uuid";
+import {DeleteElementIcon} from "../utils/ElementIcons";
+import {Button} from "@patternfly/react-core";
+import {InfrastructureAPI} from "../utils/InfrastructureAPI";
const overlapGap: number = 40;
@@ -191,7 +194,7 @@ export function DslConnections() {
const step = (pos.step as any);
const uri = step?.uri;
const directOrSeda = step && uri && step?.dslName === 'ToDefinition' && ['direct','seda'].includes(uri);
- const label = directOrSeda ? (step?.parameters?.name) : '';
+ const name = directOrSeda ? (step?.parameters?.name) : '';
const r = pos.headerRect.height / 2;
const outgoingX = width - 20;
const outgoingY = data[1] + 15;
@@ -201,7 +204,14 @@ export function DslConnections() {
<div key={pos.step.uuid + "-icon"}
style={{display: "block", position: "absolute", top: imageY, left: imageX}}>
{CamelUi.getConnectionIcon(pos.step)}
- {directOrSeda && <div style={{position: 'absolute', right: 27, top: -10, whiteSpace: 'nowrap'}}>{label}</div>}
+ {directOrSeda &&
+ <Button style={{position: 'absolute', right: 27, top: -12, whiteSpace: 'nowrap', zIndex: 300, padding: 0}}
+ variant={'link'}
+ aria-label="Goto"
+ onClick={_ => InfrastructureAPI.onInternalConsumerClick(uri, name)}>
+ {name}
+ </Button>
+ }
</div>
)
}
diff --git a/karavan-space/src/designer/utils/InfrastructureAPI.ts b/karavan-space/src/designer/utils/InfrastructureAPI.ts
index c2d5ca7c..77ef1bd3 100644
--- a/karavan-space/src/designer/utils/InfrastructureAPI.ts
+++ b/karavan-space/src/designer/utils/InfrastructureAPI.ts
@@ -21,6 +21,7 @@ export class InfrastructureAPI {
static onSaveCustomCode: (name: string, code: string) => void;
static onSave: (filename: string, yaml: string, propertyOnly: boolean) => void;
static onSavePropertyPlaceholder: (key: string, value: string) => void;
+ static onInternalConsumerClick: (uri: string, name: string) => void;
static setOnGetCustomCode(onGetCustomCode: (name: string, javaType: string) => Promise<string | undefined>){
this.onGetCustomCode = onGetCustomCode
@@ -38,6 +39,10 @@ export class InfrastructureAPI {
this.onSavePropertyPlaceholder = onSavePropertyPlaceholder
}
+ static setOnInternalConsumerClick(onInternalConsumerClick:(uri: string, name: string) => void){
+ this.onInternalConsumerClick = onInternalConsumerClick
+ }
+
// Kubernetes/Docker API
static infrastructure: 'kubernetes' | 'docker' | 'local' = 'local';
static configMaps: string[] = [];