Add SQL Managed Instance support and sorting (#7996)

- Add SQL Instances folder and support using existing SQLClient API
- Sort subscriptions in tree and quickpick for easier search
- Sort all resources (Databases, Servers, Instances) alphabetically too

Not in this PR:
- Will experiment with Graph API for faster perf & easier addition of other Azure resources such as PostgreSQL
This commit is contained in:
Kevin Cunnane
2019-10-24 15:18:49 -07:00
committed by GitHub
parent e28ecf44cb
commit 7babd6f3d0
10 changed files with 160 additions and 7 deletions

View File

@@ -80,11 +80,12 @@ export class AzureResourceAccountTreeNode extends AzureResourceContainerTreeNode
if (subscriptions.length === 0) {
return [AzureResourceMessageTreeNode.create(AzureResourceAccountTreeNode.noSubscriptionsLabel, this)];
} else {
return await Promise.all(subscriptions.map(async (subscription) => {
let subTreeNodes = await Promise.all(subscriptions.map(async (subscription) => {
const tenantId = await this._tenantService.getTenantId(subscription);
return new AzureResourceSubscriptionTreeNode(this.account, subscription, tenantId, this.appContext, this.treeChangeHandler, this);
}));
return subTreeNodes.sort((a, b) => a.subscription.name.localeCompare(b.subscription.name));
}
} catch (error) {
if (error instanceof AzureResourceCredentialError) {
@@ -163,4 +164,4 @@ export class AzureResourceAccountTreeNode extends AzureResourceContainerTreeNode
private _selectedSubscriptionCount = 0;
private static readonly noSubscriptionsLabel = localize('azure.resource.tree.accountTreeNode.noSubscriptionsLabel', "No Subscriptions found.");
}
}

View File

@@ -54,7 +54,7 @@ export class AzureResourceSubscriptionTreeNode extends AzureResourceContainerTre
// To make tree node's id unique, otherwise, treeModel.js would complain 'item already registered'
child.resourceNode.treeItem.id = `${this._id}.${child.resourceNode.treeItem.id}`;
return new AzureResourceResourceTreeNode(child, this, this.appContext);
});
}).sort((a, b) => a.nodePathValue.localeCompare(b.nodePathValue));
}
} catch (error) {
return [AzureResourceMessageTreeNode.create(AzureResourceErrorMessageUtil.getErrorMessage(error), this)];