Add dbviewer plugin: database viewer devtool from the design handoff - #8942
Add dbviewer plugin: database viewer devtool from the design handoff#8942pubkey wants to merge 9 commits into
Conversation
Implements the database viewer design handoff as a new plugin under src/plugins/dbviewer. The viewer mounts into any DOM element in plain TypeScript without a framework dependency and works over a live RxDatabase or a static exportJSON() dump (read-only). Screens implemented from the design: - Global chrome: top bar with database identity, command palette, left rail with live collection counts, replication states and tools - Table view with pagination, sorting, multi-select, inline editing, and the document drawer with fields, internals, attachments and the WILL RUN preview of the exact upsert call before applying edits - JSON view with syntax colors and live update highlighting - Mango query bar with history/favourites, exact-position syntax errors and the no-matches / empty-collection / empty-database states - Destructive delete confirmation with type-to-confirm blast radius - Live activity map: app/collections/remote columns, event particles, 60s sparklines, live query sub-panel, summary counters - Schema panel with sampled type shares, presence and violations - Query lab with query-planner based execution plan and findings - Replication panel with per-state status and live document feed - Changes panel with filterable write feed and unified diffs - Storage panel with tombstone counts, attachment bytes and cleanup - Narrow-viewport read-only phone layout below 640px Adds error codes DVW1/DVW2, unit tests for the pure helpers and the dump data source, a docs page and a changelog entry. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01XSWnG8xBeMGgwaLKniRnyJ
|
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01XSWnG8xBeMGgwaLKniRnyJ
|
The "tests passed without the fix" warning is expected here: this PR adds a new feature (the The Generated by Claude Code |
A round toggle button in the bottom right corner docks the dbviewer devtool to the bottom of the page. The viewer is mounted lazily on first open and outside of the angular zone, so server side rendering and change detection are unaffected. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01XSWnG8xBeMGgwaLKniRnyJ
… fix the missing logo - On load the browser console logs a direct db-viewer url; opening the app with #dbviewer in the url opens the viewer directly. The open state is a signal so the binding also updates without zone.js change detection. - The round nub is now a labeled "Open DB Viewer" button. - FIX postinstall:logo copied from the outdated path docs-src/files/logo/logo.svg, which led to a missing /assets/logo.svg in the browser. It now copies from docs-src/static/files/logo/logo.svg. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01XSWnG8xBeMGgwaLKniRnyJ
- Observe mode is on by default on a live database, results update
as documents change without toggling first.
- The Schema panel got an Analysis / JSON schema segmented toggle
that shows the declared schema with syntax colors.
- The query bar and Query lab accept relaxed JavaScript object
syntax like { name: 'foo' }: unquoted keys, single quotes and
trailing commas are converted to strict JSON by a character
walker that leaves string contents untouched. Added testcases.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01XSWnG8xBeMGgwaLKniRnyJ
- The top bar and phone header now render the official RxDB logo as inline svg instead of a css gradient circle. The svg is embedded as a constant, so the viewer stays self-contained. - Live map rows no longer stretch over the panel height and long replication errors on a remote node are truncated with the full text in the tooltip, so the app, collection and remote nodes of a row stay on the same line. - The angular example database is named my-angular-db instead of db, so the viewer top bar shows a recognizable name. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01XSWnG8xBeMGgwaLKniRnyJ
…he viewer - New showCloseButton option renders a close icon in the top bar. Clicking it emits on the close$ observable of the handle, so an embedding host decides what closing means. The angular example subscribes to it and hides its bottom dock instead of rendering its own close button. - The Live map no longer draws pulled documents on the app to collection lane. The event hub reads eventBulks$ and marks writes with the replication-downstream context as fromReplication, so a pulled document is one particle on the remote lane only. The app node write rate and the writes counter also exclude them, and the Changes detail names the source. Added a testcase. - Errors are shown inside the viewer instead of console or alert: a failed cleanup renders a danger box with the plugin hint (the plugin-missing stub throws synchronously, which previously escaped to the console), invalid dump files show an inline message in Settings and a failed delete shows in the modal. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01XSWnG8xBeMGgwaLKniRnyJ
…eed collection names - Errors are shown as a popup instead of inline, so the drawer buttons stay reachable for a retry. RxError parameters are serialized into a readable JSON view (circular-safe, capped) with a copy button and a link to the error code docs. - Editing an existing document runs incrementalPatch() with only the changed fields instead of upsert(), so preInsert hooks like the color-uniqueness check of the angular example no longer fire for updates. The WILL RUN block previews the exact findOne().incrementalPatch() call. Added testcases. - All JSON views (results, JSON schema, error parameters) have a copy-to-clipboard button with the same icon the docs use. - Removed the commands button and the command palette. - The help button opens https://rxdb.info/overview.html - FIX The change feed showed ? instead of the collection name and the Live map dropped write particles, because the events of eventBulks$ do not carry the collectionName. It is now taken from the bulk. Added a testcase. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01XSWnG8xBeMGgwaLKniRnyJ
Labels like "no write this session" were dim gray at 9px and additionally faded by the idle-row opacity, which made them unreadable. Informational micro-copy now uses the muted foreground at 10px, and idle rows fade only their track lines and node borders, never their text. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01XSWnG8xBeMGgwaLKniRnyJ
This PR contains:
dbviewerplugin, a database viewer devtool implemented from the static design canvas handoff (RxDB brand dark theme, zero border radii, self-contained, no framework and no asset files)dbviewer.mdreference page with in-text links fromdev-mode.md,logger.mdandrx-database.mdDescribe the problem you have without this PR
There is no built-in way to inspect and edit the data of a running RxDB database. Developers fall back to storage-specific browser devtools (IndexedDB tab, SQLite shells) which know nothing about RxDB revisions, replication, tombstones or the query planner, and which cannot open a
db.exportJSON()dump from a device you cannot reach.This PR implements the database viewer design into the repo as
src/plugins/dbviewer.mountRxDBViewer({ database, parent })renders the full devtool into any DOM element, andRxDBDbViewerPluginadds adb.launchDbViewer()convenience method. All screens run on real data:db / storage / versionidentity, ⌘K command palette, Refresh; left rail with live collection counts, replication status glyphs (●running,○idle,▲error,■stopped) and the toolsupsert()call with changed lines highlighted before Apply+/~/-writes,?/◆queries,↑/↓replication), 60s sparklines, per-node write pulses rate-limited to 4 Hz, idle/nothing-yet states, live-queries sub-panel and the last-60s summary bar. No document contents are drawn on the mapqueryPlan), with findings for unindexed selector fields and$regexfull scanspreviousDocumentDatadb.exportJSON()export, read-only with a persistent banner; live-only features are disabled with "not available on a dump" hintsDeliberately out of scope for this PR (documented in
dbviewer.md): WebRTC remote pairing to a database on another device (the design's connection screens), the TanStack Devtools surface, and cross-tab instance listing. The data-source abstraction and the surface-independent chrome are built so these can be layered on later.All screens were verified against the design canvas by mounting the built plugin over a memory-storage database with Playwright.
Error codes
DVW1/DVW2were added torx-error/dev-mode messages, and the plugin is wired into thepackage.jsonexports and the plugins build.Todos
🤖 Generated with Claude Code
https://claude.ai/code/session_01XSWnG8xBeMGgwaLKniRnyJ
Generated by Claude Code