From a641e437167c90923d4336c1415fa8da0ab3a305 Mon Sep 17 00:00:00 2001 From: shatakshiiii Date: Wed, 5 Feb 2025 17:36:31 +0530 Subject: [PATCH 1/2] Update plugin webview: Sort the pluginType drop-down entries --- src/features/contentCreator/addPluginPage.ts | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/features/contentCreator/addPluginPage.ts b/src/features/contentCreator/addPluginPage.ts index 307ddbf5e..210fb7913 100644 --- a/src/features/contentCreator/addPluginPage.ts +++ b/src/features/contentCreator/addPluginPage.ts @@ -137,9 +137,9 @@ export class AddPlugin { Plugin type * - filter - lookup - action + Action + Filter + Lookup @@ -303,9 +303,11 @@ export class AddPlugin { payload: PluginFormInterface, webView: vscode.Webview, ) { - const { pluginName, pluginType, collectionPath, verbosity, isOverwritten } = + var { pluginName, pluginType, collectionPath, verbosity, isOverwritten } = payload; + var pluginType = pluginType.toLowerCase(); + const destinationPathUrl = collectionPath ? collectionPath : `${os.homedir()}/.ansible/collections/ansible_collections`; From 05efc5eacaf274e6226ddce7c5f50a46219f2a78 Mon Sep 17 00:00:00 2001 From: shatakshiiii Date: Thu, 6 Feb 2025 10:58:37 +0530 Subject: [PATCH 2/2] Fix eslint error --- src/features/contentCreator/addPluginPage.ts | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/src/features/contentCreator/addPluginPage.ts b/src/features/contentCreator/addPluginPage.ts index 210fb7913..3af44f48d 100644 --- a/src/features/contentCreator/addPluginPage.ts +++ b/src/features/contentCreator/addPluginPage.ts @@ -303,18 +303,16 @@ export class AddPlugin { payload: PluginFormInterface, webView: vscode.Webview, ) { - var { pluginName, pluginType, collectionPath, verbosity, isOverwritten } = + const { pluginName, pluginType, collectionPath, verbosity, isOverwritten } = payload; - var pluginType = pluginType.toLowerCase(); - const destinationPathUrl = collectionPath ? collectionPath : `${os.homedir()}/.ansible/collections/ansible_collections`; let ansibleCreatorAddCommand = await this.getCreatorCommand( pluginName, - pluginType, + pluginType.toLowerCase(), destinationPathUrl, ); @@ -385,9 +383,6 @@ export class AddPlugin { ) { const folderUri = vscode.Uri.parse(expandPath(folderUrl)); - // add folder to a new workspace - // vscode.workspace.updateWorkspaceFolders(0, 1, { uri: folderUri }); - if (vscode.workspace.workspaceFolders?.length === 0) { vscode.workspace.updateWorkspaceFolders(0, null, { uri: folderUri }); } else { @@ -397,7 +392,7 @@ export class AddPlugin { } // open the plugin file in the editor - const pluginFileUrl = `${folderUrl}/plugins/${pluginType}/${pluginName}.py`; + const pluginFileUrl = `${folderUrl}/plugins/${pluginType.toLowerCase()}/${pluginName}.py`; console.log(`[ansible-creator] Plugin file url: ${pluginFileUrl}`); const parsedUrl = vscode.Uri.parse(`vscode://file${pluginFileUrl}`); console.log(`[ansible-creator] Parsed galaxy file url: ${parsedUrl}`);