= {
refresh: isDataGridToolbarCapabilityVisible(props.refresh),
autoRefresh: isDataGridToolbarCapabilityVisible(props.autoRefresh),
- navigation: props.navigationVisible === true,
copyData: isDataGridToolbarCapabilityVisible(props.copyData),
addRow: isDataGridToolbarCapabilityVisible(props.addRow),
deleteRow: isDataGridToolbarCapabilityVisible(props.deleteRow),
@@ -140,8 +138,6 @@ function actionLabelClass(action: DataGridToolbarActionKey) {
-
-
diff --git a/apps/desktop/src/components/grid/__tests__/DataGridGoToColumnShortcut.spec.ts b/apps/desktop/src/components/grid/__tests__/DataGridGoToColumnShortcut.spec.ts
index de5b58ee19..40e00e23b4 100644
--- a/apps/desktop/src/components/grid/__tests__/DataGridGoToColumnShortcut.spec.ts
+++ b/apps/desktop/src/components/grid/__tests__/DataGridGoToColumnShortcut.spec.ts
@@ -83,7 +83,7 @@ function mountGrid(
hidden_column_indexes: options.displayableColumns === false ? [0] : undefined,
});
- const grid = ref<{ tableInfoToolbarCapability: DataGridToolbarActionCapability }>();
+ const grid = ref<{ tableInfoToolbarCapability: DataGridToolbarActionCapability; goToColumnToolbarCapability: DataGridToolbarActionCapability }>();
const host = document.createElement("div");
document.body.append(host);
const Root = defineComponent({
@@ -139,12 +139,6 @@ function gridRoot(host: HTMLElement): HTMLElement {
return root;
}
-function goToColumnButton(host: HTMLElement): HTMLButtonElement {
- const button = [...host.querySelectorAll("button")].find((candidate) => candidate.textContent?.trim() === "Go to column");
- if (!button) throw new Error("Go-to-column button not found");
- return button;
-}
-
function goToColumnItem(name: string, position: number): HTMLButtonElement {
const button = [...document.querySelectorAll("button")].find((candidate) => candidate.textContent?.replaceAll(/\s/g, "") === `${name}#${position}`);
if (!button) throw new Error(`Go-to-column item ${name} not found`);
@@ -269,10 +263,29 @@ describe("DataGrid go-to-column shortcut", () => {
expect(event.defaultPrevented).toBe(true);
expect(bubbled).not.toHaveBeenCalled();
- expect(goToColumnButton(host).getAttribute("aria-expanded")).toBe("true");
+ expect(host.querySelector("[data-column-lookup-panel]")).not.toBeNull();
expect(document.activeElement?.getAttribute("placeholder")).toBe("Search column/comment...");
});
+ it("toggles the column lookup panel from its toolbar capability", async () => {
+ const { host, grid } = mountGrid({ columns: ["id", "name"] });
+ await settle();
+
+ expect(grid.value?.goToColumnToolbarCapability.active).toBe(false);
+
+ await grid.value!.goToColumnToolbarCapability.onTrigger();
+ await settle();
+
+ expect(host.querySelector("[data-column-lookup-panel]")).not.toBeNull();
+ expect(grid.value?.goToColumnToolbarCapability.active).toBe(true);
+
+ await grid.value!.goToColumnToolbarCapability.onTrigger();
+ await settle();
+
+ expect(host.querySelector("[data-column-lookup-panel]")).toBeNull();
+ expect(grid.value?.goToColumnToolbarCapability.active).toBe(false);
+ });
+
it("moves the lookup selection with arrows and chooses it with Enter", async () => {
const { host } = mountGrid({ columns: ["id", "name"] });
await settle();
@@ -294,7 +307,7 @@ describe("DataGrid go-to-column shortcut", () => {
await settle();
expect(enter.defaultPrevented).toBe(true);
- expect(goToColumnButton(host).getAttribute("aria-expanded")).toBe("false");
+ expect(host.querySelector("[data-column-lookup-panel]")).not.toBeNull();
});
it("does not consume the configured shortcut without a displayable column", async () => {
@@ -309,7 +322,7 @@ describe("DataGrid go-to-column shortcut", () => {
expect(event.defaultPrevented).toBe(false);
expect(bubbled).toHaveBeenCalledOnce();
- expect(goToColumnButton(host).getAttribute("aria-expanded")).toBe("false");
+ expect(host.querySelector("[data-column-lookup-panel]")).toBeNull();
});
it("does not trigger or consume shortcuts from editable targets", async () => {
@@ -330,7 +343,7 @@ describe("DataGrid go-to-column shortcut", () => {
await settle();
expect(bubbled).toHaveBeenCalledTimes(targets.length);
- expect(goToColumnButton(host).getAttribute("aria-expanded")).toBe("false");
+ expect(host.querySelector("[data-column-lookup-panel]")).toBeNull();
});
it("leaves an unmatched root event untouched", async () => {
@@ -346,6 +359,6 @@ describe("DataGrid go-to-column shortcut", () => {
expect(event.defaultPrevented).toBe(false);
expect(bubbled).toHaveBeenCalledOnce();
- expect(goToColumnButton(host).getAttribute("aria-expanded")).toBe("false");
+ expect(host.querySelector("[data-column-lookup-panel]")).toBeNull();
});
});
diff --git a/apps/desktop/src/components/grid/__tests__/DataGridToolbarIconTooltips.spec.ts b/apps/desktop/src/components/grid/__tests__/DataGridToolbarIconTooltips.spec.ts
index aa65fd5c81..4c7ce2317f 100644
--- a/apps/desktop/src/components/grid/__tests__/DataGridToolbarIconTooltips.spec.ts
+++ b/apps/desktop/src/components/grid/__tests__/DataGridToolbarIconTooltips.spec.ts
@@ -1,11 +1,12 @@
// @vitest-environment happy-dom
-import { createApp, defineComponent, h, markRaw, nextTick, type App, type PropType } from "vue";
+import { createApp, defineComponent, h, markRaw, nextTick, ref, type App, type PropType } from "vue";
import { createPinia, setActivePinia } from "pinia";
import { afterEach, describe, expect, it, vi } from "vitest";
import i18n from "@/i18n";
import type { QueryResult } from "@/types/database";
import { TooltipProvider } from "@/components/ui/tooltip";
+import type { DataGridToolbarActionCapability } from "@/lib/dataGrid/dataGridToolbar";
vi.mock("@/composables/useDataGridColumnResize", async (importOriginal) => {
const actual = await importOriginal();
@@ -103,16 +104,17 @@ function mountGrid() {
shortcuts: { ...settingsStore.editorSettings.shortcuts, goToColumn: "Mod+G" },
});
const result = markRaw({
- columns: ["id"],
- rows: [[1]],
+ columns: ["id", "name"],
+ rows: [[1, "Ada"]],
affected_rows: 0,
execution_time_ms: 0,
});
+ const grid = ref<{ goToColumnToolbarCapability: DataGridToolbarActionCapability }>();
const host = document.createElement("div");
document.body.append(host);
const Root = defineComponent({
setup() {
- return () => h(TooltipProvider, { delayDuration: 0 }, { default: () => h(DataGrid, { result, databaseType: "mysql", context: "table-data" }) });
+ return () => h(TooltipProvider, { delayDuration: 0 }, { default: () => h(DataGrid, { ref: grid, result, databaseType: "mysql", context: "table-data" }) });
},
});
const app = createApp(Root);
@@ -122,7 +124,7 @@ function mountGrid() {
app.mount(host);
const mounted = { app, host };
mountedApps.push(mounted);
- return mounted;
+ return { ...mounted, grid };
}
async function settle() {
@@ -197,15 +199,18 @@ describe("data grid icon-only toolbar tooltips", () => {
expect(showsTooltip("Auto-refresh results")).toBe(true);
});
- it("shows a tooltip for the go to column control", async () => {
- const { host } = mountGrid();
+ it("opens the column lookup side panel through its toolbar capability", async () => {
+ const { host, grid } = mountGrid();
await settle();
- const button = toolbarButton(host, "navigation");
- await hover(button);
+ expect(grid.value?.goToColumnToolbarCapability.visible).toBe(true);
+ expect(grid.value?.goToColumnToolbarCapability.label).toBe("Go to column");
- expect(showsTooltip("Go to column")).toBe(true);
- expect(visibleTooltipTexts().some((text) => text.includes("Go to column (") && text.includes("G)"))).toBe(true);
+ await grid.value!.goToColumnToolbarCapability.onTrigger();
+ await settle();
+
+ expect(host.querySelector("[data-column-lookup-panel]")).not.toBeNull();
+ expect(host.querySelector('[data-slot="popover-content"]')).toBeNull();
});
});
@@ -232,12 +237,15 @@ describe("data grid toolbar overlay surfaces anchor to their trigger", () => {
expectPositionedSurface("dropdown-menu-content");
});
- it("positions the go to column popover after a click", async () => {
- const { host } = mountGrid();
+ it("keeps the column lookup surface in the grid side panel", async () => {
+ const { host, grid } = mountGrid();
await settle();
- await click(toolbarButton(host, "navigation"));
+ await grid.value!.goToColumnToolbarCapability.onTrigger();
+ await settle();
- expectPositionedSurface("popover-content");
+ const panel = host.querySelector("[data-column-lookup-panel]");
+ expect(panel).not.toBeNull();
+ expect(panel?.querySelector('input[placeholder="Search column/comment..."]')).not.toBeNull();
});
});
diff --git a/apps/desktop/src/components/hbase/HBaseBrowser.vue b/apps/desktop/src/components/hbase/HBaseBrowser.vue
index 62986b4890..7e87e1f513 100644
--- a/apps/desktop/src/components/hbase/HBaseBrowser.vue
+++ b/apps/desktop/src/components/hbase/HBaseBrowser.vue
@@ -1,6 +1,6 @@