Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
5f59651
feat(linux-sidebar): add a bottom bar with an Add menu
sedax90 Nov 8, 2026
5aae8d8
docs(linux-sidebar): name the changelog entry for its PR
sedax90 Nov 8, 2026
985b30f
feat(linux-sidebar): choose which schemas the sidebar lists
sedax90 Nov 8, 2026
bb49b7c
chore(linux): changelog and translation sources for the schema filter
sedax90 Nov 8, 2026
810a042
Merge remote-tracking branch 'origin/main' into feat/linux-sidebar-fo…
datlechin Nov 9, 2026
db6a574
refactor(linux-sidebar): build the Add menu from the session's afford…
datlechin Nov 9, 2026
3638efa
Merge branch 'feat/linux-sidebar-footer' into feat/linux-sidebar-sche…
datlechin Nov 9, 2026
752a82a
refactor(linux-sidebar): keep the sidebar's schema filter per connect…
datlechin Nov 9, 2026
830c7c0
refactor(linux-sidebar): keep the schema chooser's calls inside the w…
datlechin Nov 9, 2026
02500ed
Merge remote-tracking branch 'origin/main' into feat/linux-sidebar-fo…
datlechin Nov 10, 2026
f016cc1
fix(linux-sidebar): bring MenuModelExt into scope for the Add menu
datlechin Nov 10, 2026
a713a0b
Merge branch 'feat/linux-sidebar-footer' into feat/linux-sidebar-sche…
datlechin Nov 10, 2026
6726fd4
ci(linux-sidebar): run CI again, GitHub made no run for the last push
datlechin Nov 10, 2026
b5366ca
Merge remote-tracking branch 'origin/main' into feat/linux-sidebar-fo…
datlechin Nov 10, 2026
b8daab3
Merge commit 'b5366cab44522197a1b4f04706894a79908b6be6' into feat/lin…
datlechin Nov 10, 2026
bb14cfa
refactor(linux-sidebar): split the window's input handler and the she…
datlechin Nov 10, 2026
2f37db9
Merge branch 'feat/linux-sidebar-footer' into feat/linux-sidebar-sche…
datlechin Nov 10, 2026
4c87cc7
refactor(linux-sidebar): hold the schema filter's state in one place …
datlechin Nov 10, 2026
99167fd
Merge remote-tracking branch 'origin/main' into feat/linux-sidebar-fo…
datlechin Nov 10, 2026
605f168
test(linux-sidebar): check a read-only session built an empty Add menu
datlechin Nov 10, 2026
9436fee
Merge commit '605f16888a4686ce51e777f3c04c7645f13af994' into feat/lin…
datlechin Nov 10, 2026
51fd97d
fix(linux-sidebar): update the schema checks in place so a toggle kee…
datlechin Nov 10, 2026
adcd6b4
fix(linux-sidebar): name the schema filter button in its template
datlechin Nov 10, 2026
6fc2d81
Merge remote-tracking branch 'origin/main' into feat/linux-sidebar-fo…
datlechin Nov 10, 2026
4f661ac
Merge commit '6fc2d8145' into feat/linux-sidebar-schema-filter
datlechin Nov 10, 2026
ad44265
Merge remote-tracking branch 'origin/main' into feat/linux-sidebar-sc…
datlechin Nov 11, 2026
20768af
Merge remote-tracking branch 'origin/main' into feat/linux-sidebar-sc…
datlechin Nov 11, 2026
7d9a827
fix(linux-sidebar): check the saved filter settings in the sidebar sc…
datlechin Nov 11, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion linux/ARCHITECTURE.md
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ Each engine builds its trust as `../core/ARCHITECTURE.md`, Trust, says. On Linux

The app tells each session what its connection cannot see, as `../core/ARCHITECTURE.md`, Sessions and health, describes: `GNetworkMonitor` reports a change in the network, and while a session is open a 5 s timer compares `CLOCK_BOOTTIME` with `CLOCK_MONOTONIC` to notice a suspend. A session parked on an SSH host key shows the fingerprint in its banner's Review Key. When the review cannot accept the key, because ssh's configuration takes keys only from known_hosts or the key is revoked, its dialog offers Retry for after the user fixes the key outside TablePro.

The sidebar's tree lists an open connection's schemas, the default one first and the engine's own last, and each schema's tables and views, with one menu whose items carry the table they act on. Its rows come from a `SidebarIndex`, sorted by collation key and given its search keys on a blocking thread, behind a `GListModel` that makes a row's object only when asked for it; `GtkTreeListModel` asks for every table of a schema it opens. Each search, and each new list, picks the rows it keeps on a blocking thread too. What a search finds is a flat `GtkListView`, a section per schema in a `GtkFlattenListModel` that reads only the rows on screen, and it takes a search's rows in one removal and one addition unless a newer search or list overtook them. It follows every schema's list through a watch the window drops before the session closes, and reads that list again when a reconnect commits the default schema's; a refresh that fails keeps the list and says so in a toast. The editor's completion reads the catalog when it opens: the default schema's objects, a named schema's objects after `schema.`, and the columns of the tables the statement names. Its candidates are built with that read on the runtime, and its `ProposalList` ranks them for the typed word and makes a proposal only for a row GtkSourceView shows. Either list thus costs the GTK thread the rows on screen, not the catalog, which the large-catalog case checks with 50,000 tables ([testing.md](docs/testing.md#large-catalog-case)).
The sidebar's tree lists an open connection's schemas, the default one first and the engine's own last, and each schema's tables and views, with one menu whose items carry the table they act on. Its rows come from a `SidebarIndex`, sorted by collation key and given its search keys on a blocking thread, behind a `GListModel` that makes a row's object only when asked for it; `GtkTreeListModel` asks for every table of a schema it opens. Each search, and each new list, picks the rows it keeps on a blocking thread too. What a search finds is a flat `GtkListView`, a section per schema in a `GtkFlattenListModel` that reads only the rows on screen, and it takes a search's rows in one removal and one addition unless a newer search or list overtook them. The Schemas button in the sidebar's bottom bar keeps the schemas the tree and its search list, by connection and database in the filter settings file; none kept lists every schema, and a banner says how many a filter leaves out. It follows every schema's list through a watch the window drops before the session closes, and reads that list again when a reconnect commits the default schema's; a refresh that fails keeps the list and says so in a toast. The editor's completion reads the catalog when it opens: the default schema's objects, a named schema's objects after `schema.`, and the columns of the tables the statement names. Its candidates are built with that read on the runtime, and its `ProposalList` ranks them for the typed word and makes a proposal only for a row GtkSourceView shows. Either list thus costs the GTK thread the rows on screen, not the catalog, which the large-catalog case checks with 50,000 tables ([testing.md](docs/testing.md#large-catalog-case)).

## Workspace tab system

Expand Down
1 change: 1 addition & 0 deletions linux/changelog.d/4150.added.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
The sidebar's Schemas button chooses which schemas it lists, and remembers the choice for each connection.
17 changes: 14 additions & 3 deletions linux/crates/app/src/persistence/filter_settings_document.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
use std::collections::HashMap;
use std::collections::{BTreeSet, HashMap};

use serde::{Deserialize, Serialize};
use tablepro_core::FilterSet;
use tablepro_storage::document::VersionedDocument;
use tablepro_storage::document::{Upgrade, VersionedDocument};

/// Per-table filters, keyed connection, schema, table.
///
Expand All @@ -12,12 +12,23 @@ use tablepro_storage::document::VersionedDocument;
pub struct FilterSettingsDocument {
#[serde(default)]
pub connections: HashMap<String, Schemas>,
// A schema name means something only inside its database, so each
// database of a connection keeps its own.
#[serde(default)]
pub sidebar_schemas: HashMap<String, SidebarSchemas>,
}

pub type Schemas = HashMap<String, Tables>;
pub type Tables = HashMap<String, FilterSet>;
pub type SidebarSchemas = HashMap<String, BTreeSet<String>>;

impl VersionedDocument for FilterSettingsDocument {
const KIND: &'static str = "filter-settings";
const VERSION: u32 = 1;
const VERSION: u32 = 2;
const UPGRADES: &'static [Upgrade] = &[keep_v1];
}

// Version 1 had no sidebar filters, which read as none.
fn keep_v1(document: serde_json::Value) -> Result<serde_json::Value, String> {
Ok(document)
}
85 changes: 84 additions & 1 deletion linux/crates/app/src/persistence/filter_settings_store.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
use std::collections::BTreeSet;
use std::rc::Rc;

use tablepro_core::FilterSet;
Expand Down Expand Up @@ -60,13 +61,53 @@ impl FilterSettingsStore {
});
}

pub fn sidebar_schemas(&self, connection_id: Uuid, database: &str) -> BTreeSet<String> {
self.file.read(|document| {
document
.sidebar_schemas
.get(&connection_id.to_string())
.and_then(|databases| databases.get(database))
.cloned()
.unwrap_or_default()
})
}

pub fn set_sidebar_schemas(&self, connection_id: Uuid, database: &str, kept: &BTreeSet<String>) {
self.file.update(|document| {
let connection = connection_id.to_string();
if kept.is_empty() {
let Some(databases) = document.sidebar_schemas.get_mut(&connection) else {
return false;
};
let removed = databases.remove(database).is_some();
if databases.is_empty() {
document.sidebar_schemas.remove(&connection);
}
return removed;
}
let slot = document
.sidebar_schemas
.entry(connection)
.or_default()
.entry(database.to_owned())
.or_default();
if slot == kept {
return false;
}
slot.clone_from(kept);
true
});
}

pub fn forget_connection(&self, connection_id: Uuid) {
let connection = connection_id.to_string();
self.file.update(|document| {
let before = document.connections.len();
document
.connections
.retain(|key, _| !TableStateKey::belongs_to(key, connection_id));
before != document.connections.len()
let filters = before != document.connections.len();
document.sidebar_schemas.remove(&connection).is_some() || filters
});
}

Expand Down Expand Up @@ -188,6 +229,48 @@ mod tests {
assert!(store.filters(dropped, Some("public"), "users").is_empty());
}

#[tokio::test]
async fn the_sidebars_schemas_are_kept_per_database_and_go_with_the_connection() {
let root = tempfile::tempdir().expect("tempdir");
let path = root.path().join("filter-settings.json");
let id = Uuid::new_v4();
let kept = BTreeSet::from(["public".to_owned(), "sales".to_owned()]);
let store = FilterSettingsStore::load(path.clone(), &paused_tasks());
store.set_sidebar_schemas(id, "shop", &kept);
store.set_filters(id, None, "users", sample_set());
store.flush().await.expect("saved");

let reopened = FilterSettingsStore::load(path.clone(), &paused_tasks());
assert_eq!(reopened.sidebar_schemas(id, "shop"), kept);
assert!(reopened.sidebar_schemas(id, "other").is_empty());

reopened.set_sidebar_schemas(id, "shop", &BTreeSet::new());
assert!(reopened.sidebar_schemas(id, "shop").is_empty());
reopened.set_sidebar_schemas(id, "shop", &kept);
reopened.forget_connection(id);
reopened.flush().await.expect("saved");
let written = std::fs::read_to_string(&path).expect("the file");
assert!(
!written.contains("sales"),
"the deleted connection's schemas stayed: {written}"
);
}

#[tokio::test]
async fn a_version_1_file_keeps_its_filters_and_has_no_sidebar_filter() {
let root = tempfile::tempdir().expect("tempdir");
let path = root.path().join("filter-settings.json");
let id = Uuid::new_v4();
let filter = serde_json::to_string(&sample_set()).expect("the filter");
let written = format!(r#"{{"version": 1, "connections": {{"{id}": {{"": {{"users": {filter}}}}}}}}}"#);
std::fs::write(&path, written).expect("the old file");

let store = FilterSettingsStore::load(path, &paused_tasks());

assert_eq!(store.filters(id, None, "users"), sample_set());
assert!(store.sidebar_schemas(id, "").is_empty());
}

#[tokio::test]
async fn a_saved_filter_survives_a_reopen() {
let root = tempfile::tempdir().expect("tempdir");
Expand Down
5 changes: 5 additions & 0 deletions linux/crates/app/src/ui/workspace/imp.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@ pub struct Workspace {
#[template_child]
pub catalog_banner: TemplateChild<adw::Banner>,
#[template_child]
pub schema_filter_banner: TemplateChild<adw::Banner>,
#[template_child]
pub key_limit_banner: TemplateChild<adw::Banner>,

/// The content header's title while the session is in front: the
Expand Down Expand Up @@ -58,6 +60,9 @@ pub struct Workspace {
pub(super) can_refresh: Cell<bool>,
#[property(get)]
pub(super) creation_menu: RefCell<Option<gio::MenuModel>>,
// Empty while the session's sidebar has no schemas to choose among.
#[property(get)]
pub(super) schema_filter_label: RefCell<String>,

pub(super) key: OnceCell<SessionKey>,
// File sessions and saved connections must use the editor save's identity.
Expand Down
24 changes: 24 additions & 0 deletions linux/crates/app/src/ui/workspace/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ mod import_ledger;
mod recent_tabs;
mod references;
mod saves;
mod schema_chooser;
mod schema_filter;
mod session_watches;
mod sidebar;
mod status_pages;
Expand Down Expand Up @@ -134,6 +136,7 @@ pub(crate) struct WorkspaceModel {
/// The last schema read the sidebar asked for; an older one landing
/// late is not shown.
sidebar_read: u64,
schema_filter: schema_chooser::SidebarFilter,
definition_reads: u64,
/// The Show Definition read in flight, which a newer one supersedes.
definition_read: Option<definitions::DefinitionRead>,
Expand Down Expand Up @@ -520,6 +523,11 @@ pub(crate) enum WorkspaceInput {
read: u64,
listing: sidebar::SidebarListing,
},
ShowSchema {
name: String,
shown: bool,
},
ShowAllSchemas,
/// List a key-value engine's keys again, as the search now asks.
ListKeys,
/// The keys a listing found, indexed for the sidebar, or why they
Expand Down Expand Up @@ -868,6 +876,7 @@ impl Workspace {
sidebar,
catalog_schemas: Arc::from([]),
sidebar_read: 0,
schema_filter: schema_chooser::SidebarFilter::new(&workspace),
definition_reads: 0,
definition_read: None,
all_schemas_listed: false,
Expand Down Expand Up @@ -949,6 +958,18 @@ impl Workspace {
self.notify_creation_menu();
}

fn show_schema_filter_label(&self, label: String) {
if *self.imp().schema_filter_label.borrow() != label {
self.imp().schema_filter_label.replace(label);
self.notify_schema_filter_label();
}
}

// None while the workspace is handling input.
pub(super) fn schema_choices(&self) -> Option<schema_chooser::SchemaChoices> {
self.read(WorkspaceModel::schema_choices)
}

/// The key the session is open under.
pub(crate) fn key(&self) -> Option<SessionKey> {
self.imp().key.get().cloned()
Expand Down Expand Up @@ -1182,6 +1203,7 @@ impl WorkspaceModel {
fn open(&mut self) {
self.reconnect_banner.set_revealed(false);
tracing::info!(driver = %self.driver_id, "workspace ready");
self.load_schema_filter();
self.open_sidebar();
self.refresh_title();
self.restore_workspace_tabs(self.key.clone());
Expand Down Expand Up @@ -1358,6 +1380,8 @@ impl WorkspaceModel {
WorkspaceInput::RefreshCatalog => self.refresh_catalog(),
WorkspaceInput::DefaultListCommitted(snapshot) => self.on_default_list_committed(snapshot),
WorkspaceInput::SidebarRead { read, listing } => self.on_sidebar_read(read, listing),
WorkspaceInput::ShowSchema { name, shown } => self.on_schema_shown(&name, shown),
WorkspaceInput::ShowAllSchemas => self.on_all_schemas_shown(),
WorkspaceInput::ListKeys => self.list_keys(),
WorkspaceInput::KeysListed(listed) => self.on_keys_listed(listed),
WorkspaceInput::LinkChanged => self.on_link_changed(),
Expand Down
Loading
Loading