Fix error when using azure-account deployment field (#8992)

* Fix error when using azure-account deployment field

* Make param optional

* Remove extra comment
This commit is contained in:
Charles Gagnon
2020-01-30 16:51:10 -08:00
committed by GitHub
parent 637a33c7a7
commit 261e6fa89e
2 changed files with 45 additions and 30 deletions

View File

@@ -23,7 +23,10 @@ import { AzureResourceGroupService } from './providers/resourceGroup/resourceGro
export function registerAzureResourceCommands(appContext: AppContext, tree: AzureResourceTreeProvider): void {
// Resource Management commands
appContext.apiWrapper.registerCommand('azure.accounts.getSubscriptions', async (account: azdata.Account) => {
appContext.apiWrapper.registerCommand('azure.accounts.getSubscriptions', async (account?: azdata.Account): Promise<azureResource.AzureResourceSubscription[]> => {
if (!account) {
return [];
}
const subscriptions = <azureResource.AzureResourceSubscription[]>[];
try {
const subscriptionService = appContext.getService<IAzureResourceSubscriptionService>(AzureResourceServiceNames.subscriptionService);
@@ -41,7 +44,10 @@ export function registerAzureResourceCommands(appContext: AppContext, tree: Azur
return subscriptions;
});
appContext.apiWrapper.registerCommand('azure.accounts.getResourceGroups', async (account: azdata.Account, subscription: azureResource.AzureResourceSubscription) => {
appContext.apiWrapper.registerCommand('azure.accounts.getResourceGroups', async (account?: azdata.Account, subscription?: azureResource.AzureResourceSubscription): Promise<azureResource.AzureResourceResourceGroup[]> => {
if (!account || !subscription) {
return [];
}
try {
const service = new AzureResourceGroupService();
const resourceGroups: azureResource.AzureResourceResourceGroup[] = [];