feat(desktop): add sorting to resource usage popover#3036
Conversation
Add a sort dropdown to the resource usage screen with four options: Memory (default, descending), CPU (descending), Name (alphabetical), and Sidebar order (matching the left sidebar's visual ordering). Sorting applies to both project groups and workspaces within each group.
|
Caution Review failedThe pull request is closed. ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (3)
📝 WalkthroughWalkthroughThese changes implement a workspace and project sorting feature in the Resource Consumption component. A sort dropdown control was added to the header, offering options to sort by memory, CPU, name, or sidebar order. New sorting functions were introduced to reorder both workspaces and project groups based on the selected option, utilizing live sidebar ordering data. Changes
Sequence DiagramsequenceDiagram
actor User
participant RC as ResourceConsumption
participant WRS as WorkspaceResourceSection
participant SortFns as Sorting Functions
User->>RC: Select sort option from dropdown
RC->>RC: Update sortOption state
RC->>RC: Fetch sidebar order via useLiveQuery
RC->>WRS: Pass sortOption + sidebar order props
WRS->>SortFns: Call sortProjectGroups()
SortFns->>SortFns: Reorder project groups by selected criteria
WRS->>SortFns: Call sortWorkspaces() per project
SortFns->>SortFns: Reorder workspaces by selected criteria
WRS->>WRS: Render sorted workspaces and projects
WRS-->>User: Display sorted resource usage
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Poem
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
🧹 Preview Cleanup CompleteThe following preview resources have been cleaned up:
Thank you for your contribution! 🎉 |
Summary
useLiveQuerycalls on sidebar collections for the sidebar order optionTest plan
Summary by cubic
Add a sort dropdown to the resource usage popover so you can sort projects and workspaces by Memory (default), CPU, Name, or Sidebar order. This makes it easier to spot heavy usage and mirror the left sidebar without affecting the refresh button.
useLiveQueryfrom@tanstack/react-dboverv2SidebarProjectsandv2WorkspaceLocalState.Written for commit a24c62b. Summary will update on new commits.
Summary by CodeRabbit