Skip to content

feat(frontend): improve devices empty state - #2923

Merged
WcaleNieWolny merged 7 commits into
mainfrom
wolny/improve-devices-empty-state
Aug 7, 2026
Merged

feat(frontend): improve devices empty state#2923
WcaleNieWolny merged 7 commits into
mainfrom
wolny/improve-devices-empty-state

Conversation

@WcaleNieWolny

@WcaleNieWolny WcaleNieWolny commented Aug 7, 2026

Copy link
Copy Markdown
Contributor

Summary

  • replace the generic Devices empty row with an informational checklist
  • add accessible inline actions for changing the date range, clearing filters, and refreshing
  • preserve the generic DataTable fallback for all other tables
  • expose DateRangePicker opening for the inline empty-state action

Test plan

  • bun lint
  • bun typecheck
  • bun test:unit (1,397 tests)
  • CHOKIDAR_USEPOLLING=1 bun run build
  • SKIP_STRIPE_EMULATOR_START=1 bunx playwright test playwright/e2e/devices-empty-state.spec.ts --project=chromium (2 tests)

Screenshots

Tested locally against the production-backed frontend.

Checklist

  • My code follows the code style of this project and passes bun run lint:backend && bun run lint.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • My change has adequate E2E test coverage.
  • I have tested my code manually, and I have provided steps how to reproduce my tests.

View with [code]smith Autofix with [code]smith
Need help on this PR? Tag @codesmith-bot with what you need. Autofix is disabled.

Review in cubic

Summary by CodeRabbit

  • New Features

    • Added a helpful Devices empty state with guidance about possible causes.
    • Users can change the date range, clear active filters or search, and refresh device data directly from the empty state.
    • Date-range dialogs now return focus to the element that opened them.
  • Accessibility

    • Improved keyboard focus behavior when opening and closing the date-range picker.
  • Tests

    • Added coverage for empty-state actions, filtering, refreshing, and focus behavior.

@coderabbitai

coderabbitai Bot commented Aug 7, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Warning

Review limit reached

You’ve reached a temporary PR review limit under our Fair Usage Limits Policy.

Your recent review volume is higher than typical usage, so adaptive limits are currently applied.

Next review available in: 43 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro

Run ID: 470fcb33-d8c4-4671-8f3c-3ca8df050123

📥 Commits

Reviewing files that changed from the base of the PR and between 97b7720 and a29a3a8.

📒 Files selected for processing (2)
  • playwright/e2e/devices-empty-state.spec.ts
  • src/components/tables/DeviceTable.vue
📝 Walkthrough

Walkthrough

The devices table now provides a localized custom empty state with actions. DataTable supports filter clearing and custom empty-state slots. DateRangePicker restores focus after programmatic use. Playwright tests cover the new behavior.

Changes

Devices empty-state flow

Layer / File(s) Summary
DataTable empty-state contract
src/components/DataTable.vue
DataTable exposes active-filter state, clears search and filters, resets pagination, and supports custom empty-state content.
Device table actions and focus handling
src/components/tables/DeviceTable.vue, src/components/DateRangePicker.vue, messages/en.json
DeviceTable renders localized empty-state actions. DateRangePicker supports programmatic opening and restores focus to the invoking element.
Empty-state validation and supporting updates
playwright/e2e/devices-empty-state.spec.ts, src/components/admin/AdminFilterBar.vue, tests/cli-app-permission-helper.test.ts
Playwright tests verify empty results, explanatory content, date-range focus restoration, refresh parameters, and filter clearing. Supporting router-query typing and a test mock are updated.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Sequence Diagram(s)

sequenceDiagram
  participant DeviceTable
  participant DataTable
  participant DateRangePicker
  DeviceTable->>DataTable: Render custom empty state
  DeviceTable->>DateRangePicker: Open picker from empty-state action
  DateRangePicker-->>DeviceTable: Restore focus on close
  DeviceTable->>DataTable: Clear search and device filters
  DataTable-->>DeviceTable: Reset pagination and reload
Loading

Possibly related PRs

Suggested labels: codex

Suggested reviewers: riderx

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and concisely describes the primary devices empty-state improvement.
Description check ✅ Passed The description includes the required summary, test plan, screenshots note, and checklist with relevant items completed.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Create stacked PR
  • Commit on current branch

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot added the codex label Aug 7, 2026
@codspeed-hq

codspeed-hq Bot commented Aug 7, 2026

Copy link
Copy Markdown
Contributor

Merging this PR will not alter performance

✅ 43 untouched benchmarks
⏩ 2 skipped benchmarks1


Comparing wolny/improve-devices-empty-state (a29a3a8) with main (c736895)

Open in CodSpeed

Footnotes

  1. 2 benchmarks were skipped, so the baseline results were used instead. If they were deleted from the codebase, click here and archive them to remove them from the performance reports.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@src/components/tables/DeviceTable.vue`:
- Around line 604-634: Add the DaisyUI d-btn d-btn-link classes to the three
inline action buttons in the empty-state list—openDateRangePicker,
clearDeviceViewFilters, and refreshData—while preserving their existing inline
sizing and styling utilities.
🪄 Autofix

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro

Run ID: 4316422e-7189-42c5-8626-cd53c9e22620

📥 Commits

Reviewing files that changed from the base of the PR and between 4a50144 and 19be590.

📒 Files selected for processing (5)
  • messages/en.json
  • playwright/e2e/devices-empty-state.spec.ts
  • src/components/DataTable.vue
  • src/components/DateRangePicker.vue
  • src/components/tables/DeviceTable.vue
🔗 Linked repositories identified

CodeRabbit considers these linked repositories for cross-repo context during reviews:

  • Cap-go/capacitor-updater (manual)

Comment thread src/components/tables/DeviceTable.vue

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

All reported issues were addressed

Reply with feedback, questions, or to request a fix.

Re-trigger cubic

Comment thread src/components/DataTable.vue
Comment thread playwright/e2e/devices-empty-state.spec.ts Outdated
Comment thread src/components/tables/DeviceTable.vue

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

1 issue found across 3 files (changes from recent commits).

Confidence score: 4/5

  • In src/components/DateRangePicker.vue, the empty-state “change time” control can only reopen (not close) the picker because clicks on the positionAnchor are excluded from click-outside handling and the handler always calls openPicker; users can get stuck with a picker that won’t toggle as expected, so the action should switch between open/close (or delegate to a true toggle handler).
Prompt for AI agents (unresolved issues)

Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.


<file name="src/components/DateRangePicker.vue">

<violation number="1" location="src/components/DateRangePicker.vue:188">
P3: The empty-state 'change time' action can't toggle the picker closed: clicks on it are excluded from click-outside (positionAnchor) and its handler always calls openPicker, so clicking it again while open just re-syncs the draft and silently discards any selection made, unlike the toolbar trigger which toggles. Recommend making the invoker act as a toggle (expose/check isOpen) so a second click closes the picker.</violation>
</file>

Tip: Review your code locally with the cubic CLI to iterate faster.

Re-trigger cubic

onClickOutside(popoverRef, (event) => {
const target = event.target as Node | null
if (target && triggerRef.value?.contains(target))
if (target && (triggerRef.value?.contains(target) || positionAnchor.value?.contains(target)))

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P3: The empty-state 'change time' action can't toggle the picker closed: clicks on it are excluded from click-outside (positionAnchor) and its handler always calls openPicker, so clicking it again while open just re-syncs the draft and silently discards any selection made, unlike the toolbar trigger which toggles. Recommend making the invoker act as a toggle (expose/check isOpen) so a second click closes the picker.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At src/components/DateRangePicker.vue, line 188:

<comment>The empty-state 'change time' action can't toggle the picker closed: clicks on it are excluded from click-outside (positionAnchor) and its handler always calls openPicker, so clicking it again while open just re-syncs the draft and silently discards any selection made, unlike the toolbar trigger which toggles. Recommend making the invoker act as a toggle (expose/check isOpen) so a second click closes the picker.</comment>

<file context>
@@ -182,7 +185,7 @@ defineExpose({ openPicker })
 onClickOutside(popoverRef, (event) => {
   const target = event.target as Node | null
-  if (target && triggerRef.value?.contains(target))
+  if (target && (triggerRef.value?.contains(target) || positionAnchor.value?.contains(target)))
     return
   closePicker()
</file context>

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Fixed in 91d10a0. The exposed inline action now calls togglePicker(currentTarget) instead of always calling openPicker(), while the toolbar trigger calls the same toggle without passing its MouseEvent as an anchor. The focused Playwright test now verifies second-click close, Enter to reopen, and Escape focus restoration.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

@cubic-dev-ai please re-review this thread against 91d10a0 and resolve it if the toggle behavior is now addressed.

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

@WcaleNieWolny I have started the AI code review. It will take a few minutes to complete.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

@cubic-dev-ai The requested toggle behavior remains fixed on the latest head a29a3a8 (implementation commit 91d10aebc): pressing Enter/Space on the active filter option clears it instead of reapplying it. Please re-review and resolve this thread if satisfied.

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

@WcaleNieWolny I have started the AI code review. It will take a few minutes to complete.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Correction to my previous reply: this thread concerns the empty-state date-picker toggle. The latest head exposes togglePicker() from DateRangePicker and DeviceTable calls it with the inline invoker, so a second mouse click closes the picker without resetting draft state. The focused Playwright test explicitly verifies open then close via the inline action. @cubic-dev-ai please re-review this implementation.

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

@WcaleNieWolny I have started the AI code review. It will take a few minutes to complete.

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

No issues found across 5 files

Confidence score: 5/5

  • Automated review surfaced no issues in the provided summaries.
  • No files require special attention.

Re-trigger cubic

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@playwright/e2e/devices-empty-state.spec.ts`:
- Around line 64-69: Stabilize the request activity in the device empty-state
test before assigning requestCountBeforeRefresh: after the search assertion,
wait until the requests count remains unchanged to allow the page request or
debounced reload to complete. Then capture the baseline and preserve the
existing refresh click and +2 request-count assertion.

In `@src/components/tables/DeviceTable.vue`:
- Line 634: Update refreshData() to call cancelScheduledReload() as its first
action, ensuring any pending reloadTimer is cleared before starting the refresh
load and preventing the queued callback from superseding or duplicating the
request.
🪄 Autofix

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro

Run ID: cdab6daa-c611-4c47-8d3f-365089cf059c

📥 Commits

Reviewing files that changed from the base of the PR and between 19be590 and 97b7720.

📒 Files selected for processing (7)
  • messages/en.json
  • playwright/e2e/devices-empty-state.spec.ts
  • src/components/DataTable.vue
  • src/components/DateRangePicker.vue
  • src/components/admin/AdminFilterBar.vue
  • src/components/tables/DeviceTable.vue
  • tests/cli-app-permission-helper.test.ts
🔗 Linked repositories identified

CodeRabbit considers these linked repositories for cross-repo context during reviews:

  • Cap-go/capacitor-updater (manual)

Comment thread playwright/e2e/devices-empty-state.spec.ts
Comment thread src/components/tables/DeviceTable.vue
@sonarqubecloud

sonarqubecloud Bot commented Aug 7, 2026

Copy link
Copy Markdown

@WcaleNieWolny
WcaleNieWolny merged commit 69d4a1b into main Aug 7, 2026
83 of 87 checks passed
@WcaleNieWolny
WcaleNieWolny deleted the wolny/improve-devices-empty-state branch August 7, 2026 17:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant