You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by ma...@apache.org on 2024/03/05 00:16:42 UTC
(camel-karavan) 01/03: Fix #1162
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 3fce1c34bbec4adfbae0dd5562bb419604312b3a
Author: Marat Gubaidullin <ma...@talismancloud.io>
AuthorDate: Mon Mar 4 18:56:14 2024 -0500
Fix #1162
---
karavan-vscode/src/designerView.ts | 40 +++++++++++++++++++++-----------------
1 file changed, 22 insertions(+), 18 deletions(-)
diff --git a/karavan-vscode/src/designerView.ts b/karavan-vscode/src/designerView.ts
index 612a093c..af8cf2fb 100644
--- a/karavan-vscode/src/designerView.ts
+++ b/karavan-vscode/src/designerView.ts
@@ -191,8 +191,8 @@ export class DesignerView {
utils.readBeans(fullPath),
//Read BlockList
utils.readBlockTemplates(this.context),
- // Read integration
- utils.readCamelYamlFiles(path.dirname(fullPath))
+ // // Read integration
+ // utils.readCamelYamlFiles(path.dirname(fullPath))
]).then(results => {
// Send Kamelets
panel.webview.postMessage({ command: 'kamelets', kamelets: results[0] });
@@ -206,7 +206,7 @@ export class DesignerView {
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] });
+ // 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]) });
@@ -216,26 +216,30 @@ export class DesignerView {
sendIntegrationData(panel: WebviewPanel, filename: string, relativePath: string,
fullPath: string, reread: boolean, yaml?: string, tab?: string, propertyPlaceholders?: string[], beans?: RegistryBeanDefinition[]) {
- // Read file if required
- if (reread) {
- utils.readFile(path.resolve(fullPath)).then(readData => {
- const yaml = Buffer.from(readData).toString('utf8');
+ // Read and send Integrations
+ utils.readCamelYamlFiles(path.dirname(fullPath)).then((files) => {
+ panel.webview.postMessage({ command: 'files', files: files });
+ }).finally(() => {
+ // Read file if required
+ if (reread) {
+ utils.readFile(path.resolve(fullPath)).then(readData => {
+ const yaml = Buffer.from(readData).toString('utf8');
+ // Send integration
+ panel.webview.postMessage(
+ {
+ command: 'open', page: "designer", filename: filename, relativePath: relativePath,
+ fullPath: fullPath, yaml: yaml, tab: tab, propertyPlaceholders: propertyPlaceholders, beans: beans
+ });
+ });
+ } else {
// Send integration
panel.webview.postMessage(
{
command: 'open', page: "designer", filename: filename, relativePath: relativePath,
fullPath: fullPath, yaml: yaml, tab: tab, propertyPlaceholders: propertyPlaceholders, beans: beans
});
- });
- } else {
- // Send integration
- panel.webview.postMessage(
- {
- command: 'open', page: "designer", filename: filename, relativePath: relativePath,
- fullPath: fullPath, yaml: yaml, tab: tab, propertyPlaceholders: propertyPlaceholders, beans: beans
- });
- }
-
+ }
+ })
}
downloadImage(fullPath: string) {
@@ -256,7 +260,7 @@ export class DesignerView {
commands.executeCommand("karavan.open", { fsPath: filename })
}
}).catch(err => window.showErrorMessage("Error: " + err?.reason));
- } else if(routeId) {
+ } else if (routeId) {
utils.getFileWithInternalProducer(fullPath, routeId).then((filename) => {
if (filename !== undefined) {
commands.executeCommand("karavan.open", { fsPath: filename })