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 2026/02/28 01:26:43 UTC
(camel-karavan) 02/04: karavan-designer for vscode 4.18.0
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 2a9f7e395dbc4a06c48d7753a8570f57d54bf896
Author: Marat Gubaidullin <ma...@talismancloud.io>
AuthorDate: Fri Feb 27 19:25:25 2026 -0500
karavan-designer for vscode 4.18.0
---
.../webview/integration-designer/DesignerStore.ts | 16 +-
.../integration-designer/KaravanDesigner.css | 14 +-
.../integration-designer/KaravanDesigner.tsx | 29 ++-
.../KaravanDesignerViewSwitch.tsx | 82 +++-----
.../integration-designer/beans/BeanCard.tsx | 4 +-
.../integration-designer/beans/BeansDesigner.tsx | 10 +-
.../integration-designer/editor/CodeEditor.tsx | 69 -------
.../integration-designer/icons/ComponentIcons.tsx | 8 +-
.../integration-designer/icons/KaravanIcons.tsx | 160 ++++++++++-----
.../kamelet/KameletAnnotationsPanel.tsx | 2 +-
.../kamelet/KameletDefinitionPropertyCard.tsx | 6 +-
.../kamelet/KameletDefinitionsPanel.tsx | 6 +-
.../kamelet/KameletDependenciesCard.tsx | 4 +-
.../kamelet/KameletDesigner.tsx | 5 +-
.../integration-designer/kamelet/KameletInput.tsx | 2 +-
.../kamelet/KameletTypesOutCard.tsx | 4 +-
.../property/DslProperties.css | 2 +-
.../property/DslProperties.tsx | 27 ++-
.../property/MainPropertiesPanel.tsx | 40 +---
.../property/PropertiesHeader.tsx | 14 +-
.../integration-designer/property/PropertyStore.ts | 6 +-
.../property/expression/ExpressionEditor.tsx | 7 +-
.../property/property/BeanProperties.tsx | 16 +-
.../property/property/ComponentPropertyField.tsx | 21 +-
.../property/ConfigurationSelectorModal.tsx | 4 +-
.../property/property/DataFormatField.tsx | 17 +-
.../property/property/DslPropertyField.tsx | 42 ++--
.../property/property/DslPropertyFieldSelect.tsx | 6 +-
.../property/DslPropertyFieldSelectScrollable.tsx | 4 +-
.../property/property/ExpressionField.tsx | 12 +-
.../property/property/FileReferenceDropdown.tsx | 2 +-
.../property/property/KameletPropertyField.tsx | 6 +-
.../property/property/ObjectField.tsx | 10 +-
.../property/PropertyPlaceholderDropdown.tsx | 6 +-
.../property/property/PropertyUtil.tsx | 6 +-
.../property/property/VariablesDropdown.tsx | 4 +-
.../property/usePropertiesHook.tsx | 28 +--
.../webview/integration-designer/rest/RestCard.tsx | 6 +-
.../rest/RestConfigurationCard.tsx | 6 +-
.../integration-designer/rest/RestDesigner.tsx | 29 +--
.../integration-designer/rest/RestMethodCard.tsx | 4 +-
.../rest/RestMethodSelector.tsx | 2 -
.../integration-designer/route/DslConnections.tsx | 10 +-
.../route/element/DslElement.tsx | 6 +-
.../route/element/DslElementHeader.tsx | 20 +-
.../route/element/DslElementMoveModal.tsx | 2 +-
.../route/element/RouteTemplateElement.tsx | 8 +-
.../route/useRouteDesignerHook.tsx | 29 +--
.../integration-designer/selector/DslCard.tsx | 14 +-
.../integration-designer/selector/DslFastCard.tsx | 8 +-
.../integration-designer/selector/DslSelector.tsx | 22 +-
.../webview/integration-designer/utils/CamelUi.tsx | 60 +++---
.../webview/integration-designer/utils/EventBus.ts | 11 +-
.../integration-designer/utils/Notification.tsx | 2 +-
.../CustomComponentFactory.tsx | 8 +-
.../webview/integration-topology/CustomEdge.tsx | 2 +-
.../webview/integration-topology/CustomNode.tsx | 147 +++++++++-----
.../webview/integration-topology/GetCustomMenu.tsx | 28 ++-
.../webview/integration-topology/TopologyApi.tsx | 165 ++++++++-------
.../webview/integration-topology/TopologyBeans.tsx | 16 +-
.../integration-topology/TopologyElkLayout.ts | 222 +++++++++++++++++++++
.../integration-topology/TopologyLegend.tsx | 11 +-
.../webview/integration-topology/TopologyStore.ts | 168 ----------------
.../webview/integration-topology/TopologyTab.tsx | 84 ++++----
.../integration-topology/TopologyToolbar.tsx | 102 ++++++++++
.../graph/TopologyDagreLayout.ts | 98 ---------
.../integration-topology/graph/TopologyGroup.ts | 3 -
.../integration-topology/graph/TopologyLink.ts | 72 -------
.../integration-topology/graph/TopologyNode.ts | 4 -
.../webview/integration-topology/topology.css | 67 ++++---
.../integration-topology/useTopologyHook.tsx | 43 ++--
71 files changed, 1063 insertions(+), 1117 deletions(-)
diff --git a/karavan-vscode/webview/integration-designer/DesignerStore.ts b/karavan-vscode/webview/integration-designer/DesignerStore.ts
index 3e9187ca..335a4bc5 100644
--- a/karavan-vscode/webview/integration-designer/DesignerStore.ts
+++ b/karavan-vscode/webview/integration-designer/DesignerStore.ts
@@ -15,12 +15,12 @@
* limitations under the License.
*/
-import {CamelElement, Integration, IntegrationFile} from "@/core/model/IntegrationDefinition";
+import {CamelElement, Integration, IntegrationFile} from "@karavan-core/model/IntegrationDefinition";
import {DslPosition, EventBus} from "./utils/EventBus";
import {createWithEqualityFn} from "zustand/traditional";
import {shallow} from "zustand/shallow";
-import {BeanFactoryDefinition} from "@/core/model/CamelDefinition";
-import {DslMetaModel} from "@/integration-designer/utils/DslMetaModel";
+import {BeanFactoryDefinition} from "@karavan-core/model/CamelDefinition";
+import {DslMetaModel} from "@features/project/designer/utils/DslMetaModel";
interface IntegrationState {
integration: Integration;
@@ -197,6 +197,10 @@ export const useConnectionsStore = createWithEqualityFn<ConnectionsState>((set)
}
}), shallow)
+
+export const DesignerViewSwitchOptions = ["routes", "rest", "beans", "kamelet"] as const;
+export type DesignerViewSwitchOption = typeof DesignerViewSwitchOptions[number];
+
type DesignerState = {
designerSwitch: boolean
isDebugging: boolean
@@ -222,7 +226,7 @@ type DesignerState = {
propertyPlaceholders: [string, string][]
parameterPlaceholders: [string, string][], // route template parameters
beans: BeanFactoryDefinition[],
- tab?: "routes" | "rest" | "beans" | "kamelet",
+ tab?: DesignerViewSwitchOption,
stepDoubleClicked: boolean,
}
@@ -274,7 +278,7 @@ type DesignerAction = {
setPropertyPlaceholders: (propertyPlaceholders: [string, string][]) => void;
setParameterPlaceholders: (parameterPlaceholders: [string, string][]) => void;
setBeans: (beans: BeanFactoryDefinition[]) => void;
- setTab: (tab?: "routes" | "rest" | "beans" | "kamelet") => void;
+ setTab: (tab?: DesignerViewSwitchOption) => void;
setDesignerSwitch: (designerSwitch: boolean) => void;
setStepDoubleClicked: (stepDoubleClicked: boolean) => void;
}
@@ -370,7 +374,7 @@ export const useDesignerStore = createWithEqualityFn<DesignerState & DesignerAct
return {beans: [...beans]};
})
},
- setTab: (tab?: "routes" | "rest" | "beans" | "kamelet") => {
+ setTab: (tab?: DesignerViewSwitchOption) => {
set({tab: tab})
},
setDesignerSwitch: (designerSwitch: boolean) => {
diff --git a/karavan-vscode/webview/integration-designer/KaravanDesigner.css b/karavan-vscode/webview/integration-designer/KaravanDesigner.css
index eb7b3e34..19898c41 100644
--- a/karavan-vscode/webview/integration-designer/KaravanDesigner.css
+++ b/karavan-vscode/webview/integration-designer/KaravanDesigner.css
@@ -26,16 +26,8 @@
.karavan .karavan-designer-view-switcher {
position: absolute;
- right: 0;
- top: 0;
- padding-right: 8px;
+ width: 125px;
+ right: 1px;
+ top: 1px;
z-index: 100;
-}
-
-.karavan-designer-view-switcher-dropdown button {
- padding: 0 12px 0 8px;
-}
-
-.karavan-designer-view-switcher-dropdown .pf-v6-c-menu__item-icon {
- transform: scale(0.5);
}
\ No newline at end of file
diff --git a/karavan-vscode/webview/integration-designer/KaravanDesigner.tsx b/karavan-vscode/webview/integration-designer/KaravanDesigner.tsx
index 1e91ff03..eda53963 100644
--- a/karavan-vscode/webview/integration-designer/KaravanDesigner.tsx
+++ b/karavan-vscode/webview/integration-designer/KaravanDesigner.tsx
@@ -17,9 +17,9 @@
import React, {useEffect, useState} from 'react';
import './KaravanDesigner.css';
import {RouteDesigner} from "./route/RouteDesigner";
-import {CamelDefinitionYaml} from "@/core/api/CamelDefinitionYaml";
-import {Integration, IntegrationFile} from "@/core/model/IntegrationDefinition";
-import {CamelUtil} from "@/core/api/CamelUtil";
+import {CamelDefinitionYaml} from "@karavan-core/api/CamelDefinitionYaml";
+import {Integration, IntegrationFile} from "@karavan-core/model/IntegrationDefinition";
+import {CamelUtil} from "@karavan-core/api/CamelUtil";
import {CamelUi} from "./utils/CamelUi";
import {useDesignerStore, useIntegrationStore} from "./DesignerStore";
import {shallow} from "zustand/shallow";
@@ -28,12 +28,12 @@ import {EventBus, IntegrationUpdate} from "./utils/EventBus";
import {RestDesigner} from "./rest/RestDesigner";
import {BeansDesigner} from "./beans/BeansDesigner";
import {KameletDesigner} from "./kamelet/KameletDesigner";
-import {BeanFactoryDefinition, RouteDefinition, RouteTemplateDefinition} from "@/core/model/CamelDefinition";
+import {BeanFactoryDefinition, RouteDefinition, RouteTemplateDefinition} from "@karavan-core/model/CamelDefinition";
import {ErrorBoundaryState, ErrorBoundaryWrapper} from "./ErrorBoundaryWrapper";
-import {Panel, PanelGroup, PanelResizeHandle} from 'react-resizable-panels';
-import {MainPropertiesPanel} from "./property/MainPropertiesPanel";
-import {CamelDefinitionApiExt} from "@/core/api/CamelDefinitionApiExt";
-import {KaravanDesignerViewSwitch} from "@/integration-designer/KaravanDesignerViewSwitch";
+import {Group, Panel, Separator} from 'react-resizable-panels';
+import {CamelDefinitionApiExt} from "@karavan-core/api/CamelDefinitionApiExt";
+import {KaravanDesignerViewSwitch} from "@features/project/designer/KaravanDesignerViewSwitch";
+import {MainPropertiesPanel} from "@features/project/designer/property/MainPropertiesPanel";
interface Props {
onSave: (filename: string, yaml: string, propertyOnly: boolean) => void
@@ -50,7 +50,6 @@ interface Props {
propertyPlaceholders: [string, string][]
beans: BeanFactoryDefinition[]
files: IntegrationFile[]
- mainRightPanel?: React.ReactNode
}
export function KaravanDesigner(props: Props) {
@@ -192,17 +191,17 @@ export function KaravanDesigner(props: Props) {
return (
(tab !== 'kamelet')
- ? <PanelGroup direction="horizontal">
+ ? <Group orientation="horizontal">
<Panel minSize={10} defaultSize={70}>
{getMainPart()}
</Panel>
- <PanelResizeHandle className='resize-handler'/>
+ <Separator className='resize-handler'/>
<Panel minSize={10} defaultSize={30}>
- {props.mainRightPanel || <MainPropertiesPanel/>}
+ <MainPropertiesPanel/>
</Panel>
- </PanelGroup>
- : <PanelGroup direction="horizontal">
+ </Group>
+ : <Group orientation="horizontal">
{getMainPart()}
- </PanelGroup>
+ </Group>
)
}
\ No newline at end of file
diff --git a/karavan-vscode/webview/integration-designer/KaravanDesignerViewSwitch.tsx b/karavan-vscode/webview/integration-designer/KaravanDesignerViewSwitch.tsx
index 623df87e..49a825e2 100644
--- a/karavan-vscode/webview/integration-designer/KaravanDesignerViewSwitch.tsx
+++ b/karavan-vscode/webview/integration-designer/KaravanDesignerViewSwitch.tsx
@@ -1,73 +1,45 @@
import React from 'react';
-import {Dropdown, DropdownItem, DropdownList, MenuToggle, MenuToggleElement} from '@patternfly/react-core';
-import EllipsisVIcon from "@patternfly/react-icons/dist/esm/icons/ellipsis-v-icon";
-import {useDesignerStore, useIntegrationStore} from "@/integration-designer/DesignerStore";
+import {Menu, MenuContent, MenuItem, MenuList} from '@patternfly/react-core';
+import {DesignerViewSwitchOption, DesignerViewSwitchOptions, useDesignerStore, useIntegrationStore} from "@features/project/designer/DesignerStore";
import {shallow} from "zustand/shallow";
-import {getDesignerIcon} from "@/integration-designer/icons/KaravanIcons";
+import {getDesignerIcon} from "@features/project/designer/icons/KaravanIcons";
export function KaravanDesignerViewSwitch() {
- const [setSelectedStep, setTab] = useDesignerStore((s) => [s.setSelectedStep, s.setTab], shallow)
+ const [setSelectedStep, setTab, tab] = useDesignerStore((s) => [s.setSelectedStep, s.setTab, s.tab], shallow)
const [integration] = useIntegrationStore((s) => [s.integration], shallow)
const isKamelet = integration.type === 'kamelet';
- const [isToggleOpen, setIsToggleOpen] = React.useState(false);
-
- const onToggleClick = () => {
- setIsToggleOpen(!isToggleOpen);
- };
-
- const onSelect = (_event: React.MouseEvent<Element, MouseEvent> | undefined, value: string | number | undefined) => {
- // eslint-disable-next-line no-console
- setIsToggleOpen(false);
- };
-
- function selectTab(tab: "routes" | "rest" | "beans" | "kamelet") {
- if (["routes", "rest", "beans", "kamelet"].includes(tab)) {
- setTab(tab);
+ const onSelect = (_event: React.MouseEvent<Element, MouseEvent> | undefined, itemId: number | string | undefined) => {
+ const item = itemId as string; // eslint-disable-next-line no-console
+ if (DesignerViewSwitchOptions.includes(item as DesignerViewSwitchOption)) {
+ setTab(item as DesignerViewSwitchOption);
} else {
- setTab(undefined); // Handle unexpected values
+ setTab(undefined);
}
setSelectedStep(undefined);
+ };
+
+ function getMenuItem(name: string, title: string) {
+ return (
+ <MenuItem isSelected={tab === name} itemId={name} key={name} icon={getDesignerIcon(name)}>
+ {title}
+ </MenuItem>
+ )
}
return (
<div className="karavan-designer-view-switcher">
- <Dropdown
- onSelect={onSelect}
- popperProps={{position: 'right'}}
- toggle={(toggleRef: React.Ref<MenuToggleElement>) => (
- <MenuToggle
- ref={toggleRef}
- onClick={onToggleClick}
- variant="plain"
- isExpanded={isToggleOpen}
- aria-label="Action list single group kebab"
- icon={<EllipsisVIcon/>}
- />
- )}
- isOpen={isToggleOpen}
- onOpenChange={(isOpen: boolean) => setIsToggleOpen(isOpen)}
- >
- <DropdownList className="karavan-designer-view-switcher-dropdown">
- {isKamelet &&
- <DropdownItem value={0} key="kamelet" icon={getDesignerIcon('kamelet')} onClick={(ev) => selectTab('kamelet')}>
- Kamelet Definitions
- </DropdownItem>
- }
- <DropdownItem value={1} key="routes" icon={getDesignerIcon('routes')} onClick={(ev) => selectTab('routes')}>
- Routes
- </DropdownItem>
- {!isKamelet &&
- <DropdownItem value={2} key="rest" icon={getDesignerIcon('rest')} onClick={(ev) => selectTab('rest')}>
- REST
- </DropdownItem>
- }
- <DropdownItem value={3} key="beans" icon={getDesignerIcon('beans')} onClick={(ev) => selectTab('beans')}>
- Beans
- </DropdownItem>
- </DropdownList>
- </Dropdown>
+ <Menu onSelect={onSelect} activeItemId={tab}>
+ <MenuContent>
+ <MenuList>
+ {isKamelet && getMenuItem("kamelet", "Kamelet Definitions")}
+ {getMenuItem("routes", "Routes")}
+ {!isKamelet && getMenuItem("rest", "REST")}
+ {getMenuItem("beans", "Beans")}
+ </MenuList>
+ </MenuContent>
+ </Menu>
</div>
)
}
diff --git a/karavan-vscode/webview/integration-designer/beans/BeanCard.tsx b/karavan-vscode/webview/integration-designer/beans/BeanCard.tsx
index 6266ebed..1400b213 100644
--- a/karavan-vscode/webview/integration-designer/beans/BeanCard.tsx
+++ b/karavan-vscode/webview/integration-designer/beans/BeanCard.tsx
@@ -19,9 +19,9 @@ import {
Button, Flex, FlexItem
} from '@patternfly/react-core';
import './bean.css';
-import {BeanFactoryDefinition} from "@/core/model/CamelDefinition";
+import {BeanFactoryDefinition} from "@karavan-core/model/CamelDefinition";
import {DeleteElementIcon} from "../utils/ElementIcons";
-import {CamelElement} from "@/core/model/IntegrationDefinition";
+import {CamelElement} from "@karavan-core/model/IntegrationDefinition";
interface Props {
bean: BeanFactoryDefinition
diff --git a/karavan-vscode/webview/integration-designer/beans/BeansDesigner.tsx b/karavan-vscode/webview/integration-designer/beans/BeansDesigner.tsx
index 92a96543..5cd1a6bf 100644
--- a/karavan-vscode/webview/integration-designer/beans/BeansDesigner.tsx
+++ b/karavan-vscode/webview/integration-designer/beans/BeansDesigner.tsx
@@ -15,17 +15,17 @@
* limitations under the License.
*/
import React, {useEffect} from 'react';
-import {Button, Flex, FlexItem, Gallery, GalleryItem, Modal, ModalBody, ModalFooter, ModalHeader, PageSection} from '@patternfly/react-core';
+import {Button, Flex, FlexItem, Gallery, GalleryItem, PageSection} from '@patternfly/react-core';
import './bean.css';
-import {BeanFactoryDefinition} from "@/core/model/CamelDefinition";
+import {BeanFactoryDefinition} from "@karavan-core/model/CamelDefinition";
import {CamelUi} from "../utils/CamelUi";
import PlusIcon from "@patternfly/react-icons/dist/esm/icons/plus-icon";
-import {CamelDefinitionApiExt} from "@/core/api/CamelDefinitionApiExt";
-import {CamelUtil} from "@/core/api/CamelUtil";
+import {CamelDefinitionApiExt} from "@karavan-core/api/CamelDefinitionApiExt";
+import {CamelUtil} from "@karavan-core/api/CamelUtil";
import {BeanCard} from "./BeanCard";
import {useDesignerStore, useIntegrationStore} from "../DesignerStore";
import {shallow} from "zustand/shallow";
-import {ModalConfirmation} from "@/components/ModalConfirmation";
+import {ModalConfirmation} from "@shared/ui/ModalConfirmation";
export function BeansDesigner() {
diff --git a/karavan-vscode/webview/integration-designer/editor/CodeEditor.tsx b/karavan-vscode/webview/integration-designer/editor/CodeEditor.tsx
deleted file mode 100644
index 11da14be..00000000
--- a/karavan-vscode/webview/integration-designer/editor/CodeEditor.tsx
+++ /dev/null
@@ -1,69 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-import React, {useEffect, useState} from 'react';
-// import '@/monaco-setup';
-import Editor from "@monaco-editor/react";
-import {shallow} from "zustand/shallow";
-import {useDesignerStore, useIntegrationStore} from "../DesignerStore";
-import {CamelDefinitionYaml} from "@/core/api/CamelDefinitionYaml";
-import {CamelUtil} from "@/core/api/CamelUtil";
-
-export function CodeEditor () {
-
- const [integration, setIntegration] = useIntegrationStore((s) => [s.integration, s.setIntegration], shallow);
- const [setNotification, badge] = useDesignerStore((s) => [s.setNotification, s.notificationBadge], shallow)
- const [code, setCode] = useState<string>('');
-
- useEffect(() => {
- try {
- const clone = CamelUtil.cloneIntegration(integration);
- const c = CamelDefinitionYaml.integrationToYaml(clone);
- setCode(c);
- } catch (e: any) {
- const message: string = e?.message ? e.message : e.reason;
- setNotification(true, ['Error in YAML, Integration can not be saved!', message]);
- }
- return () => {
- setNotification(false, ['', '']);
- }
- }, []);
-
- function onChange(value: string | undefined) {
- if (value) {
- try {
- const i = CamelDefinitionYaml.yamlToIntegration(integration.metadata.name, value);
- setIntegration(i, false);
- setNotification(false, ['', '']);
- } catch (e: any) {
- const message: string = e?.message ? e.message : e.reason;
- setNotification(true, ['Error in YAML, Integration can not be saved!' ,message]);
- }
- }
- }
-
- return (
- <Editor
- height="100vh"
- defaultLanguage={'yaml'}
- theme={'light'}
- value={code}
- className={'code-editor'}
- defaultValue={code}
- onChange={(value, ev) => onChange(value)}
- />
- )
-}
diff --git a/karavan-vscode/webview/integration-designer/icons/ComponentIcons.tsx b/karavan-vscode/webview/integration-designer/icons/ComponentIcons.tsx
index 92998a43..284ab55a 100644
--- a/karavan-vscode/webview/integration-designer/icons/ComponentIcons.tsx
+++ b/karavan-vscode/webview/integration-designer/icons/ComponentIcons.tsx
@@ -582,12 +582,12 @@ export function CassandraIcon() {
);
}
-export function ActivemqIcon() {
+export function ActivemqIcon(width: number = 32, height: number = 32) {
return (
<svg
xmlns="http://www.w3.org/2000/svg"
viewBox="0 0 30.803 44.324"
- className="icon" width="32px" height="32px">
+ className="icon" width={width} height={width}>
<defs>
<filter
id="a"
@@ -868,13 +868,13 @@ export function ActivemqIcon() {
);
}
-export function KafkaIcon() {
+export function KafkaIcon(width: number = 32, height: number = 32) {
return (
<svg
xmlns="http://www.w3.org/2000/svg"
preserveAspectRatio="xMidYMid"
viewBox="-78.5 0 413 413"
- className="icon" width="32px" height="32px">
+ className="icon" width={width} height={width}>
<path
fill="#1A1919"
d="M87.932 36.714c-4.55-4.571-10.896-7.394-17.951-7.394-7.029 0-13.326 2.823-17.822 7.394h-.13c-4.535 4.55-7.358 10.9-7.358 17.93 0 7.055 2.823 13.352 7.359 17.875l.129.102c4.496 4.55 10.793 7.346 17.822 7.346 7.055 0 13.402-2.797 17.951-7.346L88 72.52c4.558-4.523 7.354-10.82 7.354-17.876 0-7.029-2.796-13.38-7.354-17.929h-.067Zm-17.951 346.64a25.504 25.504 0 0 0 17.951-7.368l.067-.134c4.558-4.487 7.354-10.838 7.354-17.817 0-7.056-2.796-13.38-7.354-17.952h-.067c-4.55-4.625 [...]
diff --git a/karavan-vscode/webview/integration-designer/icons/KaravanIcons.tsx b/karavan-vscode/webview/integration-designer/icons/KaravanIcons.tsx
index b3629ce9..71f4a62b 100644
--- a/karavan-vscode/webview/integration-designer/icons/KaravanIcons.tsx
+++ b/karavan-vscode/webview/integration-designer/icons/KaravanIcons.tsx
@@ -260,10 +260,10 @@ export function CamelIcon(props?: (React.SVGProps<SVGSVGElement>) | undefined) {
);
}
-export function getDesignerIcon(icon: string): ReactElement {
+export function getDesignerIcon(icon: string, className?: string): ReactElement {
if (icon === 'kamelet') return (
<svg
- className="top-icon" id="icon"
+ className={`top-icon ${className}`} id="icon"
xmlns="http://www.w3.org/2000/svg"
viewBox="0 0 32 32"
width="32px" height="32px"
@@ -282,7 +282,7 @@ export function getDesignerIcon(icon: string): ReactElement {
)
if (icon === 'code') return (
<svg
-
+ className={`top-icon ${className}`}
xmlns="http://www.w3.org/2000/svg"
width="24"
height="24"
@@ -296,7 +296,7 @@ export function getDesignerIcon(icon: string): ReactElement {
</svg>
)
if (icon === 'routes') return (
- <svg className="top-icon" width="32px" height="32px" viewBox="0 0 32 32" id="icon">
+ <svg className={`top-icon ${className}`} width="32px" height="32px" viewBox="0 0 32 32" id="icon">
<path
d="M29,10H24v2h5v6H22v2h3v2.142a4,4,0,1,0,2,0V20h2a2.0027,2.0027,0,0,0,2-2V12A2.0023,2.0023,0,0,0,29,10ZM28,26a2,2,0,1,1-2-2A2.0027,2.0027,0,0,1,28,26Z"/>
<path
@@ -307,7 +307,7 @@ export function getDesignerIcon(icon: string): ReactElement {
height="32"/>
</svg>)
if (icon === 'route') return (
- <svg className="top-icon" width="32px" height="32px" viewBox="0 0 32 32" id="icon">
+ <svg className={`top-icon ${className}`} width="32px" height="32px" viewBox="0 0 32 32" id="icon">
<title>{"category"}</title>
<path
d="M27 22.141V18a2 2 0 0 0-2-2h-8v-4h2a2.002 2.002 0 0 0 2-2V4a2.002 2.002 0 0 0-2-2h-6a2.002 2.002 0 0 0-2 2v6a2.002 2.002 0 0 0 2 2h2v4H7a2 2 0 0 0-2 2v4.142a4 4 0 1 0 2 0V18h8v4.142a4 4 0 1 0 2 0V18h8v4.141a4 4 0 1 0 2 0ZM13 4h6l.001 6H13ZM8 26a2 2 0 1 1-2-2 2.002 2.002 0 0 1 2 2Zm10 0a2 2 0 1 1-2-2 2.003 2.003 0 0 1 2 2Zm8 2a2 2 0 1 1 2-2 2.002 2.002 0 0 1-2 2Z"/>
@@ -321,7 +321,7 @@ export function getDesignerIcon(icon: string): ReactElement {
</svg>
)
if (icon === 'rest') return (
- <svg className="top-icon" viewBox="0 0 32 32" width="32px" height="32px">
+ <svg className={`top-icon ${className}`} viewBox="0 0 32 32" width="32px" height="32px">
<g className="layer">
<title>Layer 1</title>
<path
@@ -334,7 +334,7 @@ export function getDesignerIcon(icon: string): ReactElement {
</svg>
)
if (icon === 'beans') return (
- <svg className="top-icon" width="32px" height="32px" viewBox="0 0 32 32" id="icon">
+ <svg className={`top-icon ${className}`} width="32px" height="32px" viewBox="0 0 32 32" id="icon">
<title>data--1</title>
<rect x="15" y="6" width="13" height="2"/>
<rect x="15" y="24" width="13" height="2"/>
@@ -349,7 +349,7 @@ export function getDesignerIcon(icon: string): ReactElement {
</svg>
)
if (icon === 'dependencies') return (
- <svg className="top-icon" width="32px" height="32px" viewBox="0 0 32 32" id="icon">
+ <svg className={`top-icon ${className}`} width="32px" height="32px" viewBox="0 0 32 32" id="icon">
<title>application</title>
<path d="M16,18H6a2,2,0,0,1-2-2V6A2,2,0,0,1,6,4H16a2,2,0,0,1,2,2V16A2,2,0,0,1,16,18ZM6,6V16H16V6Z"
transform="translate(0 0)"/>
@@ -365,7 +365,7 @@ export function getDesignerIcon(icon: string): ReactElement {
</svg>
)
if (icon === 'error') return (
- <svg className="top-icon" width="36px" height="36px" viewBox="0 0 36 36" version="1.1"
+ <svg className={`top-icon ${className}`} width="36px" height="36px" viewBox="0 0 36 36" version="1.1"
preserveAspectRatio="xMidYMid meet">
<circle className="clr-i-outline clr-i-outline-path-1" cx="18" cy="26.06" r="1.33"/>
<path className="clr-i-outline clr-i-outline-path-2"
@@ -375,7 +375,7 @@ export function getDesignerIcon(icon: string): ReactElement {
<rect x="0" y="0" width="36" height="36" fillOpacity="0"/>
</svg>)
if (icon === 'exception') return (
- <svg className="top-icon" width="32px" height="32px" viewBox="0 0 32 32" id="icon">
+ <svg className={`top-icon ${className}`} width="32px" height="32px" viewBox="0 0 32 32" id="icon">
<title>misuse--alt</title>
<polygon
points="21.41 23 16 17.591 10.59 23 9 21.41 14.409 16 9 10.591 10.591 9 16 14.409 21.409 9 23 10.591 17.591 16 23 21.41 21.41 23"/>
@@ -385,7 +385,7 @@ export function getDesignerIcon(icon: string): ReactElement {
height="32"/>
</svg>)
if (icon === 'routeConfiguration') return (
- <svg className="top-icon" width="32" height="32" viewBox="0 0 32 32">
+ <svg className={`top-icon ${className}`} width="32" height="32" viewBox="0 0 32 32">
<path
d="M28.83 21.17L25 17.37l.67-.67a1 1 0 000-1.41l-6-6a1 1 0 00-1.41 0l-.79.79-6.76-6.79a1 1 0 00-1.41 0l-4 4-.12.15-4 6a1 1 0 00.12 1.26l3 3a1 1 0 001.42 0L10 13.41l2.09 2.09-4.8 4.79a1 1 0 000 1.41l2 2a1 1 0 00.71.3 1 1 0 00.52-.15l4.33-2.6 2.44 2.45a1 1 0 001.41 0l.67-.7 3.79 3.83a4 4 0 005.66-5.66zM10 10.58l-5 5-1.71-1.71 3.49-5.24L10 5.41l6.09 6.09-2.59 2.58zm8 11l-2.84-2.84-5 3-.74-.74L19 11.41 23.59 16zm9.42 3.83a2 2 0 01-2.83 0l-3.8-3.79 2.83-2.83 3.8 3.79a2 2 0 010 [...]
<path
@@ -395,7 +395,7 @@ export function getDesignerIcon(icon: string): ReactElement {
></path>
</svg>)
if (icon === 'yaml') return (
- <svg className="top-icon" x="0px" y="0px" width="32px" height="32px"
+ <svg className={`top-icon ${className}`} x="0px" y="0px" width="32px" height="32px"
viewBox="0 0 32 32">
<style type="text/css">{".st0{fill:none;}"}</style>
<title>document</title>
@@ -406,7 +406,7 @@ export function getDesignerIcon(icon: string): ReactElement {
<rect className="st0" width="32" height="32"/>
</svg>)
if (icon === 'code') return (
- <svg className="top-icon" width="32px" height="32px" viewBox="0 0 32 32" id="icon">
+ <svg className={`top-icon ${className}`} width="32px" height="32px" viewBox="0 0 32 32" id="icon">
<title>code</title>
<polygon points="31 16 24 23 22.59 21.59 28.17 16 22.59 10.41 24 9 31 16"/>
<polygon points="1 16 8 9 9.41 10.41 3.83 16 9.41 21.59 8 23 1 16"/>
@@ -535,30 +535,93 @@ export function JKubeIcon(className?: string) {
)
}
-export function AsyncApiIcon({ className = '' }) {
+export function AsyncApiIcon({className = ''}) {
return (
- <svg
- width='40'
- height='40'
- className={className || 'inline-block'}
- x='0'
- y='0'
- version='1.1'
- viewBox='0 0 277 276'
- xmlSpace='preserve'
- >
- <image
- width='277'
- height='276'
- x='0'
- y='0'
- href='data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAARUAAAEUCAYAAAAFsqJHAAAABGdBTUEAALGPC/xhBQAAACBjSFJN AAB6JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAABmJLR0QA/wD/AP+gvaeTAAAA CXBIWXMAABYlAAAWJQFJUiTwAAAAB3RJTUUH5gcGCwkBMRK1zQAAOrNJREFUeNrtnXmcXGWZ73/P qeosvSfpTqdJlCwsIyCkAVESxQSJCIIEVJQRJHFFr3fEC8zn3rkzkujMHddrUGfGuQQIjKMsOoIb i0qCShAREiBhCQk0CaT39Frdna6u89w/3vVUV0Iv1X2qu5/vJ/lU16lTVe+pqvM7z/Y+L2GKwsyL ASwHcCyAJQAqACzW/wGgUv8XhHzTof/X6/v1AF4FsFNv30lEHXEPcryguAeQD5i [...]
- ></image>
+ <svg className={"h-10 mt-0.5 w-auto " + className} width="165" height="36" viewBox="0 0 165 36" fill="none" xmlns="http://www.w3.org/2000/svg">
+ <defs>
+ <linearGradient id="gradient1" x1="33.0317" y1="3.3661" x2="4.57364" y2="32.1761" gradientUnits="userSpaceOnUse">
+ <stop stop-color="#2DCCFD"></stop>
+ <stop offset="100%" stop-color="#AD20E2"></stop>
+ </linearGradient>
+ <linearGradient id="gradient2" x1="33.0317" y1="32.6313" x2="4.571" y2="3.82126" gradientUnits="userSpaceOnUse">
+ <stop stop-color="#A829E2"></stop>
+ <stop offset="5%" stop-color="#A829E2" stop-opacity="84%"></stop>
+ <stop offset="11%" stop-color="#A829E2" stop-opacity="67%"></stop>
+ <stop offset="18%" stop-color="#A829E2" stop-opacity="51%"></stop>
+ <stop offset="25%" stop-color="#A829E2" stop-opacity="38%"></stop>
+ <stop offset="33%" stop-color="#A829E2" stop-opacity="28%"></stop>
+ <stop offset="43%" stop-color="#A829E2" stop-opacity="20%"></stop>
+ <stop offset="54%" stop-color="#A829E2" stop-opacity="14%"></stop>
+ <stop offset="68%" stop-color="#A829E2" stop-opacity="11%"></stop>
+ <stop offset="100%" stop-color="#A829E2" stop-opacity="10%"></stop>
+ </linearGradient>
+ <linearGradient id="gradient3" x1="3.41005" y1="32.6313" x2="31.8682" y2="3.82129" gradientUnits="userSpaceOnUse">
+ <stop stop-color="#E50E99"></stop>
+ <stop offset="100%" stop-color="#A829E2" stop-opacity="10%"></stop>
+ </linearGradient>
+ <linearGradient id="gradient4" x1="33.0317" y1="3.36871" x2="4.57097" y2="32.1761" gradientUnits="userSpaceOnUse">
+ <stop stop-color="#21D4FD"></stop>
+ <stop offset="3%" stop-color="#27CDFC" stop-opacity="96%"></stop>
+ <stop offset="23%" stop-color="#4E9CF4" stop-opacity="70%"></stop>
+ <stop offset="43%" stop-color="#6E73EE" stop-opacity="49%"></stop>
+ <stop offset="61%" stop-color="#8753E9" stop-opacity="32%"></stop>
+ <stop offset="77%" stop-color="#993CE5" stop-opacity="20%"></stop>
+ <stop offset="90%" stop-color="#A42EE3" stop-opacity="13%"></stop>
+ <stop offset="100%" stop-color="#A829E2" stop-opacity="10%"></stop>
+ </linearGradient>
+ </defs>
+ <path
+ d="M63.9815 27.6971H61.4524L59.3704 22.3187H50.4894L48.4074 27.6971H45.9074L53.5529 8.30026H56.3783L63.9815 27.6971ZM51.3386 20.1182H58.5079L54.9074 10.5635L51.3386 20.1182Z"
+ fill="#0C0928"></path>
+ <path
+ d="M71.7037 27.9925C70.3161 28.0052 68.9453 27.6926 67.7037 27.0804C66.5264 26.5139 65.5472 25.6129 64.8915 24.4931L66.9154 23.0531C67.3281 23.9309 67.9957 24.6678 68.8333 25.17C69.7573 25.7002 70.8129 25.9645 71.881 25.9331C72.9392 25.9331 73.7566 25.7345 74.3519 25.332C74.5772 25.1976 74.771 25.0172 74.9202 24.8029C75.0695 24.5887 75.1707 24.3455 75.2173 24.0895C75.2639 23.8335 75.2547 23.5707 75.1903 23.3185C75.1259 23.0663 75.0078 22.8306 74.8439 22.6271C74.5741 22.27 [...]
+ fill="#0C0928"></path>
+ <path
+ d="M90.3703 13.0018H92.9285L85.9391 30.1668C85.642 30.9811 85.2258 31.748 84.7037 32.4431C84.3138 32.9574 83.8037 33.3707 83.2169 33.6479C82.6214 33.9034 81.9771 34.0291 81.328 34.0164C80.6995 34.0219 80.0743 33.9275 79.4762 33.7367C78.939 33.565 78.4321 33.312 77.9735 32.9867L78.6269 30.9299C78.9951 31.2671 79.424 31.5331 79.8915 31.7139C80.3125 31.8803 80.7609 31.9689 81.2143 31.9753C81.7379 31.9722 82.2474 31.8077 82.6719 31.5049C83.127 31.1913 83.5432 30.5545 83.9206 [...]
+ fill="#0C0928"></path>
+ <path
+ d="M94.9735 27.6971V13.0018H97.0502L97.2566 16.2947L96.8703 15.9707C97.1438 15.2501 97.5819 14.6017 98.1507 14.0759C98.6824 13.5968 99.3148 13.2398 100.003 13.0306C100.711 12.8158 101.449 12.7075 102.19 12.7091C103.193 12.6965 104.187 12.9017 105.101 13.3102C105.966 13.7045 106.695 14.3405 107.198 15.1396C107.727 15.9637 107.992 17.0091 107.992 18.2757V27.6841H105.611V19.1146C105.611 17.4891 105.258 16.3566 104.553 15.7172C103.842 15.079 102.91 14.7371 101.95 14.7633C101. [...]
+ fill="#0C0928"></path>
+ <path
+ d="M117.251 12.7091C118.181 12.6912 119.105 12.851 119.974 13.1795C120.741 13.4831 121.436 13.9436 122.011 14.5307C122.599 15.1392 123.072 15.8474 123.407 16.6214L121.148 17.6668C120.895 16.8219 120.393 16.0705 119.706 15.5081C118.978 14.983 118.091 14.7185 117.19 14.758C116.291 14.7331 115.404 14.9625 114.632 15.4192C113.903 15.8776 113.332 16.5437 112.995 17.3297C112.243 19.2646 112.243 21.4057 112.995 23.3405C113.329 24.1319 113.9 24.8032 114.632 25.264C115.404 25.7207 [...]
+ fill="#0C0928"></path>
+ <path
+ d="M143.659 27.6971H140.296L138.423 22.614H130.183L128.307 27.6971H125.034L132.442 8.30026H136.251L143.659 27.6971ZM131.074 20.0555H137.526L134.312 11.0052L131.074 20.0555Z"
+ fill="#0C0928"></path>
+ <path
+ d="M152.992 8.30024C154.248 8.26933 155.494 8.52043 156.638 9.03462C157.616 9.49485 158.441 10.2199 159.019 11.1254C159.584 12.1193 159.881 13.2402 159.881 14.3804C159.881 15.5205 159.584 16.6415 159.019 17.6354C158.443 18.5428 157.617 19.2684 156.638 19.7262C155.495 20.2425 154.248 20.4945 152.992 20.4631H148.619V27.6919H145.444V8.30024H152.992ZM152.487 17.7635C153.898 17.7635 154.934 17.4743 155.595 16.8958C156.257 16.3174 156.589 15.4802 156.593 14.3843C156.593 13.2692 [...]
+ fill="#0C0928"></path>
+ <path d="M165 8.30026V27.6971H161.825V8.30026H165Z" fill="#0C0928"></path>
+ <path
+ d="M27.8228 0H8.61905C3.85888 0 0 3.8121 0 8.51456V27.4854C0 32.1879 3.85888 36 8.61905 36H27.8228C32.5829 36 36.4418 32.1879 36.4418 27.4854V8.51456C36.4418 3.8121 32.5829 0 27.8228 0Z"
+ fill="url(#gradient1)"></path>
+ <path
+ d="M27.8228 0H8.61905C3.85888 0 0 3.8121 0 8.51456V27.4854C0 32.1879 3.85888 36 8.61905 36H27.8228C32.5829 36 36.4418 32.1879 36.4418 27.4854V8.51456C36.4418 3.8121 32.5829 0 27.8228 0Z"
+ fill="url(#gradient2)"></path>
+ <path
+ d="M27.8228 0H8.61905C3.85888 0 0 3.8121 0 8.51456V27.4854C0 32.1879 3.85888 36 8.61905 36H27.8228C32.5829 36 36.4418 32.1879 36.4418 27.4854V8.51456C36.4418 3.8121 32.5829 0 27.8228 0Z"
+ fill="url(#gradient3)"></path>
+ <path
+ d="M27.8228 0H8.61905C3.85888 0 0 3.8121 0 8.51456V27.4854C0 32.1879 3.85888 36 8.61905 36H27.8228C32.5829 36 36.4418 32.1879 36.4418 27.4854V8.51456C36.4418 3.8121 32.5829 0 27.8228 0Z"
+ fill="url(#gradient4)"></path>
+ <path d="M11.7645 14.1988L10.6799 15.6754L19.1508 21.749L19.209 21.7908L20.2936 20.3142L11.8227 14.2406L11.7645 14.1988Z" fill="white"></path>
+ <path d="M17.2989 14.2406L17.2407 14.1988L16.1561 15.6754L24.627 21.749L24.6852 21.7908L25.7698 20.3142L17.2989 14.2406Z" fill="white"></path>
+ <path
+ d="M18.2275 6.64075C13.6349 6.64075 9.89948 9.46064 9.89948 12.9261V12.9966H11.7513V12.9261C11.7513 10.4668 14.6614 8.46492 18.2328 8.46492C21.8042 8.46492 24.7143 10.4668 24.7143 12.9261V12.9966H26.5661V12.9261C26.5556 9.46064 22.8201 6.64075 18.2275 6.64075Z"
+ fill="white"></path>
+ <path
+ d="M24.6958 23.0714C24.6958 25.5306 21.7857 27.5325 18.2116 27.5325C14.6376 27.5325 11.7301 25.5306 11.7301 23.0714V23.0008H9.8783V23.0714C9.8783 26.5368 13.6137 29.3567 18.2063 29.3567C22.7989 29.3567 26.5344 26.5368 26.5344 23.0714V23.0008H24.6825L24.6958 23.0714Z"
+ fill="white"></path>
</svg>
);
}
-export function OpenApiIcon(className?: string, height?: number | string | undefined, width?: number | string | undefined) {
+type OpenApiIconProps = React.SVGProps<SVGSVGElement> & {
+ className?: string, height?: number | string | undefined, width?: number | string | undefined, fill?: string
+};
+
+export function OpenApiIcon(props: OpenApiIconProps) {
+ const { className, height, width, fill } = props;
return (
<svg
xmlns="http://www.w3.org/2000/svg"
@@ -569,95 +632,86 @@ export function OpenApiIcon(className?: string, height?: number | string | undef
className={className}
>
<path
- fill="#93d500"
+ fill={fill ?? "#93d500"}
d="M74.909 189.069H45.352c.005.144.009.289.017.433.012.278.032.555.049.833.008.119.013.238.022.356.023.322.051.642.08.962l.02.215a46.218 46.218 0 0 0 .126 1.168 43.62 43.62 0 0 0 .154 1.158c.339 2.356.848 4.69 1.527 6.984.003.01.007.019.009.029a43.315 43.315 0 0 0 .373 1.203c.105.323.215.645.325.968.029.081.056.163.086.244.099.279.2.558.304.837l.143.378.27.691c.069.173.141.346.213.519.074.18.15.359.226.54.094.22.192.439.289.658l.175.391c.12.263.244.526.368.787.041.084.08. [...]
style={{
- fill: "#ec7a08",
fillOpacity: 1,
}}
transform="translate(-45.308 -124.66)"
/>
<path
- fill="#4d5a31"
+ fill={fill ?? "#4d5a31"}
d="m82.173 202.638-.071.071-20.819 20.82c.107.1.213.201.323.298.194.176.392.351.589.523.102.091.202.181.304.269.236.204.474.403.711.602l.192.16a47.32 47.32 0 0 0 .917.737 62.01 62.01 0 0 0 .928.711 50.044 50.044 0 0 0 3.895 2.633l.139.085c.255.153.51.304.767.453l.471.268c.148.086.296.168.446.251a63.783 63.783 0 0 0 .927.499c.757.396 1.527.764 2.303 1.118l.739-1.794 10.471-25.429.039-.094a20.195 20.195 0 0 1-3.271-2.181z"
style={{
- fill: "#06c",
fillOpacity: 1,
}}
transform="translate(-45.308 -124.66)"
/>
<path
- fill="#6ba43a"
+ fill={fill ?? "#6ba43a"}
d="M80.005 200.564a20.653 20.653 0 0 1-1.767-2.28 21.467 21.467 0 0 1-.54-.843l-25.275 15.226c.388.645.793 1.273 1.206 1.894l.041.065.015.023c.014.02.026.042.04.063l.004.006.101.148.006.009.003.004c.439.649.89 1.288 1.355 1.91l.031.04.03.039a45.939 45.939 0 0 0 1.351 1.715l.158.191c.2.239.4.477.604.713.087.101.178.202.266.302.174.198.346.395.524.59.097.107.198.215.297.322l.135.146c.13.14.259.28.39.419.052.055.107.109.16.164.23.24.462.48.699.716l20.85-20.85a17.977 17.977 0 [...]
style={{
- fill: "#ac5608",
fillOpacity: 1,
}}
transform="translate(-45.308 -124.66)"
/>
<path
- fill="#4d5a31"
+ fill={fill ?? "#4d5a31"}
d="M107.642 202.627c-.229.185-.461.366-.697.54l.052.087 15.202 25.235c.704-.46 1.4-.934 2.08-1.432a50.463 50.463 0 0 0 4.267-3.527l-20.821-20.821z"
style={{
- fill: "#06c",
fillOpacity: 1,
}}
transform="translate(-45.308 -124.66)"
/>
<path
- fill="#93d500"
+ fill={fill ?? "#93d500"}
d="m74.961 105.035-.006.003.015-.008a.024.024 0 0 1-.009.005zM75.004 105.012c.066-.039.133-.072.198-.112-.065.04-.132.075-.198.112z"
/>
<path
- fill="#93d500"
+ fill={fill ?? "#93d500"}
d="m119.99 228.696-.516-.856-14.19-23.555c-.287.173-.581.329-.874.487a20.15 20.15 0 0 1-9.528 2.404c-1.936 0-3.871-.28-5.742-.838-.319-.095-.63-.22-.945-.332-.315-.111-.634-.207-.944-.335l-10.464 25.412-.41.996-.351.853-.002.004.082.031.086.033h.001l.002.001.02.008c.247.101.496.188.744.285.311.121.622.244.934.358.159.058.317.126.476.182h.001a49.947 49.947 0 0 0 10.119 2.422c.135.016.269.035.404.054l.424.046c.266.03.531.061.798.087l.198.017c.327.031.654.059.979.082.111.008 [...]
style={{
- fill: "#ec7a08",
fillOpacity: 1,
}}
transform="translate(-45.308 -124.66)"
/>
<path
- fill="#4d5a31"
+ fill={fill ?? "#4d5a31"}
d="M59.838 151.994c-.237.237-.461.482-.692.722-.231.24-.466.479-.692.723a49.743 49.743 0 0 0-4.212 5.22c-.061.085-.122.174-.182.261a49.018 49.018 0 0 0-1.008 1.522 49.48 49.48 0 0 0-7.7 24.627c-.013.333-.02.667-.027 1-.007.333-.017.667-.017 1h29.488c0-.334.031-.666.048-1 .017-.334.022-.668.055-1a20.013 20.013 0 0 1 4.447-10.739c.21-.256.447-.496.672-.743.224-.247.432-.504.671-.742zM120.681 144.675l-.122-.073c-.259-.159-.521-.312-.783-.465-.152-.088-.304-.173-.457-.26-.154 [...]
style={{
- fill: "#06c",
fillOpacity: 1,
}}
transform="translate(-45.308 -124.66)"
/>
<path
- fill="#6ba43a"
+ fill={fill ?? "#6ba43a"}
d="M93.914 137.485c-.333.007-.667.008-1 .021a49.856 49.856 0 0 0-6.233.643l-.136.023c-.29.05-.577.103-.865.157-.163.031-.327.061-.49.094-.17.034-.339.069-.508.106-.28.058-.56.119-.84.184l-.153.034a49.891 49.891 0 0 0-11.898 4.438h-.001c-.245.13-.484.277-.728.411-.292.16-.582.325-.872.491-.215.124-.434.238-.648.366l-.007.004h-.001l-.045.026c-.056.034-.114.062-.17.096l.003.005.516.857 14.705 24.412c.287-.173.581-.33.874-.487.295-.159.594-.308.895-.451a20.051 20.051 0 0 1 7. [...]
style={{
- fill: "#ac5608",
fillOpacity: 1,
}}
transform="translate(-45.308 -124.66)"
/>
<path
- fill="#4d5a31"
+ fill={fill ?? "#4d5a31"}
d="M144.458 184.631a53.77 53.77 0 0 0-.048-.795c-.008-.132-.015-.263-.026-.397a41.966 41.966 0 0 0-.077-.934c-.006-.081-.014-.161-.021-.242a60.396 60.396 0 0 0-.111-1.043l-.01-.084-.005-.04c-.046-.375-.096-.75-.149-1.124-.001-.011-.002-.025-.005-.035a49.558 49.558 0 0 0-1.524-6.972l-.014-.044c-.107-.356-.216-.71-.328-1.063-.015-.046-.031-.093-.045-.14a66.772 66.772 0 0 0-.412-1.212 50.701 50.701 0 0 0-.714-1.892c-.072-.18-.144-.357-.218-.534-.072-.176-.146-.35-.22-.526a80 [...]
style={{
- fill: "#06c",
fillOpacity: 1,
}}
transform="translate(-45.308 -124.66)"
/>
<path
- fill="#6ba43a"
+ fill={fill ?? "#6ba43a"}
d="M115.03 187.069c0 .334-.031.666-.048 1-.016.334-.022.668-.055 1a20.022 20.022 0 0 1-4.446 10.74c-.21.256-.447.496-.672.743-.224.247-.432.504-.671.742l20.851 20.85c.237-.237.46-.482.691-.723.231-.241.466-.479.691-.723a49.783 49.783 0 0 0 4.224-5.236l.148-.214c.155-.223.306-.448.458-.673.133-.201.266-.402.395-.605.064-.097.128-.198.19-.295a49.46 49.46 0 0 0 7.685-24.607c.013-.333.02-.667.027-1 .007-.333.017-.666.017-1H115.03Z"
style={{
- fill: "#ac5608",
fillOpacity: 1,
}}
transform="translate(-45.308 -124.66)"
/>
<path
- fill="#424143"
+ fill={fill ?? "#424143"}
d="M153.276 128.706c-5.395-5.395-14.142-5.395-19.536 0-4.304 4.303-5.164 10.736-2.601 15.902L101.048 174.7c-5.166-2.562-11.599-1.703-15.903 2.6-5.395 5.395-5.394 14.142 0 19.537 5.396 5.395 14.143 5.393 19.538-.001 4.303-4.303 5.162-10.736 2.599-15.903l30.091-30.091c5.167 2.562 11.599 1.703 15.902-2.601 5.395-5.392 5.395-14.14.001-19.535z"
style={{
- fill: "#424143",
+ fill: fill ?? "#424143",
fillOpacity: 1,
}}
transform="translate(-45.308 -124.66)"
diff --git a/karavan-vscode/webview/integration-designer/kamelet/KameletAnnotationsPanel.tsx b/karavan-vscode/webview/integration-designer/kamelet/KameletAnnotationsPanel.tsx
index c7fb2374..f0d4a062 100644
--- a/karavan-vscode/webview/integration-designer/kamelet/KameletAnnotationsPanel.tsx
+++ b/karavan-vscode/webview/integration-designer/kamelet/KameletAnnotationsPanel.tsx
@@ -22,7 +22,7 @@ import {
CardTitle,
Form, Grid,
} from '@patternfly/react-core';
-import '../karavan.css';
+import '@features/project/designer/karavan.css';
import './kamelet.css';
import {useIntegrationStore} from "../DesignerStore";
import {shallow} from "zustand/shallow";
diff --git a/karavan-vscode/webview/integration-designer/kamelet/KameletDefinitionPropertyCard.tsx b/karavan-vscode/webview/integration-designer/kamelet/KameletDefinitionPropertyCard.tsx
index da4d2843..148b98c3 100644
--- a/karavan-vscode/webview/integration-designer/kamelet/KameletDefinitionPropertyCard.tsx
+++ b/karavan-vscode/webview/integration-designer/kamelet/KameletDefinitionPropertyCard.tsx
@@ -19,11 +19,11 @@ import {Button, Card, CardBody, CardTitle, Flex, FlexItem, FormGroup, FormSelect
import './kamelet.css';
import {useIntegrationStore} from "../DesignerStore";
import {shallow} from "zustand/shallow";
-import {DefinitionProperty} from "@/core/model/IntegrationDefinition";
-import {CamelUtil} from "@/core/api/CamelUtil";
+import {DefinitionProperty} from "@karavan-core/model/IntegrationDefinition";
+import {CamelUtil} from "@karavan-core/api/CamelUtil";
import {PlusCircleIcon} from '@patternfly/react-icons';
import {KameletInput} from './KameletInput';
-import {ModalConfirmation} from "@/components/ModalConfirmation";
+import {ModalConfirmation} from "@shared/ui/ModalConfirmation";
interface Props {
index: number
diff --git a/karavan-vscode/webview/integration-designer/kamelet/KameletDefinitionsPanel.tsx b/karavan-vscode/webview/integration-designer/kamelet/KameletDefinitionsPanel.tsx
index a59d756b..f7e0affa 100644
--- a/karavan-vscode/webview/integration-designer/kamelet/KameletDefinitionsPanel.tsx
+++ b/karavan-vscode/webview/integration-designer/kamelet/KameletDefinitionsPanel.tsx
@@ -16,14 +16,14 @@
*/
import React from 'react';
import {Button, Card, CardBody, CardTitle, Flex, FlexItem, Form, Grid,} from '@patternfly/react-core';
-import '../karavan.css';
+import '@features/project/designer/karavan.css';
import './kamelet.css';
import {useIntegrationStore} from "../DesignerStore";
import {shallow} from "zustand/shallow";
import {PlusCircleIcon} from '@patternfly/react-icons';
import {KameletDefinitionPropertyCard} from "./KameletDefinitionPropertyCard";
-import {CamelUtil} from "@/core/api/CamelUtil";
-import {DefinitionProperty} from "@/core/model/IntegrationDefinition";
+import {CamelUtil} from "@karavan-core/api/CamelUtil";
+import {DefinitionProperty} from "@karavan-core/model/IntegrationDefinition";
import {KameletDependenciesCard} from "./KameletDependenciesCard";
import {KameletInput} from './KameletInput';
diff --git a/karavan-vscode/webview/integration-designer/kamelet/KameletDependenciesCard.tsx b/karavan-vscode/webview/integration-designer/kamelet/KameletDependenciesCard.tsx
index f12d174b..2c218858 100644
--- a/karavan-vscode/webview/integration-designer/kamelet/KameletDependenciesCard.tsx
+++ b/karavan-vscode/webview/integration-designer/kamelet/KameletDependenciesCard.tsx
@@ -16,12 +16,12 @@
*/
import React from 'react';
import {Button, Card, CardBody, CardTitle, FormGroup, FormHelperText, HelperText, HelperTextItem, Label, LabelGroup,} from '@patternfly/react-core';
-import '../karavan.css';
+import '@features/project/designer/karavan.css';
import './kamelet.css';
import {useIntegrationStore} from "../DesignerStore";
import {shallow} from "zustand/shallow";
import {PlusCircleIcon} from '@patternfly/react-icons';
-import {CamelUtil} from "@/core/api/CamelUtil";
+import {CamelUtil} from "@karavan-core/api/CamelUtil";
export function KameletDependenciesCard() {
diff --git a/karavan-vscode/webview/integration-designer/kamelet/KameletDesigner.tsx b/karavan-vscode/webview/integration-designer/kamelet/KameletDesigner.tsx
index 4fa65747..f045f8b4 100644
--- a/karavan-vscode/webview/integration-designer/kamelet/KameletDesigner.tsx
+++ b/karavan-vscode/webview/integration-designer/kamelet/KameletDesigner.tsx
@@ -15,10 +15,7 @@
* limitations under the License.
*/
import React from 'react';
-import {
- PageSection,
-} from '@patternfly/react-core';
-import '../karavan.css';
+import '@features/project/designer/karavan.css';
import './kamelet.css';
import {KameletAnnotationsPanel} from "./KameletAnnotationsPanel";
import {KameletDefinitionsPanel} from "./KameletDefinitionsPanel";
diff --git a/karavan-vscode/webview/integration-designer/kamelet/KameletInput.tsx b/karavan-vscode/webview/integration-designer/kamelet/KameletInput.tsx
index c6ef9ad6..6dd58f38 100644
--- a/karavan-vscode/webview/integration-designer/kamelet/KameletInput.tsx
+++ b/karavan-vscode/webview/integration-designer/kamelet/KameletInput.tsx
@@ -28,7 +28,7 @@ import {
capitalize,
TextArea
} from "@patternfly/react-core";
-import '../karavan.css';
+import '@features/project/designer/karavan.css';
import './kamelet.css';
interface Props {
diff --git a/karavan-vscode/webview/integration-designer/kamelet/KameletTypesOutCard.tsx b/karavan-vscode/webview/integration-designer/kamelet/KameletTypesOutCard.tsx
index 23e74090..bb2fde3a 100644
--- a/karavan-vscode/webview/integration-designer/kamelet/KameletTypesOutCard.tsx
+++ b/karavan-vscode/webview/integration-designer/kamelet/KameletTypesOutCard.tsx
@@ -16,12 +16,12 @@
*/
import React from 'react';
import {Button, Card, CardBody, CardTitle, FormGroup, FormHelperText, HelperText, HelperTextItem, Label, LabelGroup,} from '@patternfly/react-core';
-import '../karavan.css';
+import '@features/project/designer/karavan.css';
import './kamelet.css';
import {useIntegrationStore} from "../DesignerStore";
import {shallow} from "zustand/shallow";
import {PlusCircleIcon} from '@patternfly/react-icons';
-import {CamelUtil} from "@/core/api/CamelUtil";
+import {CamelUtil} from "@karavan-core/api/CamelUtil";
export function KameletTypesOutCard() {
diff --git a/karavan-vscode/webview/integration-designer/property/DslProperties.css b/karavan-vscode/webview/integration-designer/property/DslProperties.css
index cf7ef7ab..cd8b3f6a 100644
--- a/karavan-vscode/webview/integration-designer/property/DslProperties.css
+++ b/karavan-vscode/webview/integration-designer/property/DslProperties.css
@@ -189,7 +189,7 @@
.karavan .properties .input-group .pf-v6-c-text-input-group__utilities {
align-items: flex-end;
- margin-top: auto;
+ margin: auto;
}
.karavan .properties .chip .pf-v6-c-button {
diff --git a/karavan-vscode/webview/integration-designer/property/DslProperties.tsx b/karavan-vscode/webview/integration-designer/property/DslProperties.tsx
index 3aeec0ba..edc0e5e9 100644
--- a/karavan-vscode/webview/integration-designer/property/DslProperties.tsx
+++ b/karavan-vscode/webview/integration-designer/property/DslProperties.tsx
@@ -14,7 +14,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-import React, {useEffect, useState, ReactElement} from 'react';
+import React, {ReactElement, useEffect, useState} from 'react';
import {
Button,
Content,
@@ -32,23 +32,22 @@ import {
import './DslProperties.css';
import {DataFormatField} from "./property/DataFormatField";
import {DslPropertyField} from "./property/DslPropertyField";
-import {CamelDefinitionApiExt} from "@/core/api/CamelDefinitionApiExt";
+import {CamelDefinitionApiExt} from "@karavan-core/api/CamelDefinitionApiExt";
import {CamelUi} from "../utils/CamelUi";
-import {CamelMetadataApi, DataFormats, PropertyMeta} from "@/core/model/CamelMetadata";
+import {CamelMetadataApi, DataFormats, PropertyMeta} from "@karavan-core/model/CamelMetadata";
import {IntegrationHeader} from "../utils/IntegrationHeader";
import CloneIcon from "@patternfly/react-icons/dist/esm/icons/clone-icon";
import {useDesignerStore, useIntegrationStore} from "../DesignerStore";
import {shallow} from "zustand/shallow";
import {usePropertiesHook} from "./usePropertiesHook";
-import {CamelDisplayUtil} from "@/core/api/CamelDisplayUtil";
+import {CamelDisplayUtil} from "@karavan-core/api/CamelDisplayUtil";
import {PropertiesHeader} from "./PropertiesHeader";
import {PropertyUtil} from "./property/PropertyUtil";
import {usePropertiesStore} from "./PropertyStore";
import TimesIcon from "@patternfly/react-icons/dist/esm/icons/times-icon";
-import {RouteTemplateDefinition} from "@/core/model/CamelDefinition";
+import {RouteTemplateDefinition} from "@karavan-core/model/CamelDefinition";
interface Props {
- designerType: 'routes' | 'rest' | 'beans',
expressionEditor: React.ComponentType<any>;
}
@@ -63,10 +62,10 @@ export function DslProperties(props: Props) {
onParametersChange,
onExpressionChange
} =
- usePropertiesHook(props.designerType);
+ usePropertiesHook();
- const [selectedStep, setParameterPlaceholders]
- = useDesignerStore((s) => [s.selectedStep, s.setParameterPlaceholders], shallow)
+ const [selectedStep, setParameterPlaceholders, tab]
+ = useDesignerStore((s) => [s.selectedStep, s.setParameterPlaceholders, s.tab], shallow)
const [propertyFilter, changedOnly, requiredOnly, setChangedOnly, sensitiveOnly, setSensitiveOnly, setPropertyFilter, setRequiredOnly]
= usePropertiesStore((s) => [s.propertyFilter, s.changedOnly, s.requiredOnly, s.setChangedOnly, s.sensitiveOnly, s.setSensitiveOnly, s.setPropertyFilter, s.setRequiredOnly], shallow)
@@ -74,9 +73,9 @@ export function DslProperties(props: Props) {
const [showAdvanced, setShowAdvanced] = useState<boolean>(false);
useEffect(() => {
- setRequiredOnly(false);
- setChangedOnly(false);
- setSensitiveOnly(false);
+ // setRequiredOnly(false);
+ // setChangedOnly(false);
+ // setSensitiveOnly(false);
setPropertyFilter('');
getRouteTemplateParameters()
}, [selectedStep?.uuid])
@@ -110,7 +109,7 @@ export function DslProperties(props: Props) {
}
function getPropertiesHeader(): ReactElement {
- if (props.designerType === 'routes') return <PropertiesHeader designerType={props.designerType}/>
+ if (tab === 'routes') return <PropertiesHeader/>
else return getClonableElementHeader();
}
@@ -223,7 +222,7 @@ export function DslProperties(props: Props) {
aria-label="filter by name"
/>
<TextInputGroupUtilities>
- <Button icon={<TimesIcon aria-hidden={true}/>} variant="plain" onClick={_ => setPropertyFilter('')}/>
+ <Button icon={<TimesIcon aria-hidden={true}/>} isInline variant="link" onClick={_ => setPropertyFilter('')}/>
</TextInputGroupUtilities>
</TextInputGroup>
)
diff --git a/karavan-vscode/webview/integration-designer/property/MainPropertiesPanel.tsx b/karavan-vscode/webview/integration-designer/property/MainPropertiesPanel.tsx
index 49b2d8d8..41fdeec5 100644
--- a/karavan-vscode/webview/integration-designer/property/MainPropertiesPanel.tsx
+++ b/karavan-vscode/webview/integration-designer/property/MainPropertiesPanel.tsx
@@ -14,38 +14,22 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
-import React, {useEffect, useState} from 'react';
-import {Tab, Tabs, TabTitleIcon, TabTitleText,} from '@patternfly/react-core';
-import './DslProperties.css';
-import {DslProperties} from "./DslProperties";
-import {getDesignerIcon} from "../icons/KaravanIcons";
-import {useDesignerStore} from "../DesignerStore";
-import {shallow} from "zustand/shallow";
-import { ExpressionEditor } from './expression/ExpressionEditor';
+import React from 'react';
+import {Tab, Tabs, TabTitleText,} from '@patternfly/react-core';
+import '@features/project/designer/property/DslProperties.css';
export function MainPropertiesPanel() {
- const [tab] = useDesignerStore((s) => [s.tab], shallow)
-
- const [lastStatus, setLastStatus] = useState<boolean>(false);
const [activeTabKey, setActiveTabKey] = React.useState<string | number>();
const handleTabClick = (event: React.MouseEvent<any> | React.KeyboardEvent | MouseEvent, tabIndex: string | number) => {
setActiveTabKey(tabIndex);
};
- useEffect(() => {
- if (!lastStatus) {
- setActiveTabKey('properties');
- setLastStatus(true);
- }
- }, [])
function getTab(title: string, icon: string, error: boolean = false) {
const color = error ? "red" : "initial";
return (
<div className="top-menu-item" style={{color: color}}>
- <TabTitleIcon>{getDesignerIcon(icon)}</TabTitleIcon>
<TabTitleText>{title}</TabTitleText>
</div>
)
@@ -53,9 +37,8 @@ export function MainPropertiesPanel() {
function getPropertiesPanelTabs() {
return (
- <div className={"main-tabs-wrapper"}>
- <Tabs className="main-tabs"
- activeKey={activeTabKey}
+ <div>
+ <Tabs activeKey={activeTabKey}
onSelect={handleTabClick}
isFilled
aria-label="PropertyTypes"
@@ -67,22 +50,11 @@ export function MainPropertiesPanel() {
)
}
- function getPropertiesPanel() {
- if (tab === "routes") {
- return <DslProperties designerType={"routes"} expressionEditor={ExpressionEditor}/>
- } else if (tab === "rest") {
- return <DslProperties designerType={"rest"} expressionEditor={ExpressionEditor}/>
- } else if (tab === "beans") {
- return <DslProperties designerType={"beans"} expressionEditor={ExpressionEditor}/>
- } else {
- return <></>
- }
- }
return (
<div className='main-properties'>
{getPropertiesPanelTabs()}
- {activeTabKey === 'properties' && getPropertiesPanel() }
</div>
)
+
}
diff --git a/karavan-vscode/webview/integration-designer/property/PropertiesHeader.tsx b/karavan-vscode/webview/integration-designer/property/PropertiesHeader.tsx
index d9a39d48..d5b5ed35 100644
--- a/karavan-vscode/webview/integration-designer/property/PropertiesHeader.tsx
+++ b/karavan-vscode/webview/integration-designer/property/PropertiesHeader.tsx
@@ -41,19 +41,15 @@ import {CamelUi} from "../utils/CamelUi";
import {useDesignerStore} from "../DesignerStore";
import {shallow} from "zustand/shallow";
import {usePropertiesHook} from "./usePropertiesHook";
-import {CamelDisplayUtil} from "@/core/api/CamelDisplayUtil";
+import {CamelDisplayUtil} from "@karavan-core/api/CamelDisplayUtil";
import {EllipsisVIcon} from '@patternfly/react-icons';
-import {ComponentApi} from "@/core/api/ComponentApi";
-import {CamelMetadataApi} from "@/core/model/CamelMetadata";
+import {ComponentApi} from "@karavan-core/api/ComponentApi";
+import {CamelMetadataApi} from "@karavan-core/model/CamelMetadata";
import {useRouteDesignerHook} from "../route/useRouteDesignerHook";
-interface Props {
- designerType: 'routes' | 'rest' | 'beans'
-}
-
-export function PropertiesHeader(props: Props) {
+export function PropertiesHeader() {
- const {saveAsRoute, convertStep, onPropertyChange} = usePropertiesHook(props.designerType);
+ const {saveAsRoute, convertStep, onPropertyChange} = usePropertiesHook();
const {openSelectorToReplaceFrom} = useRouteDesignerHook();
const [selectedStep] = useDesignerStore((s) => [s.selectedStep], shallow)
diff --git a/karavan-vscode/webview/integration-designer/property/PropertyStore.ts b/karavan-vscode/webview/integration-designer/property/PropertyStore.ts
index 3515ec0a..51149e1e 100644
--- a/karavan-vscode/webview/integration-designer/property/PropertyStore.ts
+++ b/karavan-vscode/webview/integration-designer/property/PropertyStore.ts
@@ -17,6 +17,8 @@
import {createWithEqualityFn} from "zustand/traditional";
import {shallow} from "zustand/shallow";
+export const NO_INFRA_BUTTON_PROPERTIES = ["uri", "id", "description", "group", "note"]
+
interface PropertiesState {
propertyFilter: string;
setPropertyFilter: (propertyFilter: string) => void
@@ -29,8 +31,8 @@ interface PropertiesState {
}
export const usePropertiesStore = createWithEqualityFn<PropertiesState>((set, get) => ({
- requiredOnly: false,
- changedOnly: false,
+ requiredOnly: true,
+ changedOnly: true,
sensitiveOnly: false,
propertyFilter: '',
setPropertyFilter: (propertyFilter: string) => {
diff --git a/karavan-vscode/webview/integration-designer/property/expression/ExpressionEditor.tsx b/karavan-vscode/webview/integration-designer/property/expression/ExpressionEditor.tsx
index dca824e6..457b8eb5 100644
--- a/karavan-vscode/webview/integration-designer/property/expression/ExpressionEditor.tsx
+++ b/karavan-vscode/webview/integration-designer/property/expression/ExpressionEditor.tsx
@@ -15,18 +15,19 @@
* limitations under the License.
*/
import React, {useEffect, useState} from 'react';
-// import '@/monaco-setup';
+import '@shared/monaco-setup';
import Editor from "@monaco-editor/react";
-import {ExpressionBottomPanel} from "./ExpressionBottomPanel";
import './ExpressionEditor.css'
import {ExpressionFunctions, ExpressionVariables} from "./ExpressionContextModel";
-import {useTheme} from "@/main/ThemeContext";
+import {useTheme} from "@app/theme/ThemeContext";
interface Props {
customCode: any,
onChange: (value: string |undefined) => void,
title: string,
dslLanguage?: [string, string, string],
+ dark?: boolean,
+ name?: string
}
export function ExpressionEditor(props: Props) {
diff --git a/karavan-vscode/webview/integration-designer/property/property/BeanProperties.tsx b/karavan-vscode/webview/integration-designer/property/property/BeanProperties.tsx
index 20bf35e0..ad8f9f31 100644
--- a/karavan-vscode/webview/integration-designer/property/property/BeanProperties.tsx
+++ b/karavan-vscode/webview/integration-designer/property/property/BeanProperties.tsx
@@ -29,9 +29,9 @@ import {
ValidatedOptions,
} from '@patternfly/react-core';
import './BeanProperties.css';
-import {BeanFactoryDefinition,} from "@/core/model/CamelDefinition";
-import {CamelUtil} from "@/core/api/CamelUtil";
-import {SensitiveKeys} from "@/core/model/CamelMetadata";
+import {BeanFactoryDefinition,} from "@karavan-core/model/CamelDefinition";
+import {CamelUtil} from "@karavan-core/api/CamelUtil";
+import {SensitiveKeys} from "@karavan-core/model/CamelMetadata";
import {v4 as uuidv4} from "uuid";
import {CogIcon, DockerIcon, PlusCircleIcon, TimesIcon} from '@patternfly/react-icons';
import {ConfigurationSelectorModal} from "./ConfigurationSelectorModal";
@@ -246,13 +246,13 @@ export function BeanProperties (props: Props) {
}}/>
</InputGroupItem>
</InputGroup>
- <Button icon={<TimesIcon/>} variant="link" className="delete-button" onClick={e => constructorDeleted(i)}>
+ <Button icon={<TimesIcon/>} isInline variant="link" className="delete-button" onClick={e => constructorDeleted(i)}>
</Button>
</div>
)
})}
- <Button icon={<PlusCircleIcon/>} variant="link" className="add-button" onClick={e => constructorChanged(uuidv4(), constructors.size, '')}>
+ <Button icon={<PlusCircleIcon/>} isInline variant="link" className="add-button" onClick={e => constructorChanged(uuidv4(), constructors.size, '')}>
Add argument</Button>
</>
)
@@ -292,7 +292,7 @@ export function BeanProperties (props: Props) {
}}
/>
<TextInputGroupUtilities>
- <Button icon={<TimesIcon aria-hidden={true}/>} variant="plain" className='button-clear' onClick={_ => {
+ <Button icon={<TimesIcon aria-hidden={true}/>} isInline variant="link" className='button-clear' onClick={_ => {
propertyChanged(i, key,'');
}} />
</TextInputGroupUtilities>
@@ -324,11 +324,11 @@ export function BeanProperties (props: Props) {
{/* }}/>*/}
{/* </InputGroupItem>*/}
{/*</InputGroup>*/}
- <Button icon={<TimesIcon/>} variant="link" className="delete-button" onClick={e => propertyDeleted(i)}></Button>
+ <Button icon={<TimesIcon/>} isInline variant="link" className="delete-button" onClick={e => propertyDeleted(i)}></Button>
</div>
)
})}
- <Button icon={<PlusCircleIcon/>} variant="link" className="add-button" onClick={e => propertyChanged(uuidv4(), '', '')}>
+ <Button icon={<PlusCircleIcon/>} isInline variant="link" className="add-button" onClick={e => propertyChanged(uuidv4(), '', '')}>
Add property</Button>
</>
)
diff --git a/karavan-vscode/webview/integration-designer/property/property/ComponentPropertyField.tsx b/karavan-vscode/webview/integration-designer/property/property/ComponentPropertyField.tsx
index 97ed229d..b645364c 100644
--- a/karavan-vscode/webview/integration-designer/property/property/ComponentPropertyField.tsx
+++ b/karavan-vscode/webview/integration-designer/property/property/ComponentPropertyField.tsx
@@ -37,25 +37,26 @@ import {
ValidatedOptions
} from '@patternfly/react-core';
import './ComponentPropertyField.css';
-import {ComponentProperty} from "@/core/model/ComponentModels";
+import {ComponentProperty} from "@karavan-core/model/ComponentModels";
import {CamelUi, RouteToCreate} from "../../utils/CamelUi";
-import {CamelElement} from "@/core/model/IntegrationDefinition";
-import {ToDefinition} from "@/core/model/CamelDefinition";
+import {CamelElement} from "@karavan-core/model/IntegrationDefinition";
+import {ToDefinition} from "@karavan-core/model/CamelDefinition";
import {ConfigurationSelectorModal} from "./ConfigurationSelectorModal";
import {InfrastructureAPI} from "../../utils/InfrastructureAPI";
import {CogIcon, PlusIcon, TimesIcon} from '@patternfly/react-icons';
import {usePropertiesHook} from "../usePropertiesHook";
import {useDesignerStore, useIntegrationStore} from "../../DesignerStore";
import {shallow} from "zustand/shallow";
-import {INTERNAL_COMPONENTS} from "@/core/api/ComponentApi";
+import {INTERNAL_COMPONENTS} from "@karavan-core/api/ComponentApi";
import {PropertyUtil} from "./PropertyUtil";
import {isSensitiveFieldValid} from "../../utils/ValidatorUtils";
import ExclamationCircleIcon from "@patternfly/react-icons/dist/esm/icons/exclamation-circle-icon";
import {CamelDefaultStepProperty} from "../../utils/CamelDefaultStepProperty";
import {FileReferenceDropdown} from "./FileReferenceDropdown";
-import {FieldSelectWithCreate} from "@/components/FieldSelectWithCreate";
-import {FieldSelectScrollable} from "@/components/FieldSelectScrollable";
-import {CamelMetadataApi} from "@/core/model/CamelMetadata";
+import {FieldSelectWithCreate} from "@shared/ui/FieldSelectWithCreate";
+import {FieldSelectScrollable} from "@shared/ui/FieldSelectScrollable";
+import {CamelMetadataApi} from "@karavan-core/model/CamelMetadata";
+import {NO_INFRA_BUTTON_PROPERTIES} from "@features/project/designer/property/PropertyStore";
const prefix = "parameters";
const beanPrefix = "#bean:";
@@ -329,7 +330,7 @@ export function ComponentPropertyField(props: Props) {
}
function getStringInput(property: ComponentProperty) {
- const noInfraSelectorButton = ["uri", "id", "description", "group"].includes(property.name);
+ const noInfraSelectorButton = NO_INFRA_BUTTON_PROPERTIES.includes(property.name);
return <InputGroup className={valueChangedClassName}>
<TextInputGroup>
<TextInputGroupMain
@@ -346,7 +347,7 @@ export function ComponentPropertyField(props: Props) {
}}
/>
<TextInputGroupUtilities>
- <Button icon={<TimesIcon aria-hidden={true}/>} variant="plain" className='button-clear' onClick={_ => {
+ <Button icon={<TimesIcon aria-hidden={true}/>} isInline variant="link" className='button-clear' onClick={_ => {
parametersChanged(property.name, '');
setTextValue('');
setCheckChanges(true);
@@ -377,7 +378,7 @@ export function ComponentPropertyField(props: Props) {
/>
<TextInputGroupUtilities>
<Content component={ContentVariants.p}>{property.type}</Content>
- <Button icon={<TimesIcon aria-hidden={true}/>} variant="plain" className='button-clear' onClick={_ => {
+ <Button icon={<TimesIcon aria-hidden={true}/>} isInline variant="link" className='button-clear' onClick={_ => {
parametersChanged(property.name, '');
setTextValue('');
setCheckChanges(true);
diff --git a/karavan-vscode/webview/integration-designer/property/property/ConfigurationSelectorModal.tsx b/karavan-vscode/webview/integration-designer/property/property/ConfigurationSelectorModal.tsx
index 132aacae..a8a0d51b 100644
--- a/karavan-vscode/webview/integration-designer/property/property/ConfigurationSelectorModal.tsx
+++ b/karavan-vscode/webview/integration-designer/property/property/ConfigurationSelectorModal.tsx
@@ -22,7 +22,7 @@ import {useDesignerStore} from "../../DesignerStore";
import {shallow} from "zustand/shallow";
import {ExpressionEditor} from "../expression/ExpressionEditor";
import './ConfigurationSelectorModal.css'
-import {useCodeStore} from "@/integration-designer/CodeStore";
+import {useCodeStore} from "@features/project/designer/CodeStore";
const SYNTAX_EXAMPLES = [
{key: 'property:', value: 'group.property', description: 'Application property'},
@@ -337,7 +337,7 @@ export function ConfigurationSelectorModal(props: Props) {
<Content component={'h3'}>{'Set from'}</Content>
</div>
<div style={{width: '300px'}}>
- {tabIndex !== 'editor' && searchInput()}
+ {tabIndex !== 'editor' && searchInput()}
</div>
<ToggleGroup>
{tabs.map(tab =>
diff --git a/karavan-vscode/webview/integration-designer/property/property/DataFormatField.tsx b/karavan-vscode/webview/integration-designer/property/property/DataFormatField.tsx
index 17b52c3e..f1cb0865 100644
--- a/karavan-vscode/webview/integration-designer/property/property/DataFormatField.tsx
+++ b/karavan-vscode/webview/integration-designer/property/property/DataFormatField.tsx
@@ -15,20 +15,17 @@
* limitations under the License.
*/
import React, {useState} from 'react';
-import {
- ExpandableSection, SelectOptionProps
-} from '@patternfly/react-core';
-import {CamelMetadataApi, PropertyMeta} from "@/core/model/CamelMetadata";
-import {CamelDefinitionApiExt} from "@/core/api/CamelDefinitionApiExt";
-import {DataFormatDefinition} from "@/core/model/CamelDefinition";
-import {Integration, CamelElement} from "@/core/model/IntegrationDefinition";
-import {CamelDefinitionApi} from "@/core/api/CamelDefinitionApi";
+import {ExpandableSection, SelectOptionProps} from '@patternfly/react-core';
+import {CamelMetadataApi, DataFormats, PropertyMeta} from "@karavan-core/model/CamelMetadata";
+import {CamelDefinitionApiExt} from "@karavan-core/api/CamelDefinitionApiExt";
+import {DataFormatDefinition} from "@karavan-core/model/CamelDefinition";
+import {CamelElement, Integration} from "@karavan-core/model/IntegrationDefinition";
+import {CamelDefinitionApi} from "@karavan-core/api/CamelDefinitionApi";
import {DslPropertyField} from "./DslPropertyField";
-import {DataFormats} from "@/core/model/CamelMetadata";
import {usePropertiesStore} from "../PropertyStore";
import {shallow} from "zustand/shallow";
import {PropertyUtil} from "./PropertyUtil";
-import {FieldSelectScrollable} from "@/components/FieldSelectScrollable";
+import {FieldSelectScrollable} from "@shared/ui/FieldSelectScrollable";
interface Props {
dslName: string,
diff --git a/karavan-vscode/webview/integration-designer/property/property/DslPropertyField.tsx b/karavan-vscode/webview/integration-designer/property/property/DslPropertyField.tsx
index d0be682e..a12a9cbb 100644
--- a/karavan-vscode/webview/integration-designer/property/property/DslPropertyField.tsx
+++ b/karavan-vscode/webview/integration-designer/property/property/DslPropertyField.tsx
@@ -42,38 +42,38 @@ import {
} from '@patternfly/react-core';
import './DslPropertyField.css';
import {CogIcon, ExclamationCircleIcon, PlusCircleIcon, PlusIcon, TimesCircleIcon, TimesIcon} from '@patternfly/react-icons';
-import {CamelUtil} from "@/core/api/CamelUtil";
-import {CamelMetadataApi, PropertyMeta} from "@/core/model/CamelMetadata";
-import {CamelDefinitionApiExt} from "@/core/api/CamelDefinitionApiExt";
+import {CamelUtil} from "@karavan-core/api/CamelUtil";
+import {CamelMetadataApi, PropertyMeta} from "@karavan-core/model/CamelMetadata";
+import {CamelDefinitionApiExt} from "@karavan-core/api/CamelDefinitionApiExt";
import {ExpressionField} from "./ExpressionField";
import {CamelUi, RouteToCreate} from "../../utils/CamelUi";
import {ComponentPropertyField} from "./ComponentPropertyField";
-import {CamelElement} from "@/core/model/IntegrationDefinition";
+import {CamelElement} from "@karavan-core/model/IntegrationDefinition";
import {KameletPropertyField} from "./KameletPropertyField";
import {ObjectField} from "./ObjectField";
-import {CamelDefinitionApi} from "@/core/api/CamelDefinitionApi";
-import {ComponentProperty} from "@/core/model/ComponentModels";
+import {CamelDefinitionApi} from "@karavan-core/api/CamelDefinitionApi";
+import {ComponentProperty} from "@karavan-core/model/ComponentModels";
import {ConfigurationSelectorModal} from "./ConfigurationSelectorModal";
import {InfrastructureAPI} from "../../utils/InfrastructureAPI";
import {shallow} from "zustand/shallow";
-import {BeanFactoryDefinition, DataFormatDefinition, ExpressionDefinition} from "@/core/model/CamelDefinition";
-import {TemplateApi} from "@/core/api/TemplateApi";
+import {BeanFactoryDefinition, DataFormatDefinition, ExpressionDefinition} from "@karavan-core/model/CamelDefinition";
+import {TemplateApi} from "@karavan-core/api/TemplateApi";
import {BeanProperties} from "./BeanProperties";
import {PropertyPlaceholderDropdown} from "./PropertyPlaceholderDropdown";
import {VariablesDropdown} from "./VariablesDropdown";
-import {SpiBeanApi} from "@/core/api/SpiBeanApi";
+import {SpiBeanApi} from "@karavan-core/api/SpiBeanApi";
import {PropertyUtil} from "./PropertyUtil";
-import {usePropertiesStore} from "../PropertyStore";
-import {Property} from "@/core/model/KameletModels";
+import {NO_INFRA_BUTTON_PROPERTIES, usePropertiesStore} from "../PropertyStore";
+import {Property} from "@karavan-core/model/KameletModels";
import {isSensitiveFieldValid} from "../../utils/ValidatorUtils";
import {EventBus} from "../../utils/EventBus";
import {CamelDefaultStepProperty} from "../../utils/CamelDefaultStepProperty";
-import {useDesignerStore, useIntegrationStore} from "@/integration-designer/DesignerStore";
-import {DslPropertyFieldSelect} from "@/integration-designer/property/property/DslPropertyFieldSelect";
-import {MEDIA_TYPES} from "@/integration-designer/utils/MediaTypes";
-import {DslPropertyFieldSelectScrollable} from "@/integration-designer/property/property/DslPropertyFieldSelectScrollable";
-import {FieldSelectWithCreate} from "@/components/FieldSelectWithCreate";
-import {FileReferenceDropdown} from "@/integration-designer/property/property/FileReferenceDropdown";
+import {useDesignerStore, useIntegrationStore} from "@features/project/designer/DesignerStore";
+import {DslPropertyFieldSelect} from "@features/project/designer/property/property/DslPropertyFieldSelect";
+import {MEDIA_TYPES} from "@features/project/designer/utils/MediaTypes";
+import {DslPropertyFieldSelectScrollable} from "@features/project/designer/property/property/DslPropertyFieldSelectScrollable";
+import {FieldSelectWithCreate} from "@shared/ui/FieldSelectWithCreate";
+import {FileReferenceDropdown} from "@features/project/designer/property/property/FileReferenceDropdown";
const beanPrefix = "#bean:";
const classPrefix = "#class:";
@@ -342,7 +342,7 @@ export function DslPropertyField(props: Props) {
}
function getStringInput(property: PropertyMeta) {
- const noInfraSelectorButton = ["uri", "id", "description", "group"].includes(property.name);
+ const noInfraSelectorButton = NO_INFRA_BUTTON_PROPERTIES.includes(property.name);
const isNumber = ['integer', 'number', 'duration'].includes(property.type);
const uriReadOnly = isUriReadOnly(property);
return (
@@ -374,7 +374,7 @@ export function DslPropertyField(props: Props) {
}}
/>
<TextInputGroupUtilities>
- <Button icon={<TimesIcon aria-hidden={true}/>} variant="plain" className='button-clear' onClick={_ => {
+ <Button icon={<TimesIcon aria-hidden={true}/>} isInline variant="link" className='button-clear' onClick={_ => {
propertyChanged(property.name, '');
setTextValue('');
setCheckChanges(true);
@@ -423,7 +423,7 @@ export function DslPropertyField(props: Props) {
placeholder='Select bean'
onPropertyChange={(_, val) => propertyChanged(property.name, val)}
utilities={[
- <Tooltip position="bottom-end" content={"Open Java Class"}>
+ <Tooltip key={property?.name} position="bottom-end" content={"Open Java Class"}>
<Button icon={<PlusIcon/>} isDisabled={value === undefined || value?.length === 0} variant="plain"
onClick={e => showCode(value, property.javaType)}>
</Button>
@@ -566,7 +566,7 @@ export function DslPropertyField(props: Props) {
}}
/>
<TextInputGroupUtilities>
- <Button icon={<TimesIcon aria-hidden={true}/>} variant="plain" className='button-clear' onClick={_ => {
+ <Button icon={<TimesIcon aria-hidden={true}/>} isInline variant="link" className='button-clear' onClick={_ => {
propertyChanged(property.name, '');
setTextValue('');
setCheckChanges(true);
diff --git a/karavan-vscode/webview/integration-designer/property/property/DslPropertyFieldSelect.tsx b/karavan-vscode/webview/integration-designer/property/property/DslPropertyFieldSelect.tsx
index 203adacf..17c01245 100644
--- a/karavan-vscode/webview/integration-designer/property/property/DslPropertyFieldSelect.tsx
+++ b/karavan-vscode/webview/integration-designer/property/property/DslPropertyFieldSelect.tsx
@@ -16,7 +16,7 @@
*/
import React, {ReactElement, useState} from 'react';
import {Button, MenuToggle, MenuToggleElement, Select, SelectList, SelectOption, SelectOptionProps, TextInputGroup, TextInputGroupUtilities, Tooltip} from '@patternfly/react-core';
-import {PropertyMeta} from "@/core/model/CamelMetadata";
+import {PropertyMeta} from "@karavan-core/model/CamelMetadata";
import {RouteToCreate} from "../../utils/CamelUi";
import {PropertyUtil} from "./PropertyUtil";
import TimesIcon from "@patternfly/react-icons/dist/esm/icons/times-icon";
@@ -68,8 +68,8 @@ export function DslPropertyFieldSelect(props: Props) {
</SelectList>
</Select>
<TextInputGroupUtilities>
- <Tooltip key={0} position="bottom" content={"Clear"}>
- <Button icon={<TimesIcon/>} variant="plain"
+ <Tooltip key={property?.name} position="bottom" content={"Clear"}>
+ <Button icon={<TimesIcon/>} isInline variant="link"
onClick={e => onPropertyChange?.(property.name, undefined)}
aria-label="Delete"
/>
diff --git a/karavan-vscode/webview/integration-designer/property/property/DslPropertyFieldSelectScrollable.tsx b/karavan-vscode/webview/integration-designer/property/property/DslPropertyFieldSelectScrollable.tsx
index 7290d025..1f8d9907 100644
--- a/karavan-vscode/webview/integration-designer/property/property/DslPropertyFieldSelectScrollable.tsx
+++ b/karavan-vscode/webview/integration-designer/property/property/DslPropertyFieldSelectScrollable.tsx
@@ -27,7 +27,7 @@ import {
TextInputGroupMain,
TextInputGroupUtilities
} from '@patternfly/react-core';
-import {PropertyMeta} from "@/core/model/CamelMetadata";
+import {PropertyMeta} from "@karavan-core/model/CamelMetadata";
import {RouteToCreate} from "../../utils/CamelUi";
import {PropertyUtil} from "./PropertyUtil";
import TimesIcon from "@patternfly/react-icons/dist/esm/icons/times-icon";
@@ -114,7 +114,7 @@ export function DslPropertyFieldSelectScrollable(props: Props) {
</DropdownList>
</Dropdown>
<TextInputGroupUtilities>
- <Button icon={<TimesIcon/>} variant="plain"
+ <Button icon={<TimesIcon/>} isInline variant="link"
onClick={e => {
onPropertyChange?.(property.name, undefined)
setInputValue(undefined)
diff --git a/karavan-vscode/webview/integration-designer/property/property/ExpressionField.tsx b/karavan-vscode/webview/integration-designer/property/property/ExpressionField.tsx
index 77bd1b47..2e93752a 100644
--- a/karavan-vscode/webview/integration-designer/property/property/ExpressionField.tsx
+++ b/karavan-vscode/webview/integration-designer/property/property/ExpressionField.tsx
@@ -16,17 +16,17 @@
*/
import React, {useState} from 'react';
import {ExpandableSection, FormGroup, FormGroupLabelHelp, Popover, SelectOptionProps} from '@patternfly/react-core';
-import {CamelMetadataApi, Languages, PropertyMeta} from "@/core/model/CamelMetadata";
-import {CamelDefinitionApiExt} from "@/core/api/CamelDefinitionApiExt";
-import {ExpressionDefinition} from "@/core/model/CamelDefinition";
-import {CamelElement} from "@/core/model/IntegrationDefinition";
-import {CamelDefinitionApi} from "@/core/api/CamelDefinitionApi";
+import {CamelMetadataApi, Languages, PropertyMeta} from "@karavan-core/model/CamelMetadata";
+import {CamelDefinitionApiExt} from "@karavan-core/api/CamelDefinitionApiExt";
+import {ExpressionDefinition} from "@karavan-core/model/CamelDefinition";
+import {CamelElement} from "@karavan-core/model/IntegrationDefinition";
+import {CamelDefinitionApi} from "@karavan-core/api/CamelDefinitionApi";
import {DslPropertyField} from "./DslPropertyField";
import {CamelUi} from "../../utils/CamelUi";
import {usePropertiesStore} from "../PropertyStore";
import {shallow} from "zustand/shallow";
import {PropertyUtil} from "./PropertyUtil";
-import {DslPropertyFieldSelectScrollable} from "@/integration-designer/property/property/DslPropertyFieldSelectScrollable";
+import {DslPropertyFieldSelectScrollable} from "@features/project/designer/property/property/DslPropertyFieldSelectScrollable";
interface Props {
property: PropertyMeta,
diff --git a/karavan-vscode/webview/integration-designer/property/property/FileReferenceDropdown.tsx b/karavan-vscode/webview/integration-designer/property/property/FileReferenceDropdown.tsx
index c3706bff..d7b21093 100644
--- a/karavan-vscode/webview/integration-designer/property/property/FileReferenceDropdown.tsx
+++ b/karavan-vscode/webview/integration-designer/property/property/FileReferenceDropdown.tsx
@@ -230,7 +230,7 @@ export const FileReferenceDropdown: React.FC<FileReferenceDropdownProps> = ({
aria-controls="file-reference-dropdown-listbox"
/>
<TextInputGroupUtilities {...(!inputValue ? { style: { display: 'none' } } : {})}>
- <Button icon={<TimesIcon aria-hidden />} variant="plain" onClick={onClearButtonClick} aria-label="Clear input value" />
+ <Button icon={<TimesIcon aria-hidden />} isInline variant="link" onClick={onClearButtonClick} aria-label="Clear input value" />
</TextInputGroupUtilities>
</TextInputGroup>
</MenuToggle>
diff --git a/karavan-vscode/webview/integration-designer/property/property/KameletPropertyField.tsx b/karavan-vscode/webview/integration-designer/property/property/KameletPropertyField.tsx
index 490fe98b..4fcbafa4 100644
--- a/karavan-vscode/webview/integration-designer/property/property/KameletPropertyField.tsx
+++ b/karavan-vscode/webview/integration-designer/property/property/KameletPropertyField.tsx
@@ -35,11 +35,11 @@ import {
} from '@patternfly/react-core';
import './KameletPropertyField.css';
import {CogIcon, ExclamationCircleIcon, TimesIcon} from '@patternfly/react-icons';
-import {Property} from "@/core/model/KameletModels";
+import {Property} from "@karavan-core/model/KameletModels";
import {ConfigurationSelectorModal} from "./ConfigurationSelectorModal";
import {usePropertiesHook} from "../usePropertiesHook";
import {isSensitiveFieldValid} from "../../utils/ValidatorUtils";
-import {FieldSelectScrollable} from "@/components/FieldSelectScrollable";
+import {FieldSelectScrollable} from "@shared/ui/FieldSelectScrollable";
interface Props {
property: Property,
@@ -206,7 +206,7 @@ export function KameletPropertyField(props: Props) {
}}
/>
<TextInputGroupUtilities>
- <Button icon={<TimesIcon aria-hidden={true}/>} variant="plain" className='button-clear' onClick={_ => {
+ <Button icon={<TimesIcon aria-hidden={true}/>} isInline variant="link" className='button-clear' onClick={_ => {
parametersChanged(property.id, '');
setTextValue('');
setCheckChanges(true);
diff --git a/karavan-vscode/webview/integration-designer/property/property/ObjectField.tsx b/karavan-vscode/webview/integration-designer/property/property/ObjectField.tsx
index 522ccfde..374eee6e 100644
--- a/karavan-vscode/webview/integration-designer/property/property/ObjectField.tsx
+++ b/karavan-vscode/webview/integration-designer/property/property/ObjectField.tsx
@@ -18,11 +18,11 @@ import React, {useState} from 'react';
import {DslPropertyField} from "./DslPropertyField";
import {
ExpressionDefinition,
-} from "@/core/model/CamelDefinition";
-import {CamelElement} from "@/core/model/IntegrationDefinition";
-import {CamelDefinitionApiExt} from "@/core/api/CamelDefinitionApiExt";
-import {CamelUtil} from "@/core/api/CamelUtil";
-import { PropertyMeta} from "@/core/model/CamelMetadata";
+} from "@karavan-core/model/CamelDefinition";
+import {CamelElement} from "@karavan-core/model/IntegrationDefinition";
+import {CamelDefinitionApiExt} from "@karavan-core/api/CamelDefinitionApiExt";
+import {CamelUtil} from "@karavan-core/api/CamelUtil";
+import { PropertyMeta} from "@karavan-core/model/CamelMetadata";
import {RouteToCreate} from "../../utils/CamelUi";
interface Props {
diff --git a/karavan-vscode/webview/integration-designer/property/property/PropertyPlaceholderDropdown.tsx b/karavan-vscode/webview/integration-designer/property/property/PropertyPlaceholderDropdown.tsx
index eefc349f..4a2af9c9 100644
--- a/karavan-vscode/webview/integration-designer/property/property/PropertyPlaceholderDropdown.tsx
+++ b/karavan-vscode/webview/integration-designer/property/property/PropertyPlaceholderDropdown.tsx
@@ -32,14 +32,14 @@ import {
TextInput
} from '@patternfly/react-core';
import './PropertyPlaceholderDropdown.css';
-import {ComponentProperty} from "@/core/model/ComponentModels";
+import {ComponentProperty} from "@karavan-core/model/ComponentModels";
import {useDesignerStore} from "../../DesignerStore";
import {shallow} from "zustand/shallow";
import {EllipsisVIcon, PlusIcon} from '@patternfly/react-icons';
import {InfrastructureAPI} from "../../utils/InfrastructureAPI";
-import {PropertyMeta} from "@/core/model/CamelMetadata";
+import {PropertyMeta} from "@karavan-core/model/CamelMetadata";
import {RouteToCreate} from "../../utils/CamelUi";
-import {Property} from "@/core/model/KameletModels";
+import {Property} from "@karavan-core/model/KameletModels";
const SYNTAX_EXAMPLES = [
{key: 'property:', value: 'group.property', description: 'Application property'},
diff --git a/karavan-vscode/webview/integration-designer/property/property/PropertyUtil.tsx b/karavan-vscode/webview/integration-designer/property/property/PropertyUtil.tsx
index 8eed8134..91e0ea1b 100644
--- a/karavan-vscode/webview/integration-designer/property/property/PropertyUtil.tsx
+++ b/karavan-vscode/webview/integration-designer/property/property/PropertyUtil.tsx
@@ -14,9 +14,9 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-import {PropertyMeta} from "@/core/model/CamelMetadata";
-import {ComponentProperty} from "@/core/model/ComponentModels";
-import {Property} from "@/core/model/KameletModels";
+import {PropertyMeta} from "@karavan-core/model/CamelMetadata";
+import {ComponentProperty} from "@karavan-core/model/ComponentModels";
+import {Property} from "@karavan-core/model/KameletModels";
export class PropertyUtil {
diff --git a/karavan-vscode/webview/integration-designer/property/property/VariablesDropdown.tsx b/karavan-vscode/webview/integration-designer/property/property/VariablesDropdown.tsx
index b6caa4f8..d1ddc97a 100644
--- a/karavan-vscode/webview/integration-designer/property/property/VariablesDropdown.tsx
+++ b/karavan-vscode/webview/integration-designer/property/property/VariablesDropdown.tsx
@@ -32,7 +32,7 @@ import {
ToggleGroupItem
} from '@patternfly/react-core';
import {TimesIcon} from '@patternfly/react-icons';
-import {GLOBAL, ROUTE} from "@/core/api/VariableUtil";
+import {GLOBAL, ROUTE} from "@karavan-core/api/VariableUtil";
interface VariablesDropdownProps {
initialValue?: string;
@@ -230,7 +230,7 @@ export const VariablesDropdown: React.FC<VariablesDropdownProps> = ({
aria-controls="variables-dropdown-listbox"
/>
<TextInputGroupUtilities {...(!inputValue ? {style: {display: 'none'}} : {})}>
- <Button icon={<TimesIcon aria-hidden/>} variant="plain" onClick={onClearButtonClick} aria-label="Clear input value"/>
+ <Button icon={<TimesIcon aria-hidden/>} isInline variant="link" onClick={onClearButtonClick} aria-label="Clear input value"/>
</TextInputGroupUtilities>
</TextInputGroup>
</MenuToggle>
diff --git a/karavan-vscode/webview/integration-designer/property/usePropertiesHook.tsx b/karavan-vscode/webview/integration-designer/property/usePropertiesHook.tsx
index df101aac..045a1f46 100644
--- a/karavan-vscode/webview/integration-designer/property/usePropertiesHook.tsx
+++ b/karavan-vscode/webview/integration-designer/property/usePropertiesHook.tsx
@@ -14,31 +14,31 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-import '../karavan.css';
-import {CamelUtil} from "@/core/api/CamelUtil";
-import {DataFormatDefinition, ExpressionDefinition, ToDefinition,} from "@/core/model/CamelDefinition";
-import {CamelElement} from "@/core/model/IntegrationDefinition";
-import {CamelDefinitionApiExt} from "@/core/api/CamelDefinitionApiExt";
-import {CamelDefinitionApi} from "@/core/api/CamelDefinitionApi";
+import '@features/project/designer/karavan.css';
+import {CamelUtil} from "@karavan-core/api/CamelUtil";
+import {DataFormatDefinition, ExpressionDefinition, ToDefinition,} from "@karavan-core/model/CamelDefinition";
+import {CamelElement} from "@karavan-core/model/IntegrationDefinition";
+import {CamelDefinitionApiExt} from "@karavan-core/api/CamelDefinitionApiExt";
+import {CamelDefinitionApi} from "@karavan-core/api/CamelDefinitionApi";
import {CamelUi, RouteToCreate} from "../utils/CamelUi";
import {useDesignerStore, useIntegrationStore} from "../DesignerStore";
import {shallow} from "zustand/shallow";
-import {CamelMetadataApi} from "@/core/model/CamelMetadata";
+import {CamelMetadataApi} from "@karavan-core/model/CamelMetadata";
import {EventBus} from "../utils/EventBus";
-import {INTERNAL_COMPONENTS} from "@/core/api/ComponentApi";
+import {INTERNAL_COMPONENTS} from "@karavan-core/api/ComponentApi";
-export function usePropertiesHook(designerType: 'routes' | 'rest' | 'beans' = 'routes') {
+export function usePropertiesHook() {
const [integration, setIntegration] = useIntegrationStore((state) => [state.integration, state.setIntegration], shallow)
- const [selectedStep, setSelectedStep, setSelectedUuids] = useDesignerStore((s) =>
- [s.selectedStep, s.setSelectedStep, s.setSelectedUuids], shallow)
+ const [selectedStep, setSelectedStep, setSelectedUuids, tab] = useDesignerStore((s) =>
+ [s.selectedStep, s.setSelectedStep, s.setSelectedUuids, s.tab], shallow)
function onPropertyUpdate(element: CamelElement, newRoute?: RouteToCreate) {
- if (designerType === 'routes') {
+ if (tab === 'routes') {
onRoutePropertyUpdate(element, newRoute);
- } else if (designerType === 'rest') {
+ } else if (tab === 'rest') {
onRestPropertyUpdate(element, newRoute);
- } else if (designerType === 'beans') {
+ } else if (tab === 'beans') {
onBeanPropertyUpdate(element, newRoute);
}
}
diff --git a/karavan-vscode/webview/integration-designer/rest/RestCard.tsx b/karavan-vscode/webview/integration-designer/rest/RestCard.tsx
index a589579b..456ccbcb 100644
--- a/karavan-vscode/webview/integration-designer/rest/RestCard.tsx
+++ b/karavan-vscode/webview/integration-designer/rest/RestCard.tsx
@@ -19,9 +19,9 @@ import {
Button, Tooltip
} from '@patternfly/react-core';
import './rest.css';
-import '../karavan.css';
-import {CamelElement, Integration} from "@/core/model/IntegrationDefinition";
-import {GetDefinition, RestDefinition} from "@/core/model/CamelDefinition";
+import '@features/project/designer/karavan.css';
+import {CamelElement, Integration} from "@karavan-core/model/IntegrationDefinition";
+import {GetDefinition, RestDefinition} from "@karavan-core/model/CamelDefinition";
import {RestMethodCard} from "./RestMethodCard";
import {AddElementIcon, DeleteElementIcon} from "../utils/ElementIcons";
diff --git a/karavan-vscode/webview/integration-designer/rest/RestConfigurationCard.tsx b/karavan-vscode/webview/integration-designer/rest/RestConfigurationCard.tsx
index ffa64008..db201045 100644
--- a/karavan-vscode/webview/integration-designer/rest/RestConfigurationCard.tsx
+++ b/karavan-vscode/webview/integration-designer/rest/RestConfigurationCard.tsx
@@ -17,9 +17,9 @@
import React from 'react';
import {Button} from '@patternfly/react-core';
import './rest.css';
-import '../karavan.css';
-import {CamelElement} from "@/core/model/IntegrationDefinition";
-import {RestConfigurationDefinition} from "@/core/model/CamelDefinition";
+import '@features/project/designer/karavan.css';
+import {CamelElement} from "@karavan-core/model/IntegrationDefinition";
+import {RestConfigurationDefinition} from "@karavan-core/model/CamelDefinition";
import {DeleteElementIcon} from "../utils/ElementIcons";
interface Props {
diff --git a/karavan-vscode/webview/integration-designer/rest/RestDesigner.tsx b/karavan-vscode/webview/integration-designer/rest/RestDesigner.tsx
index e967adf4..6f51e0ad 100644
--- a/karavan-vscode/webview/integration-designer/rest/RestDesigner.tsx
+++ b/karavan-vscode/webview/integration-designer/rest/RestDesigner.tsx
@@ -15,37 +15,24 @@
* limitations under the License.
*/
import React, {useEffect} from 'react';
-import {
- Button,
- Flex,
- FlexItem,
- Gallery,
- GalleryItem, Modal,
- ModalBody,
- ModalHeader,
- PageSection
-} from '@patternfly/react-core';
+import {Button, Flex, FlexItem, Gallery, GalleryItem, Modal, ModalBody, ModalHeader, PageSection} from '@patternfly/react-core';
import './rest.css';
-import '../karavan.css';
-import {CamelElement} from "@/core/model/IntegrationDefinition";
+import '@features/project/designer/karavan.css';
+import {CamelElement} from "@karavan-core/model/IntegrationDefinition";
import {RestCard} from "./RestCard";
import PlusIcon from "@patternfly/react-icons/dist/esm/icons/plus-icon";
-import {
- RestConfigurationDefinition,
- RestContextRefDefinition,
- RestDefinition
-} from "@/core/model/CamelDefinition";
-import {CamelUtil} from "@/core/api/CamelUtil";
-import {CamelDefinitionApiExt} from "@/core/api/CamelDefinitionApiExt";
+import {RestConfigurationDefinition, RestContextRefDefinition, RestDefinition} from "@karavan-core/model/CamelDefinition";
+import {CamelUtil} from "@karavan-core/api/CamelUtil";
+import {CamelDefinitionApiExt} from "@karavan-core/api/CamelDefinitionApiExt";
import {RestMethodSelector} from "./RestMethodSelector";
import {DslMetaModel} from "../utils/DslMetaModel";
-import {CamelDefinitionApi} from "@/core/api/CamelDefinitionApi";
+import {CamelDefinitionApi} from "@karavan-core/api/CamelDefinitionApi";
import {RestConfigurationCard} from "./RestConfigurationCard";
import {v4 as uuidv4} from "uuid";
import {useDesignerStore, useIntegrationStore, useSelectorStore} from "../DesignerStore";
import {shallow} from "zustand/shallow";
-import {ModalConfirmation} from "@/components/ModalConfirmation";
+import {ModalConfirmation} from "@shared/ui/ModalConfirmation";
export function RestDesigner() {
diff --git a/karavan-vscode/webview/integration-designer/rest/RestMethodCard.tsx b/karavan-vscode/webview/integration-designer/rest/RestMethodCard.tsx
index e2913776..e4d30051 100644
--- a/karavan-vscode/webview/integration-designer/rest/RestMethodCard.tsx
+++ b/karavan-vscode/webview/integration-designer/rest/RestMethodCard.tsx
@@ -16,8 +16,8 @@
*/
import React from 'react';
import {Button} from '@patternfly/react-core';
-import '../karavan.css';
-import {CamelElement} from "@/core/model/IntegrationDefinition";
+import '@features/project/designer/karavan.css';
+import {CamelElement} from "@karavan-core/model/IntegrationDefinition";
import {useDesignerStore} from "../DesignerStore";
import {shallow} from "zustand/shallow";
import {DeleteElementIcon} from "../utils/ElementIcons";
diff --git a/karavan-vscode/webview/integration-designer/rest/RestMethodSelector.tsx b/karavan-vscode/webview/integration-designer/rest/RestMethodSelector.tsx
index 1702925f..a4e525ea 100644
--- a/karavan-vscode/webview/integration-designer/rest/RestMethodSelector.tsx
+++ b/karavan-vscode/webview/integration-designer/rest/RestMethodSelector.tsx
@@ -18,8 +18,6 @@ import React from 'react';
import {Badge, Card, CardBody, CardFooter, CardHeader, Content, Gallery} from '@patternfly/react-core';
import {CamelUi} from "../utils/CamelUi";
import {DslMetaModel} from "../utils/DslMetaModel";
-import {useDesignerStore} from "../DesignerStore";
-import {shallow} from "zustand/shallow";
interface Props {
onMethodSelect: (method: DslMetaModel) => void
diff --git a/karavan-vscode/webview/integration-designer/route/DslConnections.tsx b/karavan-vscode/webview/integration-designer/route/DslConnections.tsx
index 612f176b..0ebbc6d6 100644
--- a/karavan-vscode/webview/integration-designer/route/DslConnections.tsx
+++ b/karavan-vscode/webview/integration-designer/route/DslConnections.tsx
@@ -20,14 +20,14 @@ import {DslPosition, EventBus} from "../utils/EventBus";
import {CamelUi} from "../utils/CamelUi";
import {useConnectionsStore, useDesignerStore, useIntegrationStore} from "../DesignerStore";
import {shallow} from "zustand/shallow";
-import {CamelDefinitionApiExt} from "@/core/api/CamelDefinitionApiExt";
-import {IncomingLink, TopologyUtils} from "@/core/api/TopologyUtils";
-import {CamelElement} from "@/core/model/IntegrationDefinition";
+import {CamelDefinitionApiExt} from "@karavan-core/api/CamelDefinitionApiExt";
+import {IncomingLink, TopologyUtils} from "@karavan-core/api/TopologyUtils";
+import {CamelElement} from "@karavan-core/model/IntegrationDefinition";
import {v4 as uuidv4} from "uuid";
import {Button, Tooltip} from "@patternfly/react-core";
import {InfrastructureAPI} from "../utils/InfrastructureAPI";
-import {getIntegrations} from "@/integration-topology/TopologyApi";
-import {ComponentApi, INTERNAL_COMPONENTS} from "@/core/api/ComponentApi";
+import {getIntegrations} from "@features/project/project-topology/TopologyApi";
+import {ComponentApi, INTERNAL_COMPONENTS} from "@karavan-core/api/ComponentApi";
const overlapGap: number = 40;
const DIAMETER: number = 34;
diff --git a/karavan-vscode/webview/integration-designer/route/element/DslElement.tsx b/karavan-vscode/webview/integration-designer/route/element/DslElement.tsx
index e96bc0a8..d2bbd7de 100644
--- a/karavan-vscode/webview/integration-designer/route/element/DslElement.tsx
+++ b/karavan-vscode/webview/integration-designer/route/element/DslElement.tsx
@@ -16,10 +16,10 @@
*/
import React, {CSSProperties, useState} from 'react';
import './DslElement.css';
-import {CamelElement} from "@/core/model/IntegrationDefinition";
+import {CamelElement} from "@karavan-core/model/IntegrationDefinition";
import {EventBus} from "../../utils/EventBus";
-import {CamelDefinitionApiExt, ChildElement} from "@/core/api/CamelDefinitionApiExt";
-import {CamelDisplayUtil} from "@/core/api/CamelDisplayUtil";
+import {CamelDefinitionApiExt, ChildElement} from "@karavan-core/api/CamelDefinitionApiExt";
+import {CamelDisplayUtil} from "@karavan-core/api/CamelDisplayUtil";
import {useDesignerStore, useIntegrationStore} from "../../DesignerStore";
import {shallow} from "zustand/shallow";
import {useRouteDesignerHook} from "../useRouteDesignerHook";
diff --git a/karavan-vscode/webview/integration-designer/route/element/DslElementHeader.tsx b/karavan-vscode/webview/integration-designer/route/element/DslElementHeader.tsx
index 9bb36a78..3476b848 100644
--- a/karavan-vscode/webview/integration-designer/route/element/DslElementHeader.tsx
+++ b/karavan-vscode/webview/integration-designer/route/element/DslElementHeader.tsx
@@ -16,23 +16,23 @@
*/
import React, {CSSProperties, ReactElement, useCallback, useMemo, useRef} from 'react';
import {Content, Tooltip,} from '@patternfly/react-core';
-import '../../karavan.css';
+import '@features/project/designer/karavan.css';
import './DslElement.css';
-import {CamelElement} from "@/core/model/IntegrationDefinition";
+import {CamelElement} from "@karavan-core/model/IntegrationDefinition";
import {CamelUi} from "../../utils/CamelUi";
-import {CamelDefinitionApiExt, ChildElement} from "@/core/api/CamelDefinitionApiExt";
-import {CamelUtil} from "@/core/api/CamelUtil";
-import {CamelDisplayUtil} from "@/core/api/CamelDisplayUtil";
+import {CamelDefinitionApiExt, ChildElement} from "@karavan-core/api/CamelDefinitionApiExt";
+import {CamelUtil} from "@karavan-core/api/CamelUtil";
+import {CamelDisplayUtil} from "@karavan-core/api/CamelDisplayUtil";
import {useDesignerStore, useIntegrationStore} from "../../DesignerStore";
import {shallow} from "zustand/shallow";
import {useRouteDesignerHook} from "../useRouteDesignerHook";
import {AddElementIcon, CopyElementIcon, DeleteElementIcon, DisableStepIcon, EnableStepIcon, InsertElementIcon} from "../../utils/ElementIcons";
-import {RouteConfigurationDefinition} from "@/core/model/CamelDefinition";
+import {RouteConfigurationDefinition} from "@karavan-core/model/CamelDefinition";
import {AutoStartupFalseIcon, ErrorHandlerIcon} from "../../icons/OtherIcons";
import {usePropertiesHook} from "../../property/usePropertiesHook";
interface Props {
- headerRef: React.Ref<HTMLDivElement> | undefined
+ headerRef?: React.Ref<HTMLDivElement>;
step: CamelElement,
parent: CamelElement | undefined,
nextStep: CamelElement | undefined,
@@ -67,7 +67,7 @@ export function DslElementHeader(props: Props) {
const disabled = (step as any).disabled === true;
const autoStartup = (step as any).autoStartup === undefined || (step as any).autoStartup === true;
- const localHeaderRef = useRef<HTMLDivElement>(null);
+ const localHeaderRef = useRef<HTMLDivElement | null>(null);
// Merge any incoming ref into our local ref
const mergedRef = useCallback(
@@ -245,8 +245,8 @@ export function DslElementHeader(props: Props) {
const showDisableButton = Object.getOwnPropertyNames(step).includes('disabled')
const showAutoStartupButton = Object.getOwnPropertyNames(step).includes('autoStartup')
const headerClasses = getHeaderClasses();
- const childrenInfo = getChildrenInfo(step) || [];
- const hasWideChildrenElement = getHasWideChildrenElement(childrenInfo)
+ const childrenInfo = getChildrenInfo(step);
+ const hasWideChildrenElement = childrenInfo ? getHasWideChildrenElement(childrenInfo) : false;
return (
<div className={"dsl-element " + headerClasses} style={getHeaderStyle()} ref={mergedRef}>
{!['RouteConfigurationDefinition', 'RouteTemplateDefinition', 'RouteDefinition'].includes(step.dslName) &&
diff --git a/karavan-vscode/webview/integration-designer/route/element/DslElementMoveModal.tsx b/karavan-vscode/webview/integration-designer/route/element/DslElementMoveModal.tsx
index e55f9f15..d53b151c 100644
--- a/karavan-vscode/webview/integration-designer/route/element/DslElementMoveModal.tsx
+++ b/karavan-vscode/webview/integration-designer/route/element/DslElementMoveModal.tsx
@@ -25,7 +25,7 @@ import {
import {useDesignerStore, useIntegrationStore} from "../../DesignerStore";
import {shallow} from "zustand/shallow";
import {useRouteDesignerHook} from "../useRouteDesignerHook";
-import {CamelDefinitionApiExt} from "@/core/api/CamelDefinitionApiExt";
+import {CamelDefinitionApiExt} from "@karavan-core/api/CamelDefinitionApiExt";
export function DslElementMoveModal() {
diff --git a/karavan-vscode/webview/integration-designer/route/element/RouteTemplateElement.tsx b/karavan-vscode/webview/integration-designer/route/element/RouteTemplateElement.tsx
index 9d3da4ad..599d1171 100644
--- a/karavan-vscode/webview/integration-designer/route/element/RouteTemplateElement.tsx
+++ b/karavan-vscode/webview/integration-designer/route/element/RouteTemplateElement.tsx
@@ -15,16 +15,16 @@
* limitations under the License.
*/
import React from 'react';
-import '../../karavan.css';
+import '@features/project/designer/karavan.css';
import './RouteTemplateElement.css';
-import {CamelElement} from "@/core/model/IntegrationDefinition";
-import {ChildElement, CamelDefinitionApiExt} from "@/core/api/CamelDefinitionApiExt";
+import {CamelElement} from "@karavan-core/model/IntegrationDefinition";
+import {ChildElement, CamelDefinitionApiExt} from "@karavan-core/api/CamelDefinitionApiExt";
import {useDesignerStore} from "../../DesignerStore";
import {shallow} from "zustand/shallow";
import {useRouteDesignerHook} from "../useRouteDesignerHook";
import {DslElementHeader} from "./DslElementHeader";
import {DslElement} from "./DslElement";
-import {RouteDefinition, RouteTemplateDefinition} from "@/core/model/CamelDefinition";
+import {RouteDefinition, RouteTemplateDefinition} from "@karavan-core/model/CamelDefinition";
interface Props {
step: CamelElement,
diff --git a/karavan-vscode/webview/integration-designer/route/useRouteDesignerHook.tsx b/karavan-vscode/webview/integration-designer/route/useRouteDesignerHook.tsx
index 435e2d4b..5104fdfa 100644
--- a/karavan-vscode/webview/integration-designer/route/useRouteDesignerHook.tsx
+++ b/karavan-vscode/webview/integration-designer/route/useRouteDesignerHook.tsx
@@ -15,9 +15,9 @@
* limitations under the License.
*/
import React from 'react';
-import '../karavan.css';
+import '@features/project/designer/karavan.css';
import {DslMetaModel} from "../utils/DslMetaModel";
-import {CamelUtil} from "@/core/api/CamelUtil";
+import {CamelUtil} from "@karavan-core/api/CamelUtil";
import {
ChoiceDefinition,
FromDefinition,
@@ -27,17 +27,19 @@ import {
MarshalDefinition,
RouteConfigurationDefinition,
RouteDefinition,
+ RouteTemplateDefinition,
SplitDefinition,
UnmarshalDefinition
-} from "@/core/model/CamelDefinition";
-import {CamelElement, MetadataLabels} from "@/core/model/IntegrationDefinition";
-import {CamelDefinitionApiExt} from "@/core/api/CamelDefinitionApiExt";
-import {CamelDefinitionApi} from "@/core/api/CamelDefinitionApi";
+} from "@karavan-core/model/CamelDefinition";
+import {CamelElement, MetadataLabels} from "@karavan-core/model/IntegrationDefinition";
+import {CamelDefinitionApiExt} from "@karavan-core/api/CamelDefinitionApiExt";
+import {CamelDefinitionApi} from "@karavan-core/api/CamelDefinitionApi";
import {EventBus} from "../utils/EventBus";
-import {CamelDisplayUtil} from "@/core/api/CamelDisplayUtil";
+import {CamelDisplayUtil} from "@karavan-core/api/CamelDisplayUtil";
import {useDesignerStore, useIntegrationStore, useSelectorStore} from "../DesignerStore";
import {shallow} from "zustand/shallow";
import {v4 as uuidv4} from 'uuid';
+import {CamelUi} from "@features/project/designer/utils/CamelUi";
export function useRouteDesignerHook() {
@@ -331,11 +333,14 @@ export function useRouteDesignerHook() {
const createRouteTemplate = (dsl: DslMetaModel) => {
const clone = CamelUtil.cloneIntegration(integration);
- const route = CamelDefinitionApi.createRouteDefinition({
- from: new FromDefinition({uri: dsl.uri}),
- nodePrefixId: 'route-' + uuidv4().substring(0, 3)
- });
- const routeTemplate = CamelDefinitionApi.createRouteTemplateDefinition({route: route});
+ const keys = dsl.properties ? Object.keys(dsl.properties) : [];
+ const key = keys.at(0);
+ const routeId = dsl.properties?.[key] + "Route";
+ const templateId = dsl.properties?.[key] + "RouteTemplate";
+ const route = CamelUi.createRouteFromComponent(dsl.uri, dsl.properties, '');
+ route.id = routeId
+ route.nodePrefixId = routeId
+ const routeTemplate = CamelDefinitionApi.createRouteTemplateDefinition({id: templateId, route: route});
const i = CamelDefinitionApiExt.addRouteTemplateToIntegration(clone, routeTemplate);
setIntegration(i, false);
setSelectedStep(routeTemplate);
diff --git a/karavan-vscode/webview/integration-designer/selector/DslCard.tsx b/karavan-vscode/webview/integration-designer/selector/DslCard.tsx
index f0934cf4..ce6a2c15 100644
--- a/karavan-vscode/webview/integration-designer/selector/DslCard.tsx
+++ b/karavan-vscode/webview/integration-designer/selector/DslCard.tsx
@@ -19,13 +19,13 @@ import {Badge, capitalize, Card, CardBody, CardFooter, CardHeader, Content, Form
import './DslSelector.css';
import '../property/property/ComponentPropertyField.css';
import {CamelUi} from "../utils/CamelUi";
-import {DslMetaModel} from "@/integration-designer/utils/DslMetaModel";
-import {KameletApi} from "@/core/api/KameletApi";
-import {ComponentApi} from "@/core/api/ComponentApi";
-import {useSelectorStore} from "@/integration-designer/DesignerStore";
-import {ComponentPropertyField} from "@/integration-designer/property/property/ComponentPropertyField";
-import {ExpressionEditor} from "@/integration-designer/property/expression/ExpressionEditor";
-import {ComponentProperty} from "@/core/model/ComponentModels";
+import {DslMetaModel} from "@features/project/designer/utils/DslMetaModel";
+import {KameletApi} from "@karavan-core/api/KameletApi";
+import {ComponentApi} from "@karavan-core/api/ComponentApi";
+import {useSelectorStore} from "@features/project/designer/DesignerStore";
+import {ComponentPropertyField} from "@features/project/designer/property/property/ComponentPropertyField";
+import {ExpressionEditor} from "@features/project/designer/property/expression/ExpressionEditor";
+import {ComponentProperty} from "@karavan-core/model/ComponentModels";
interface Props {
dsl: DslMetaModel,
diff --git a/karavan-vscode/webview/integration-designer/selector/DslFastCard.tsx b/karavan-vscode/webview/integration-designer/selector/DslFastCard.tsx
index be3d1ae8..2ecd0161 100644
--- a/karavan-vscode/webview/integration-designer/selector/DslFastCard.tsx
+++ b/karavan-vscode/webview/integration-designer/selector/DslFastCard.tsx
@@ -15,13 +15,7 @@
* limitations under the License.
*/
import React from 'react';
-import {
- Button,
- Card,
- CardBody,
- CardHeader,
- Content,
-} from '@patternfly/react-core';
+import {Button, Content,} from '@patternfly/react-core';
import './DslSelector.css';
import {CamelUi} from "../utils/CamelUi";
import {DslMetaModel} from "../utils/DslMetaModel";
diff --git a/karavan-vscode/webview/integration-designer/selector/DslSelector.tsx b/karavan-vscode/webview/integration-designer/selector/DslSelector.tsx
index 8b00d8fa..7337f865 100644
--- a/karavan-vscode/webview/integration-designer/selector/DslSelector.tsx
+++ b/karavan-vscode/webview/integration-designer/selector/DslSelector.tsx
@@ -40,17 +40,17 @@ import {CamelUi} from "../utils/CamelUi";
import {DslMetaModel} from "../utils/DslMetaModel";
import {useSelectorStore} from "../DesignerStore";
import {shallow} from "zustand/shallow";
-import {ComponentApi} from '@/core/api/ComponentApi';
-import {KameletApi} from '@/core/api/KameletApi';
+import {ComponentApi} from '@karavan-core/api/ComponentApi';
+import {KameletApi} from '@karavan-core/api/KameletApi';
import TimesIcon from "@patternfly/react-icons/dist/esm/icons/times-icon";
import {addPreferredElement, deletePreferredElement, getPreferredElements} from "./DslPreferences";
import {DslFastCard} from "./DslFastCard";
import {DslCard} from "./DslCard";
import {useDebounceValue} from 'usehooks-ts';
import {v4 as uuidv4} from "uuid";
-import {toSpecialRouteId} from "@/integration-designer/utils/ValidatorUtils";
-import {FILE_WORDS_SEPARATOR, KARAVAN_DOT_EXTENSION} from "@/core/contants";
-import {useFilesStore} from "@/api/ProjectStore";
+import {toSpecialRouteId} from "@features/project/designer/utils/ValidatorUtils";
+import {FILE_WORDS_SEPARATOR, KARAVAN_DOT_EXTENSION} from "@karavan-core/contants";
+import {useFilesStore} from "@stores/ProjectStore";
import ExclamationCircleIcon from "@patternfly/react-icons/dist/esm/icons/exclamation-circle-icon";
interface Props {
@@ -62,10 +62,10 @@ interface Props {
export function DslSelector(props: Props) {
const [showSelector, showSteps, parentId, parentDsl, setShowSelector, showProperties, selectedDsl,
- selectedPosition, selectedToggles, addSelectedToggle, deleteSelectedToggle, setShowProperties, setSelectedDsl] =
+ selectedPosition, selectedToggles, addSelectedToggle, deleteSelectedToggle, setShowProperties, setSelectedDsl, isRouteTemplate] =
useSelectorStore((s) =>
[s.showSelector, s.showSteps, s.parentId, s.parentDsl, s.setShowSelector, s.showProperties, s.selectedDsl,
- s.selectedPosition, s.selectedToggles, s.addSelectedToggle, s.deleteSelectedToggle, s.setShowProperties, s.setSelectedDsl], shallow)
+ s.selectedPosition, s.selectedToggles, s.addSelectedToggle, s.deleteSelectedToggle, s.setShowProperties, s.setSelectedDsl, s.isRouteTemplate], shallow)
const files = useFilesStore((s) => s.files);
const [fileName, setFileName] = useState<string>();
@@ -105,8 +105,12 @@ export function DslSelector(props: Props) {
function generateRouteFileName(dsl: DslMetaModel): string {
const paramsUri = generateParamUri(dsl);
- const fullUri = `${FILE_WORDS_SEPARATOR}${paramsUri}`
- return toSpecialRouteId(`from${FILE_WORDS_SEPARATOR}${fullUri}`);
+ const fullUri = `${FILE_WORDS_SEPARATOR}${paramsUri}`;
+ if (isRouteTemplate) {
+ return toSpecialRouteId(`${FILE_WORDS_SEPARATOR}${fullUri}-route-template`);
+ } else {
+ return toSpecialRouteId(`${FILE_WORDS_SEPARATOR}${fullUri}`);
+ }
}
useEffect(() => {
diff --git a/karavan-vscode/webview/integration-designer/utils/CamelUi.tsx b/karavan-vscode/webview/integration-designer/utils/CamelUi.tsx
index 398a6796..6d0cf54b 100644
--- a/karavan-vscode/webview/integration-designer/utils/CamelUi.tsx
+++ b/karavan-vscode/webview/integration-designer/utils/CamelUi.tsx
@@ -14,15 +14,15 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-import {KameletApi} from "@/core/api/KameletApi";
-import {KameletModel} from "@/core/model/KameletModels";
+import {KameletApi} from "@karavan-core/api/KameletApi";
+import {KameletModel} from "@karavan-core/model/KameletModels";
import {DslMetaModel} from "./DslMetaModel";
-import {ComponentApi} from "@/core/api/ComponentApi";
-import {CamelMetadataApi} from "@/core/model/CamelMetadata";
-import {CamelUtil} from "@/core/api/CamelUtil";
-import {CamelDefinitionApiExt} from "@/core/api/CamelDefinitionApiExt";
-import {BeanFactoryDefinition, FromDefinition, RouteConfigurationDefinition, RouteDefinition, RouteTemplateDefinition, ToDefinition} from "@/core/model/CamelDefinition";
-import {CamelElement, Integration, IntegrationFile} from "@/core/model/IntegrationDefinition";
+import {ComponentApi} from "@karavan-core/api/ComponentApi";
+import {CamelMetadataApi} from "@karavan-core/model/CamelMetadata";
+import {CamelUtil} from "@karavan-core/api/CamelUtil";
+import {CamelDefinitionApiExt} from "@karavan-core/api/CamelDefinitionApiExt";
+import {BeanFactoryDefinition, FromDefinition, RouteConfigurationDefinition, RouteDefinition, RouteTemplateDefinition, ToDefinition} from "@karavan-core/model/CamelDefinition";
+import {CamelElement, Integration, IntegrationFile} from "@karavan-core/model/IntegrationDefinition";
import {
ActivemqIcon,
AmqpIcon,
@@ -101,15 +101,16 @@ import {
ToIcon,
} from "../icons/EipIcons";
import React, {ReactElement} from "react";
-import {TopologyUtils} from "@/core/api/TopologyUtils";
-import {getIntegrations} from "@/integration-topology/TopologyApi";
+import {TopologyUtils} from "@karavan-core/api/TopologyUtils";
+import {getIntegrations} from "@features/project/project-topology/TopologyApi";
import {toKebabCase, toSpecialRouteId} from "./ValidatorUtils";
-import {ProjectFile} from "@/api/ProjectModels";
-import {CamelDefinitionYaml} from "@/core/api/CamelDefinitionYaml";
+import {ProjectFile} from "@models/ProjectModels";
+import {CamelDefinitionYaml} from "@karavan-core/api/CamelDefinitionYaml";
import {EventBus} from "./EventBus";
-import {CamelDefinitionApi} from "@/core/api/CamelDefinitionApi";
+import {KaravanApi} from "@api/KaravanApi";
+import {CamelDefinitionApi} from "@karavan-core/api/CamelDefinitionApi";
import {capitalize} from "@patternfly/react-core";
-import {FILE_WORDS_SEPARATOR} from "@/core/contants";
+import {FILE_WORDS_SEPARATOR} from "@karavan-core/contants";
const StepElements: string[] = [
"AggregateDefinition",
@@ -273,20 +274,19 @@ export class CamelUi {
static createNewRoute = (projectId:string, componentName: string, parameters: any = {}, expression: string, after:(file: ProjectFile) => void): void => {
try {
const stringWithParams = CamelUi.createFullStringWithParameters(componentName, parameters);
- const name = `from-${stringWithParams}`;
const newRoute = CamelUi.createRouteFromComponent(componentName, parameters, expression);
const newIntegration = Integration.createNew(stringWithParams, 'plain');
newIntegration.spec.flows = [newRoute];
const code = CamelDefinitionYaml.integrationToYaml(newIntegration);
- const fileName = name + '.camel.yaml';
+ const fileName = stringWithParams + '.camel.yaml';
const file = new ProjectFile(fileName, projectId, code, Date.now());
- // KaravanApi.saveProjectFile(file, (result, newFile) => {
- // if (result) {
- // after(newFile);
- // } else {
- // EventBus.sendAlert('Error creating file', 'Error: ' +newFile?.toString());
- // }
- // });
+ KaravanApi.saveProjectFile(file, (result, newFile) => {
+ if (result) {
+ after(newFile);
+ } else {
+ EventBus.sendAlert('Error creating file', 'Error: ' +newFile?.toString());
+ }
+ });
} catch (err: any){
console.error(err)
}
@@ -295,13 +295,13 @@ export class CamelUi {
static createNewFile = (projectId:string, fileName: string, code: string = '', after:(file: ProjectFile) => void): void => {
try {
const file = new ProjectFile(fileName, projectId, code, Date.now());
- // KaravanApi.saveProjectFile(file, (result, newFile) => {
- // if (result) {
- // after(newFile);
- // } else {
- // EventBus.sendAlert('Error creating file', 'Error: ' +newFile?.toString());
- // }
- // });
+ KaravanApi.saveProjectFile(file, (result, newFile) => {
+ if (result) {
+ after(newFile);
+ } else {
+ EventBus.sendAlert('Error creating file', 'Error: ' +newFile?.toString());
+ }
+ });
} catch (err: any){
console.error(err)
}
diff --git a/karavan-vscode/webview/integration-designer/utils/EventBus.ts b/karavan-vscode/webview/integration-designer/utils/EventBus.ts
index b130df33..9fcd7d53 100644
--- a/karavan-vscode/webview/integration-designer/utils/EventBus.ts
+++ b/karavan-vscode/webview/integration-designer/utils/EventBus.ts
@@ -15,7 +15,7 @@
* limitations under the License.
*/
import {Subject} from 'rxjs';
-import {CamelElement, Integration} from "@/core/model/IntegrationDefinition";
+import {CamelElement, Integration} from "@karavan-core/model/IntegrationDefinition";
import {v4 as uuidv4} from "uuid";
export class DslPosition {
@@ -115,7 +115,12 @@ export const EventBus = {
sendCommand: (command: string, data?: any) => commands.next(new Command(command, data)),
onCommand: () => commands.asObservable(),
- sendAlert: (title: string, text: string, variant: 'success' | 'danger' | 'warning' | 'info' | 'custom' = 'success') =>
- alerts.next(new ToastMessage(title, text, variant)),
+ sendAlert: (title: string, text: string | string[], variant: 'success' | 'danger' | 'warning' | 'info' | 'custom' = 'success') => {
+ if (Array.isArray(text)) {
+ text.forEach(line => alerts.next(new ToastMessage(title, line, variant)))
+ } else {
+ alerts.next(new ToastMessage(title, text, variant))
+ }
+ },
onAlert: () => alerts.asObservable(),
}
diff --git a/karavan-vscode/webview/integration-designer/utils/Notification.tsx b/karavan-vscode/webview/integration-designer/utils/Notification.tsx
index 33052697..a8dc05ae 100644
--- a/karavan-vscode/webview/integration-designer/utils/Notification.tsx
+++ b/karavan-vscode/webview/integration-designer/utils/Notification.tsx
@@ -17,7 +17,7 @@
import React, {useEffect, useState} from 'react';
import {Alert, AlertActionCloseButton, AlertGroup,} from '@patternfly/react-core';
-import '../karavan.css';
+import '@features/project/designer/karavan.css';
import {EventBus, ToastMessage} from "./EventBus";
export function Notification () {
diff --git a/karavan-vscode/webview/integration-topology/CustomComponentFactory.tsx b/karavan-vscode/webview/integration-topology/CustomComponentFactory.tsx
index 9e01f4f4..ef7af5bb 100644
--- a/karavan-vscode/webview/integration-topology/CustomComponentFactory.tsx
+++ b/karavan-vscode/webview/integration-topology/CustomComponentFactory.tsx
@@ -34,10 +34,10 @@ import {
withSelection,
withTargetDrag,
} from '@patternfly/react-topology';
-import CustomNode from "./CustomNode";
-import CustomEdge from "./CustomEdge";
-import CustomGroup from "./CustomGroup";
-import {getCustomMenu} from "./GetCustomMenu";
+import CustomGroup from "@features/project/project-topology/CustomGroup";
+import {getCustomMenu} from "@features/project/project-topology/GetCustomMenu";
+import CustomNode from "@features/project/project-topology/CustomNode";
+import CustomEdge from "@features/project/project-topology/CustomEdge";
const CONNECTOR_TARGET_DROP = 'connector-target-drop';
diff --git a/karavan-vscode/webview/integration-topology/CustomEdge.tsx b/karavan-vscode/webview/integration-topology/CustomEdge.tsx
index 9fab2ca1..a516114e 100644
--- a/karavan-vscode/webview/integration-topology/CustomEdge.tsx
+++ b/karavan-vscode/webview/integration-topology/CustomEdge.tsx
@@ -32,7 +32,7 @@ const CustomEdge: React.FC<any> = observer(({ element, ...rest }) => {
endTerminalSize={10}
endTerminalStatus={data?.endTerminalStatus || NodeStatus.default}
tagStatus={data?.endTerminalStatus || NodeStatus.default}
- tag={data.label}
+ tag={data?.label}
{...rest}
/>
)
diff --git a/karavan-vscode/webview/integration-topology/CustomNode.tsx b/karavan-vscode/webview/integration-topology/CustomNode.tsx
index 0d251517..60266fd8 100644
--- a/karavan-vscode/webview/integration-topology/CustomNode.tsx
+++ b/karavan-vscode/webview/integration-topology/CustomNode.tsx
@@ -1,36 +1,36 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
import * as React from 'react';
-import {RegionsIcon} from '@patternfly/react-icons';
-import {DefaultNode, observer, WithContextMenuProps} from '@patternfly/react-topology';
-import {AsyncApiIcon, BeanIcon, getDesignerIcon, OpenApiIcon} from "@/integration-designer/icons/KaravanIcons";
-import {CamelUi} from "@/integration-designer/utils/CamelUi";
-import './topology.css';
-import {RouteDefinition} from "@/core/model/CamelDefinition";
-import {AutoStartupFalseIcon, ErrorHandlerIcon} from "@/integration-designer/icons/OtherIcons";
-import {useTopologyHook} from "./useTopologyHook";
-
-export const COLOR_ORANGE = '#ef9234';
-export const COLOR_BLUE = '#2b9af3';
-export const COLOR_GREEN = '#6ec664';
+import {useRef} from 'react';
+import {LockedIcon, RegionsIcon} from '@patternfly/react-icons';
+import {Decorator, DEFAULT_DECORATOR_RADIUS, DefaultNode, getDefaultShapeDecoratorCenter, observer, TopologyQuadrant, WithContextMenuProps} from '@patternfly/react-topology';
+import {BeanIcon, getDesignerIcon, OpenApiIcon} from "@features/project/designer/icons/KaravanIcons";
+import {CamelUi} from "@features/project/designer/utils/CamelUi";
+import '@features/project/project-topology/topology.css';
+import {RouteDefinition} from "@karavan-core/model/CamelDefinition";
+import {AutoStartupFalseIcon, ErrorHandlerIcon} from "@features/project/designer/icons/OtherIcons";
+import {runInAction} from "mobx";
+import {SvgIcon} from "@shared/icons/SvgIcon";
+import {useTopologyHook} from "@features/project/project-topology/useTopologyHook";
+import {Category, IntentRequestScaleIn, IntentRequestScaleOut} from "@carbon/icons-react";
function getIcon(data: any) {
- if (['route', 'rest', 'routeConfiguration'].includes(data.icon)) {
+ if (['route'].includes(data.icon)) {
+ return (
+ <g transform={`translate(14, 14) scale(2)`} className='icon-wrapper'>
+ <Category/>
+ {data?.generatedFromAsyncApi &&
+ <g transform={`translate(9, -2)`}>
+ {SvgIcon({icon: 'asyncapi', width: 14, height: 14})}
+ </g>
+ }
+ </g>
+ )
+ } else if (['routeConfiguration'].includes(data.icon)) {
+ return (
+ <g transform={`translate(8, 8) scale(0.75)`}>
+ {getDesignerIcon(data.icon)}
+ </g>
+ )
+ } else if (['rest'].includes(data.icon)) {
return (
<g transform={`translate(14, 14)`}>
{getDesignerIcon(data.icon)}
@@ -51,13 +51,31 @@ function getIcon(data: any) {
} else if (data.icon === 'openapi') {
return (
<g transform={`translate(14, 14)`}>
- {OpenApiIcon('', 32, 32)}
+ <OpenApiIcon width={32} height={32} />
</g>
)
} else if (data.icon === 'asyncapi') {
return (
- <g transform={`translate(11, 11)`}>
- {AsyncApiIcon({})}
+ <g transform={`translate(14, 14)`}>
+ {SvgIcon({icon: 'asyncapi', width: 32, height: 32})}
+ </g>
+ )
+ } else if (data.icon === 'send') {
+ return (
+ <g rotate={45} transform={`translate(14, 14) scale(2)`}>
+ <IntentRequestScaleOut style={{fill: "var(--pf-t--global--text--color--subtle)"}}/>
+ <g transform={`translate(12, -2)`}>
+ {SvgIcon({icon: 'asyncapi', width: 6, height: 6})}
+ </g>
+ </g>
+ )
+ } else if (data.icon === 'receive') {
+ return (
+ <g rotate={45} transform={`translate(14, 14) scale(2)`}>
+ <IntentRequestScaleIn style={{fill: "var(--pf-t--global--text--color--subtle)"}}/>
+ <g transform={`translate(12, -2)`}>
+ {SvgIcon({icon: 'asyncapi', width: 6, height: 6})}
+ </g>
</g>
)
}
@@ -67,7 +85,7 @@ function getIcon(data: any) {
function isDisable(data: any) {
if ((data && data?.step?.dslName === 'RouteDefinition')) {
const route: RouteDefinition = data?.step;
- const autoStartup = route?.autoStartup === false;
+ const autoStartup = route?.autoStartup === false;
return autoStartup;
} else if (data?.type === 'step' && data?.outgoing && data?.disabled) {
return true;
@@ -76,10 +94,11 @@ function isDisable(data: any) {
}
function getAttachments(data: any) {
+ const showStats = data?.showStats;
if (data && data?.step?.dslName === 'RouteDefinition') {
const route: RouteDefinition = data?.step;
const routeId = route?.id;
- const errorHandler = route?.errorHandler !== undefined;
+ const errorHandler = route?.errorHandler !== undefined;
return (
<g>
<g className="pf-topology__node__label__badge auto-start" transform="translate(-4, -4)">
@@ -99,42 +118,60 @@ function getAttachments(data: any) {
}
}
-const CustomNode: React.FC<any & WithContextMenuProps> = observer(({element, onContextMenu, contextMenuOpen, ...rest}) => {
- const {selectFile} = useTopologyHook(undefined);
-
+const CustomNode: React.FC<any & WithContextMenuProps> = observer(({element, onContextMenu, contextMenuOpen, selected, ...rest}) => {
+ const {selectFile, project} = useTopologyHook(undefined);
+ const decoratorRef = useRef(null);
const data = element.getData();
- const badge: string = ['API', 'RT'].includes(data.badge) ? data.badge : data.badge?.substring(0, 1).toUpperCase();
+ const badge: string = ['API', 'RT', 'TR'].includes(data.badge) ? data.badge : data.badge?.substring(0, 1).toUpperCase();
let colorClass = 'route';
+ let label = element.getLabel();
if (badge === 'C') {
colorClass = 'component'
} else if (badge === 'K') {
colorClass = 'kamelet';
+ label = element.getLabel()?.replace('kamelet:', '');
}
- const label: string = badge === 'K' ? element.getLabel().replace('kamelet:', '') : element.getLabel();
if (label?.length > 30) {
- element.setLabel(label?.substring(0, 30) + '...');
+ runInAction(() => {
+ element.setLabel(label?.substring(0, 30) + '...');
+ });
}
const disableClass = isDisable(data) ? 'disable-node' : '';
+ const { x, y } = getDefaultShapeDecoratorCenter("lowerRight" as TopologyQuadrant, element);
+
+ const decorator = (
+ <Decorator
+ radius={DEFAULT_DECORATOR_RADIUS}
+ showBackground
+ className="gen-route-decorator"
+ icon= {<LockedIcon width={14}/>}
+ x={x - DEFAULT_DECORATOR_RADIUS / 2}
+ y={y - DEFAULT_DECORATOR_RADIUS / 2}
+ innerRef={decoratorRef}
+ />
+ );
+
return (
<g onDoubleClick={event => {
event.stopPropagation();
selectFile(data.fileName)
}}>
- <DefaultNode
- showStatusDecorator
- className={"common-node common-node-" + badge + " topology-color-" + colorClass + " " + disableClass}
- scaleLabel={true}
- element={element}
- onContextMenu={onContextMenu}
- contextMenuOpen={contextMenuOpen}
- attachments={getAttachments(data)}
- hideContextMenuKebab={false}
- {...rest}
- on
- >
- {getIcon(data)}
- </DefaultNode>
+ <DefaultNode
+ showStatusDecorator
+ className={"common-node common-node-" + badge + " topology-color-" + colorClass + " " + disableClass}
+ scaleLabel={true}
+ element={element}
+ onContextMenu={onContextMenu}
+ contextMenuOpen={contextMenuOpen}
+ attachments={getAttachments(data)}
+ hideContextMenuKebab={false}
+ labelIconPadding={1}
+ label={label}
+ {...rest}
+ >
+ {getIcon(data)}
+ </DefaultNode>
</g>
)
})
diff --git a/karavan-vscode/webview/integration-topology/GetCustomMenu.tsx b/karavan-vscode/webview/integration-topology/GetCustomMenu.tsx
index 01bc9dd9..d8efab26 100644
--- a/karavan-vscode/webview/integration-topology/GetCustomMenu.tsx
+++ b/karavan-vscode/webview/integration-topology/GetCustomMenu.tsx
@@ -28,7 +28,33 @@ export function getCustomMenu(element: GraphElement, groupNames: string[]) {
</ContextMenuItem>
);
if (data?.type === 'route') {
-
+ result.push(
+ <ContextMenuItem key={element.getId()}
+ onClick={() => data?.setDisabled?.(data?.fileName, data?.routeId, !(data?.autoStartup))}>
+ {data?.autoStartup === false ? 'Enable' : 'Disable'}
+ </ContextMenuItem>
+ );
+ result.push(
+ <ContextMenuItem key={element.getId() + '-delete'} onClick={() => {
+ data?.deleteRoute?.(data?.fileName, data?.step.id);
+ }}>
+ {'Delete'}
+ </ContextMenuItem>
+ );
+ if (groupNames.length > 0) {
+ result.push(
+ <ContextSubMenuItem label='Groups' key={element.getId() + '-groups'} children={
+ groupNames.filter(g => !g.startsWith("karavan-")).map(groupName => {
+ return (
+ <ContextMenuItem key={`${element.getId()}-groups-${groupName}`} isSelected={data.routeGroup === groupName} onClick={() => data?.setRouteGroup?.(data?.fileName, data?.routeId, groupName)}
+ >
+ {groupName}
+ </ContextMenuItem>
+ )
+ })
+ }/>
+ )
+ }
} else if (data?.type === 'step' && data?.outgoing) {
result.push(
<ContextMenuItem key={element.getId() + '-step'}
diff --git a/karavan-vscode/webview/integration-topology/TopologyApi.tsx b/karavan-vscode/webview/integration-topology/TopologyApi.tsx
index 91084667..f5d87cba 100644
--- a/karavan-vscode/webview/integration-topology/TopologyApi.tsx
+++ b/karavan-vscode/webview/integration-topology/TopologyApi.tsx
@@ -1,24 +1,7 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
import {EdgeAnimationSpeed, EdgeModel, EdgeStyle, Model, NodeModel, NodeShape, NodeStatus,} from '@patternfly/react-topology';
-import {Integration, IntegrationFile} from "@/core/model/IntegrationDefinition";
-import {CamelDefinitionYaml} from "@/core/api/CamelDefinitionYaml";
-import {TopologyUtils} from "@/core/api/TopologyUtils";
+import {Integration, IntegrationFile} from "@karavan-core/model/IntegrationDefinition";
+import {CamelDefinitionYaml} from "@karavan-core/api/CamelDefinitionYaml";
+import {TopologyUtils} from "@karavan-core/api/TopologyUtils";
import {
TopologyAsyncApiNode,
TopologyIncomingNode,
@@ -27,9 +10,9 @@ import {
TopologyRestNode,
TopologyRouteConfigurationNode,
TopologyRouteNode
-} from "@/core/model/TopologyDefinition";
-import {INTERNAL_COMPONENTS} from "@/core/api/ComponentApi";
-import {EventBus} from "@/integration-designer/utils/EventBus";
+} from "@karavan-core/model/TopologyDefinition";
+import {INTERNAL_COMPONENTS} from "@karavan-core/api/ComponentApi";
+import {EventBus} from "@features/project/designer/utils/EventBus";
const NODE_DIAMETER_ROUTE = 60;
const NODE_DIAMETER_INOUT = NODE_DIAMETER_ROUTE / 1.5;
@@ -53,10 +36,10 @@ export function getIncomingNodes(tins: TopologyIncomingNode[]): NodeModel[] {
return {
id: tin.id,
type: 'node',
- label: tin.title,
+ label: getUriLabel(tin.uniqueUri),
width: NODE_DIAMETER_INOUT,
height: NODE_DIAMETER_INOUT,
- shape: NodeShape.ellipse,
+ shape: NodeShape.circle,
status: NodeStatus.default,
data: {
isAlternate: false,
@@ -70,8 +53,9 @@ export function getIncomingNodes(tins: TopologyIncomingNode[]): NodeModel[] {
});
}
-export function getRoutes(tins: TopologyRouteNode[]): NodeModel[] {
+export function getRoutes(tins: TopologyRouteNode[], tasyncapis: TopologyAsyncApiNode, showStats?: boolean): NodeModel[] {
return tins.map(tin => {
+ const oper = tasyncapis?.operations?.find(o => o.operationId === tin.routeId)
const node: NodeModel = {
id: tin.id,
type: 'node',
@@ -82,7 +66,7 @@ export function getRoutes(tins: TopologyRouteNode[]): NodeModel[] {
status: NodeStatus.default,
data: {
isAlternate: false,
- badge: tin.templateId !== undefined ? 'RT' : 'R',
+ badge: (tin.templateId !== undefined ? 'RT' : 'R'),
type: 'route',
icon: 'route',
step: tin.route,
@@ -91,7 +75,9 @@ export function getRoutes(tins: TopologyRouteNode[]): NodeModel[] {
fileName: tin.fileName,
templateId: tin.templateId,
templateTitle: tin.templateTitle,
- autoStartup: tin.route.autoStartup !== false
+ generatedFromAsyncApi: oper?.operationId === tin.routeId,
+ autoStartup: tin.route.autoStartup !== false,
+ showStats: showStats,
}
}
return node;
@@ -104,9 +90,9 @@ export function getRouteConfigurations(trcs: TopologyRouteConfigurationNode[]):
id: tin.id,
type: 'node',
label: tin.title,
- width: NODE_DIAMETER_ROUTE,
- height: NODE_DIAMETER_ROUTE,
- shape: NodeShape.rect,
+ width: NODE_DIAMETER_INOUT,
+ height: NODE_DIAMETER_INOUT,
+ shape: NodeShape.octagon,
status: NodeStatus.default,
data: {
isAlternate: false,
@@ -126,10 +112,10 @@ export function getOutgoingNodes(tons: TopologyOutgoingNode[]): NodeModel[] {
const node: NodeModel = {
id: tin.id,
type: 'node',
- label: tin.title,
+ label: getUriLabel(tin.uniqueUri),
width: NODE_DIAMETER_INOUT,
height: NODE_DIAMETER_INOUT,
- shape: NodeShape.ellipse,
+ shape: NodeShape.circle,
status: NodeStatus.default,
data: {
isAlternate: false,
@@ -205,6 +191,12 @@ export function getExternalEdges(tons: TopologyOutgoingNode[], tins: TopologyInc
return result;
}
+function getUriLabel(uniqueUri: string) {
+ const parts = uniqueUri.split('=');
+ const name = parts[1];
+ return `${name}`
+}
+
export function getUniqueUriNodes(tons: TopologyOutgoingNode[], tins: TopologyIncomingNode[], troutes: TopologyRouteNode[]): NodeModel[] {
const result: Map<string, NodeModel> = new Map();
@@ -214,7 +206,7 @@ export function getUniqueUriNodes(tons: TopologyOutgoingNode[], tins: TopologyIn
const node: NodeModel = result.get(uniqueUri) ?? {
id: uniqueUri,
type: 'node',
- label: '',
+ label: getUriLabel(uniqueUri),
width: NODE_DIAMETER_INOUT,
height: NODE_DIAMETER_INOUT,
shape: NodeShape.circle,
@@ -226,6 +218,7 @@ export function getUniqueUriNodes(tons: TopologyOutgoingNode[], tins: TopologyIn
badge: ton.connectorType,
step: ton.step,
fileName: ton.fileName,
+ uniqueUri: uniqueUri,
outgoing: true,
incomingIds: [],
outgoingIds: [],
@@ -251,12 +244,13 @@ export function getUniqueUriNodes(tons: TopologyOutgoingNode[], tins: TopologyIn
const node: NodeModel = result.get(uniqueUri) ?? {
id: uniqueUri,
type: 'node',
- label: '',
+ label: getUriLabel(uniqueUri),
width: NODE_DIAMETER_INOUT,
height: NODE_DIAMETER_INOUT,
shape: NodeShape.circle,
status: NodeStatus.default,
data: {
+ uniqueUri: uniqueUri,
isAlternate: false,
icon: 'element',
type: 'step',
@@ -343,7 +337,7 @@ export function getRestNodes(tins: TopologyRestNode[]): NodeModel[] {
});
}
-export function getOpenApiNodes(topenapis: TopologyOpenApiNode[]): NodeModel[] {
+export function getOpenApiNodes(topenapis: TopologyOpenApiNode[], showStats?: boolean): NodeModel[] {
return topenapis.map(topenapi => {
return {
id: topenapi.fileName,
@@ -361,40 +355,33 @@ export function getOpenApiNodes(topenapis: TopologyOpenApiNode[]): NodeModel[] {
// step: tin.rest,
fileName: topenapi.fileName,
secondaryLabel: topenapi.title,
- }
- }
- });
-}
-export function getAsyncApiNodes(tasyncapis: TopologyAsyncApiNode[]): NodeModel[] {
- return tasyncapis.map(tasyncapi => {
- return {
- id: tasyncapi.fileName,
- type: 'node',
- label: tasyncapi.title,
- width: NODE_DIAMETER_ROUTE,
- height: NODE_DIAMETER_ROUTE,
- shape: NodeShape.hexagon,
- status: NodeStatus.default,
- data: {
- isAlternate: false,
- badge: 'AsyncAPI',
- icon: 'asyncapi',
- type: 'asyncapi',
- // step: tin.rest,
- fileName: tasyncapi.fileName,
- secondaryLabel: tasyncapi.title,
+ showStats: showStats,
}
}
});
}
-export function getOpenApiEdges(topenapis: TopologyOpenApiNode[], tins: TopologyIncomingNode[]): EdgeModel[] {
+
+export function getOpenApiEdges(topenapis: TopologyOpenApiNode[], tins: TopologyIncomingNode[], trcs: TopologyRestNode[]): EdgeModel[] {
const result: EdgeModel[] = [];
topenapis.forEach(topenapi => {
+
+ trcs.filter(t => t.rest?.openApi !== undefined).forEach(trc => {
+ const edgeRest: EdgeModel = {
+ id: 'rest-openapi-' + topenapi.fileName + '-' + trc.id,
+ type: 'edge',
+ source: trc.id,
+ target: topenapi.fileName,
+ edgeStyle: EdgeStyle.solid,
+ animationSpeed: EdgeAnimationSpeed.none
+ }
+ result.push(edgeRest);
+ })
+
topenapi.operations.filter(o => o.operationId?.length > 0)
.forEach((operation, index, array) => {
const target = TopologyUtils.getRouteIdByUri(tins, 'direct:' + operation.operationId);
- const node: EdgeModel = {
+ const edge: EdgeModel = {
id: 'incoming-' + operation.path + '-' + operation.method + '-' + index,
type: 'edge',
source: topenapi.fileName,
@@ -405,9 +392,10 @@ export function getOpenApiEdges(topenapis: TopologyOpenApiNode[], tins: Topology
label: `${operation.method} ${operation.path} `
}
}
- if (target) result.push(node);
+ if (target) result.push(edge);
})
});
+
return result;
}
@@ -454,11 +442,10 @@ export function getInternalEdges(tons: TopologyOutgoingNode[], tins: TopologyInc
}
if (target) result.push(node);
} else {
- const uri: string = (ton.step as any).uri;
+ const uri: string = step.uri;
const component = uri?.split(":")?.[0];
+ const name = step.parameters.name || step.parameters.address;
if (INTERNAL_COMPONENTS.includes(component)) {
- const step = (ton.step as any);
- const name = step.parameters.name || step.parameters.address;
const target = TopologyUtils.getRouteIdByUriAndName(tins, uri, name);
const node: EdgeModel = {
id: 'internal-' + ton.id + '-' + index,
@@ -478,26 +465,18 @@ export function getInternalEdges(tons: TopologyOutgoingNode[], tins: TopologyInc
return result;
}
-export function getSimpleModel(files: IntegrationFile[], showGroups: boolean, openApiJson?: string, asyncApiJson?: string): Model {
- return getModel(files, showGroups, (fileName: string) => {
- }, (fileName, elementId, disabled) => {
- }, (fileName, routeId) => {
- }, (fileName, routeId, groupName) => {
- }, openApiJson, asyncApiJson)
-}
-
-export function getModel(files: IntegrationFile[], showGroups: boolean,
+export function getModel(projectId: string, files: IntegrationFile[], showGroups: boolean,
selectFile: (fileName: string) => void,
setDisabled: (fileName: string, elementId: string, disabled: boolean) => void,
deleteRoute: (fileName: string, routeId: string) => void,
setRouteGroup: (fileName: string, routeId: string, groupName: string) => void,
- openApiJson?: string, asyncApiJson?: string): Model {
+ openApiJson?: string, asyncApiJson?: string, showStats?: boolean): Model {
+ const tasyncapis = asyncApiJson ? [TopologyUtils.findTopologyAsyncApiNodes(asyncApiJson, projectId)] : [];
const integrations = getIntegrations(files);
- const tins = TopologyUtils.findTopologyIncomingNodes(integrations);
const troutes = TopologyUtils.findTopologyRouteNodes(integrations);
- const tons = TopologyUtils.findTopologyRouteOutgoingNodes(integrations);
+ const tins: any[] = TopologyUtils.findTopologyRoutesIncomingNodes(troutes);
+ const tons: any[]= TopologyUtils.findTopologyRoutesOutgoingNodes(troutes);
const topenapis = openApiJson ? [TopologyUtils.findTopologyOpenApiNodes(openApiJson)] : [];
- const tasyncapis = asyncApiJson ? [TopologyUtils.findTopologyAsyncApiNodes(asyncApiJson)] : [];
const trestns = TopologyUtils.findTopologyRestNodes(integrations) || [];
@@ -507,9 +486,9 @@ export function getModel(files: IntegrationFile[], showGroups: boolean,
const nodes: NodeModel[] = [];
nodes.push(...getRestNodes(trestns))
- nodes.push(...getOpenApiNodes(topenapis))
- nodes.push(...getAsyncApiNodes(tasyncapis))
- nodes.push(...getRoutes(troutes))
+ nodes.push(...getOpenApiNodes(topenapis, showStats))
+ // nodes.push(...getAsyncApiNodes(tasyncapis))
+ nodes.push(...getRoutes(troutes, tasyncapis?.at(0), showStats))
nodes.push(...getRouteConfigurations(trcs))
const uriNodes = getUniqueUriNodes(tons, tins, troutes);
if (showGroups) {
@@ -529,7 +508,8 @@ export function getModel(files: IntegrationFile[], showGroups: boolean,
edges.push(...uriEdges);
}
edges.push(...getRestEdges(trestns, tins));
- edges.push(...getOpenApiEdges(topenapis, tins));
+ edges.push(...getOpenApiEdges(topenapis, tins, trestns));
+ // edges.push(...getAsyncApiEdges(tasyncapis));
edges.push(...getInternalEdges(tons, tins));
edges.push(...getInternalEdges(trcons, tins));
@@ -555,7 +535,20 @@ export function getModel(files: IntegrationFile[], showGroups: boolean,
})
}
+ const asyncReceive: string[] = [];
+ const asyncSend: string[] = [];
+ // tasyncapis.forEach((asyn, i) => {
+ // asyn.operations.forEach((operation) => {
+ // if (operation.action === "send") {
+ // asyncSend.push(`asyncapi-operation-${operation.operationId}`);
+ // } else {
+ // asyncReceive.push(`asyncapi-operation-${operation.operationId}`);
+ // }
+ // })
+ // });
+
const children1 = [
+ ...asyncReceive,
...tins.filter(i => i.type === 'external').map(i => i.id),
...(!hasOpenApi ? trestns.map(i => i.id) : []),
];
@@ -570,7 +563,10 @@ export function getModel(files: IntegrationFile[], showGroups: boolean,
}
})
- const children2 = [...tons.filter(i => i.type === 'external').map(i => i.id)];
+ const children2 = [
+ ...asyncSend,
+ ...tons.filter(i => i.type === 'external').map(i => i.id)
+ ];
groups.push({
id: 'karavan-producer-group',
children: children2,
@@ -581,6 +577,7 @@ export function getModel(files: IntegrationFile[], showGroups: boolean,
padding: 20,
},
})
+
} else {
// edges.push(...externalEdges);
}
@@ -603,7 +600,7 @@ export function getModel(files: IntegrationFile[], showGroups: boolean,
// routeGroups.set(groupName, children);
// })
- Array.from(routeGroups.keys()).forEach(groupName => {
+ routeGroups.keys().forEach(groupName => {
groups.push({
id: groupName,
children: routeGroups.get(groupName) ?? [],
@@ -633,7 +630,7 @@ export function getModel(files: IntegrationFile[], showGroups: boolean,
// children: externalGroups.get(groupName) ?? [],
// type: 'group',
// group: true,
- // label: '',
+ //
// style: {
// padding: 20,
// },
diff --git a/karavan-vscode/webview/integration-topology/TopologyBeans.tsx b/karavan-vscode/webview/integration-topology/TopologyBeans.tsx
index 8f2acad3..e5bf40f2 100644
--- a/karavan-vscode/webview/integration-topology/TopologyBeans.tsx
+++ b/karavan-vscode/webview/integration-topology/TopologyBeans.tsx
@@ -17,21 +17,15 @@
import * as React from 'react';
import './TopologyBeans.css';
-import {
- Button,
- Card,
- CardBody,
- CardTitle,
- Label,
-} from "@patternfly/react-core";
-import {TopologyUtils} from "@/core/api/TopologyUtils";
-import {useFilesStore} from "@/api/ProjectStore";
+import {Button, Card, CardBody, CardTitle, Label,} from "@patternfly/react-core";
+import {TopologyUtils} from "@karavan-core/api/TopologyUtils";
+import {useFilesStore} from "@stores/ProjectStore";
import {shallow} from "zustand/shallow";
-import {IntegrationFile} from "@/core/model/IntegrationDefinition";
+import {IntegrationFile} from "@karavan-core/model/IntegrationDefinition";
import {getIntegrations} from "./TopologyApi";
import JavaIcon from "@patternfly/react-icons/dist/js/icons/java-icon";
import {useTopologyHook} from "./useTopologyHook";
-import {camelIcon, CamelUi} from "@/integration-designer/utils/CamelUi";
+import {camelIcon, CamelUi} from "@features/project/designer/utils/CamelUi";
export function TopologyBeans() {
diff --git a/karavan-vscode/webview/integration-topology/TopologyElkLayout.ts b/karavan-vscode/webview/integration-topology/TopologyElkLayout.ts
new file mode 100644
index 00000000..972d3a0e
--- /dev/null
+++ b/karavan-vscode/webview/integration-topology/TopologyElkLayout.ts
@@ -0,0 +1,222 @@
+import {BaseLayout, Graph, GRAPH_LAYOUT_END_EVENT, Layout, LayoutOptions, Node} from '@patternfly/react-topology';
+import ELK, {ElkExtendedEdge, ElkNode} from 'elkjs/lib/elk.bundled';
+import Point from "@patternfly/react-topology/src/geom/Point";
+import Dimensions from "@patternfly/react-topology/src/geom/Dimensions";
+
+// --- CONFIGURATION ---
+const getRootOptions = (): any => {
+ return {
+ 'elk.algorithm': 'layered',
+ 'elk.direction': 'DOWN',
+ "elk.edgeRouting" : "ORTHOGONAL",
+ "elk.separateConnectedComponents": "true",
+ 'elk.spacing.nodeNode': '75',
+ 'elk.spacing.edgeNode': '75',
+ 'elk.portConstraints': 'FREE',
+ "elk.hierarchyHandling": "INCLUDE_CHILDREN",
+
+ "elk.layered.thoroughness": "100",
+ 'elk.layered.nodePlacement.bk.fixedAlignment': 'BALANCED',
+ 'elk.layered.unnecessaryBendpoints': 'false',
+ 'elk.layered.spacing.edgeEdgeBetweenLayers': '20',
+ // 'elk.layered.layering.strategy': 'NETWORK_SIMPLEX',
+ 'elk.layered.nodePlacement.strategy': 'NETWORK_SIMPLEX',
+ "elk.layered.compaction.postCompaction.strategy": "EDGE_LENGTH",
+ // "elk.layered.crossingMinimization.strategy": "LAYER_SWEEP",
+ // "elk.layered.crossingMinimization.greedySwitch.type": "TWO_SIDED",
+ 'elk.layered.spacing.nodeNodeBetweenLayers': '60',
+ 'elk.layered.spacing.edgeNodeBetweenLayers': '20',
+ 'elk.layered.cycleBreaking.strategy': 'GREEDY',
+ };
+};
+
+const GROUP_OPTIONS = {
+ 'elk.padding': '[top=40,left=40,bottom=40,right=40]',
+ 'elk.portConstraints': 'FREE',
+ "elk.layered.crossingMinimization.strategy": "LAYER_SWEEP",
+ 'elk.layered.layering.strategy': 'NETWORK_SIMPLEX',
+ 'elk.layered.nodePlacement.strategy': 'NETWORK_SIMPLEX',
+};
+
+const NODE_OPTIONS = {
+ 'elk.portConstraints': 'FREE',
+};
+
+const EDGE_OPTIONS = {
+ 'elk.priority': '10',
+ 'elk.layered.priority.direction': '0',
+ 'elk.layered.priority.straightness': '2000',
+ 'elk.edgeRouting': 'ORTHOGONAL',
+};
+
+
+export class TopologyElkLayout extends BaseLayout implements Layout {
+ private elk: InstanceType<typeof ELK>;
+
+ constructor(graph: Graph, options?: Partial<LayoutOptions>) {
+ super(graph, options);
+ this.elk = new ELK();
+ }
+
+ protected startLayout(graph: Graph): void {
+ const elkGraph = this.createElkGraph(graph);
+
+ this.elk.layout(elkGraph)
+ .then((layoutedGraph) => {
+ this.applyLayout(layoutedGraph);
+ // Optional: Update edge bend points if your PF version supports it
+ // this.updateEdgeSegments(layoutedGraph, graph);
+
+ graph.getController().fireEvent(GRAPH_LAYOUT_END_EVENT, { graph });
+ })
+ .catch((err) => console.error('ELK Layout Failed:', err));
+ }
+
+ // --- MAPPING INPUT ---
+
+ private createElkGraph(graph: Graph): ElkNode {
+ return {
+ id: 'root',
+ layoutOptions: getRootOptions(),
+ children: graph.getNodes().map(node => this.mapNodeToElk(node)),
+ edges: this.mapEdgesToElk(graph)
+ };
+ }
+
+ private estimatedLabelWidth(text: string) {
+ // ~7px per char + padding; adjust to your font
+ return Math.min(120, Math.max(20, 64 + text.length * 7));
+ }
+
+ private mapNodeToElk(node: Node): ElkNode {
+ const children = node.getNodes().sort((a, b) => Math.random() - 0.5);
+ const isGroup = node.isGroup();
+ const dims = node.getDimensions();
+
+ const ICON_W = 75; // your circle/icon area
+
+ const label = node.getLabel?.() ?? node.getId(); // however you get label
+ const width = Math.max(ICON_W, this.estimatedLabelWidth(label));
+ const height = Math.max(60, dims.height || 60);
+
+ if (!isGroup) {
+ return {
+ id: node.getId(),
+ width: width,
+ height: height,
+ layoutOptions: NODE_OPTIONS,
+ };
+ } else {
+ return {
+ id: node.getId(),
+ children: children.map(child => this.mapNodeToElk(child)),
+ layoutOptions: GROUP_OPTIONS
+ };
+ }
+ }
+
+ private mapEdgesToElk(graph: Graph): ElkExtendedEdge[] {
+ // We map ALL edges at the root.
+ // Since we use 'INCLUDE_CHILDREN', ELK handles the hierarchy routing automatically.
+ return graph.getEdges().map(edge => {
+ const s = edge.getSource().getId();
+ const t = edge.getTarget().getId();
+ return ({
+ id: edge.getId(),
+ sources: [`${s}`],
+ targets: [`${t}`],
+ layoutOptions: EDGE_OPTIONS,
+ });
+ });
+ }
+
+ // --- APPLYING OUTPUT ---
+
+ private getNode(id: string): Node | undefined {
+ // Helper to find node even if nested deep in groups
+ return this.graph.getNodes().find(n => n.getId() === id)
+ || this.graph.getNodes().flatMap(n => n.getNodes()).find(n => n.getId() === id);
+ }
+
+ private applyLayout(elkNode: ElkNode, parentX = 0, parentY = 0) {
+ if (elkNode.id !== 'root') {
+ const pfNode = this.getNode(elkNode.id);
+ if (pfNode) {
+ // ELK coordinates are relative to parent.
+ // PF usually wants absolute, so we accumulate parent offsets.
+ const absoluteX = (elkNode.x ?? 0) + parentX;
+ const absoluteY = (elkNode.y ?? 0) + parentY;
+
+ pfNode.setPosition(new Point(absoluteX, absoluteY));
+
+ if (pfNode.isGroup() && elkNode.width && elkNode.height) {
+ pfNode.setDimensions(new Dimensions(elkNode.width, elkNode.height));
+ }
+ }
+ }
+
+ // Recurse with current node's absolute position as the new parent offset
+ if (elkNode.children) {
+ const currentX = (elkNode.id === 'root') ? 0 : (elkNode.x ?? 0) + parentX;
+ const currentY = (elkNode.id === 'root') ? 0 : (elkNode.y ?? 0) + parentY;
+
+ elkNode.children.forEach((child) => {
+ this.applyLayout(child, currentX, currentY);
+ });
+ }
+ }
+
+ /**
+ * Optional: ELK calculates complex routes to avoid nodes.
+ * If we don't apply these bend points, the frontend just draws a straight line
+ * between the new node positions, ignoring ELK's hard work.
+ */
+ private updateEdgeSegments(elkNode: ElkNode, graph: Graph) {
+ const allElkEdges: ElkExtendedEdge[] = [];
+ const collectEdges = (node: ElkNode) => {
+ if (node.edges) allElkEdges.push(...node.edges);
+ if (node.children) node.children.forEach(collectEdges);
+ };
+ collectEdges(elkNode);
+
+ allElkEdges.forEach(elkEdge => {
+ const pfEdge = graph.getEdges().find(e => e.getId() === elkEdge.id);
+ if (!pfEdge || !elkEdge.sections || elkEdge.sections.length === 0) return;
+
+ const section = elkEdge.sections[0];
+ const bendPoints = section.bendPoints || [];
+
+ if (bendPoints.length > 0) {
+ // Check if these bendpoints actually create a deviation from a straight line
+ // This prevents "jittery" lines that are 99% straight
+ const start = section.startPoint;
+ const end = section.endPoint;
+
+ const isMeaningful = bendPoints.some(bp => {
+ const distToStraightLine = this.pointToLineDistance(bp, start, end);
+ return distToStraightLine > 2; // Threshold in pixels
+ });
+
+ if (isMeaningful) {
+ // Map ELK points to PatternFly Points
+ const bends = bendPoints.map(bp => new Point(bp.x, bp.y));
+ pfEdge.setBendpoints(bends);
+ } else {
+ pfEdge.setBendpoints([]);
+ }
+ } else {
+ pfEdge.setBendpoints([]);
+ }
+ });
+ }
+
+// Helper to detect if a bendpoint is just a point on a straight line
+ private pointToLineDistance(p: {x: number, y: number}, a: {x: number, y: number}, b: {x: number, y: number}) {
+ const numerator = Math.abs((b.y - a.y) * p.x - (b.x - a.x) * p.y + b.x * a.y - b.y * a.x);
+ const denominator = Math.sqrt(Math.pow(b.y - a.y, 2) + Math.pow(b.x - a.x, 2));
+ return denominator === 0 ? 0 : numerator / denominator;
+ }
+
+ protected updateLayout(): void {}
+ protected stopSimulation(): void {}
+}
\ No newline at end of file
diff --git a/karavan-vscode/webview/integration-topology/TopologyLegend.tsx b/karavan-vscode/webview/integration-topology/TopologyLegend.tsx
index 319a4793..eaaaccb3 100644
--- a/karavan-vscode/webview/integration-topology/TopologyLegend.tsx
+++ b/karavan-vscode/webview/integration-topology/TopologyLegend.tsx
@@ -17,13 +17,8 @@
import * as React from 'react';
import './TopologyLegend.css';
-import {
- Card,
- CardBody,
- CardTitle,
- Label,
-} from "@patternfly/react-core";
-import {getDesignerIcon, OpenApiIcon} from "@/integration-designer/icons/KaravanIcons";
+import {Card, CardBody, CardTitle, Label,} from "@patternfly/react-core";
+import {getDesignerIcon, OpenApiIcon} from "@features/project/designer/icons/KaravanIcons";
export function TopologyLegend () {
@@ -32,7 +27,7 @@ export function TopologyLegend () {
<CardTitle>Legend</CardTitle>
<CardBody className='card-body'>
<Label className='orange' icon={<div style={{display: 'flex'}}>{getDesignerIcon('route')}</div>}>Route</Label>
- <Label className='orange' icon={<div style={{display: 'flex', gap: '6px'}}>{OpenApiIcon()}</div>}>OpenAPI</Label>
+ <Label className='orange' icon={<div style={{display: 'flex', gap: '6px'}}><OpenApiIcon/></div>}>OpenAPI</Label>
<Label className='orange' icon={<div style={{display: 'flex'}}>{getDesignerIcon('rest')}</div>}>REST</Label>
<Label className='orange route-template'>Route Template</Label>
<Label className='blue'>Component</Label>
diff --git a/karavan-vscode/webview/integration-topology/TopologyStore.ts b/karavan-vscode/webview/integration-topology/TopologyStore.ts
deleted file mode 100644
index 1ab486bd..00000000
--- a/karavan-vscode/webview/integration-topology/TopologyStore.ts
+++ /dev/null
@@ -1,168 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-import {ErrorEventBus} from "@/api/ErrorEventBus";
-import {ProjectFile} from "@/api/ProjectModels";
-import {useFilesStore, useProjectStore} from "@/api/ProjectStore";
-import {createWithEqualityFn} from "zustand/traditional";
-
-type Position = { x: number; y: number };
-type ModelMap = Map<string, Position>;
-export type LayoutManager = 'auto' | 'manual'
-const SAVE_DEBOUNCE_MS = 500;
-
-function debounce<F extends (...args: any[]) => any>(func: F, waitFor: number) {
- let timeout: ReturnType<typeof setTimeout> | null = null;
-
- const debounced = (...args: Parameters<F>) => {
- if (timeout !== null) {
- clearTimeout(timeout);
- }
- timeout = setTimeout(() => func(...args), waitFor);
- };
-
- // Add a cancel method to the debounced function
- debounced.cancel = () => {
- if (timeout !== null) {
- clearTimeout(timeout);
- }
- };
-
- return debounced;
-}
-
-interface TopologyState {
- fileName?: string
- setFileName: (fileName?: string) => void
- modelMap: ModelMap;
- setModelMap: (modelMap: ModelMap) => Promise<void>;
- setNodePosition: (id: string, position: Position) => void;
- saveNow: () => void; // Expose a way to save immediately if needed
- showGroups: boolean
- setShowGroups: (showGroups: boolean) => void
- straightEdges: boolean
- setStraightEdges: (straightEdges: boolean) => void
- showBeans: boolean
- setShowBeans: (showBeans: boolean) => void
- showLegend: boolean
- setShowLegend: (showLegend: boolean) => void
- layout: LayoutManager
- setLayout: (layout: LayoutManager) => void
-}
-
-export const useTopologyStore = createWithEqualityFn<TopologyState>((set, get) => {
-
- const saveTopologyApi = (mapToSave: ModelMap): Promise<void> => {
- return new Promise((resolve, reject) => {
- const projectId = useProjectStore.getState().project.projectId;
- const files = useFilesStore.getState().files;
- let file = files.find(f => f.name === 'topology.json');
-
- const obj = Object.fromEntries(mapToSave.entries());
- const code = JSON.stringify(obj, null, 2);
-
- const onSuccess = (newFile: ProjectFile) => {
- // useFilesStore.getState().upsertFile(newFile);
- resolve();
- };
-
- const onError = (errorData: any) => {
- ErrorEventBus.sendApiError(errorData);
- reject(new Error("Failed to save topology file."));
- };
-
- });
- };
-
- const debouncedSave = debounce(() => {
- const currentMap = get().modelMap;
- if (currentMap.size > 0) {
- saveTopologyApi(currentMap);
- }
- }, SAVE_DEBOUNCE_MS);
-
-
- return {
- setFileName: (fileName?: string) => {
- set((state: TopologyState) => {
- return {fileName: fileName};
- });
- },
- modelMap: new Map<string, Position>(),
- setModelMap: async (newModelMap: ModelMap) => {
- set({ modelMap: newModelMap });
- try {
- if (get().layout === 'manual') {
- await saveTopologyApi(newModelMap);
- }
- } catch (error) {
- // Optional: Handle error, e.g., show a notification or revert state
- console.error("Failed to save the new model map.", error);
- }
- },
-
- setNodePosition: (id: string, position: Position) => {
- // Update state immutably for predictable re-renders
- const newModelMap = new Map(get().modelMap);
- newModelMap.set(id, position);
- set({ modelMap: newModelMap });
-
- // Trigger the debounced save
- if (get().layout === 'manual') {
- debouncedSave();
- }
- },
-
- saveNow: () => {
- // You might want to cancel any pending debounced calls first if your debounce lib supports it.
- debouncedSave.cancel(); // Cancel any pending debounced save
- const currentMap = get().modelMap;
- if(currentMap.size > 0) {
- saveTopologyApi(currentMap);
- }
- },
-
- showGroups: false,
- setShowGroups: (showGroups: boolean) => {
- set({showGroups: showGroups});
- },
- straightEdges: true,
- setStraightEdges: (straightEdges: boolean) => {
- set((state: TopologyState) => {
- return {straightEdges: straightEdges};
- });
- },
- showBeans: false,
- setShowBeans: (showBeans: boolean) => {
- set((state: TopologyState) => {
- return {showBeans: showBeans};
- });
- },
- showLegend: false,
- setShowLegend: (showLegend: boolean) => {
- set((state: TopologyState) => {
- return {showLegend: showLegend};
- });
- },
- layout: 'auto',
- setLayout: (layout: LayoutManager) => {
- set((state: TopologyState) => {
- return {layout: layout};
- });
- }
- }
-});
diff --git a/karavan-vscode/webview/integration-topology/TopologyTab.tsx b/karavan-vscode/webview/integration-topology/TopologyTab.tsx
index fcb659bf..9d100619 100644
--- a/karavan-vscode/webview/integration-topology/TopologyTab.tsx
+++ b/karavan-vscode/webview/integration-topology/TopologyTab.tsx
@@ -33,37 +33,38 @@ import {
VisualizationProvider,
VisualizationSurface,
} from '@patternfly/react-topology';
-import {getCustomComponentFactory} from "./CustomComponentFactory";
+import {getCustomComponentFactory} from "@features/project/project-topology/CustomComponentFactory";
import {shallow} from "zustand/shallow";
-import {useTopologyStore} from "./TopologyStore";
-import {useDesignerStore} from "@/integration-designer/DesignerStore";
-import {IntegrationFile} from "@/core/model/IntegrationDefinition";
-import {TopologyBeans} from "./TopologyBeans";
-import {getModel} from "./TopologyApi";
-import {useTopologyHook} from "./useTopologyHook";
-import {TopologyLegend} from "./TopologyLegend";
-import {ModalConfirmation, ModalConfirmationProps} from "@/components/ModalConfirmation";
+import {useTopologyStore} from "@stores/TopologyStore";
+import {useDesignerStore} from "@features/project/designer/DesignerStore";
+import {IntegrationFile} from "@karavan-core/model/IntegrationDefinition";
+import {TopologyBeans} from "@features/project/project-topology/TopologyBeans";
+import {getModel} from "@features/project/project-topology/TopologyApi";
+import {useTopologyHook} from "@features/project/project-topology/useTopologyHook";
+import {TopologyLegend} from "@features/project/project-topology/TopologyLegend";
+import {ModalConfirmation, ModalConfirmationProps} from "@shared/ui/ModalConfirmation";
import {EyeIcon, EyeSlashIcon} from '@patternfly/react-icons';
-import {ArrowDown, GroupObjects, JumpLink, UngroupObjects} from '@carbon/icons-react';
+import {ArrayNumbers, GroupObjects, UngroupObjects} from '@carbon/icons-react';
+import {useFilesStore, useProjectStore} from "@stores/ProjectStore";
import {NODE_POSITIONED_EVENT} from "@patternfly/react-topology/src/types";
-import {TopologyDagreLayout} from "@/integration-topology/graph/TopologyDagreLayout";
-import {ASYNCAPI_FILE_NAME_JSON, OPENAPI_FILE_NAME_JSON} from "@/core/contants";
+import {OPENAPI_FILE_NAME_JSON} from "@karavan-core/contants";
+import {runInAction} from "mobx";
+import {TopologyToolbar} from "@features/project/project-topology/TopologyToolbar";
+import {TopologyElkLayout} from "@features/project/project-topology/TopologyElkLayout";
interface Props {
- files: IntegrationFile[],
- openApiJson?: string
asyncApiJson?: string
- hideToolbar: boolean,
}
export function TopologyTab(props: Props) {
- const { files, hideToolbar } = props;
- const [modelMap, setModelMap, setFileName, layout, showGroups, setShowGroups,
- showBeans, setShowBeans, showLegend, setShowLegend, straightEdges, setStraightEdges] = useTopologyStore((s) =>
- [s.modelMap, s.setModelMap, s.setFileName, s.layout, s.showGroups, s.setShowGroups,
- s.showBeans, s.setShowBeans, s.showLegend, s.setShowLegend, s.straightEdges, s.setStraightEdges]);
+ const {asyncApiJson } = props;
+ const [setFileName, showGroups, setShowGroups, showBeans, setShowBeans, showLegend, setShowLegend]
+ = useTopologyStore((s) => [s.setFileName, s.showGroups, s.setShowGroups, s.showBeans, s.setShowBeans, s.showLegend, s.setShowLegend]);
+ const [showStats, setShowStats] = useTopologyStore((s) => [s.showStats, s.setShowStats]);
const [setSelectedStep] = useDesignerStore((s) => [s.setSelectedStep], shallow)
+ const [files] = useFilesStore((s) => [s.files], shallow);
+ const [project] = useProjectStore((s) => [s.project], shallow);
const [confirmationProps, setConfirmationProps] = useState<ModalConfirmationProps>();
const {selectFile, setDisabled, deleteRoute, setRouteGroup} = useTopologyHook(setConfirmationProps);
@@ -71,11 +72,8 @@ export function TopologyTab(props: Props) {
.filter(f => f.name.endsWith('.camel.yaml'))
// .filter(f => search === '' || filedFound.includes(f.name))
.map(f => new IntegrationFile(f.name, f.code));
- const codes = files.map(f => f.code).join("");
const openApiFile = files.filter(f => f.name === OPENAPI_FILE_NAME_JSON)?.at(0);
const openApiJson = openApiFile?.code;
- const asyncApiFile = files.filter(f => f.name === ASYNCAPI_FILE_NAME_JSON)?.at(0);
- const asyncApiJson = asyncApiFile?.code;
function setTopologySelected(model: Model, ids: string []) {
if (ids.length > 0) {
@@ -94,11 +92,12 @@ export function TopologyTab(props: Props) {
}
const customLayoutFactory: LayoutFactory = (type: string, graph: Graph): Layout => {
- return new TopologyDagreLayout(graph, {}, straightEdges);
+ // return new TopologyDagreLayout(graph, {}, straightEdges);
+ return new TopologyElkLayout(graph, {});
};
const controller = React.useMemo(() => {
- const model = getModel(camelFiles, showGroups, selectFile, setDisabled, deleteRoute, setRouteGroup, openApiJson, asyncApiJson);
+ const model = getModel(project.projectId, camelFiles, showGroups, selectFile, setDisabled, deleteRoute, setRouteGroup, openApiJson, asyncApiJson, showStats);
const controller = new Visualization();
controller.registerLayoutFactory((type, graph) => customLayoutFactory(type, graph));
@@ -106,21 +105,15 @@ export function TopologyTab(props: Props) {
controller.addEventListener(SELECTION_EVENT, args => setTopologySelected(model, args));
controller.addEventListener(GRAPH_LAYOUT_END_EVENT, () => {
- controller.getGraph().fit(80);
+ runInAction(() => {
+ controller.getGraph().fit(90);
+ });
});
controller.addEventListener(NODE_POSITIONED_EVENT, (args: any) => {
});
controller.fromModel(model, false);
return controller;
- }, [files, showGroups, straightEdges, layout]);
-
- function saveModelMap(graph: Graph) {
- const newModelMap: Map<string, { x: number, y: number }> = new Map();
- graph.getNodes().forEach((node: any) => {
- newModelMap.set(node.getId(), {x: node.position?.x, y: node.position?.y})
- });
- setModelMap(newModelMap);
- }
+ }, [files, showGroups, asyncApiJson, showStats]);
function getButtonTitle(title: string, icon: React.ReactNode) {
return (
@@ -153,36 +146,31 @@ export function TopologyTab(props: Props) {
controller.getGraph().layout();
}),
customButtons: [
- {
- id: 'straightEdges',
- icon: straightEdges ? getButtonTitle('Edges', <ArrowDown className='carbon'/> ) : getButtonTitle('Edges', <JumpLink className='carbon'/>),
- tooltip: 'Switch Straight/Right-Angle Edges',
- callback: id => setStraightEdges(!straightEdges)
- },
{
id: 'showGroups',
icon: showGroups ? getButtonTitle('Grouped', <GroupObjects className='carbon'/> ) : getButtonTitle('Ungrouped', <UngroupObjects className='carbon'/>) ,
tooltip: 'Switch Ungrouped/Grouped',
callback: id => setShowGroups(!showGroups)
},
- // {
- // id: 'layout',
- // icon: layout === 'manual' ? getButtonTitle('Manual', <HandPointUpIcon/>) : getButtonTitle('Auto', <RobotIcon/>),
- // tooltip: 'Switch Auto/Manual Layout',
- // callback: id => setLayout(layout === 'auto' ? 'manual' : 'auto')
- // },
{
id: 'showBeans',
icon: showBeans ? getButtonTitle('Beans', <EyeIcon/>) : getButtonTitle('Beans', <EyeSlashIcon/>),
tooltip: 'Show/Hide Beans',
callback: id => setShowBeans(!showBeans)
+ },
+ {
+ id: "stats",
+ icon: <ArrayNumbers className='carbon'/>,
+ tooltip: showStats ? "Hide stats" : "Show stats",
+ callback: (id: any) => setShowStats(!showStats),
}
],
});
- }, [controller, showLegend, showBeans, straightEdges, showGroups, layout]);
+ }, [controller, showLegend, showBeans, showGroups]);
return (
<>
+ <TopologyToolbar/>
<TopologyView
className="topology-panel"
controlBar={
diff --git a/karavan-vscode/webview/integration-topology/TopologyToolbar.tsx b/karavan-vscode/webview/integration-topology/TopologyToolbar.tsx
new file mode 100644
index 00000000..ead29fef
--- /dev/null
+++ b/karavan-vscode/webview/integration-topology/TopologyToolbar.tsx
@@ -0,0 +1,102 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import * as React from 'react';
+import {MouseEventHandler, ReactElement} from 'react';
+import {Button} from '@patternfly/react-core';
+import {shallow} from "zustand/shallow";
+import {useAppConfigStore} from '@stores/ProjectStore';
+import {useTopologyHook} from '@features/project/project-topology/useTopologyHook';
+import {useRouteDesignerHook} from "@features/project/designer/route/useRouteDesignerHook";
+import {APPLICATION_PROPERTIES, DOCKER_COMPOSE, DOCKER_STACK} from "@models/ProjectModels";
+import {ProjectTitle} from "@features/project/ProjectTitle";
+import {useProjectFunctions} from "@features/project/ProjectContext";
+import {AddLarge} from "@carbon/icons-react";
+
+export function TopologyToolbar() {
+
+ const [config] = useAppConfigStore((s) => [s.config], shallow);
+ const isDev = config.environment === 'dev';
+
+ const {
+ createNewBean,
+ createRouteConfiguration,
+ createOpenApi,
+ createNewKamelet,
+ project
+ } = useProjectFunctions();
+ const {openSelector} = useRouteDesignerHook();
+
+ const {selectFile} = useTopologyHook();
+
+ function getInfraButton(): ReactElement {
+ const isKubernetes = config.infrastructure === 'kubernetes';
+ const swarmMode = config.swarmMode;
+ const fileName = isKubernetes
+ ? 'deployment.jkube.yaml'
+ : (swarmMode ? DOCKER_STACK : DOCKER_COMPOSE);
+
+ return (
+ <div>
+ <Button variant={"tertiary"}
+ className='bean-button'
+ // icon={<OutlinedFileAltIcon/>}
+ onClick={() => {
+ selectFile(fileName)
+ }}
+ >
+ {isKubernetes ? "Deployment" : "Compose"}
+ </Button>
+ </div>
+ )
+ }
+
+ function getButton(caption: string,
+ variant?: 'primary' | 'secondary' | 'tertiary' | 'danger' | 'warning' | 'link' | 'plain' | 'control' | 'stateful',
+ icon?: ReactElement,
+ onClick?: MouseEventHandler<any> | undefined): ReactElement {
+ return (
+ <div>
+ <Button className="dev-action-button "
+ isDisabled={!isDev}
+ icon={icon}
+ variant={variant}
+ onClick={onClick}
+ >
+ {caption}
+ </Button>
+ </div>
+ )
+ }
+
+
+ return (
+ <div className='topology-toolbar'>
+ <div className="group-switch">
+ <ProjectTitle/>
+ </div>
+
+ {getButton("Route", 'primary', <AddLarge className='carbon'/>, event => openSelector(undefined, undefined))}
+ {getButton("Route Configuration", 'secondary', <AddLarge className='carbon'/>, event => createRouteConfiguration())}
+ {getButton("Route Template", 'secondary', <AddLarge className='carbon'/>, event => openSelector(undefined, undefined, true, undefined, true))}
+ {getButton("Kamelet", 'tertiary', <AddLarge className='carbon'/>, event => createNewKamelet())}
+ {getButton("Bean", 'tertiary', <AddLarge className='carbon'/>, event => createNewBean())}
+ {getButton("Properties", 'tertiary', undefined, event => selectFile(APPLICATION_PROPERTIES))}
+ {getInfraButton()}
+ </div>
+ )
+}
\ No newline at end of file
diff --git a/karavan-vscode/webview/integration-topology/graph/TopologyDagreLayout.ts b/karavan-vscode/webview/integration-topology/graph/TopologyDagreLayout.ts
deleted file mode 100644
index a34dc751..00000000
--- a/karavan-vscode/webview/integration-topology/graph/TopologyDagreLayout.ts
+++ /dev/null
@@ -1,98 +0,0 @@
-import {BaseLayout, Edge, Graph, GRAPH_LAYOUT_END_EVENT, Layout, LAYOUT_DEFAULTS, LayoutLink, LayoutNode, Node} from "@patternfly/react-topology";
-import {LayoutOptions} from "@patternfly/react-topology/src/layouts/LayoutOptions";
-import dagre from "@dagrejs/dagre";
-import {DagreNode} from "@patternfly/react-topology/dist/esm/layouts/DagreNode";
-import {LayoutGroup} from "@patternfly/react-topology/dist/esm/layouts/LayoutGroup";
-import {BendpointConfig, TopologyLink} from "@/integration-topology/graph/TopologyLink";
-import {TopologyGroup} from "@/integration-topology/graph/TopologyGroup";
-
-export type DagreLayoutOptions = LayoutOptions & dagre.GraphLabel & { ignoreGroups?: boolean };
-
-export class TopologyDagreLayout extends BaseLayout implements Layout {
-
- protected dagreOptions: DagreLayoutOptions;
- private bendpointConfig: BendpointConfig;
-
- constructor(graph: Graph, options?: Partial<DagreLayoutOptions>, straightEdges?: boolean) {
- super(graph, options);
- this.dagreOptions = {
- ...this.options,
- layoutOnDrag: false,
- marginx: 0,
- marginy: 0,
- rankdir: 'TB',
- ranker: "network-simplex",
- nodesep: 20,
- edgesep: 20,
- ranksep: 10,
- ...options
- };
- this.bendpointConfig = {
- avoidNodes: !straightEdges,
- };
- }
-
- protected createLayoutNode(node: Node, nodeDistance: number, index: number) {
- return new DagreNode(node, nodeDistance, index);
- }
-
- protected createLayoutLink(edge: Edge, source: LayoutNode, target: LayoutNode, isFalse: boolean): LayoutLink {
- return new TopologyLink(edge, source, target, isFalse, this.bendpointConfig);
- }
-
- protected createLayoutGroup(node: Node, padding: number, index: number): LayoutGroup {
- return new TopologyGroup(node, padding, index);
- }
-
- protected updateEdgeBendpoints(edges: TopologyLink[]): void {
- edges.forEach((edge) => {
- const link = edge as TopologyLink;
- link.updateBendpoints(edges);
- });
- }
-
- protected getFauxEdges(): LayoutLink[] {
- return [];
- }
-
- protected startLayout(graph: Graph, initialRun: boolean, addingNodes: boolean): void {
- if (initialRun || addingNodes) {
- const dagreGraph = new dagre.graphlib.Graph({ compound: true });
- const options = { ...this.dagreOptions };
- Object.keys(LAYOUT_DEFAULTS).forEach((key) => delete (options as any)[key]);
- dagreGraph.setGraph(options);
-
- if (!this.dagreOptions.ignoreGroups) {
- this.groups.forEach((group) => {
- dagreGraph.setNode(group.id, group);
- dagreGraph.setParent(group.id, group.element.getParent().getId());
- });
- }
-
- this.nodes?.forEach((node) => {
- const updateNode = (node as DagreNode).getUpdatableNode();
- dagreGraph.setNode(node.id, updateNode);
- if (!this.dagreOptions.ignoreGroups) {
- dagreGraph.setParent(node.id, node.element.getParent().getId());
- }
- });
-
- this.edges?.forEach((dagreEdge) => {
- dagreGraph.setEdge(dagreEdge.source.id, dagreEdge.target.id, dagreEdge);
- });
-
- dagre.layout(dagreGraph);
- this.nodes.forEach((node) => {
- (node as DagreNode).updateToNode(dagreGraph.node(node.id));
- });
-
- this.updateEdgeBendpoints(this.edges as TopologyLink[]);
- }
-
- if (this.dagreOptions.layoutOnDrag) {
- this.forceSimulation.useForceSimulation(this.nodes, this.edges, this.getFixedNodeDistance);
- } else {
- this.graph.getController().fireEvent(GRAPH_LAYOUT_END_EVENT, { graph: this.graph });
- }
- }
-}
diff --git a/karavan-vscode/webview/integration-topology/graph/TopologyGroup.ts b/karavan-vscode/webview/integration-topology/graph/TopologyGroup.ts
deleted file mode 100644
index 5c945fa3..00000000
--- a/karavan-vscode/webview/integration-topology/graph/TopologyGroup.ts
+++ /dev/null
@@ -1,3 +0,0 @@
-import {LayoutGroup} from "@patternfly/react-topology/dist/esm/layouts/LayoutGroup";
-
-export class TopologyGroup extends LayoutGroup {}
\ No newline at end of file
diff --git a/karavan-vscode/webview/integration-topology/graph/TopologyLink.ts b/karavan-vscode/webview/integration-topology/graph/TopologyLink.ts
deleted file mode 100644
index 68de9a23..00000000
--- a/karavan-vscode/webview/integration-topology/graph/TopologyLink.ts
+++ /dev/null
@@ -1,72 +0,0 @@
-import {action, LayoutLink, Point} from "@patternfly/react-topology";
-
-export interface BendpointConfig {
- maxBendpoints?: number;
- avoidNodes?: boolean;
- bendpointSpacing?: number;
-}
-
-export class TopologyLink extends LayoutLink {
- private config: BendpointConfig;
- public points?: { x: number; y: number }[];
-
- constructor(element: any, source: any, target: any, isFalse: boolean, config: BendpointConfig = {}) {
- super(element, source, target, isFalse);
- this.config = {
- maxBendpoints: 8,
- avoidNodes: true,
- bendpointSpacing: 5,
- ...config
- };
- }
-
- updateBendpoints(edges: LayoutLink []): void {
- if (this.points && !this.isFalse && this.points.length > 2) {
- // this.element.setBendpoints(this.points.slice(1, -1).map((point: any) => new Point(point.x, point.y)));
- if (!this.config.avoidNodes) {
- action(() => this.element.setBendpoints([]))();
- return;
- }
- const bendpoints = this.calculateNodeAvoidingBendpoints(edges);
- action(() => this.element.setBendpoints(bendpoints))();
- }
- }
-
- private calculateNodeAvoidingBendpoints(edges: LayoutLink []): Point[] {
- const sourcePoint = this.source.element.getBounds().getCenter();
- const targetPoint = this.target.element.getBounds().getCenter();
-
- // Simple orthogonal routing to avoid nodes
- const bendpoints: Point[] = [];
- const maxBendpoints = this.config.maxBendpoints || 4;
-
- if (maxBendpoints > 0) {
- const dx = targetPoint.x - sourcePoint.x;
- const dy = targetPoint.y - sourcePoint.y;
-
- // Create orthogonal path with up to maxBendpoints
- if (Math.abs(dx) > Math.abs(dy)) {
- // Horizontal-first routing
- const midX = sourcePoint.x + dx * 0.5;
- bendpoints.push(new Point(midX, sourcePoint.y));
- if (maxBendpoints > 1) {
- bendpoints.push(new Point(midX, targetPoint.y));
- }
- } else {
- // Vertical-first routing
- const midY = sourcePoint.y + dy * 0.7;
- bendpoints.push(new Point(sourcePoint.x, midY));
- if (maxBendpoints > 1) {
- bendpoints.push(new Point(targetPoint.x, midY));
- }
- }
- }
-
- return bendpoints;
- }
-
- public setBendpointConfig(config: Partial<BendpointConfig>, edges: LayoutLink []): void {
- this.config = { ...this.config, ...config };
- this.updateBendpoints(edges);
- }
-}
diff --git a/karavan-vscode/webview/integration-topology/graph/TopologyNode.ts b/karavan-vscode/webview/integration-topology/graph/TopologyNode.ts
deleted file mode 100644
index eb34a252..00000000
--- a/karavan-vscode/webview/integration-topology/graph/TopologyNode.ts
+++ /dev/null
@@ -1,4 +0,0 @@
-import {LayoutNode} from "@patternfly/react-topology";
-
-export class TopologyNode extends LayoutNode {
-}
diff --git a/karavan-vscode/webview/integration-topology/topology.css b/karavan-vscode/webview/integration-topology/topology.css
index 3ab5adba..241b3cf2 100644
--- a/karavan-vscode/webview/integration-topology/topology.css
+++ b/karavan-vscode/webview/integration-topology/topology.css
@@ -1,20 +1,3 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
.karavan .topology-toolbar {
width: 100%;
display: flex;
@@ -23,6 +6,7 @@
gap: 8px;
padding: 8px 16px 8px 16px;
position: relative;
+ text-wrap: nowrap;
}
.karavan .topology-toolbar::before {
@@ -44,12 +28,9 @@
gap: 16px;
}
-.karavan .topology-toolbar .group-switch .pf-v6-c-switch {
- column-gap: 0.4em;
-}
-
-.topology-actions-dropdown {
- /*right: 0 !important;*/
+.karavan .topology-toolbar .dev-action-button {
+ padding-left: 12px;
+ padding-right: 12px;
}
.karavan .topology-panel .pf-topology-control-bar {
@@ -69,6 +50,18 @@
.karavan .topology-panel .common-node {
cursor: pointer;
+ .validation-icon {
+ height: 21px;
+ width: 21px;
+ }
+ .validation-icon-danger {
+ color: var(--pf-t--global--icon--color--status--danger--default);
+ fill: var(--pf-t--global--icon--color--status--danger--default);
+ }
+ .validation-icon-pending {
+ fill: var(--pf-t--global--color--brand--default);
+ color: var(--pf-t--global--color--brand--default);
+ }
}
.karavan .topology-panel .common-node .icon {
@@ -128,16 +121,27 @@
border-radius: 9px;
}
+.karavan .topology-panel .gen-route-decorator {
+ background-color: red;
+ circle {
+ stroke: var(--pf-t--global--icon--color--status--warning--default);
+ }
+ svg {
+ fill: var(--pf-t--global--icon--color--status--warning--default);
+ transform: translate(1px, -1px);
+ }
+}
+
.pf-topology__group__label .pf-topology__node__label__background {
fill: grey;
}
.pf-topology__node.topology-color-component {
- --pf-topology__node__label__background--Stroke: #2b9af3;
+ --pf-topology__node__label__background--Stroke: var(--pf-t--global--color--brand--100);
}
.pf-topology__node.topology-color-component .pf-topology__node__background {
- --pf-topology__node__background--Stroke: #2b9af3;
+ --pf-topology__node__background--Stroke: var(--pf-t--global--color--brand--100);
}
.pf-topology__node.topology-color-kamelet {
@@ -148,12 +152,13 @@
--pf-topology__node__background--Stroke: #6ec664;
}
-.pf-topology__node.topology-color-route {
- --pf-topology__node__label__background--Stroke: #ef9234;
-}
-
-.pf-topology__node.topology-color-route .pf-topology__node__background {
- --pf-topology__node__background--Stroke: #ef9234;
+.pf-topology__node.topology-color-gen-route {
+ .pf-topology__node__background {
+ --pf-topology__node__background--Stroke: #ef9234;
+ }
+ .icon-wrapper svg {
+ fill: #ef9234;
+ }
}
.pf-topology__edge {
diff --git a/karavan-vscode/webview/integration-topology/useTopologyHook.tsx b/karavan-vscode/webview/integration-topology/useTopologyHook.tsx
index a2f0f05e..fa4a34b2 100644
--- a/karavan-vscode/webview/integration-topology/useTopologyHook.tsx
+++ b/karavan-vscode/webview/integration-topology/useTopologyHook.tsx
@@ -16,23 +16,26 @@
*/
import React from "react";
import {shallow} from "zustand/shallow";
-import {useFilesStore, useFileStore, useProjectStore} from "@/api/ProjectStore";
-import {EventBus} from "@/integration-designer/utils/EventBus";
-import {CamelDefinitionYaml} from "@/core/api/CamelDefinitionYaml";
-import {CamelDefinitionApiExt} from "@/core/api/CamelDefinitionApiExt";
-import {RouteDefinition} from "@/core/model/CamelDefinition";
-import {ModalConfirmationProps} from "@/components/ModalConfirmation";
-import vscode from "../vscode";
+import {useFilesStore, useFileStore, useProjectStore} from "@stores/ProjectStore";
+import {EventBus} from "@features/project/designer/utils/EventBus";
+import {CamelDefinitionYaml} from "@karavan-core/api/CamelDefinitionYaml";
+import {CamelDefinitionApiExt} from "@karavan-core/api/CamelDefinitionApiExt";
+import {RouteDefinition} from "@karavan-core/model/CamelDefinition";
+import {ProjectService} from "@services/ProjectService";
+import {ModalConfirmationProps} from "@shared/ui/ModalConfirmation";
export function useTopologyHook(setConfirmationProps?: React.Dispatch<React.SetStateAction<ModalConfirmationProps | undefined>>) {
const [setFile] = useFileStore((s) => [s.setFile], shallow);
const [files] = useFilesStore((s) => [s.files], shallow);
- const [setTabIndex] = useProjectStore((s) => [s.setTabIndex], shallow);
+ const [setTabIndex, project] = useProjectStore((s) => [s.setTabIndex, s.project], shallow);
function selectFile(fileName: string) {
- console.log(fileName)
- vscode.postMessage({ command: 'openFile', fileName: fileName })
+ const file = files.filter(f => f.name === fileName)?.at(0);
+ if (file) {
+ setFile('select', file);
+ setTabIndex(0);
+ }
}
function setDisabled(fileName: string, elementId: string, enable: boolean) {
@@ -49,6 +52,7 @@ export function useTopologyHook(setConfirmationProps?: React.Dispatch<React.SetS
}
const newIntegration = CamelDefinitionApiExt.updateIntegrationRouteElement(integration, element);
file.code = CamelDefinitionYaml.integrationToYaml(newIntegration);
+ ProjectService.updateFile(file, true);
}
}
@@ -65,8 +69,12 @@ export function useTopologyHook(setConfirmationProps?: React.Dispatch<React.SetS
const newIntegration = CamelDefinitionApiExt.deleteRouteFromIntegration(integration, routeId);
const isEmpty = newIntegration?.spec.flows?.length === 0 && newIntegration?.spec.template === undefined;
const propsClose: ModalConfirmationProps = {
- isOpen: false, title: '', message: '', onConfirm: () => {
- }, onCancel: () => {
+ isOpen: false,
+ title: '',
+ message: '',
+ onConfirm: () => {
+ },
+ onCancel: () => {
}
};
const props: ModalConfirmationProps = {
@@ -75,7 +83,13 @@ export function useTopologyHook(setConfirmationProps?: React.Dispatch<React.SetS
btnConfirmVariant: 'danger',
message: `Delete route ${isEmpty ? ' and file ' + fileName : ''}`,
onConfirm: () => {
-
+ if (isEmpty) {
+ ProjectService.deleteFile(file);
+ } else {
+ file.code = CamelDefinitionYaml.integrationToYaml(newIntegration);
+ ProjectService.updateFile(file, true);
+ }
+ setConfirmationProps?.(propsClose)
},
onCancel: () => setConfirmationProps?.(propsClose)
};
@@ -99,6 +113,7 @@ export function useTopologyHook(setConfirmationProps?: React.Dispatch<React.SetS
}
const newIntegration = CamelDefinitionApiExt.updateIntegrationRouteElement(integration, element);
file.code = CamelDefinitionYaml.integrationToYaml(newIntegration);
+ ProjectService.updateFile(file, true);
}
}
@@ -108,6 +123,6 @@ export function useTopologyHook(setConfirmationProps?: React.Dispatch<React.SetS
}
return {
- selectFile, setDisabled, deleteRoute, setRouteGroup
+ selectFile, setDisabled, deleteRoute, setRouteGroup, project
}
}
\ No newline at end of file