Files
supabase/apps/studio/components/interfaces/Database/Replication/ReplicationPipelineStatus/ReplicationPipelineStatus.utils.test.ts
T
Danny White 2a46c00653 feat(studio): polish replicated table controls (#50446)
## What kind of change does this PR introduce?

Studio UI improvement.

## What is the current behavior?

Replicated tables use badge-heavy rows, fixed name sorting, prominent
per-row reset buttons, and inconsistent restart terminology.

## What is the new behavior?

Adds table and status sorting, accessible search feedback, concise state
details, table action menus, and consistent **Reset** terminology.
Failed-table reset remains unavailable when there are no failed tables
or another reset is running.

| Before | After |
| --- | --- |
| <img width="1872" height="356" alt="CleanShot 2026-09-16 at 13 36
51@2x"
src="https://github.com/user-attachments/assets/6546f089-f6f8-4ff2-9509-ec44a2dee973"
/> | <img width="1840" height="452" alt="CleanShot 2026-09-16 at 13 36
30@2x"
src="https://github.com/user-attachments/assets/6e36b1e6-baee-4aea-80e9-e5e4a3fc8a75"
/> |

This is an independent slice extracted from #49630. The related review
series is #50443, #50444, #50445, this PR, then #49630.

## To test

1. Open `/project/<ref>/database/replication` and select a pipeline with
replicated tables.
2. Sort by **Table** and **Status**, then search for a table and clear
the search with Escape.
3. Open a table’s action menu and confirm its reset and Table Editor
actions.
4. Confirm **Reset failed tables only** is unavailable when the pipeline
has no failed tables.

<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit

* **New Features**
* Added sortable Table and Status columns to the replication pipeline
view.
  * Added options to reset all tables or only failed tables.
  * Added clearer replication lag details and status indicators.
* Added dropdown actions for resetting tables and opening the Table
Editor.
  * Added Escape-to-clear support for search.

* **Bug Fixes**
* Improved empty search results with a clear “No results found” message.
  * Error details are now displayed separately for easier access.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
2026-09-17 14:54:08 +10:00

43 lines
1.2 KiB
TypeScript

import { describe, expect, test } from 'vitest'
import { getTableSyncLagLabel } from './ReplicationPipelineStatus.utils'
describe('getTableSyncLagLabel', () => {
test('omits healthy slot details when the table has caught up', () => {
expect(
getTableSyncLagLabel({
active: true,
wal_status: 'reserved',
restart_lsn_bytes: 0,
confirmed_flush_lsn_bytes: 0,
safe_wal_size_bytes: null,
})
).toEqual([])
})
test('reports the backlog and last check-in', () => {
expect(
getTableSyncLagLabel({
active: true,
wal_status: 'reserved',
restart_lsn_bytes: 4096,
confirmed_flush_lsn_bytes: 2048,
safe_wal_size_bytes: null,
reply_time_lag: 4800,
})
).toEqual(['2 KB waiting to sync', 'Last check-in 4.80 s'])
})
test('reports slot risk without treating the expected inactive connection as a fault', () => {
expect(
getTableSyncLagLabel({
active: false,
wal_status: 'unreserved',
restart_lsn_bytes: 0,
confirmed_flush_lsn_bytes: 0,
safe_wal_size_bytes: null,
})
).toEqual(['Some changes at risk'])
})
})