From 978ef10ae38a2e92e4a8131862f0d239c491588b Mon Sep 17 00:00:00 2001 From: Rishabh Jain Date: Tue, 20 Jun 2023 18:43:05 +0530 Subject: [PATCH 1/2] uri trigger --- package.json | 3 ++- src/client/extension.ts | 23 +++++++++++++++++++++++ src/client/lib/PacTerminal.ts | 4 +++- 3 files changed, 28 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index dec49548..5a681895 100644 --- a/package.json +++ b/package.json @@ -91,7 +91,8 @@ "onStartupFinished", "workspaceContains:**/**.portalconfig", "onDebug", - "onFileSystem:powerplatform-vfs" + "onFileSystem:powerplatform-vfs", + "onUri" ], "capabilities": { "untrustedWorkspaces": { diff --git a/src/client/extension.ts b/src/client/extension.ts index 9f0c5492..f9863e76 100644 --- a/src/client/extension.ts +++ b/src/client/extension.ts @@ -84,6 +84,29 @@ export async function activate( vscode.workspace.onDidOpenTextDocument(didOpenTextDocument); vscode.workspace.textDocuments.forEach(didOpenTextDocument); + vscode.window.registerUriHandler({ + handleUri(uri:vscode.Uri) { + const params = uri.query.split('&'); + let org = ''; + let siteid = ''; + params.forEach(param => { + const pair = param.split('='); + switch (pair[0]){ + case 'org':{ + org = pair[1]; + break; + } + case 'siteid':{ + siteid = pair[1]; + break; + } + } + }); + vscode.commands.executeCommand("pacCLI.pacAuthCreate", org); + vscode.commands.executeCommand("pacCLI.pacPaportalDownload", siteid); + } + }) + // portal web view panel _context.subscriptions.push( vscode.commands.registerCommand( diff --git a/src/client/lib/PacTerminal.ts b/src/client/lib/PacTerminal.ts index a8c49361..1d84e465 100644 --- a/src/client/lib/PacTerminal.ts +++ b/src/client/lib/PacTerminal.ts @@ -44,7 +44,9 @@ export class PacTerminal implements vscode.Disposable { vscode.commands.registerCommand('pacCLI.pacAuthHelp', () => PacTerminal.getTerminal().sendText("pac auth help")), vscode.commands.registerCommand('pacCLI.pacPackageHelp', () => PacTerminal.getTerminal().sendText("pac package help")), vscode.commands.registerCommand('pacCLI.pacPcfHelp', () => PacTerminal.getTerminal().sendText("pac pcf help")), - vscode.commands.registerCommand('pacCLI.pacSolutionHelp', () => PacTerminal.getTerminal().sendText("pac solution help"))); + vscode.commands.registerCommand('pacCLI.pacSolutionHelp', () => PacTerminal.getTerminal().sendText("pac solution help")), + vscode.commands.registerCommand('pacCLI.pacAuthCreate', (orgUrl) => PacTerminal.getTerminal().sendText("pac auth create -u " + orgUrl)), + vscode.commands.registerCommand('pacCLI.pacPaportalDownload', (websiteId) => PacTerminal.getTerminal().sendText(`pac paportal download -id ${websiteId} -p . -o`))); this._cmdDisposables.push(vscode.commands.registerCommand(`pacCLI.enableTelemetry`, async () => { const result = await this._pacWrapper.enableTelemetry(); From 870698a455cc2fd67f72c9857a0fede81e9325ca Mon Sep 17 00:00:00 2001 From: Amit Joshi Date: Thu, 1 Feb 2024 16:20:05 +0530 Subject: [PATCH 2/2] added uri in comment --- src/client/extension.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/client/extension.ts b/src/client/extension.ts index f9863e76..34ba5f2d 100644 --- a/src/client/extension.ts +++ b/src/client/extension.ts @@ -86,7 +86,7 @@ export async function activate( vscode.window.registerUriHandler({ handleUri(uri:vscode.Uri) { - const params = uri.query.split('&'); + const params = uri.query.split('&'); //'vscode://microsoft-IsvExpTools.powerplatform-vscode?org&siteid' let org = ''; let siteid = ''; params.forEach(param => {