-
Notifications
You must be signed in to change notification settings - Fork 72
Add an UriHandler to handle external requests to open/attach a specific account and open the Query Editor #2635
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Draft
sevoku
wants to merge
24
commits into
main
Choose a base branch
from
dev/sevoku/open-from-url
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+1,505
−479
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This also allows attaching Cosmos DB accounts without an account key, Entra ID will be used instead automatically.
and extract the account name from the endpoint with ParsedCosmosDBConnectionString
…odes and by providing an existing NoSqlQueryConnection directly
…extension Based on given parameters: * Reveal a matching account node in the Azure Tree * Attach the account if it is not an Azure resource * Open the Query editor for a given collection
…rameters in Azure resource revealing This change requires an upstream change: microsoft/vscode-azureresourcegroups#1107
…anchDataProvider and implement getParent to enable vscode.TreeView revealing of the children.
…rent retrieval functionality
…rameters in Workspace resource revealing This change requires an upstream change: microsoft/vscode-azureresourcegroups#1108
…nd progress indication
bk201-
reviewed
Apr 2, 2025
To enable TreeView.reveal we need all elements to have nested Ids separated by '/'. Emulators were stored with their connection string as Id which can have '/' in it breaking the convention. This changes emulators to always have a compatible Id and a unified structure.
6f71d5f
to
8663850
Compare
…rove parent-child relationship handling
…CachedBranchDataProvider - Introduced BaseCachedBranchDataProvider as a common base class for caching tree data. - Updated CosmosDBBranchDataProvider to utilize the new base class, simplifying the implementation and enhancing caching logic. - Refactored MongoVCoreBranchDataProvider to extend BaseCachedBranchDataProvider, improving code reuse and maintainability. - Simplified CosmosDBWorkspaceBranchDataProvider and ClustersWorkspaceBranchDataProvider by extending BaseCachedBranchDataProvider, reducing boilerplate code and enhancing clarity. - Removed redundant caching logic and event emitters in favor of the base class's functionality.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR adds a UriHandler with following features:
Following parameters are supported (with dependencies):
resourceId
: The full Azure Resource Id of the accountvscode://ms-azuretools.vscode-cosmosdb?resourceId=[accountResourceId]
cs
: The NoSQL/Mongo Connection String (For NoSQL optionally with or without theAccountKey
parameter,AccountEndpoint
is enough to authenticate with EntraID RBAC)subscriptionId
: Azure Subscription IDresourceGroup
: Azure Resource Group Name (required forcs
)tenantId
: Id of the tenant the resource belongs to (TODO: not yet implemented!)vscode://ms-azuretools.vscode-cosmosdb?subscriptionId=[subscriptionId]&resourceGroup=[resourceGroupName]&cs=AccountEndpoint=[connectionString]
database
: Database Namecontainer
: Container/Collection Namevscode://ms-azuretools.vscode-cosmosdb?resourceId=[accountResourceId]&database=[databaseName]&container=[containerName]
IMPORTANT: parameters – especially
cs
– must be encoded using urlEncode()!Examples:
Dependency Updates:
package.json
to includeonView:azureResourceGroups
andonUri
.@microsoft/vscode-azext-utils
to version2.6.6
. [1]Function Enhancements:
openNoSqlQueryEditor
function to handle different input types and added a helper function to extract connections from container nodes insrc/commands/openNoSqlQueryEditor/openNoSqlQueryEditor.ts
.Cosmos DB Connection Handling:
accountName
getter toParsedConnectionString
class insrc/ParsedConnectionString.ts
.parseCosmosDBConnectionString
andParsedCosmosDBConnectionString
classes insrc/cosmosdb/cosmosDBConnectionStrings.ts
. [1] [2]getAccountInfo
function insrc/tree/cosmosdb/AccountInfo.ts
.Miscellaneous:
src/extension.ts
to handle URIs.TODO:
tenantId
parameter to support multi-tenant configsClustersWorkspaceBranchDataProvider.getParent()
similar toCosmosDBWorkspaceBranchDataProvider
MongoVCoreBranchDataProvider.getPArent()
similar toCosmosDBBranchDataProvider
openAppropriateEditorForConnection()
revealAttachedInWorkspaceExplorer
to userevealWorkspaceResource
once Add revealWorkspaceResource function to expose resources in Workspaces vscode-azureresourcegroups#1108 becomes available in @microsoft/vscode-azext-azureutils.BranchDataProvider.refresh()
is never called for root node, i.e. select to "Refresh" a resource group, it will callgetResourceItem(resource)
right away, so there is no way for us to cache root (account/cluster) nodes. We need to either patch this in Azure Resources or find another way to detect whether to invalidate cache or not (maybe a timestamp on the resource model?)Fixes #2532
Fixes partially #2620