fix(sidebar): open object browser on double click
This commit is contained in:
parent
3be6f4486a
commit
69f05cdf6f
|
|
@ -373,6 +373,9 @@ function onDoubleClick() {
|
|||
);
|
||||
if (action === "open-object-browser") {
|
||||
void openObjectBrowser();
|
||||
} else if (action === "open-object-browser-and-expand") {
|
||||
void openObjectBrowser();
|
||||
if (!props.node.isExpanded) void toggle();
|
||||
} else if (action === "open-data") {
|
||||
openData();
|
||||
} else if (action === "open-source") {
|
||||
|
|
|
|||
|
|
@ -5,6 +5,7 @@ export type TreeNodeRowAction = "open-data" | "toggle" | "none";
|
|||
export type TreeNodeRowDoubleClickAction =
|
||||
| "open-data"
|
||||
| "open-object-browser"
|
||||
| "open-object-browser-and-expand"
|
||||
| "open-source"
|
||||
| "open-saved-sql"
|
||||
| "toggle"
|
||||
|
|
@ -40,6 +41,8 @@ export function treeNodeRowDoubleClickAction(
|
|||
if (sourceNodeTypes.has(type)) return "open-source";
|
||||
if (type === "saved-sql-file") return "open-saved-sql";
|
||||
if (toggleLeafNodeTypes.has(type)) return "toggle";
|
||||
if (canOpenObjectBrowser && objectBrowserNodeTypes.has(type) && canExpand) return "open-object-browser-and-expand";
|
||||
if (canOpenObjectBrowser && objectBrowserNodeTypes.has(type)) return "open-object-browser";
|
||||
if (canExpand) return "toggle";
|
||||
}
|
||||
if (canOpenObjectBrowser && objectBrowserNodeTypes.has(type)) return "open-object-browser";
|
||||
|
|
|
|||
|
|
@ -53,6 +53,16 @@ test("database and schema rows open object browser only on double click", () =>
|
|||
assert.equal(treeNodeRowAction("schema", true, "double"), "none");
|
||||
});
|
||||
|
||||
test("double click navigation mode opens object browser for database and schema rows", () => {
|
||||
assert.equal(treeNodeRowDoubleClickAction("database", true, "double", false), "open-object-browser");
|
||||
assert.equal(treeNodeRowDoubleClickAction("schema", true, "double", false), "open-object-browser");
|
||||
});
|
||||
|
||||
test("double click navigation mode opens object browser and expands expandable database and schema rows", () => {
|
||||
assert.equal(treeNodeRowDoubleClickAction("database", true, "double", true), "open-object-browser-and-expand");
|
||||
assert.equal(treeNodeRowDoubleClickAction("schema", true, "double", true), "open-object-browser-and-expand");
|
||||
});
|
||||
|
||||
test("double click does not open object browser for non-browsable rows", () => {
|
||||
assert.equal(treeNodeRowDoubleClickAction("database", false), "none");
|
||||
assert.equal(treeNodeRowDoubleClickAction("table", true), "none");
|
||||
|
|
|
|||
Loading…
Reference in New Issue