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 fd66d7973842102217e4e670aedb3a164caa3839
Author: Marat Gubaidullin <[email protected]>
AuthorDate: Sun Mar 1 13:32:26 2026 -0500

    Fix Topology in VsCode for 4.18.0
---
 karavan-vscode/package.json                        | 34 -----------
 karavan-vscode/src/designerView.ts                 | 24 ++------
 karavan-vscode/src/helpView.ts                     | 12 +---
 karavan-vscode/src/utils.ts                        | 50 ++--------------
 karavan-vscode/webview/App.tsx                     | 69 ++++++----------------
 .../karavan-core/model/TopologyDefinition.ts       |  4 +-
 .../project/project-topology/GetCustomMenu.tsx     | 38 +-----------
 .../project/project-topology/TopologyApi.tsx       | 12 ++--
 .../project/project-topology/TopologyTab.tsx       | 13 +---
 .../project/project-topology/useTopologyHook.tsx   | 21 ++-----
 .../webview/karavan/stores/TopologyStore.ts        |  8 ---
 11 files changed, 48 insertions(+), 237 deletions(-)

diff --git a/karavan-vscode/package.json b/karavan-vscode/package.json
index 68b64b83..10ba4372 100644
--- a/karavan-vscode/package.json
+++ b/karavan-vscode/package.json
@@ -126,34 +126,6 @@
           "scope": "machine",
           "order": 60
         },
-        "Karavan.supportedComponents": {
-          "type": "string",
-          "default": "",
-          "description": "Supported Components (*.json)",
-          "scope": "machine",
-          "order": 61
-        },
-        "Karavan.supportedDataformats": {
-          "type": "string",
-          "default": "",
-          "description": "Supported Dataformats (*.json)",
-          "scope": "machine",
-          "order": 62
-        },
-        "Karavan.supportedLanguages": {
-          "type": "string",
-          "default": "",
-          "description": "Supported Expression Languages (*.json)",
-          "scope": "machine",
-          "order": 62
-        },
-        "Karavan.supportedOnly": {
-          "type": "boolean",
-          "default": false,
-          "description": "Show Supported Only",
-          "scope": "machine",
-          "order": 64
-        },
         "Karavan.kameletsPath": {
           "type": "string",
           "default": "",
@@ -454,12 +426,6 @@
           "description": "application.properties template for camel-main on 
Kubernetes",
           "scope": "machine",
           "order": 95
-        },
-        "Karavan.blockingComponentsPath": {
-          "type": "string",
-          "description": "Blocked kamelets/components Path",
-          "scope": "machine",
-          "order": 96
         }
       }
     },
diff --git a/karavan-vscode/src/designerView.ts 
b/karavan-vscode/src/designerView.ts
index d9c34f30..4bac27c5 100644
--- a/karavan-vscode/src/designerView.ts
+++ b/karavan-vscode/src/designerView.ts
@@ -14,13 +14,13 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-import { Uri, window, commands, WebviewPanel, ExtensionContext, ViewColumn, 
WebviewPanelOnDidChangeViewStateEvent } from "vscode";
+import {commands, ExtensionContext, Uri, ViewColumn, WebviewPanel, 
WebviewPanelOnDidChangeViewStateEvent, window} from "vscode";
 import * as path from "path";
 import * as utils from "./utils";
-import { CamelDefinitionYaml } from "@karavan-core/api/CamelDefinitionYaml";
-import { Integration, KameletTypes, Metadata, MetadataLabels } from 
"@karavan-core/model/IntegrationDefinition";
-import { getWebviewContent } from "./webviewContent";
-import { BeanFactoryDefinition } from "@karavan-core/model/CamelDefinition";
+import {CamelDefinitionYaml} from "@karavan-core/api/CamelDefinitionYaml";
+import {Integration, KameletTypes, MetadataLabels} from 
"@karavan-core/model/IntegrationDefinition";
+import {getWebviewContent} from "./webviewContent";
+import {BeanFactoryDefinition} from "@karavan-core/model/CamelDefinition";
 
 const KARAVAN_LOADED = "karavan:loaded";
 const KARAVAN_PANELS: Map<string, WebviewPanel> = new Map<string, 
WebviewPanel>();
@@ -182,15 +182,10 @@ export class DesignerView {
             utils.readTemplates(this.context),
             // Read java classes
             utils.readJavaCode(fullPath),
-            // Read supported components
-            utils.readSupportedComponents(),
-            utils.readSupportedOnlySettings(),
             // Read property placeholders
             utils.readPropertyPlaceholders(this.context),
             // Read beans
             utils.readBeans(fullPath),
-            //Read BlockList
-            utils.readBlockTemplates(this.context),
             // // Read integration
             // utils.readCamelYamlFiles(path.dirname(fullPath))
         ]).then(results => {
@@ -202,14 +197,7 @@ export class DesignerView {
             panel.webview.postMessage({ command: 'templates', templates: 
Object.fromEntries(results[2]) });
             // Send java code
             panel.webview.postMessage({ command: 'javaCode', javaCode: 
Object.fromEntries(results[3]) });
-            // Send supported components
-            if (results[4]) panel.webview.postMessage({ command: 
'supportedComponents', components: results[4] });
-            if (results[5] === true) panel.webview.postMessage({ command: 
'supportedOnly' });
-            // Send integration
-            // panel.webview.postMessage({ command: 'files', files: results[8] 
});
-            this.sendIntegrationData(panel, filename, relativePath, fullPath, 
reread, yaml, tab, results[6], results[7]);
-            // Send block list
-            panel.webview.postMessage({ command: 'blockList', blockList: 
Object.fromEntries(results[8]) });
+            this.sendIntegrationData(panel, filename, relativePath, fullPath, 
reread, yaml, tab, results[4], results[5]);
 
         }).catch(err => console.log(err));
     }
diff --git a/karavan-vscode/src/helpView.ts b/karavan-vscode/src/helpView.ts
index 2bc365f8..04318413 100644
--- a/karavan-vscode/src/helpView.ts
+++ b/karavan-vscode/src/helpView.ts
@@ -16,8 +16,7 @@
  */
 import * as vscode from "vscode";
 import * as utils from "./utils";
-import { ThemeIcon } from "vscode";
-import { getWebviewContent } from "./webviewContent";
+import {getWebviewContent} from "./webviewContent";
 
 const KARAVAN_PANELS: Map<string, vscode.WebviewPanel> = new Map<string, 
vscode.WebviewPanel>();
 
@@ -71,10 +70,6 @@ export class HelpView implements 
vscode.TreeDataProvider<HelpItem> {
                                                case 'getData':
                                                        this.sendData(panel, 
page);
                                                        break;
-                                               
-                                               case 'saveBlockedList':
-                                                       
utils.saveBlockList(message.key, message.value);
-                                                       break;
                                        }
                                },
                                undefined,
@@ -106,10 +101,7 @@ export class HelpView implements 
vscode.TreeDataProvider<HelpItem> {
                        utils.readComponents(this.context).then(components => {
                                // Read and send Components
                                panel.webview.postMessage({ command: 
'components', components: components });
-                       }).finally(() => 
{utils.readBlockTemplates(this.context).then(list => {
-                               // Read and send block lists
-                               panel.webview.postMessage({ command: 
'blockList', blockList: Object.fromEntries(list) });
-                       }) }).finally(() => {
+                       }).finally(() => {
                                // Send integration
                                panel.webview.postMessage({ command: 'open', 
page: page });
                        })
diff --git a/karavan-vscode/src/utils.ts b/karavan-vscode/src/utils.ts
index 1c264ddb..9ef93108 100644
--- a/karavan-vscode/src/utils.ts
+++ b/karavan-vscode/src/utils.ts
@@ -15,11 +15,11 @@
  * limitations under the License.
  */
 import * as path from "path";
-import { workspace, Uri, window, ExtensionContext, FileType } from "vscode";
-import { CamelDefinitionYaml } from "@karavan-core/api/CamelDefinitionYaml";
-import { Integration, KameletTypes } from 
"@karavan-core/model/IntegrationDefinition";
-import { BeanFactoryDefinition } from "@karavan-core/model/CamelDefinition";
-import { TopologyUtils } from "@karavan-core/api/TopologyUtils";
+import {ExtensionContext, FileType, Uri, window, workspace} from "vscode";
+import {CamelDefinitionYaml} from "@karavan-core/api/CamelDefinitionYaml";
+import {Integration, KameletTypes} from 
"@karavan-core/model/IntegrationDefinition";
+import {BeanFactoryDefinition} from "@karavan-core/model/CamelDefinition";
+import {TopologyUtils} from "@karavan-core/api/TopologyUtils";
 
 export function getRoot(): string | undefined {
     return (workspace.workspaceFolders && (workspace.workspaceFolders.length > 
0))
@@ -49,20 +49,6 @@ export async function savePropertyPlaceholder(key: string, 
value: string) {
     }
 }
 
-export function saveBlockList(key: string, value: string) {
-    if (workspace.workspaceFolders) {
-        const uriFolder: Uri = workspace.workspaceFolders[0].uri;
-        const blockingComponentsPath: string | undefined = 
workspace.getConfiguration().get("Karavan.blockingComponentsPath");
-        if (blockingComponentsPath && blockingComponentsPath.trim().length > 
0) {
-            const name = key+"s-blocklist.txt";
-            write(path.join(uriFolder.path, blockingComponentsPath+"/"+name), 
value);
-        } else {
-            window.showErrorMessage("Settings path not configured!")
-        }
-    }
-}
-
-
 export function deleteFile(fullPath: string) {
     if (workspace.workspaceFolders) {
         const uriFile: Uri = Uri.file(path.resolve(fullPath));
@@ -98,20 +84,6 @@ async function readBuildInKamelets(context: 
ExtensionContext) {
     return result;
 }
 
-export async function readSupportedComponents() {
-    const supportedComponentsPath: string | undefined = 
workspace.getConfiguration().get("Karavan.supportedComponents");
-    if (supportedComponentsPath && supportedComponentsPath.trim().length > 0) {
-        const filename = path.isAbsolute(supportedComponentsPath) ? 
supportedComponentsPath : path.resolve(supportedComponentsPath);
-        const file = await readFile(filename);
-        return Buffer.from(file).toString('utf8');
-    }
-    return undefined;
-}
-
-export async function readSupportedOnlySettings(): Promise<boolean> {
-    return workspace.getConfiguration().get("Karavan.supportedOnly") || false;
-}
-
 async function readFilesInDirByExtension(dir: string, extension: string): 
Promise<Map<string, string>> {
     const result = new Map<string, string>();
     const dirs: [string, FileType][] = await readDirectory(dir);
@@ -193,18 +165,6 @@ export async function readTemplates(context: 
ExtensionContext) {
     })
     return result;
 }
-export async function readBlockTemplates(context: ExtensionContext) {
-    const result = new Map<string, string>();
-    const blockedListDir: string | undefined = 
workspace.getConfiguration().get("Karavan.blockingComponentsPath");
-    if (blockedListDir && blockedListDir.trim().length > 0) {
-        const files = await readFilesInDirByExtension(blockedListDir, "txt");
-        files.forEach((v, k) => {
-                    result.set(k,v);
-            })
-    }
-    return result;
-}
-
 
 export async function readJavaCode(fullPath: string) {
     const result = new Map<string, string>();
diff --git a/karavan-vscode/webview/App.tsx b/karavan-vscode/webview/App.tsx
index db8f4a2b..6c26a655 100644
--- a/karavan-vscode/webview/App.tsx
+++ b/karavan-vscode/webview/App.tsx
@@ -15,23 +15,21 @@
  * limitations under the License.
  */
 import * as React from "react";
-import {
-  Bullseye,
-  Content,
-  Page, PageSection, Spinner
-} from "@patternfly/react-core";
+import {Bullseye, Content, PageSection, Spinner} from "@patternfly/react-core";
 import vscode from "./vscode";
-import { KameletApi } from "@karavan-core/api/KameletApi";
-import { ComponentApi } from "@karavan-core/api/ComponentApi";
-import { TemplateApi } from "@karavan-core/api/TemplateApi";
-import { BeanFactoryDefinition } from "@karavan-core/model/CamelDefinition";
-import { IntegrationFile } from "@karavan-core/model/IntegrationDefinition";
-import { TopologyTab } from "@features/project/project-topology/TopologyTab";
-import { DocumentationPage } from "@features/documentation/DocumentationPage";
-import { KaravanDesigner } from "@features/project/designer/KaravanDesigner";
-import { EventBus } from "@features/project/designer/utils/EventBus";
+import {KameletApi} from "@karavan-core/api/KameletApi";
+import {ComponentApi} from "@karavan-core/api/ComponentApi";
+import {TemplateApi} from "@karavan-core/api/TemplateApi";
+import {BeanFactoryDefinition} from "@karavan-core/model/CamelDefinition";
+import {IntegrationFile} from "@karavan-core/model/IntegrationDefinition";
+import {TopologyTab} from "@features/project/project-topology/TopologyTab";
+import {DocumentationPage} from "@features/documentation/DocumentationPage";
+import {KaravanDesigner} from "@features/project/designer/KaravanDesigner";
+import {EventBus} from "@features/project/designer/utils/EventBus";
 import {ProjectFunctionHook} from "@app/navigation/ProjectFunctionHook";
 import {ProjectProvider} from "@features/project/ProjectContext";
+import {ProjectFile} from "@models/ProjectModels";
+import {useFilesStore} from "@stores/ProjectStore";
 
 interface Props {
 }
@@ -57,6 +55,8 @@ interface State {
 
 class App extends React.Component<Props, State> {
 
+  setFiles = useFilesStore.getState().setFiles;
+
   public state: State = {
     filename: '',
     relativePath: '',
@@ -93,7 +93,7 @@ class App extends React.Component<Props, State> {
 
   onMessage = (event) => {
     const message = event.data;
-    console.log("message.command", message.command);
+    console.log("message.command", message);
     switch (message.command) {
       case 'kamelets':
         KameletApi.saveCustomKamelets(message.kamelets, true);
@@ -109,17 +109,11 @@ class App extends React.Component<Props, State> {
           return { loadingMessages: prevState.loadingMessages }
         });
         break;
-      case 'supportedComponents':
-        ComponentApi.saveSupportedComponents(message.components);
-        this.setState((prevState: State) => {
-          prevState.loadingMessages.push("Supported Components loaded");
-          return { loadingMessages: prevState.loadingMessages }
-        });
-        break;
-      case 'supportedOnly':
-        ComponentApi.setSupportedOnly(true);
-        break;
       case 'files':
+        const fileNames = message.files ? Object.keys(message.files) : 
[message.files];
+        console.log("fileNames", fileNames);
+        const files = fileNames.map((fileName) => new ProjectFile(fileName, 
'projectId', message.files[fileName], 0));
+        this.setFiles(files);
         this.saveIntegrationFiles(message.files);
         this.setState((prevState: State) => {
           prevState.loadingMessages.push("Integrations loaded");
@@ -169,21 +163,6 @@ class App extends React.Component<Props, State> {
       case 'downloadImage':
         EventBus.sendCommand("downloadImage");
         break;
-      case 'blockList':
-        const blockList = message.blockList;
-        const blockListMap = new Map(Object.keys(blockList).map(key => [key, 
blockList[key]])).forEach((list, key) => {
-          if (key === 'components-blocklist.txt') {
-            ComponentApi.saveBlockedComponentNames(list.split(/\r?\n/));
-          }
-          else if (key === 'kamelets-blocklist.txt') {
-            KameletApi.saveBlockedKameletNames(list.split(/\r?\n/));
-          }
-        });
-        this.setState((prevState: State) => {
-          prevState.loadingMessages.push("block lists loaded");
-          return { loadingMessages: prevState.loadingMessages }
-        });
-        break;
     }
   };
 
@@ -212,16 +191,6 @@ class App extends React.Component<Props, State> {
     this.setState({ files: f });
   }
 
-  onchangeBlockedList(type: string, name: string, checked: boolean) {
-    let fileContent = '';
-    if (type === "component") {
-      fileContent = ComponentApi.saveBlockedComponentName(name, 
checked).join('\n');
-    } else {
-      fileContent = KameletApi.saveBlockedKameletName(name, 
checked).join('\n');
-    }
-    vscode.postMessage({ command: 'saveBlockedList', key: type, value: 
fileContent });
-  }
-
   public render() {
     const { loadingMessages, filename, key, yaml, page, loaded, tab } = 
this.state;
     return (
diff --git a/karavan-vscode/webview/karavan-core/model/TopologyDefinition.ts 
b/karavan-vscode/webview/karavan-core/model/TopologyDefinition.ts
index 03f4fbe1..0e57872c 100644
--- a/karavan-vscode/webview/karavan-core/model/TopologyDefinition.ts
+++ b/karavan-vscode/webview/karavan-core/model/TopologyDefinition.ts
@@ -96,7 +96,7 @@ export class TopologyIncomingNode {
     title: string;
     fileName: string;
     from: FromDefinition;
-    uniqueUri?: string;
+    uniqueUri: string;
 
 
     constructor(id: string, type: "internal" | "external", connectorType: 
"component" | "kamelet", routeId: string, title: string, fileName: string, 
from: FromDefinition, uniqueUri: string) {
@@ -157,7 +157,7 @@ export class TopologyOutgoingNode {
     title: string;
     fileName: string;
     step: CamelElement;
-    uniqueUri?: string;
+    uniqueUri: string;
 
 
     constructor(id: string, type: "internal" | "external", connectorType: 
"component" | "kamelet", routeId: string, title: string, fileName: string, 
step: CamelElement, uniqueUri: string) {
diff --git 
a/karavan-vscode/webview/karavan/features/project/project-topology/GetCustomMenu.tsx
 
b/karavan-vscode/webview/karavan/features/project/project-topology/GetCustomMenu.tsx
index d8efab26..f1c555bd 100644
--- 
a/karavan-vscode/webview/karavan/features/project/project-topology/GetCustomMenu.tsx
+++ 
b/karavan-vscode/webview/karavan/features/project/project-topology/GetCustomMenu.tsx
@@ -15,7 +15,7 @@
  * limitations under the License.
  */
 
-import {ContextMenuItem, ContextSubMenuItem, GraphElement} from 
'@patternfly/react-topology';
+import {ContextMenuItem, GraphElement} from '@patternfly/react-topology';
 import * as React from "react";
 
 export function getCustomMenu(element: GraphElement, groupNames: string[]) {
@@ -27,41 +27,5 @@ export function getCustomMenu(element: GraphElement, 
groupNames: string[]) {
             Open
         </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'}
-                             onClick={() => 
data?.setDisabled?.(data?.fileName, data?.step.id, !(data?.disabled))}>
-                {data?.disabled ? 'Enable' : 'Disable'}
-            </ContextMenuItem>
-        );
-    }
     return result;
 }
diff --git 
a/karavan-vscode/webview/karavan/features/project/project-topology/TopologyApi.tsx
 
b/karavan-vscode/webview/karavan/features/project/project-topology/TopologyApi.tsx
index f5d87cba..a8097584 100644
--- 
a/karavan-vscode/webview/karavan/features/project/project-topology/TopologyApi.tsx
+++ 
b/karavan-vscode/webview/karavan/features/project/project-topology/TopologyApi.tsx
@@ -53,7 +53,7 @@ export function getIncomingNodes(tins: 
TopologyIncomingNode[]): NodeModel[] {
     });
 }
 
-export function getRoutes(tins: TopologyRouteNode[], tasyncapis: 
TopologyAsyncApiNode, showStats?: boolean): NodeModel[] {
+export function getRoutes(tins: TopologyRouteNode[], tasyncapis?: 
TopologyAsyncApiNode): NodeModel[] {
     return tins.map(tin => {
         const oper = tasyncapis?.operations?.find(o => o.operationId === 
tin.routeId)
         const node: NodeModel = {
@@ -77,7 +77,6 @@ export function getRoutes(tins: TopologyRouteNode[], 
tasyncapis: TopologyAsyncAp
                 templateTitle: tin.templateTitle,
                 generatedFromAsyncApi: oper?.operationId === tin.routeId,
                 autoStartup: tin.route.autoStartup !== false,
-                showStats: showStats,
             }
         }
         return node;
@@ -337,7 +336,7 @@ export function getRestNodes(tins: TopologyRestNode[]): 
NodeModel[] {
     });
 }
 
-export function getOpenApiNodes(topenapis: TopologyOpenApiNode[], showStats?: 
boolean): NodeModel[] {
+export function getOpenApiNodes(topenapis: TopologyOpenApiNode[]): NodeModel[] 
{
     return topenapis.map(topenapi => {
         return {
             id: topenapi.fileName,
@@ -355,7 +354,6 @@ export function getOpenApiNodes(topenapis: 
TopologyOpenApiNode[], showStats?: bo
                 // step: tin.rest,
                 fileName: topenapi.fileName,
                 secondaryLabel: topenapi.title,
-                showStats: showStats,
             }
         }
     });
@@ -470,7 +468,7 @@ export function getModel(projectId: string, files: 
IntegrationFile[], showGroups
                          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, 
showStats?: boolean): Model {
+                         openApiJson?: string, asyncApiJson?: string): Model {
     const tasyncapis = asyncApiJson ? 
[TopologyUtils.findTopologyAsyncApiNodes(asyncApiJson, projectId)] : [];
     const integrations = getIntegrations(files);
     const troutes = TopologyUtils.findTopologyRouteNodes(integrations);
@@ -486,9 +484,9 @@ export function getModel(projectId: string, files: 
IntegrationFile[], showGroups
     const nodes: NodeModel[] = [];
 
     nodes.push(...getRestNodes(trestns))
-    nodes.push(...getOpenApiNodes(topenapis, showStats))
+    nodes.push(...getOpenApiNodes(topenapis))
     // nodes.push(...getAsyncApiNodes(tasyncapis))
-    nodes.push(...getRoutes(troutes, tasyncapis?.at(0), showStats))
+    nodes.push(...getRoutes(troutes, tasyncapis?.at(0)))
     nodes.push(...getRouteConfigurations(trcs))
     const uriNodes = getUniqueUriNodes(tons, tins, troutes);
     if (showGroups) {
diff --git 
a/karavan-vscode/webview/karavan/features/project/project-topology/TopologyTab.tsx
 
b/karavan-vscode/webview/karavan/features/project/project-topology/TopologyTab.tsx
index 433ec661..11743abd 100644
--- 
a/karavan-vscode/webview/karavan/features/project/project-topology/TopologyTab.tsx
+++ 
b/karavan-vscode/webview/karavan/features/project/project-topology/TopologyTab.tsx
@@ -44,7 +44,7 @@ import {useTopologyHook} from 
"@features/project/project-topology/useTopologyHoo
 import {TopologyLegend} from 
"@features/project/project-topology/TopologyLegend";
 import {ModalConfirmation, ModalConfirmationProps} from 
"@shared/ui/ModalConfirmation";
 import {EyeIcon, EyeSlashIcon} from '@patternfly/react-icons';
-import {ArrayNumbers, GroupObjects, UngroupObjects} from '@carbon/icons-react';
+import {GroupObjects, UngroupObjects} from '@carbon/icons-react';
 import {useFilesStore, useProjectStore} from "@stores/ProjectStore";
 import {NODE_POSITIONED_EVENT} from "@patternfly/react-topology/src/types";
 import {OPENAPI_FILE_NAME_JSON} from "@karavan-core/contants";
@@ -60,7 +60,6 @@ export function TopologyTab(props: Props) {
     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);
@@ -96,7 +95,7 @@ export function TopologyTab(props: Props) {
     };
 
     const controller = React.useMemo(() => {
-        const model = getModel(project.projectId, camelFiles, showGroups, 
selectFile, setDisabled, deleteRoute, setRouteGroup, openApiJson, asyncApiJson, 
showStats);
+        const model = getModel(project.projectId, camelFiles, showGroups, 
selectFile, setDisabled, deleteRoute, setRouteGroup, openApiJson, asyncApiJson);
         const controller = new Visualization();
 
         controller.registerLayoutFactory((type, graph) => 
customLayoutFactory(type, graph));
@@ -112,7 +111,7 @@ export function TopologyTab(props: Props) {
         });
         controller.fromModel(model, false);
         return controller;
-    }, [files, showGroups, asyncApiJson, showStats]);
+    }, [files, showGroups, asyncApiJson]);
 
     function getButtonTitle(title: string, icon: React.ReactNode) {
         return (
@@ -156,12 +155,6 @@ export function TopologyTab(props: Props) {
                     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),
                 }
             ],
         });
diff --git 
a/karavan-vscode/webview/karavan/features/project/project-topology/useTopologyHook.tsx
 
b/karavan-vscode/webview/karavan/features/project/project-topology/useTopologyHook.tsx
index 4f4fa413..32e4b1a5 100644
--- 
a/karavan-vscode/webview/karavan/features/project/project-topology/useTopologyHook.tsx
+++ 
b/karavan-vscode/webview/karavan/features/project/project-topology/useTopologyHook.tsx
@@ -16,25 +16,21 @@
  */
 import React from "react";
 import {shallow} from "zustand/shallow";
-import {useFilesStore, useFileStore, useProjectStore} from 
"@stores/ProjectStore";
+import {useFilesStore, 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 {ModalConfirmationProps} from "@shared/ui/ModalConfirmation";
+import vscode from "@/vscode";
 
 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, project] = useProjectStore((s) => [s.setTabIndex, 
s.project], shallow);
+    const [project] = useProjectStore((s) => [s.project], shallow);
 
     function selectFile(fileName: string) {
-        const file = files.filter(f => f.name === fileName)?.at(0);
-        if (file) {
-            setFile('select', file);
-            setTabIndex(0);
-        }
+        vscode.postMessage({ command: 'openFile', fileName: fileName })
     }
 
     function setDisabled(fileName: string, elementId: string, enable: boolean) 
{
@@ -82,13 +78,7 @@ 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)
                 };
@@ -112,7 +102,6 @@ export function useTopologyHook(setConfirmationProps?: 
React.Dispatch<React.SetS
                     }
                     const newIntegration = 
CamelDefinitionApiExt.updateIntegrationRouteElement(integration, element);
                     file.code = 
CamelDefinitionYaml.integrationToYaml(newIntegration);
-                    ProjectService.updateFile(file, true);
                 }
 
             }
diff --git a/karavan-vscode/webview/karavan/stores/TopologyStore.ts 
b/karavan-vscode/webview/karavan/stores/TopologyStore.ts
index f7088137..c0ab5cdd 100644
--- a/karavan-vscode/webview/karavan/stores/TopologyStore.ts
+++ b/karavan-vscode/webview/karavan/stores/TopologyStore.ts
@@ -26,8 +26,6 @@ interface TopologyState {
     setShowBeans: (showBeans: boolean) => void
     showLegend: boolean
     setShowLegend: (showLegend: boolean) => void
-    showStats: boolean
-    setShowStats: (showStats: boolean) => void
 }
 
 export const useTopologyStore = createWithEqualityFn<TopologyState>((set, get) 
=> {
@@ -53,11 +51,5 @@ export const useTopologyStore = 
createWithEqualityFn<TopologyState>((set, get) =
                 return {showLegend: showLegend};
             });
         },
-        showStats: false,
-        setShowStats: (showStats: boolean) => {
-            set((state: TopologyState) => {
-                return {showStats: showStats};
-            });
-        },
     }
 });

Reply via email to