diff --git a/package-lock.json b/package-lock.json index e7248f4a3..de7d012f6 100644 --- a/package-lock.json +++ b/package-lock.json @@ -19,7 +19,7 @@ "@azure/storage-queue": "^12.7.0", "@microsoft/vscode-azext-azureappservice": "^0.7.0", "@microsoft/vscode-azext-azureutils": "^0.3.4", - "@microsoft/vscode-azext-utils": "^0.3.14", + "@microsoft/vscode-azext-utils": "^0.3.26", "glob": "^7.1.2", "mime": "^2.4.4", "open": "^8.0.4", @@ -1330,9 +1330,9 @@ } }, "node_modules/@microsoft/vscode-azext-utils": { - "version": "0.3.14", - "resolved": "https://registry.npmjs.org/@microsoft/vscode-azext-utils/-/vscode-azext-utils-0.3.14.tgz", - "integrity": "sha512-ic9pzUA3hpP8NLnlMYn3ebrz33w27AuFxJmTY5t7Z7PY026/A/+T4SPTBaWsyMRnE2KLbr5iti6ByMhhCm0MMw==", + "version": "0.3.26", + "resolved": "https://registry.npmjs.org/@microsoft/vscode-azext-utils/-/vscode-azext-utils-0.3.26.tgz", + "integrity": "sha512-txsXb2uzRJoOiRqeOB+o7YVFnfK6QGbP/+IfdciycVWWECMmenUKi+E9oTo1GjQABUMNgwsgjo12n+jD294TtQ==", "dependencies": { "@vscode/extension-telemetry": "^0.6.2", "dayjs": "^1.11.2", @@ -13731,9 +13731,9 @@ } }, "@microsoft/vscode-azext-utils": { - "version": "0.3.14", - "resolved": "https://registry.npmjs.org/@microsoft/vscode-azext-utils/-/vscode-azext-utils-0.3.14.tgz", - "integrity": "sha512-ic9pzUA3hpP8NLnlMYn3ebrz33w27AuFxJmTY5t7Z7PY026/A/+T4SPTBaWsyMRnE2KLbr5iti6ByMhhCm0MMw==", + "version": "0.3.26", + "resolved": "https://registry.npmjs.org/@microsoft/vscode-azext-utils/-/vscode-azext-utils-0.3.26.tgz", + "integrity": "sha512-txsXb2uzRJoOiRqeOB+o7YVFnfK6QGbP/+IfdciycVWWECMmenUKi+E9oTo1GjQABUMNgwsgjo12n+jD294TtQ==", "requires": { "@vscode/extension-telemetry": "^0.6.2", "dayjs": "^1.11.2", diff --git a/package.json b/package.json index 4b08cdf3f..dadd77982 100644 --- a/package.json +++ b/package.json @@ -86,6 +86,21 @@ }, "contributes": { "x-azResources": { + "azure": { + "branches": [ + { + "type": "StorageAccounts" + } + ] + }, + "workspace": { + "branches": [ + { + "type": "storageEmulator" + } + ], + "resources": true + }, "activation": { "onFetch": [ "microsoft.storage/storageaccounts" @@ -837,7 +852,7 @@ "@azure/storage-queue": "^12.7.0", "@microsoft/vscode-azext-azureappservice": "^0.7.0", "@microsoft/vscode-azext-azureutils": "^0.3.4", - "@microsoft/vscode-azext-utils": "^0.3.14", + "@microsoft/vscode-azext-utils": "^0.3.26", "glob": "^7.1.2", "mime": "^2.4.4", "open": "^8.0.4", diff --git a/src/commands/blob/blobContainerActionHandlers.ts b/src/commands/blob/blobContainerActionHandlers.ts index ef7d5bef5..468672cb5 100644 --- a/src/commands/blob/blobContainerActionHandlers.ts +++ b/src/commands/blob/blobContainerActionHandlers.ts @@ -3,7 +3,7 @@ * Licensed under the MIT License. See License.md in the project root for license information. *--------------------------------------------------------------------------------------------*/ -import { IActionContext, registerCommand } from '@microsoft/vscode-azext-utils'; +import { IActionContext, registerCommandWithTreeNodeUnwrapping } from '@microsoft/vscode-azext-utils'; import * as path from 'path'; import * as vscode from 'vscode'; import { AzureStorageFS } from '../../AzureStorageFS'; @@ -17,10 +17,10 @@ import { localize } from '../../utils/localize'; import { deleteNode } from '../commonTreeCommands'; export function registerBlobContainerActionHandlers(): void { - registerCommand("azureStorage.openBlobContainer", openBlobContainerInStorageExplorer); - registerCommand("azureStorage.editBlob", async (context: IActionContext, treeItem: BlobTreeItem) => AzureStorageFS.showEditor(context, treeItem), 250); - registerCommand("azureStorage.deleteBlobContainer", deleteBlobContainer); - registerCommand("azureStorage.createBlockBlob", async (context: IActionContext, parent: BlobContainerTreeItem) => { + registerCommandWithTreeNodeUnwrapping("azureStorage.openBlobContainer", openBlobContainerInStorageExplorer); + registerCommandWithTreeNodeUnwrapping("azureStorage.editBlob", async (context: IActionContext, treeItem: BlobTreeItem) => AzureStorageFS.showEditor(context, treeItem), 250); + registerCommandWithTreeNodeUnwrapping("azureStorage.deleteBlobContainer", deleteBlobContainer); + registerCommandWithTreeNodeUnwrapping("azureStorage.createBlockBlob", async (context: IActionContext, parent: BlobContainerTreeItem) => { const blobPath: string = normalizeBlobPathInput(await getBlobPath(context, parent)); const dirNames: string[] = blobPath.includes('/') ? path.dirname(blobPath).split('/') : []; let dirParentTreeItem: BlobDirectoryTreeItem | BlobContainerTreeItem = parent; diff --git a/src/commands/blob/blobContainerGroupActionHandlers.ts b/src/commands/blob/blobContainerGroupActionHandlers.ts index 1661d80ea..ddf23475f 100644 --- a/src/commands/blob/blobContainerGroupActionHandlers.ts +++ b/src/commands/blob/blobContainerGroupActionHandlers.ts @@ -3,13 +3,13 @@ * Licensed under the MIT License. See License.md in the project root for license information. *--------------------------------------------------------------------------------------------*/ -import { IActionContext, registerCommand } from '@microsoft/vscode-azext-utils'; +import { IActionContext, registerCommandWithTreeNodeUnwrapping } from '@microsoft/vscode-azext-utils'; import { BlobContainerGroupTreeItem } from '../../tree/blob/BlobContainerGroupTreeItem'; import { isAzuriteInstalled, warnAzuriteNotInstalled } from '../../utils/azuriteUtils'; import { createChildNode } from '../commonTreeCommands'; export function registerBlobContainerGroupActionHandlers(): void { - registerCommand("azureStorage.createBlobContainer", createBlobContainer); + registerCommandWithTreeNodeUnwrapping("azureStorage.createBlobContainer", createBlobContainer); } export async function createBlobContainer(context: IActionContext, treeItem?: BlobContainerGroupTreeItem): Promise { diff --git a/src/commands/fileShare/directoryActionHandlers.ts b/src/commands/fileShare/directoryActionHandlers.ts index 6dc0a6337..4978861ad 100644 --- a/src/commands/fileShare/directoryActionHandlers.ts +++ b/src/commands/fileShare/directoryActionHandlers.ts @@ -3,14 +3,14 @@ * Licensed under the MIT License. See License.md in the project root for license information. *--------------------------------------------------------------------------------------------*/ -import { AzExtParentTreeItem, IActionContext, registerCommand } from '@microsoft/vscode-azext-utils'; +import { AzExtParentTreeItem, IActionContext, registerCommandWithTreeNodeUnwrapping } from '@microsoft/vscode-azext-utils'; import { DirectoryTreeItem } from '../../tree/fileShare/DirectoryTreeItem'; import { IFileShareCreateChildContext } from '../../tree/fileShare/FileShareTreeItem'; import { deleteFilesAndDirectories } from '../deleteFilesAndDirectories'; export function registerDirectoryActionHandlers(): void { - registerCommand("azureStorage.deleteDirectory", deleteFilesAndDirectories); - registerCommand("azureStorage.createSubdirectory", async (context: IActionContext, treeItem: AzExtParentTreeItem) => await treeItem.createChild({ ...context, childType: DirectoryTreeItem.contextValue })); + registerCommandWithTreeNodeUnwrapping("azureStorage.deleteDirectory", deleteFilesAndDirectories); + registerCommandWithTreeNodeUnwrapping("azureStorage.createSubdirectory", async (context: IActionContext, treeItem: AzExtParentTreeItem) => await treeItem.createChild({ ...context, childType: DirectoryTreeItem.contextValue })); // Note: azureStorage.createTextFile is registered in fileShareActionHandlers } diff --git a/src/commands/fileShare/fileActionHandlers.ts b/src/commands/fileShare/fileActionHandlers.ts index c6d4a52dc..e237490a5 100644 --- a/src/commands/fileShare/fileActionHandlers.ts +++ b/src/commands/fileShare/fileActionHandlers.ts @@ -3,9 +3,9 @@ * Licensed under the MIT License. See License.md in the project root for license information. *--------------------------------------------------------------------------------------------*/ -import { registerCommand } from '@microsoft/vscode-azext-utils'; +import { registerCommandWithTreeNodeUnwrapping } from '@microsoft/vscode-azext-utils'; import { deleteFilesAndDirectories } from '../deleteFilesAndDirectories'; export function registerFileActionHandlers(): void { - registerCommand("azureStorage.deleteFile", deleteFilesAndDirectories); + registerCommandWithTreeNodeUnwrapping("azureStorage.deleteFile", deleteFilesAndDirectories); } diff --git a/src/commands/fileShare/fileShareActionHandlers.ts b/src/commands/fileShare/fileShareActionHandlers.ts index 4f922f8aa..216b26315 100644 --- a/src/commands/fileShare/fileShareActionHandlers.ts +++ b/src/commands/fileShare/fileShareActionHandlers.ts @@ -2,7 +2,7 @@ * Copyright (c) Microsoft Corporation. All rights reserved. * Licensed under the MIT License. See License.md in the project root for license information. *--------------------------------------------------------------------------------------------*/ -import { IActionContext, registerCommand } from '@microsoft/vscode-azext-utils'; +import { IActionContext, registerCommandWithTreeNodeUnwrapping } from '@microsoft/vscode-azext-utils'; import * as vscode from 'vscode'; import { AzureStorageFS } from '../../AzureStorageFS'; import { storageExplorerLauncher } from '../../storageExplorerLauncher/storageExplorerLauncher'; @@ -12,11 +12,11 @@ import { FileTreeItem } from '../../tree/fileShare/FileTreeItem'; import { deleteNode } from '../commonTreeCommands'; export function registerFileShareActionHandlers(): void { - registerCommand("azureStorage.openFileShare", openFileShareInStorageExplorer); - registerCommand("azureStorage.editFile", async (context: IActionContext, treeItem: FileTreeItem) => AzureStorageFS.showEditor(context, treeItem), 250); - registerCommand("azureStorage.deleteFileShare", deleteFileShare); - registerCommand("azureStorage.createDirectory", async (context: IActionContext, treeItem: FileShareTreeItem) => await treeItem.createChild({ ...context, childType: DirectoryTreeItem.contextValue })); - registerCommand("azureStorage.createFile", async (context: IActionContext, treeItem: FileShareTreeItem) => { + registerCommandWithTreeNodeUnwrapping("azureStorage.openFileShare", openFileShareInStorageExplorer); + registerCommandWithTreeNodeUnwrapping("azureStorage.editFile", async (context: IActionContext, treeItem: FileTreeItem) => AzureStorageFS.showEditor(context, treeItem), 250); + registerCommandWithTreeNodeUnwrapping("azureStorage.deleteFileShare", deleteFileShare); + registerCommandWithTreeNodeUnwrapping("azureStorage.createDirectory", async (context: IActionContext, treeItem: FileShareTreeItem) => await treeItem.createChild({ ...context, childType: DirectoryTreeItem.contextValue })); + registerCommandWithTreeNodeUnwrapping("azureStorage.createFile", async (context: IActionContext, treeItem: FileShareTreeItem) => { const childTreeItem = await treeItem.createChild({ ...context, childType: FileTreeItem.contextValue }); await vscode.commands.executeCommand("azureStorage.editFile", childTreeItem); }); diff --git a/src/commands/fileShare/fileShareGroupActionHandlers.ts b/src/commands/fileShare/fileShareGroupActionHandlers.ts index 74a5e5ad7..69c1d34c5 100644 --- a/src/commands/fileShare/fileShareGroupActionHandlers.ts +++ b/src/commands/fileShare/fileShareGroupActionHandlers.ts @@ -3,12 +3,12 @@ * Licensed under the MIT License. See License.md in the project root for license information. *--------------------------------------------------------------------------------------------*/ -import { IActionContext, registerCommand } from '@microsoft/vscode-azext-utils'; +import { IActionContext, registerCommandWithTreeNodeUnwrapping } from '@microsoft/vscode-azext-utils'; import { FileShareGroupTreeItem } from '../../tree/fileShare/FileShareGroupTreeItem'; import { createChildNode } from '../commonTreeCommands'; export function registerFileShareGroupActionHandlers(): void { - registerCommand("azureStorage.createFileShare", createFileShare); + registerCommandWithTreeNodeUnwrapping("azureStorage.createFileShare", createFileShare); } export async function createFileShare(context: IActionContext, treeItem?: FileShareGroupTreeItem): Promise { diff --git a/src/commands/queue/queueActionHandlers.ts b/src/commands/queue/queueActionHandlers.ts index 61612dd03..434e3363e 100644 --- a/src/commands/queue/queueActionHandlers.ts +++ b/src/commands/queue/queueActionHandlers.ts @@ -3,14 +3,14 @@ * Licensed under the MIT License. See License.md in the project root for license information. *--------------------------------------------------------------------------------------------*/ -import { IActionContext, registerCommand } from '@microsoft/vscode-azext-utils'; +import { IActionContext, registerCommandWithTreeNodeUnwrapping } from '@microsoft/vscode-azext-utils'; import { storageExplorerLauncher } from '../../storageExplorerLauncher/storageExplorerLauncher'; import { QueueTreeItem } from '../../tree/queue/QueueTreeItem'; import { deleteNode } from '../commonTreeCommands'; export function registerQueueActionHandlers(): void { - registerCommand("azureStorage.openQueue", openQueueInStorageExplorer); - registerCommand("azureStorage.deleteQueue", deleteQueue); + registerCommandWithTreeNodeUnwrapping("azureStorage.openQueue", openQueueInStorageExplorer); + registerCommandWithTreeNodeUnwrapping("azureStorage.deleteQueue", deleteQueue); } async function openQueueInStorageExplorer(_context: IActionContext, treeItem: QueueTreeItem): Promise { diff --git a/src/commands/queue/queueGroupActionHandlers.ts b/src/commands/queue/queueGroupActionHandlers.ts index e94c65fe0..fa088b801 100644 --- a/src/commands/queue/queueGroupActionHandlers.ts +++ b/src/commands/queue/queueGroupActionHandlers.ts @@ -3,13 +3,13 @@ * Licensed under the MIT License. See License.md in the project root for license information. *--------------------------------------------------------------------------------------------*/ -import { IActionContext, registerCommand } from '@microsoft/vscode-azext-utils'; +import { IActionContext, registerCommandWithTreeNodeUnwrapping } from '@microsoft/vscode-azext-utils'; import { QueueGroupTreeItem } from '../../tree/queue/QueueGroupTreeItem'; import { isAzuriteInstalled, warnAzuriteNotInstalled } from '../../utils/azuriteUtils'; import { createChildNode } from '../commonTreeCommands'; export function registerQueueGroupActionHandlers(): void { - registerCommand("azureStorage.createQueue", createQueue); + registerCommandWithTreeNodeUnwrapping("azureStorage.createQueue", createQueue); } export async function createQueue(context: IActionContext, treeItem?: QueueGroupTreeItem): Promise { diff --git a/src/commands/registerCommands.ts b/src/commands/registerCommands.ts index 645b6c36b..310b08986 100644 --- a/src/commands/registerCommands.ts +++ b/src/commands/registerCommands.ts @@ -3,7 +3,7 @@ * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ -import { AzExtTreeItem, AzureWizard, IActionContext, registerCommand } from "@microsoft/vscode-azext-utils"; +import { AzExtTreeItem, AzureWizard, IActionContext, registerCommandWithTreeNodeUnwrapping } from "@microsoft/vscode-azext-utils"; import { commands } from "vscode"; import { azuriteExtensionId, emulatorTimeoutMS, storageFilter } from "../constants"; import { ext } from "../extensionVariables"; @@ -49,9 +49,9 @@ export function registerCommands(): void { registerTableActionHandlers(); registerTableGroupActionHandlers(); - registerCommand('azureStorage.refresh', async (actionContext: IActionContext, treeItem?: AzExtTreeItem & IStorageTreeItem) => { await refreshTreeItem(actionContext, treeItem) }) - registerCommand('azureStorage.showOutputChannel', () => { ext.outputChannel.show(); }); - registerCommand('azureStorage.openInFileExplorer', async (actionContext: IActionContext, treeItem?: BlobContainerTreeItem | FileShareTreeItem) => { + registerCommandWithTreeNodeUnwrapping('azureStorage.refresh', async (actionContext: IActionContext, treeItem?: AzExtTreeItem & IStorageTreeItem) => { await refreshTreeItem(actionContext, treeItem) }) + registerCommandWithTreeNodeUnwrapping('azureStorage.showOutputChannel', () => { ext.outputChannel.show(); }); + registerCommandWithTreeNodeUnwrapping('azureStorage.openInFileExplorer', async (actionContext: IActionContext, treeItem?: BlobContainerTreeItem | FileShareTreeItem) => { if (!treeItem) { treeItem = await ext.rgApi.pickAppResource(actionContext, { filter: storageFilter, @@ -70,8 +70,8 @@ export function registerCommands(): void { await wizard.prompt(); await wizard.execute(); }); - registerCommand('azureStorage.copyUrl', (_actionContext: IActionContext, treeItem: AzExtTreeItem & ICopyUrl) => treeItem.copyUrl()); - registerCommand("azureStorage.configureStaticWebsite", async (actionContext: IActionContext, treeItem?: AzExtTreeItem) => { + registerCommandWithTreeNodeUnwrapping('azureStorage.copyUrl', (_actionContext: IActionContext, treeItem: AzExtTreeItem & ICopyUrl) => treeItem.copyUrl()); + registerCommandWithTreeNodeUnwrapping("azureStorage.configureStaticWebsite", async (actionContext: IActionContext, treeItem?: AzExtTreeItem) => { const accountTreeItem = await selectStorageAccountTreeItemForCommand( treeItem, actionContext, @@ -81,7 +81,7 @@ export function registerCommands(): void { }); await accountTreeItem.configureStaticWebsite(actionContext); }); - registerCommand("azureStorage.disableStaticWebsite", async (actionContext: IActionContext, treeItem?: AzExtTreeItem) => { + registerCommandWithTreeNodeUnwrapping("azureStorage.disableStaticWebsite", async (actionContext: IActionContext, treeItem?: AzExtTreeItem) => { const accountTreeItem = await selectStorageAccountTreeItemForCommand( treeItem, actionContext, @@ -91,9 +91,9 @@ export function registerCommands(): void { }); await accountTreeItem.disableStaticWebsite(actionContext); }); - registerCommand("azureStorage.createGpv2Account", createStorageAccount); - registerCommand("azureStorage.createGpv2AccountAdvanced", createStorageAccountAdvanced); - registerCommand('azureStorage.browseStaticWebsite', async (actionContext: IActionContext, treeItem?: AzExtTreeItem) => { + registerCommandWithTreeNodeUnwrapping("azureStorage.createGpv2Account", createStorageAccount); + registerCommandWithTreeNodeUnwrapping("azureStorage.createGpv2AccountAdvanced", createStorageAccountAdvanced); + registerCommandWithTreeNodeUnwrapping('azureStorage.browseStaticWebsite', async (actionContext: IActionContext, treeItem?: AzExtTreeItem) => { const accountTreeItem = await selectStorageAccountTreeItemForCommand( treeItem, actionContext, @@ -104,18 +104,18 @@ export function registerCommands(): void { await accountTreeItem.browseStaticWebsite(actionContext); }); - registerCommand("azureStorage.uploadFiles", uploadFiles); - registerCommand("azureStorage.uploadFolder", uploadFolder); - registerCommand("azureStorage.uploadToAzureStorage", uploadToAzureStorage); - registerCommand('azureStorage.downloadTreeItems', downloadTreeItems); - registerCommand('azureStorage.downloadSasUrl', downloadSasUrl); - registerCommand('azureStorage.generateSasUrl', generateSasUrl); - registerCommand("azureStorage.attachStorageAccount", async (actionContext: IActionContext) => { + registerCommandWithTreeNodeUnwrapping("azureStorage.uploadFiles", uploadFiles); + registerCommandWithTreeNodeUnwrapping("azureStorage.uploadFolder", uploadFolder); + registerCommandWithTreeNodeUnwrapping("azureStorage.uploadToAzureStorage", uploadToAzureStorage); + registerCommandWithTreeNodeUnwrapping('azureStorage.downloadTreeItems', downloadTreeItems); + registerCommandWithTreeNodeUnwrapping('azureStorage.downloadSasUrl', downloadSasUrl); + registerCommandWithTreeNodeUnwrapping('azureStorage.generateSasUrl', generateSasUrl); + registerCommandWithTreeNodeUnwrapping("azureStorage.attachStorageAccount", async (actionContext: IActionContext) => { await ext.attachedStorageAccountsTreeItem.attachWithConnectionString(actionContext); }); - registerCommand('azureStorage.detachStorageAccount', detachStorageAccount); - registerCommand('azureStorage.startBlobEmulator', async (actionContext: IActionContext) => { await startEmulator(actionContext, EmulatorType.blob); }, emulatorTimeoutMS); - registerCommand('azureStorage.startQueueEmulator', async (actionContext: IActionContext) => { await startEmulator(actionContext, EmulatorType.queue); }, emulatorTimeoutMS); - registerCommand('azureStorage.startTableEmulator', async (actionContext: IActionContext) => { await startEmulator(actionContext, EmulatorType.table); }, emulatorTimeoutMS); - registerCommand('azureStorage.showAzuriteExtension', async () => { await commands.executeCommand('extension.open', azuriteExtensionId); }); + registerCommandWithTreeNodeUnwrapping('azureStorage.detachStorageAccount', detachStorageAccount); + registerCommandWithTreeNodeUnwrapping('azureStorage.startBlobEmulator', async (actionContext: IActionContext) => { await startEmulator(actionContext, EmulatorType.blob); }, emulatorTimeoutMS); + registerCommandWithTreeNodeUnwrapping('azureStorage.startQueueEmulator', async (actionContext: IActionContext) => { await startEmulator(actionContext, EmulatorType.queue); }, emulatorTimeoutMS); + registerCommandWithTreeNodeUnwrapping('azureStorage.startTableEmulator', async (actionContext: IActionContext) => { await startEmulator(actionContext, EmulatorType.table); }, emulatorTimeoutMS); + registerCommandWithTreeNodeUnwrapping('azureStorage.showAzuriteExtension', async () => { await commands.executeCommand('extension.open', azuriteExtensionId); }); } diff --git a/src/commands/storageAccountActionHandlers.ts b/src/commands/storageAccountActionHandlers.ts index b62de78d4..121667bd9 100644 --- a/src/commands/storageAccountActionHandlers.ts +++ b/src/commands/storageAccountActionHandlers.ts @@ -3,7 +3,7 @@ * Licensed under the MIT License. See License.md in the project root for license information. *--------------------------------------------------------------------------------------------*/ -import { AzExtTreeItem, IActionContext, registerCommand } from '@microsoft/vscode-azext-utils'; +import { AzExtTreeItem, IActionContext, registerCommandWithTreeNodeUnwrapping } from '@microsoft/vscode-azext-utils'; import { ResolvedAppResourceTreeItem } from '@microsoft/vscode-azext-utils/hostapi'; import * as vscode from "vscode"; import { configurationSettingsKeys, extensionPrefix, storageFilter } from '../constants'; @@ -20,11 +20,11 @@ import { deleteNode } from './commonTreeCommands'; import { selectStorageAccountTreeItemForCommand } from './selectStorageAccountNodeForCommand'; export function registerStorageAccountActionHandlers(): void { - registerCommand("azureStorage.openStorageAccount", openStorageAccountInStorageExplorer); - registerCommand("azureStorage.copyPrimaryKey", copyPrimaryKey); - registerCommand("azureStorage.copyConnectionString", copyConnectionString); - registerCommand("azureStorage.deployStaticWebsite", deployStaticWebsite); - registerCommand("azureStorage.deleteStorageAccount", deleteStorageAccount); + registerCommandWithTreeNodeUnwrapping("azureStorage.openStorageAccount", openStorageAccountInStorageExplorer); + registerCommandWithTreeNodeUnwrapping("azureStorage.copyPrimaryKey", copyPrimaryKey); + registerCommandWithTreeNodeUnwrapping("azureStorage.copyConnectionString", copyConnectionString); + registerCommandWithTreeNodeUnwrapping("azureStorage.deployStaticWebsite", deployStaticWebsite); + registerCommandWithTreeNodeUnwrapping("azureStorage.deleteStorageAccount", deleteStorageAccount); } async function openStorageAccountInStorageExplorer(context: IActionContext, treeItem?: ResolvedAppResourceTreeItem): Promise { diff --git a/src/commands/table/tableActionHandlers.ts b/src/commands/table/tableActionHandlers.ts index 9fb246753..ba474355c 100644 --- a/src/commands/table/tableActionHandlers.ts +++ b/src/commands/table/tableActionHandlers.ts @@ -3,14 +3,14 @@ * Licensed under the MIT License. See License.md in the project root for license information. *--------------------------------------------------------------------------------------------*/ -import { IActionContext, registerCommand } from '@microsoft/vscode-azext-utils'; +import { IActionContext, registerCommandWithTreeNodeUnwrapping } from '@microsoft/vscode-azext-utils'; import { storageExplorerLauncher } from '../../storageExplorerLauncher/storageExplorerLauncher'; import { TableTreeItem } from '../../tree/table/TableTreeItem'; import { deleteNode } from '../commonTreeCommands'; export function registerTableActionHandlers(): void { - registerCommand("azureStorage.openTable", openTableInStorageExplorer); - registerCommand("azureStorage.deleteTable", deleteTable); + registerCommandWithTreeNodeUnwrapping("azureStorage.openTable", openTableInStorageExplorer); + registerCommandWithTreeNodeUnwrapping("azureStorage.deleteTable", deleteTable); } async function openTableInStorageExplorer(_context: IActionContext, treeItem: TableTreeItem): Promise { diff --git a/src/commands/table/tableGroupActionHandlers.ts b/src/commands/table/tableGroupActionHandlers.ts index b2a8bbfa7..a72291a63 100644 --- a/src/commands/table/tableGroupActionHandlers.ts +++ b/src/commands/table/tableGroupActionHandlers.ts @@ -3,12 +3,12 @@ * Licensed under the MIT License. See License.md in the project root for license information. *--------------------------------------------------------------------------------------------*/ -import { IActionContext, registerCommand } from '@microsoft/vscode-azext-utils'; +import { IActionContext, registerCommandWithTreeNodeUnwrapping } from '@microsoft/vscode-azext-utils'; import { TableGroupTreeItem } from '../../tree/table/TableGroupTreeItem'; import { createChildNode } from '../commonTreeCommands'; export function registerTableGroupActionHandlers(): void { - registerCommand("azureStorage.createTable", createTable); + registerCommandWithTreeNodeUnwrapping("azureStorage.createTable", createTable); } export async function createTable(context: IActionContext, treeItem?: TableGroupTreeItem): Promise { diff --git a/src/commands/uploadFiles/uploadFiles.ts b/src/commands/uploadFiles/uploadFiles.ts index 995ce8ff0..b9e355188 100644 --- a/src/commands/uploadFiles/uploadFiles.ts +++ b/src/commands/uploadFiles/uploadFiles.ts @@ -3,7 +3,7 @@ * Licensed under the MIT License. See License.md in the project root for license information. *--------------------------------------------------------------------------------------------*/ -import { AzureWizard, IActionContext, IWizardOptions, nonNullProp } from "@microsoft/vscode-azext-utils"; +import { AzExtTreeItem, AzureWizard, IActionContext, IWizardOptions, nonNullProp } from "@microsoft/vscode-azext-utils"; import { basename } from "path"; import { CancellationToken, Uri } from "vscode"; import { BlobContainerTreeItem } from "../../tree/blob/BlobContainerTreeItem"; @@ -18,6 +18,7 @@ import { UploadFilesStep } from "./UploadFilesStep"; export async function uploadFiles( context: IActionContext, treeItem?: BlobContainerTreeItem | FileShareTreeItem, + _selectedNodes?: AzExtTreeItem[], uris?: Uri[], cancellationToken?: CancellationToken, destinationDirectory?: string diff --git a/src/commands/uploadFolder/uploadFolder.ts b/src/commands/uploadFolder/uploadFolder.ts index 758b0821c..274a9af30 100644 --- a/src/commands/uploadFolder/uploadFolder.ts +++ b/src/commands/uploadFolder/uploadFolder.ts @@ -3,7 +3,7 @@ * Licensed under the MIT License. See License.md in the project root for license information. *--------------------------------------------------------------------------------------------*/ -import { AzureWizard, IActionContext, IWizardOptions, nonNullProp } from '@microsoft/vscode-azext-utils'; +import { AzExtTreeItem, AzureWizard, IActionContext, IWizardOptions, nonNullProp } from '@microsoft/vscode-azext-utils'; import { basename } from "path"; import * as vscode from 'vscode'; import { BlobContainerTreeItem } from '../../tree/blob/BlobContainerTreeItem'; @@ -18,6 +18,7 @@ import { UploadFolderStep } from './UploadFolderStep'; export async function uploadFolder( context: IActionContext, treeItem?: BlobContainerTreeItem | FileShareTreeItem, + _selectedNodes?: AzExtTreeItem[], uri?: vscode.Uri, cancellationToken?: vscode.CancellationToken, destinationDirectory?: string diff --git a/src/commands/uploadToAzureStorage.ts b/src/commands/uploadToAzureStorage.ts index cc68f3180..193df4532 100644 --- a/src/commands/uploadToAzureStorage.ts +++ b/src/commands/uploadToAzureStorage.ts @@ -84,10 +84,10 @@ export async function uploadToAzureStorage(context: IActionContext, _firstSelect await vscode.window.withProgress({ cancellable: true, location: vscode.ProgressLocation.Notification, title }, async (_notificationProgress, cancellationToken) => { for (const folderUri of folderUrisToUpload) { throwIfCanceled(cancellationToken, context.telemetry.properties, 'uploadToAzureStorage'); - errors.push(...(await uploadFolder(context, treeItem, folderUri, cancellationToken, destinationDirectory)).errors); + errors.push(...(await uploadFolder(context, treeItem, undefined, folderUri, cancellationToken, destinationDirectory)).errors); } - errors.push(...(await uploadFiles(context, treeItem, fileUrisToUpload, cancellationToken, destinationDirectory)).errors); + errors.push(...(await uploadFiles(context, treeItem, undefined, fileUrisToUpload, cancellationToken, destinationDirectory)).errors); }); if (errors.length === 1) { diff --git a/src/extension.ts b/src/extension.ts index 98a4b4ea6..1da93fd76 100644 --- a/src/extension.ts +++ b/src/extension.ts @@ -6,7 +6,7 @@ 'use strict'; import { registerAzureUtilsExtensionVariables } from '@microsoft/vscode-azext-azureutils'; -import { AzExtParentTreeItem, callWithTelemetryAndErrorHandling, createApiProvider, createAzExtOutputChannel, IActionContext, registerErrorHandler, registerReportIssueCommand, registerUIExtensionVariables } from '@microsoft/vscode-azext-utils'; +import { AzExtParentTreeItem, AzExtResourceType, callWithTelemetryAndErrorHandling, createApiProvider, createAzExtOutputChannel, IActionContext, registerErrorHandler, registerReportIssueCommand, registerUIExtensionVariables } from '@microsoft/vscode-azext-utils'; import { AzureExtensionApi, AzureExtensionApiProvider } from '@microsoft/vscode-azext-utils/api'; import { AzureHostExtensionApi } from '@microsoft/vscode-azext-utils/hostapi'; import * as vscode from 'vscode'; @@ -46,11 +46,11 @@ export async function activateInternal(context: vscode.ExtensionContext, perfSta if (rgApiProvider) { const api = rgApiProvider.getApi('0.0.1'); ext.rgApi = api; - api.registerApplicationResourceResolver('microsoft.storage/storageaccounts', new StorageAccountResolver()); + api.registerApplicationResourceResolver(AzExtResourceType.StorageAccounts, new StorageAccountResolver()); const workspaceRootTreeItem = (ext.rgApi.workspaceResourceTree as unknown as { _rootTreeItem: AzExtParentTreeItem })._rootTreeItem; const storageWorkspaceProvider = new StorageWorkspaceProvider(workspaceRootTreeItem); - ext.rgApi.registerWorkspaceResourceProvider('ms-azuretools.vscode-azurestorage', storageWorkspaceProvider); + ext.rgApi.registerWorkspaceResourceProvider('storageEmulator', storageWorkspaceProvider); } else { throw new Error('Could not find the Azure Resource Groups extension'); }