Skip to content

[UI] Empty states for the main tables#1179

Open
rnetuka wants to merge 1 commit into
wanaku-ai:mainfrom
rnetuka:prompts-table-empty-state
Open

[UI] Empty states for the main tables#1179
rnetuka wants to merge 1 commit into
wanaku-ai:mainfrom
rnetuka:prompts-table-empty-state

Conversation

@rnetuka
Copy link
Copy Markdown

@rnetuka rnetuka commented May 22, 2026

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:

  • Introduce a shared TableEmptyState component for rendering empty table content following Carbon empty state patterns.
  • Display contextual empty state messaging in Prompts, Forwards, Resources, Targets, and Tools tables when they have no rows.

Enhancements:

  • Standardize empty table presentation across multiple admin pages for a more consistent user experience.

@rnetuka rnetuka requested a review from orpiske May 22, 2026 13:33
@sourcery-ai
Copy link
Copy Markdown

sourcery-ai Bot commented May 22, 2026

Reviewer's Guide

Implements 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 logic

flowchart 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]
Loading

File-Level Changes

Change Details Files
Introduce a reusable Carbon-based empty table state component.
  • Create TableEmptyState React component that renders a full-width TableRow/TableCell with configurable title/body text.
  • Use Carbon Stack for vertical spacing and alignment, with inline styles for padding and Carbon text tokens for colors.
  • Expose colSpan prop so the component can span the correct number of columns for different tables.
apps/ui/admin/src/Pages/EmptyTableState.tsx
Wire the empty-state component into Prompts, Forwards, Resources, Targets, and Tools tables.
  • Import TableEmptyState into each table file and render it conditionally when the corresponding dataset length is zero.
  • Pass colSpan based on headers length (or headers length + 1 where an extra column exists) to keep the row layout correct.
  • Provide context-specific titles/bodies for Prompts, Forwards, Resources, and Tools, while leaving Targets’ text empty per current product requirements.
  • Refactor PromptsTable DataTable render prop to use a block body so the empty-state JSX can be appended after the mapped rows.
apps/ui/admin/src/Pages/Prompts/PromptsTable.tsx
apps/ui/admin/src/Pages/Forwards/ForwardsTable.tsx
apps/ui/admin/src/Pages/Resources/ResourcesTable.tsx
apps/ui/admin/src/Pages/Targets/TargetsTable.tsx
apps/ui/admin/src/Pages/Tools/ToolsTable.tsx

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

Copy link
Copy Markdown

@sourcery-ai sourcery-ai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey - I've found 1 issue, and left some high level feedback:

  • 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.
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>

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
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)"
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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. `

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant