Skip to content

Database Explorer Browser, Drill-down Data Viewer, and Bug Fixes#98

Merged
Skyfay merged 21 commits into
mainfrom
dev
May 25, 2026
Merged

Database Explorer Browser, Drill-down Data Viewer, and Bug Fixes#98
Skyfay merged 21 commits into
mainfrom
dev

Conversation

@Skyfay

@Skyfay Skyfay commented May 25, 2026

Copy link
Copy Markdown
Owner

No description provided.

Skyfay and others added 20 commits May 24, 2026 10:10
Prevent the backup job edit dialog from becoming unusable when many databases are selected by showing at most 8 database badges and collapsing the rest into a "+N more" badge (adds MAX_VISIBLE_BADGES, visibleDbs and hiddenCount logic). Also add a vNEXT changelog entry documenting the bug fix and Docker image/tags/platforms.
Remove a redundant/misleading sentence from the Exclude from Restore helper text in src/components/adapter/form-sections.tsx so the message only states the source won't appear as a restore target, avoiding confusion about backup creation.
Restore Exclusion Feature

Overview

The "Exclude from Restore" feature allows database sources to be
excluded from the restore operation dropdown while maintaining their
functionality for creating new backups.


Configuration
When creating or editing a database source, a new toggle switch "Exclude
from Restore" appears in the Configuration tab. This switch lets you
mark the source as unavailable for restoration purposes.

Behavior

Enabled: When the toggle is active, the source will not appear in the
dropdown list when users initiate a database restore operation.

Disabled (default): The source appears normally in all restore
dropdowns.
Independent: The exclusion flag only affects restore operations. The
source continues to work normally for:

Creating new backups
Scheduling backup jobs
Health checks

Use Cases

Test/Development Sources: Exclude staging database sources to prevent
accidental production data overwrites during restore operations.
Deprecated Sources: Hide sources that are no longer actively used
without deleting them.
Safety Mechanism: Prevent users from selecting certain critical sources
as restore destinations.
Technical Implementation

The exclusion flag is stored in the adapter's metadata and is checked
during the source filtering process when rendering the restore dialog.
The filtering is safe and handles malformed metadata gracefully.

<img width="641" height="775" alt="imagen"
src="https://github.com/user-attachments/assets/3b90d9a2-9026-4cf9-804f-2ee94ba0633a"
/>

As before, if you don't see it as useful or necessary, feel free to
discard it

Thx!
Run date token expansion before replacing {job_name}/{db_name} so date-like substrings in job or DB names (e.g. 'mm' in 'Immich' or 'yyyy' in 'backup_yyyy') are not misinterpreted as format tokens. Updates applyNamingPattern and previewPattern to call applyDateTokens first, adds regression tests, and updates the changelog entry. Fixes filename corruption described in issue #90.
Ensure pending backup jobs are unblocked after a restore by calling processQueue() in the restore pipeline's finally block (with error logging). Adds an import for the queue manager and updates unit tests to verify processQueue is invoked on both successful and failed restores. Also documents the fix in the changelog (closes #95).
Introduce a drill-down Database Explorer: breadcrumb deep-linking via URL params and UI components to list tables/collections (DatabaseTableList) and view paginated read-only row/document data with schema (DatabaseTableData). Add two server endpoints (/api/adapters/database-tables and /api/adapters/database-table-data) that accept either a saved sourceId or raw adapterId+config, perform auth/permission checks, and resolve adapters via the registry. Extend the DatabaseAdapter interface with optional getTables and getTableData methods and wire browser-side implementations for MySQL/MariaDB, MongoDB, MSSQL (and update adapters to expose them). Includes Mongo document flattening/derived column types, Redis key/type/TTL rendering, server-side pagination, search, and configurable page size; updates changelog accordingly.
Introduce a tabbed layout for the Database Explorer (General / Databases) to match the Storage Explorer UI. Moved server/stats cards into the General tab and implemented a Databases tab that contains the drill-down database list, breadcrumb navigation, and paginated table/data viewer. Added Tabs state (activeTab) and reset it on source change, renamed navigation handlers for clarity, repositioned the auto-load effect, improved error handling and skeleton counts, and minor UI/text tweaks. Also updated docs/changelog.md to describe the new tab-based UI.
Postgres: information_schema.tables is scoped per-database, so the combined stats query could not reliably return cross-database table counts. Remove table_count from the main pg stats query and add a dedicated per-database count query (pgTableCountQuery). Implement countTablesInDatabase and countTablesViaSsh to fetch table counts for each database (local and SSH modes) and merge results with parsed size data. Update parsing to handle the new tab-separated output (name and size) and adjust tests: expected outputs no longer include tableCount by default, and new tests verify that tableCount is populated when per-database queries succeed and omitted when they fail. Also add a clarifying comment above the query.
getTables now parses the sqlite3 output into TableInfo[] and enriches table entries with rowCount. Added helper functions enrichWithRowCounts (local) and enrichWithRowCountsSsh (SSH) that build a UNION ALL of SELECT count(*) queries (using escapeIdentifier/shellEscape), execute them, parse the results, and attach counts to corresponding tables. Both helpers skip work when there are no regular tables and fail gracefully (returning original table list) on errors.
Introduce schemaSearch state and derive filteredColumns for the Schema tab so users can search columns by name or data type. Move and refine search inputs: a rows search is shown only for non-Redis/non-Mongo data views, and a dedicated "Search columns" input is added to the Schema header. Add responsive width constraints (max-widths and min-w/w-full) to table containers to prevent overflow and improve layout on smaller viewports. Also show a friendly message when no schema columns match the search. Miscellaneous markup/flex cleanup around TabsList and tab headers for better spacing.
Update Database Explorer pagination UI and docs for consistency with Storage Explorer.

- UI: Rework pagination footer in src/components/dashboard/explorer/database-table-data.tsx to display total row count on the left and move "Rows per page" selector, page indicator, and navigation buttons to the right. Adds first/last buttons (ChevronsLeft/ChevronsRight), keeps them hidden on small screens, adds accessible labels, and shows a Redis-specific note when only a subset is displayed.
- Docs: Add a changelog entry describing the pagination footer redesign and its alignment with the DataTable used elsewhere.

This change improves visual consistency and usability across explorers.
Introduce a column visibility feature and refresh control in the table UI. Adds DropdownMenu components and a Settings/Refresh toolbar: users can toggle column visibility via checkbox items (hiddenColumns state + visibleCols derived) and manually refresh data (fetchData) with a spinning icon when loading. Also refactors the Card header/content layout and imports the cn utility and new icons to support the UI changes.
Support column sorting in the database table viewer. Added `sortBy` and `sortDir` to the API body schema and to `TableDataOptions`, wired the fields through the client fetch, and added UI state + controls to toggle ascending/descending per column. Each database adapter (MongoDB, MSSQL, MySQL, Postgres, SQLite) now accepts the sort options and applies an appropriate ORDER BY / sort spec in both local and SSH/remote query paths. Sorting defaults to ascending and preserves previous behavior when no sort is provided.
Introduce optional column-scoped searching by adding searchColumn to TableDataOptions and the API route, and wiring it through the frontend. Update database adapters (MongoDB, MSSQL, MySQL, Postgres, SQLite) to apply a filter/WHERE clause when search + searchColumn are provided, including added literal-escaping helpers for MySQL and SQLite and adjusted SSH/mongosh handling. Frontend: add a column picker popover, reset button, and only send search when a column is selected; also include the new param in fetch dependencies. Overall enables searching within a single column across supported adapters.
Introduce an optional matchMode (contains|equals|starts|ends) to table data queries. Updated API request schema and TableDataOptions interface, propagated the option from the DatabaseTableData component (with a small UI select and default 'contains'), and ensured it resets on search reset. Implemented matching behavior in database adapters (MongoDB, MSSQL, MySQL, Postgres, SQLite) with appropriate escaping and query generation (regex for MongoDB, parameterized/LIKE or = for SQL engines).
Introduce a new PERMISSIONS.SOURCES.VIEW and migrate UI/server checks to use it for viewing source configs and protecting the Database Explorer. Updated API routes, adapter helpers, and SSH/connection tests to check sources:view where appropriate, and changed error messages to reference the new permission. The Dashboard Explorer now enforces the permission at the server component (blocks direct navigation) and passes a canBrowse flag to DatabaseExplorer so the 'Databases' tab and data browsing only render for users with browse access. Sidebar entries, adapter manager health popovers, permissions types and AVAILABLE_PERMISSIONS labels were updated to reflect the new separation between viewing source configs (sources:view) and browsing database contents (sources:read). Changelog updated to document the RBAC change.
Condense the Database Explorer entry in docs/changelog.md to a concise summary highlighting server-side pagination, search, schema inspection, and deep-link URL support across all 7 database adapters. Removed verbose implementation and UI details while preserving the issue reference (#92). This is a docs-only change.
Add browser-mode unit tests for all database adapters (MySQL, PostgreSQL, MongoDB, MSSQL, Redis, SQLite) covering getTables and getTableData (parsing, type mapping, TTL formatting, search/sort behavior). Update docs/changelog.md to announce the tests. Also remove the now-unused resolveConnectDb helper from the Postgres browser adapter.
Release prep: bump project and docs versions to 2.4.0 across root package.json, docs/package.json, and OpenAPI files (api-docs/openapi.yaml and public/openapi.yaml). Update docs/changelog.md to announce v2.4.0 (Released: May 25, 2026) with feature summary (Database Explorer Browser, Drill-down Data Viewer, and bug fixes) and adjust Docker image tags to skyfay/dbackup:v2.4.0 (also tagged latest and v2).
Comment thread src/lib/adapters/database/mysql/browser.ts Fixed
Comment thread src/lib/adapters/database/mysql/browser.ts Fixed
Comment thread src/lib/adapters/database/mysql/browser.ts Fixed
Replace the previous manual escaping (.replace on escapeMysqlIdentifier) with escapeMysqlLiteral for TABLE_SCHEMA and TABLE_NAME in tablesQuery and columnsQuery to ensure proper SQL literal escaping. Add unit tests that verify escaping behavior (doubling backslashes, escaping single quotes, and removing null bytes) for both the tables and columns queries.
@Skyfay
Skyfay merged commit 5d703d8 into main May 25, 2026
9 checks passed
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.

3 participants