[UI] Empty states for the main tables#1179
Open
rnetuka wants to merge 1 commit into
Open
Conversation
Reviewer's GuideImplements a reusable Carbon-style TableEmptyState component and integrates it across key admin tables (Prompts, Forwards, Resources, Targets, Tools) to show consistent empty-state messaging when there is no data. Flow diagram for table empty-state rendering logicflowchart TD
A[Render table body] --> B{Has rows?}
B -- Yes --> C[Render data rows]
B -- No --> D[Render TableEmptyState]
D --> E[TableRow with single TableCell]
E --> F[Stack with title and body text]
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
There was a problem hiding this comment.
Hey - I've found 1 issue, and left some high level feedback:
- In
TableEmptyState,alignItems: "left"andjustifyContent: "left"are not valid flex alignment values; consider using"flex-start"for both to ensure predictable layout across browsers. - Instead of requiring
titleandbodystrings (and passing empty strings for Targets), consider making these props optional and conditionally rendering the<h4>and<p>elements when values are provided. - For the empty-state checks (e.g.,
fetchedData.length == 0), prefer strict equality (===) to avoid unintended truthiness quirks and stay consistent with typical TypeScript/JavaScript style.
Prompt for AI Agents
Please address the comments from this code review:
## Overall Comments
- In `TableEmptyState`, `alignItems: "left"` and `justifyContent: "left"` are not valid flex alignment values; consider using `"flex-start"` for both to ensure predictable layout across browsers.
- Instead of requiring `title` and `body` strings (and passing empty strings for Targets), consider making these props optional and conditionally rendering the `<h4>` and `<p>` elements when values are provided.
- For the empty-state checks (e.g., `fetchedData.length == 0`), prefer strict equality (`===`) to avoid unintended truthiness quirks and stay consistent with typical TypeScript/JavaScript style.
## Individual Comments
### Comment 1
<location path="apps/ui/admin/src/Pages/EmptyTableState.tsx" line_range="15-19" />
<code_context>
+ return (
+ <TableRow>
+ <TableCell colSpan={colSpan}>
+ <Stack gap={6} style={{
+ alignItems: "left",
+ justifyContent: "left",
+ padding: "4rem 0",
+ color: "var(--cds-text-secondary)"
+ }}>
+ <div style={{ textAlign: "left", paddingLeft: "4rem" }}>
</code_context>
<issue_to_address>
**issue (bug_risk):** The `alignItems` and `justifyContent` values of `"left"` are not valid flexbox values.
These properties should use valid flexbox values like `flex-start` or `center`. `
</issue_to_address>Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
Comment on lines
+15
to
+19
| <Stack gap={6} style={{ | ||
| alignItems: "left", | ||
| justifyContent: "left", | ||
| padding: "4rem 0", | ||
| color: "var(--cds-text-secondary)" |
There was a problem hiding this comment.
issue (bug_risk): The alignItems and justifyContent values of "left" are not valid flexbox values.
These properties should use valid flexbox values like flex-start or center. `
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Empty table state according to Carbon patterns:
https://carbondesignsystem.com/patterns/empty-states-pattern/
Implemented as a reusable component.
Capabilities/Targets doesn't have any text since there is currently no Add/Edit feature for these.
NamespaceTable doesn't have it since there will be always at least public and default namespaces.
Summary by Sourcery
Add reusable empty state component for main admin tables when no data is available.
New Features:
Enhancements: