Skip to content
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

API Upgrade - Migrating Tree View to V2 #2514

Open
20 of 22 tasks
tnaum-ms opened this issue Dec 5, 2024 · 0 comments · May be fixed by #2477
Open
20 of 22 tasks

API Upgrade - Migrating Tree View to V2 #2514

tnaum-ms opened this issue Dec 5, 2024 · 0 comments · May be fixed by #2477
Assignees
Milestone

Comments

@tnaum-ms
Copy link
Collaborator

tnaum-ms commented Dec 5, 2024

API Upgrade - Migrating Tree View to V2

The extension uses the Azure Resources extension to display database resources in a tree view. The API for providing data to the tree view has recently been upgraded to v2, introducing the BranchDataProvider interface. This interface enables more modular and extensible tree views by allowing specific "branches" of the tree to be controlled independently by registered data providers.

While the newly added MongoDB Clusters (Azure Cosmos DB for MongoDB (vCore)) already uses the v2 API, the implementations for MongoDB RU, NoSQL, and Postgres are still based on the v1 API. This task involves migrating these older implementations to v2 to align with modern standards.

The v2 API leverages the BranchDataProvider interface, which extends VS Code's native TreeDataProvider to create extensible, branch-specific resource trees. This provides:

  1. Branch Control: Each branch in the tree view is managed by a BranchDataProvider.
  2. Registration Mechanism: Resource types must register their respective BranchDataProvider in the extension manifest.
  3. Improved Modularity: Enables granular control over tree items, making the architecture more flexible and maintainable.

Key methods in the BranchDataProvider interface:

  • getChildren(element: TModel): ProviderResult<TModel[]>
    Retrieves child nodes for a given tree item, ensuring hierarchical navigation.
  • getResourceItem(element: TResource): TModel | Thenable<TModel>
    Maps a specific resource to its corresponding tree model element, ensuring compatibility with the resource's starting branch item.

Special Considerations

  1. Workspace Data Provider Independence
    Special care is required for the workspace data provider, as creating resources in this provider must not depend on the presence of an existing Azure subscription. The implementation should ensure that workspace-level resource creation is independent of Azure-specific requirements, maintaining a consistent user experience for non-Azure scenarios.

  2. Improved Security for User-Provided Secrets
    A dedicated work item will focus on enhancing the security of user-provided secrets, such as connection strings or authentication keys, used in the workspace data provider. This will include:

    • Secure storage and retrieval mechanisms for secrets.
    • Clear guidelines and warnings for handling sensitive information.

Tracking Azure Cosmos DB for MongoDB (RU)

Tree Items

  • Account Level
  • Database Level
  • Collection Level

Commands

  • New Mongo Scrapbook
    • This is the only one that seems not to be wired to any tree item

Context-Menu: Account Level

  • Create Database
  • Delete Account
  • Ask Azure
  • Copy Connection String
  • Edit Tags
  • View Properties
  • Open in Portal
  • Refresh

Context-Menu: Database Level

  • Create Collection
  • Delete Database
  • Connect to Database
    • This one is tightly coupled to the "MongoDB Scrapbook" feature, a feature to be revisited.
  • Refresh

Context-Menu: Collection Level

  • Create Document
  • Open Collection
    • This opens the entire collection content as one big view, very risky for large collections.
    • Discuss deleting this feature and replacing with a Mongo Clusters collection viewer
    • Figure out why this feature was created
  • Import documents into container
  • Delete Collection
  • Refresh

Document Level

  • Removing this feature
  • Adding the new Collection View available for Mongo Clusters
@tnaum-ms tnaum-ms added this to the 0.24.2 milestone Dec 5, 2024
@tnaum-ms tnaum-ms linked a pull request Dec 5, 2024 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants