feat: Add Assets page to support Assets API visualization #164
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.
Fixes #28
What does this PR change?
Creates src/services/assets.js - a new service class to interact with the Assets API
Creates src/pages/Assets.js - a new page component displaying assets in a table format with pagination
Updates src/route.js to include the /assets route
Updates src/components/Nav/SidebarNav.js to add "Assets" navigation item in the sidebar with Storage icon
Provides UI visualization for infrastructure assets (nodes, storage, load balancers, etc.) that was previously only available via API
Does this PR relate to any other PRs?
No, this is a standalone feature implementation
How will this PR impact users?
New Feature: Adds a new "Assets" page accessible from the sidebar navigation
User Experience: Provides consistent UI/UX with existing pages (Allocations, Cloud Costs, External Costs)
Functionality: Users can:
View infrastructure assets in a table format
Filter assets by time window (today, 7d, 14d, etc.)
Convert costs to different currencies
View total cost across all assets
Navigate through paginated asset lists
No Breaking Changes: This is purely additive - no existing functionality is modified or removed
Does this PR address any GitHub or Zendesk issues?
How was this PR tested?
Verified Assets page loads correctly and displays assets from the API
Tested time window selection (today, 7d, 14d, etc.)
Tested currency conversion functionality
Tested pagination with different page sizes (10, 25, 50 rows)
Verified error handling when backend is unavailable
Tested loading states display correctly
Verified navigation integration (sidebar link works)
Confirmed URL parameters persist correctly (window, currency)
Tested refresh functionality
Code Review:
Follows existing code patterns and architecture
Uses Material-UI components consistently with other pages
Proper error handling and loading states implemented
No linter errors
Integration Testing:
Verified route configuration works correctly
Confirmed API service integrates with existing api_client.js
Tested with different backend configurations
Does this PR require changes to documentation?
The Assets API endpoint already exists and is documented
This PR only adds UI visualization for existing API functionality
Future consideration: If user-facing documentation exists, it may benefit from mentioning the new Assets page in the UI
Have you labeled this PR and its corresponding Issue as "next release" if it should be part of the next OpenCost release? If not, why not?
This PR should be considered for next release because:
It completes a missing piece of functionality (Assets API was available but not accessible in UI)
It's a valuable visualization feature for users
It's necessary for future Carbon Costs feature (/assets/carbon) mentioned in the issue
No breaking changes, purely additive feature
Low risk implementation following established patterns