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 875420f29321ee58743fe97f122248ee1e9ba42e Author: Marat Gubaidullin <marat.gubaidul...@gmail.com> AuthorDate: Mon Dec 19 10:22:49 2022 -0500 fix #569 --- karavan-vscode/src/extension.ts | 28 +++++++++++++++++----------- 1 file changed, 17 insertions(+), 11 deletions(-) diff --git a/karavan-vscode/src/extension.ts b/karavan-vscode/src/extension.ts index 3e2b52f..b009636 100644 --- a/karavan-vscode/src/extension.ts +++ b/karavan-vscode/src/extension.ts @@ -70,7 +70,7 @@ export function activate(context: ExtensionContext) { context.subscriptions.push(openFile); // Create application - const applicationCommand = commands.registerCommand("karavan.create-application", (...args: any[]) => { + const applicationCommand = commands.registerCommand("karavan.create-application", async (...args: any[]) => { if (rootPath) { const defaultRuntime: string = workspace.getConfiguration().get("camel.runtimes") || ''; const deployTarget: string = workspace.getConfiguration().get("camel.deployTarget") || 'openshift'; @@ -83,17 +83,23 @@ export function activate(context: ExtensionContext) { { label: "kubernetes", picked: "kubernetes" === deployTarget }, { label: "none", picked: "none" === deployTarget } ]; - utils.hasApplicationProperties(rootPath).then(hasAP => { - if (hasAP) { - window.showInformationMessage("Folder already contains application.properties"); - } else { - window.showQuickPick(runtimeOptions, { title: "Select Runtime", canPickMany: false }).then((runtime) => { - window.showQuickPick(deployOptions, { title: "Select Deploy Target", canPickMany: false }).then((target) => { - if (runtime && target) inputExportGav(runtime.label, target.label) - }) + const hasAP = await utils.hasApplicationProperties(rootPath); + let createApp = !hasAP; + if (hasAP) { + const replaceOptions: QuickPickItem[] = [ + { label: "Replace", picked: false }, + { label: "Cancel", picked: true } + ]; + const replace = await window.showQuickPick(replaceOptions, {title: "Application already exists!", canPickMany: false }); + createApp = replace?.label === replaceOptions.at(0)?.label; + } + if (createApp){ + window.showQuickPick(runtimeOptions, { title: "Select Runtime", canPickMany: false }).then((runtime) => { + window.showQuickPick(deployOptions, { title: "Select Deploy Target", canPickMany: false }).then((target) => { + if (runtime && target) inputExportGav(runtime.label, target.label) }) - } - }) + }) + } } }); context.subscriptions.push(applicationCommand);