From c8632c255a8fd57ccf2ab0b5548b87f8330322ed Mon Sep 17 00:00:00 2001 From: Alan Ren Date: Tue, 24 Nov 2020 17:32:50 -0800 Subject: [PATCH] scoped refresh commands (#13541) --- extensions/azurecore/package.json | 19 ++++++++++++++----- .../azurecore/src/azureResource/commands.ts | 13 ++++++++----- extensions/azurecore/src/extension.ts | 2 +- 3 files changed, 23 insertions(+), 11 deletions(-) diff --git a/extensions/azurecore/package.json b/extensions/azurecore/package.json index c0486415e1..cd1711d7b3 100644 --- a/extensions/azurecore/package.json +++ b/extensions/azurecore/package.json @@ -141,7 +141,12 @@ "icon": "$(refresh)" }, { - "command": "azure.resource.refresh", + "command": "azure.resource.azureview.refresh", + "title": "%azure.resource.refresh.title%", + "icon": "$(refresh)" + }, + { + "command": "azure.resource.connectiondialog.refresh", "title": "%azure.resource.refresh.title%", "icon": "$(refresh)" }, @@ -209,7 +214,11 @@ "when": "false" }, { - "command": "azure.resource.refresh", + "command": "azure.resource.azureview.refresh", + "when": "false" + }, + { + "command": "azure.resource.connectiondialog.refresh", "when": "false" }, { @@ -245,12 +254,12 @@ "group": "azurecore" }, { - "command": "azure.resource.refresh", + "command": "azure.resource.azureview.refresh", "when": "viewItem =~ /^azure\\.resource\\.itemType\\.(?:account|subscription|databaseContainer|databaseServerContainer)$/", "group": "inline" }, { - "command": "azure.resource.refresh", + "command": "azure.resource.azureview.refresh", "when": "viewItem =~ /^azure\\.resource\\.itemType\\.(?:account|subscription|databaseContainer|databaseServerContainer)$/", "group": "azurecore" }, @@ -287,7 +296,7 @@ "group": "navigation" }, { - "command": "azure.resource.refresh", + "command": "azure.resource.connectiondialog.refresh", "when": "contextValue == azure.resource.itemType.account", "group": "navigation" }, diff --git a/extensions/azurecore/src/azureResource/commands.ts b/extensions/azurecore/src/azureResource/commands.ts index 0e972c4982..671b359f52 100644 --- a/extensions/azurecore/src/azureResource/commands.ts +++ b/extensions/azurecore/src/azureResource/commands.ts @@ -21,7 +21,8 @@ import { AzureAccount, Tenant } from '../account-provider/interfaces'; import { FlatAccountTreeNode } from './tree/flatAccountTreeNode'; import { ConnectionDialogTreeProvider } from './tree/connectionDialogTreeProvider'; -export function registerAzureResourceCommands(appContext: AppContext, trees: (AzureResourceTreeProvider | ConnectionDialogTreeProvider)[]): void { +export function registerAzureResourceCommands(appContext: AppContext, azureViewTree: AzureResourceTreeProvider, connectionDialogTree: ConnectionDialogTreeProvider): void { + const trees = [azureViewTree, connectionDialogTree]; vscode.commands.registerCommand('azure.resource.startterminal', async (node?: TreeNode) => { try { const enablePreviewFeatures = vscode.workspace.getConfiguration('workbench').get('enablePreviewFeatures'); @@ -168,10 +169,12 @@ export function registerAzureResourceCommands(appContext: AppContext, trees: (Az } }); - vscode.commands.registerCommand('azure.resource.refresh', async (node?: TreeNode) => { - for (const tree of trees) { - await tree.refresh(node, true); - } + vscode.commands.registerCommand('azure.resource.azureview.refresh', async (node?: TreeNode) => { + await azureViewTree.refresh(node, true); + }); + + vscode.commands.registerCommand('azure.resource.connectiondialog.refresh', async (node?: TreeNode) => { + await connectionDialogTree.refresh(node, true); }); vscode.commands.registerCommand('azure.resource.signin', async (node?: TreeNode) => { diff --git a/extensions/azurecore/src/extension.ts b/extensions/azurecore/src/extension.ts index fe473a8585..bac592f4f1 100644 --- a/extensions/azurecore/src/extension.ts +++ b/extensions/azurecore/src/extension.ts @@ -89,7 +89,7 @@ export async function activate(context: vscode.ExtensionContext): Promise onDidChangeConfiguration(e), this)); - registerAzureResourceCommands(appContext, [azureResourceTree, connectionDialogTree]); + registerAzureResourceCommands(appContext, azureResourceTree, connectionDialogTree); azdata.dataprotocol.registerDataGridProvider(new AzureDataGridProvider(appContext)); vscode.commands.registerCommand('azure.dataGrid.openInAzurePortal', async (item: azdata.DataGridItem) => { const portalEndpoint = item.portalEndpoint;