-
Notifications
You must be signed in to change notification settings - Fork 16
fix: incorrect storage group count #2653
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
Conversation
bugbot run |
Claude finished @astandrik's task —— View job PR Review: Fix incorrect storage group countI've reviewed the changes in this PR that addresses issue #2650. Here's my comprehensive feedback: ✅ Positive Aspects
🔍 Issues and Suggestions1. Missing PropTypes Documentation (src/containers/Tenant/Diagnostics/TenantOverview/MetricsTabs/MetricsTabs.tsx:33)The 2. Simplified TabCard Interface (src/containers/Tenant/Diagnostics/TenantOverview/TabCard/TabCard.tsx)The removal of the 3. Performance Consideration (src/containers/Tenant/Diagnostics/TenantOverview/MetricsTabs/MetricsTabs.tsx:60-72)The storage groups API call is made with 4. Conditional Text Display (src/containers/Tenant/Diagnostics/TenantOverview/MetricsTabs/MetricsTabs.tsx:139-142)The conditional rendering logic for storage text is clean and follows the i18n pattern correctly: text={
storageGroupCount === undefined
? i18n('cards.storage-label')
: i18n('context_storage-groups', {count: storageGroupCount})
} ✅ Code Standards Compliance
📋 Testing RecommendationsWhile the code changes look good, consider adding tests for:
SummaryThe fix correctly addresses the issue of incorrect storage group count by fetching the actual count from the API instead of using the array length. The implementation follows all the project's coding standards and best practices. The changes are minimal and focused on solving the specific problem. |
src/containers/Tenant/Diagnostics/TenantOverview/MetricsTabs/MetricsTabs.tsx
Outdated
Show resolved
Hide resolved
const groupsHandlerAvailable = useStorageGroupsHandlerAvailable(); | ||
const [autoRefreshInterval] = useAutoRefreshInterval(); | ||
|
||
const {currentData: storageGroupsData} = storageApi.useGetStorageGroupsInfoQuery( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You have StorageGroups
inside tenant data, there is no need to use storage handler
https://github.com/ydb-platform/ydb-embedded-ui/blob/main/src/types/api/tenant.ts#L56
/claude_review |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR fixes an incorrect storage group count display by passing the actual storage groups count from tenant data instead of calculating it from storage statistics array length. The fix ensures that the storage tab shows the correct number of storage groups as provided by the backend API.
Key Changes
- Pass
storageGroupsCount
from tenant data through the component hierarchy - Simplify
TabCard
component by consolidatinglabel
andsublabel
props into a singletext
prop - Update storage group count logic to use actual tenant data instead of derived statistics
Reviewed Changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.
File | Description |
---|---|
TenantOverview.tsx | Pass storageGroupsCount from tenantData.StorageGroups to MetricsTabs component |
TabCard.tsx | Simplify props by replacing label and sublabel with single text prop |
MetricsTabs.tsx | Accept storageGroupsCount prop and use it instead of calculating from stats array length |
tabletStorageStats={tabletStorageStats} | ||
networkStats={networkStats} | ||
storageGroupsCount={ | ||
tenantData.StorageGroups |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Using Number() constructor without validation could cause issues if tenantData.StorageGroups contains non-numeric values. Consider using parseInt() with explicit base or adding validation to ensure the value is numeric before conversion.
tenantData.StorageGroups | |
tenantData.StorageGroups && | |
!isNaN(Number(tenantData.StorageGroups)) |
Copilot uses AI. Check for mistakes.
Claude finished @astandrik's task —— View job PR Review: Fix incorrect storage group countI've reviewed the changes that address issue #2650. The fix correctly passes the actual storage group count from tenant data instead of calculating it from the storage statistics array. ✅ Positive Aspects
📋 Code Standards ReviewTypeScript & Type Safety ✅
React Best Practices ✅
Redux/RTK Patterns ✅
i18n Usage ✅storageGroupsCount === undefined
? i18n('cards.storage-label')
: i18n('context_storage-groups', {count: storageGroupsCount})
API Usage ✅
🔍 Minor Observations
⚡ Performance & Security
✅ BEM Naming & Code Style
SummaryThis is a well-implemented fix that addresses the issue correctly while maintaining all project standards. The change is minimal, focused, and follows the codebase conventions perfectly. The solution leverages existing API data efficiently without introducing complexity. Great work on keeping the fix simple and maintainable! 👍 |
Closes #2650
Stand
CI Results
Test Status:⚠️ FLAKY
📊 Full Report
Test Changes Summary ⏭️2
⏭️ Skipped Tests (2)
Bundle Size: ✅
Current: 85.36 MB | Main: 85.36 MB
Diff: +0.00 KB (0.00%)
✅ Bundle size unchanged.
ℹ️ CI Information