fix: use EMPTY_DATA_PLACEHOLDER instead of hardcoded “no data”#3532
Conversation
| } | ||
|
|
||
| return <div className={`${b({size})} ${className} error`}>no data</div>; | ||
| return <div className={`${b({size})} ${className} error`}>{EMPTY_DATA_PLACEHOLDER}</div>; |
There was a problem hiding this comment.
Thank you for your contribution and effort on this task!
I wanted to clarify the requirements to make sure we're aligned. We don't need to change the default behavior of the component itself. Instead, the goal is to:
Review all the places where this component is currently used
Check if there's sufficient data in each case
When data is insufficient, render EMPTY_DATA_PLACEHOLDER instead of the component
So the changes should be made at the usage sites, not within the component's core logic.
I hope this clarifies things! Please let me know if you have any questions.
Thanks again for your help!
There was a problem hiding this comment.
Got it, thanks for the clarification.
I’ll revert the changes made inside the component and instead update the usage sites to conditionally render EMPTY_DATA_PLACEHOLDER when data is insufficient. This keeps the component’s default behavior unchanged while aligning with the requirement.
I’ll push the updates shortly.
| rowKey={getRowIndex} | ||
| wrapperClassName={b('table-wrapper')} | ||
| emptyDataMessage="No data" | ||
| emptyDataMessage={EMPTY_DATA_PLACEHOLDER} |
There was a problem hiding this comment.
The task was about table cells only, so this change is not needed.
69bcaec to
b1f40f7
Compare
Raubzeug
left a comment
There was a problem hiding this comment.
Thank you for the update. I think there might still be some confusion, so let me be more specific:
The task is to find all places where the ProgressViewer component is used in tables (table cells), and add data sufficiency checks in those specific cells.
So the steps would be:
- Search for all occurrences of ProgressViewer in table contexts
- For each table cell that renders ProgressViewer, add a check to verify if there's sufficient data
- If data is insufficient, render EMPTY_DATA_PLACEHOLDER instead of ProgressViewer
The component itself should remain unchanged - we only need to modify the table cells where it's being used.
Does this make sense? Let me know if you need any clarification!
Thanks for your patience!
| ? JSON.stringify(data).slice(1, -1) | ||
| : String(data); | ||
| return <Cell value={normalizedData} />; | ||
| const cell = row[name]; |
There was a problem hiding this comment.
For the query results table, let's skip these checks entirely. It's critically important that we don't substitute or alter any data in the query results - they should always display exactly what the query returns, even if the data appears insufficient.
There was a problem hiding this comment.
Thanks for the clarification that makes sense.
I understand now that
- I shouldn’t modify
QueryResultTableor alter query result values. - I only need to update table cells where
ProgressVieweris used. - The check should be added at the usage site, not inside the component.
Just to confirm:
Should “sufficient data” mean that both value and capacity are defined?
And should 0 still be treated as valid data?
I’ll revert the QueryResultTable changes and focus only on the relevant table cells.
Thanks for your guidance — I’m still learning the codebase.
There was a problem hiding this comment.
@Arunkoo no problem, our codebase is tricky, and issues may not be as clear as wanted unfortunately...
Sufficient data in this case means that isNumeric(value) === true.
Additional Comments (1)
The Consider returning a sentinel value like |
| const allocated = row.AllocatedSize; | ||
| const available = row.AvailableSize; | ||
|
|
||
| if (!isNumeric(allocated) || !isNumeric(available)) { |
There was a problem hiding this comment.
!isNumeric(available) is redundant here
Additional Comments (1)
|
|
Please rebase your branch to the latest main! |
a3f603c to
adbb375
Compare
Additional Comments (1)
Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time! |
adbb375 to
a7cc0a7
Compare
Additional Comments (2)
return <div className={`${b({size})} ${className} error`}>no data</div>;Guards were added here and in To achieve full consistency across all usages without per-callsite guards, consider also updating the fallback in
|
…ues in vdisk size cell
…k size ProgressViewer
a7cc0a7 to
654b9db
Compare
Additional Comments (1)
|
Replaces hardcoded "No data" text in table empty states with the shared EMPTY_DATA_PLACEHOLDER constant.
Updated ProgressViewer and TopicPreviewTable to use the placeholder. Verified locally in dev mode.
Greptile Summary
This PR improves empty state handling across node and storage tables by replacing hardcoded "No data" text with the shared
EMPTY_DATA_PLACEHOLDERconstant and addingisNumericguards before renderingProgressViewercomponents.Changes verified:
src/components/nodesColumns/columns.tsx: Four columns (getRAMColumn,getMemoryColumn,getCpuColumn,getLoadAverageColumn) now include defensiveisNumericchecks before rendering progress bars, falling back to the placeholder when data is missing or non-numeric.src/containers/Node/NodeStructure/Pdisk.tsx: The VDisk Size column adds anisNumericguard forAllocatedSize. One minor improvement: the capacity expression should reuse the already-extracted and validatedallocatedvariable instead of re-readingrow.AllocatedSizedirectly.All changes follow existing codebase patterns and are consistent with similar defensive checks in other columns (e.g.,
getConnectionsColumn,getNetworkUtilizationColumn).Confidence Score: 4/5
allocatedvariable in the capacity expression for consistency.Last reviewed commit: 654b9db