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

Showing Fleets in the Treeview #1237

Merged
merged 18 commits into from
Feb 12, 2025
Merged

Showing Fleets in the Treeview #1237

merged 18 commits into from
Feb 12, 2025

Conversation

JunyuQian
Copy link
Contributor

Showing Fleets in the Treeview

This PR adds the Fleet resource to the treeview, based on @serbrech's initial work. The image below shows the final result of the treeview.
treeview

Due to the special characteristics that a Fleet can have member clusters from different subscriptions, the initial treeview design, which classifies clusters based on subscriptions, does not quite fit Fleets. The current design can be summarized into three cases below:
design

Key Changes

New Files

  • fleet-tree-icon.png: The fleet icon displayed in the treeview.
  • fleetTreeItem.ts: The class responsible for the Fleet node in the treeview. It includes the createFleetTreeNode function and all necessary properties.

Modified Files

  • package.json & arm.ts: Included the arm resource Graph API which is used to fetch resources in a more efficient way.
  • azure-api-util.ts: Modified the parseResource function to enable parsing a member cluster to a cluster resource.
  • azureResources.ts: Defined the DefinedFleetMemberWithGroup type and Fleet-related resource types. Added functions to retrieve all clusters and Fleets using Graph API and convert a FleetMember to a DefinedFleetMemberWithGroup.
  • clusterfilter.ts: Used Graph API to fetch all resources efficiently.
  • config.ts: Added the interface that fits to both clusters and Fleets.
  • aksClusterTreeItem.ts: Modified the parent node type so that the parent node of a cluster can be either a subscription or a Fleet.
  • subscriptionTreeItem.ts: Merged the cluster filter #1208 into the current PR. Added the process of fetching fleets and mapping members to their corresponding fleets before loading.

Some known issues are:

  • When the user clicks the filter button next to a subscription, the cluster pool only contains clusters from the current subscription. However, as mentioned above, a Fleet can have member clusters from different subscriptions. In this case, member clusters from other subscriptions will never be visible to the user. The user must go to the corresponding subscription to see the member clusters. It also makes sense to leave it as it is since it is a filter based on the subscription and there might not be a need to have members from another subscription.
    no external cluster
  • Once the user sets some filter conditions, there is no way to clear the filter. This issue has been discussed, and later the user will be able to clear the conditions by unselecting all the filtering conditions.

Next Steps

  • Implement the hasMoreChildren function in fleetTreeItems.ts, so that the resources will be loaded gradually (e.g., load 10 lines, and display the "load more" button), rather than load them all at once. Currently, in the testing environment, the number of resources is not quite big. But in reality, it should have the ability to handle a large amount of resources.

Last but not least, a huge thank-you to @serbrech and @Tatsinnit, who provided immense assistance to this PR and spent hours peer-programming with me ❤️ Looking forward to moving on to the next feature!

@Tatsinnit
Copy link
Member

Tatsinnit commented Feb 12, 2025

🎊 Than you for this, can we please close most of the PR which are representing same work like: #1220 , #1219 & #1210 which are doing same thing I guess, I have close #1224

Thanks you!

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot reviewed 7 out of 11 changed files in this pull request and generated no comments.

Files not reviewed (4)
  • package.json: Language not supported
  • src/commands/utils/arm.ts: Evaluated as low risk
  • src/tree/aksClusterTreeItem.ts: Evaluated as low risk
  • src/commands/utils/clusterfilter.ts: Evaluated as low risk
@Tatsinnit Tatsinnit added the enhancement 🚀 New feature or request or improvements on existing code. label Feb 12, 2025
@JunyuQian
Copy link
Contributor Author

Here is the VSIX file for the webview test. Please let me know if there is any issue. Thank you :)
vscode-aks-tools-1.5.5-treeview-vsix.vsix.zip

Copy link
Collaborator

@ReinierCC ReinierCC left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tested VSIX on Windows, Looks good!

Copy link
Collaborator

@tejhan tejhan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tested v6 & everythings working great, LGTM 👍

Copy link
Collaborator

@hsubramanianaks hsubramanianaks left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, except few comments which can be handled as incremental PR's. Thank you @JunyuQian

@Tatsinnit Tatsinnit merged commit 990922d into Azure:main Feb 12, 2025
9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement 🚀 New feature or request or improvements on existing code.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants