feat(sidebar): allow pinning default database to top
This commit is contained in:
1 parent
f991d118cd
commit
b498b1e63a
22 files changed
+135
-1
No files matched your search
@@ -229,6 +229,19 @@ describe("sidebar pinned tree nodes", () => {
|
||||
expect(defaultNode.pinned).toBe(true);
|
||||
});
|
||||
|
||||
it("restores the natural order of the default database when fixed priority is disabled", () => {
|
||||
const nodeA: TreeNode = { id: "db-a", label: "A", type: "database", connectionId: "conn", database: "a" };
|
||||
const defaultNode: TreeNode = { id: "db-default", label: "B", type: "database", connectionId: "conn", database: "default" };
|
||||
const nodeC: TreeNode = { id: "db-c", label: "C", type: "database", connectionId: "conn", database: "c" };
|
||||
const nodes = [nodeA, defaultNode, nodeC];
|
||||
|
||||
syncPinnedTreeNodeStateInPlace(nodes, new Set(), [], (node) => node.id === defaultNode.id);
|
||||
expect(nodes.map((node) => node.id)).toEqual(["db-default", "db-a", "db-c"]);
|
||||
|
||||
syncPinnedTreeNodeStateInPlace(nodes, new Set(), [], () => false);
|
||||
expect(nodes.map((node) => node.id)).toEqual(["db-a", "db-default", "db-c"]);
|
||||
});
|
||||
|
||||
it("reorders pinned keys before and after a sibling without dropping unrelated keys", () => {
|
||||
const initial = ["scope:a", "other:x", "scope:b", "other:y", "scope:c"];
|
||||
|
||||
|
||||
@@ -94,6 +94,7 @@ export const EDITOR_SETTINGS_DRAFT_KEYS = [
|
||||
"sidebarTableSearchEnabled",
|
||||
"sidebarSearchOpenedDatabasesOnly",
|
||||
"autoSelectActiveSidebarNode",
|
||||
"sidebarPinDefaultDatabase",
|
||||
"sidebarBrowseObjectsOnDatabaseActivation",
|
||||
"openTabsRestoreMode",
|
||||
"autoReloadRestoredDataTabsOnOpen",
|
||||
|
||||
@@ -204,6 +204,7 @@ export const SETTINGS_SEARCH_DEFINITIONS: readonly SettingsSearchDefinition[] =
|
||||
{ id: "navigation-table-search", category: "navigation", titleKey: "settings.sidebarTableSearchEnabled", descriptionKey: "settings.sidebarTableSearchEnabledDescription", targetId: "navigation" },
|
||||
{ id: "navigation-search-opened-databases-only", category: "navigation", titleKey: "settings.sidebarSearchOpenedDatabasesOnly", descriptionKey: "settings.sidebarSearchOpenedDatabasesOnlyDescription", targetId: "navigation" },
|
||||
{ id: "navigation-active-node", category: "navigation", titleKey: "settings.autoSelectActiveSidebarNode", descriptionKey: "settings.autoSelectActiveSidebarNodeDescription", targetId: "navigation" },
|
||||
{ id: "navigation-sidebar-pin-default-database", category: "navigation", titleKey: "settings.sidebarPinDefaultDatabase", descriptionKey: "settings.sidebarPinDefaultDatabaseDescription", targetId: "navigation" },
|
||||
{ id: "navigation-browse-objects-on-database-activation", category: "navigation", titleKey: "settings.sidebarBrowseObjectsOnDatabaseActivation", descriptionKey: "settings.sidebarBrowseObjectsOnDatabaseActivationDescription", targetId: "navigation" },
|
||||
{ id: "navigation-tabs-restore", category: "navigation", titleKey: "settings.openTabsRestoreMode", descriptionKey: "settings.openTabsRestoreModeDescription", targetId: "navigation" },
|
||||
{ id: "navigation-sidebar-scroll", category: "navigation", titleKey: "settings.sidebarAllowHorizontalScroll", descriptionKey: "settings.sidebarAllowHorizontalScrollDescription", targetId: "navigation" },
|
||||
|
||||
@@ -125,6 +125,7 @@ const SETTINGS_TRANSFER_CATEGORY_KEYS: Record<SettingsTransferCategoryId, readon
|
||||
"sidebarTableSearchEnabled",
|
||||
"sidebarSearchOpenedDatabasesOnly",
|
||||
"autoSelectActiveSidebarNode",
|
||||
"sidebarPinDefaultDatabase",
|
||||
"sidebarBrowseObjectsOnDatabaseActivation",
|
||||
"openTabsRestoreMode",
|
||||
"autoReloadRestoredDataTabsOnOpen",
|
||||
@@ -291,6 +292,7 @@ const PASS_THROUGH_BOOLEAN_KEYS = [
|
||||
"infiniteScroll",
|
||||
"autoCalculateTotalRows",
|
||||
"autoSelectActiveSidebarNode",
|
||||
"sidebarPinDefaultDatabase",
|
||||
"sidebarAllowHorizontalScroll",
|
||||
"sidebarShowTooltips",
|
||||
"updateNotificationsEnabled",
|
||||
|
||||
Reference in new issue
Block a user