feat(grid): add a pinnable column lookup sidebar
This commit is contained in:
22 files changed
+223
-106
No files matched your search
@@ -2,7 +2,7 @@
|
|||||||
import { computed, ref, shallowRef, nextTick, watch, onMounted, onBeforeUnmount, toRaw } from "vue";
|
import { computed, ref, shallowRef, nextTick, watch, onMounted, onBeforeUnmount, toRaw } from "vue";
|
||||||
import { uuid } from "@/lib/common/utils";
|
import { uuid } from "@/lib/common/utils";
|
||||||
import { useI18n } from "vue-i18n";
|
import { useI18n } from "vue-i18n";
|
||||||
import { RefreshCw, Trash2, Plus, Save, ChevronDown, ChevronLeft, ChevronRight, Table2, Braces, X, Search, Wrench, Filter, Columns3Cog, SquareDashed, Minus, Rows3, AlignLeft, AlignRight, EyeOff, Palette, Copy } from "@lucide/vue";
|
import { RefreshCw, Trash2, Plus, Save, ChevronDown, ChevronLeft, ChevronRight, Table2, Braces, X, Search, Wrench, Filter, Columns3, Columns3Cog, SquareDashed, Minus, Rows3, AlignLeft, AlignRight, EyeOff, Palette, Copy } from "@lucide/vue";
|
||||||
import { Button } from "@/components/ui/button";
|
import { Button } from "@/components/ui/button";
|
||||||
import { Badge } from "@/components/ui/badge";
|
import { Badge } from "@/components/ui/badge";
|
||||||
import { Input } from "@/components/ui/input";
|
import { Input } from "@/components/ui/input";
|
||||||
@@ -2788,6 +2788,20 @@ defineExpose({ focusSearch });
|
|||||||
|
|
||||||
<DataGridColumnLayoutPopover v-if="viewMode === 'table' && gridResult.columns.length" :grid="dataGridRef" />
|
<DataGridColumnLayoutPopover v-if="viewMode === 'table' && gridResult.columns.length" :grid="dataGridRef" />
|
||||||
|
|
||||||
|
<Button
|
||||||
|
v-if="viewMode === 'table' && dataGridRef?.goToColumnToolbarCapability?.visible"
|
||||||
|
variant="ghost"
|
||||||
|
size="icon"
|
||||||
|
class="h-6 w-7 shrink-0 text-foreground hover:bg-accent"
|
||||||
|
:class="{ 'bg-accent': dataGridRef?.goToColumnToolbarCapability?.active }"
|
||||||
|
:title="dataGridRef?.goToColumnToolbarCapability?.label"
|
||||||
|
:aria-label="dataGridRef?.goToColumnToolbarCapability?.label"
|
||||||
|
:aria-pressed="dataGridRef?.goToColumnToolbarCapability?.active"
|
||||||
|
@click="dataGridRef?.goToColumnToolbarCapability?.onTrigger()"
|
||||||
|
>
|
||||||
|
<Columns3 class="h-4 w-4" />
|
||||||
|
</Button>
|
||||||
|
|
||||||
<Popover v-if="viewMode === 'table' && gridResult.columns.length" v-model:open="viewOptionsOpen">
|
<Popover v-if="viewMode === 'table' && gridResult.columns.length" v-model:open="viewOptionsOpen">
|
||||||
<PopoverTrigger as-child>
|
<PopoverTrigger as-child>
|
||||||
<Button variant="ghost" size="icon" class="h-6 w-7 shrink-0 text-foreground hover:bg-accent" :class="{ 'bg-accent text-foreground': dataGridRef?.nullColumnsHidden }" :title="t('grid.viewOptions')" :aria-label="t('grid.viewOptions')">
|
<Button variant="ghost" size="icon" class="h-6 w-7 shrink-0 text-foreground hover:bg-accent" :class="{ 'bg-accent text-foreground': dataGridRef?.nullColumnsHidden }" :title="t('grid.viewOptions')" :aria-label="t('grid.viewOptions')">
|
||||||
|
|||||||
@@ -2209,19 +2209,10 @@ const goToColumnOpen = ref(false);
|
|||||||
const goToColumnSearch = ref("");
|
const goToColumnSearch = ref("");
|
||||||
const goToColumnSearchInput = ref<HTMLInputElement>();
|
const goToColumnSearchInput = ref<HTMLInputElement>();
|
||||||
const goToColumnListRef = ref<HTMLElement>();
|
const goToColumnListRef = ref<HTMLElement>();
|
||||||
// The trigger lives inside a Tooltip so the icon keeps its hover hint, and that
|
|
||||||
// tooltip claims the popper anchor for its own popper root. Pointing the popover at
|
|
||||||
// the button element directly keeps the column list positioned on screen.
|
|
||||||
const goToColumnTriggerRef = ref<HTMLElement | { $el?: HTMLElement }>();
|
|
||||||
|
|
||||||
function goToColumnTriggerElement(): HTMLElement | undefined {
|
|
||||||
const trigger = goToColumnTriggerRef.value;
|
|
||||||
if (!trigger) return undefined;
|
|
||||||
return trigger instanceof HTMLElement ? trigger : trigger.$el;
|
|
||||||
}
|
|
||||||
|
|
||||||
const goToColumnSelectedIndex = ref(0);
|
const goToColumnSelectedIndex = ref(0);
|
||||||
const goToColumnTooltip = computed(() => formatShortcutTooltip(t("grid.goToColumn"), settingsStore.editorSettings.shortcuts.goToColumn));
|
const goToColumnTooltip = computed(() => formatShortcutTooltip(t("grid.goToColumn"), settingsStore.editorSettings.shortcuts.goToColumn));
|
||||||
|
const goToColumnPanelPinned = computed(() => settingsStore.editorSettings.goToColumnPanelPinned);
|
||||||
|
const GO_TO_COLUMN_PANEL_WIDTH = 280;
|
||||||
const columnOrderKeys = computed(() => uniqueDataGridColumnOrderKeys(props.result.columns, props.sourceColumns));
|
const columnOrderKeys = computed(() => uniqueDataGridColumnOrderKeys(props.result.columns, props.sourceColumns));
|
||||||
const resolvedColumnLayoutScopeKey = computed(
|
const resolvedColumnLayoutScopeKey = computed(
|
||||||
() =>
|
() =>
|
||||||
@@ -2406,7 +2397,6 @@ function actualColumnIndex(visibleColumnIndex: number): number {
|
|||||||
return visibleColumnIndexes.value[visibleColumnIndex] ?? visibleColumnIndex;
|
return visibleColumnIndexes.value[visibleColumnIndex] ?? visibleColumnIndex;
|
||||||
}
|
}
|
||||||
function scrollToColumn(columnIndex: number) {
|
function scrollToColumn(columnIndex: number) {
|
||||||
goToColumnOpen.value = false;
|
|
||||||
goToColumnSearch.value = "";
|
goToColumnSearch.value = "";
|
||||||
scrollToColumnIndex(columnIndex);
|
scrollToColumnIndex(columnIndex);
|
||||||
gridRef.value?.focus();
|
gridRef.value?.focus();
|
||||||
@@ -2433,6 +2423,26 @@ function openGoToColumn(): boolean {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function toggleGoToColumn(): boolean {
|
||||||
|
if (goToColumnOpen.value) {
|
||||||
|
goToColumnOpen.value = false;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return openGoToColumn();
|
||||||
|
}
|
||||||
|
|
||||||
|
function toggleGoToColumnPanelPinned() {
|
||||||
|
settingsStore.updateEditorSettings({ goToColumnPanelPinned: !goToColumnPanelPinned.value });
|
||||||
|
}
|
||||||
|
|
||||||
|
watch(
|
||||||
|
[() => settingsStore.editorSettings.goToColumnPanelPinned, () => props.result.columns, () => props.context],
|
||||||
|
([pinned, columns]) => {
|
||||||
|
if (pinned && columns.length > 0 && displayableColumnIndexes.value.length > 0) goToColumnOpen.value = true;
|
||||||
|
},
|
||||||
|
{ immediate: true },
|
||||||
|
);
|
||||||
|
|
||||||
function moveGoToColumnSelection(delta: number) {
|
function moveGoToColumnSelection(delta: number) {
|
||||||
const count = filteredGoToColumns.value.length;
|
const count = filteredGoToColumns.value.length;
|
||||||
if (!count) return;
|
if (!count) return;
|
||||||
@@ -11355,19 +11365,24 @@ const contentGridStyle = computed(() => {
|
|||||||
const hasRightCellDetail = !cellDetailPanelIsBottom.value && showCellDetail.value && activeCellDetail.value;
|
const hasRightCellDetail = !cellDetailPanelIsBottom.value && showCellDetail.value && activeCellDetail.value;
|
||||||
const rightPanelWidth = hasRightCellDetail ? detailPanelHeight.value : mongoJsonPreviewOpen.value ? mongoJsonPreviewWidth.value : 0;
|
const rightPanelWidth = hasRightCellDetail ? detailPanelHeight.value : mongoJsonPreviewOpen.value ? mongoJsonPreviewWidth.value : 0;
|
||||||
const hasRightPanel = hasRightCellDetail || mongoJsonPreviewOpen.value;
|
const hasRightPanel = hasRightCellDetail || mongoJsonPreviewOpen.value;
|
||||||
const tableInfoAvailableWidth = hasRightPanel ? `max(0px, calc(100% - ${rightPanelWidth}px))` : "100%";
|
// Keep this track explicit. WebKit can resolve a nested min() track sizing
|
||||||
|
// function to zero when sibling tracks are currently collapsed, which
|
||||||
|
// leaves the panel rendered but compresses its contents to a narrow strip.
|
||||||
|
const columnLookupWidthPx = goToColumnOpen.value ? GO_TO_COLUMN_PANEL_WIDTH : 0;
|
||||||
|
const columnLookupTrack = goToColumnOpen.value ? `${columnLookupWidthPx}px` : "0px";
|
||||||
|
const tableInfoAvailableWidth = `max(0px, calc(100% - ${rightPanelWidth + columnLookupWidthPx}px))`;
|
||||||
const tableInfoTrack = showTableInfo.value ? `minmax(0, min(${ddlWidth.value}px, ${tableInfoAvailableWidth}))` : "0px";
|
const tableInfoTrack = showTableInfo.value ? `minmax(0, min(${ddlWidth.value}px, ${tableInfoAvailableWidth}))` : "0px";
|
||||||
const detailTrack = hasRightPanel ? `minmax(0, min(${rightPanelWidth}px, 100%))` : "0px";
|
const detailTrack = hasRightPanel ? `minmax(0, min(${rightPanelWidth}px, 100%))` : "0px";
|
||||||
|
|
||||||
if (cellDetailPanelIsBottom.value && showCellDetail.value && activeCellDetail.value) {
|
if (cellDetailPanelIsBottom.value && showCellDetail.value && activeCellDetail.value) {
|
||||||
return {
|
return {
|
||||||
gridTemplateColumns: `minmax(0, 1fr) ${tableInfoTrack}`,
|
gridTemplateColumns: `minmax(0, 1fr) ${columnLookupTrack} ${tableInfoTrack}`,
|
||||||
gridTemplateRows: `minmax(${CELL_DETAIL_TABLE_MIN_VISIBLE_HEIGHT}px, 1fr) minmax(0, min(${detailPanelHeight.value}px, 70vh, ${CELL_DETAIL_PANEL_MAX_HEIGHT}px, calc(100% - ${CELL_DETAIL_TABLE_MIN_VISIBLE_HEIGHT}px)))`,
|
gridTemplateRows: `minmax(${CELL_DETAIL_TABLE_MIN_VISIBLE_HEIGHT}px, 1fr) minmax(0, min(${detailPanelHeight.value}px, 70vh, ${CELL_DETAIL_PANEL_MAX_HEIGHT}px, calc(100% - ${CELL_DETAIL_TABLE_MIN_VISIBLE_HEIGHT}px)))`,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
return {
|
return {
|
||||||
gridTemplateColumns: `minmax(0, 1fr) ${tableInfoTrack} ${detailTrack}`,
|
gridTemplateColumns: `minmax(0, 1fr) ${columnLookupTrack} ${tableInfoTrack} ${detailTrack}`,
|
||||||
gridTemplateRows: "minmax(0, 1fr)",
|
gridTemplateRows: "minmax(0, 1fr)",
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
@@ -11391,6 +11406,15 @@ const tableInfoToolbarCapability = computed<DataGridToolbarActionCapability>(()
|
|||||||
active: showTableInfo.value && activeTableInfoTab.value === "ddl",
|
active: showTableInfo.value && activeTableInfoTab.value === "ddl",
|
||||||
onTrigger: () => toggleTableInfo("ddl"),
|
onTrigger: () => toggleTableInfo("ddl"),
|
||||||
}));
|
}));
|
||||||
|
const goToColumnToolbarCapability = computed<DataGridToolbarActionCapability>(() => ({
|
||||||
|
label: t("grid.goToColumn"),
|
||||||
|
tooltip: goToColumnTooltip.value,
|
||||||
|
visible: props.result.columns.length > 0,
|
||||||
|
active: goToColumnOpen.value,
|
||||||
|
onTrigger: () => {
|
||||||
|
toggleGoToColumn();
|
||||||
|
},
|
||||||
|
}));
|
||||||
const mongoConnectionConfig = resolvedConnectionConfig;
|
const mongoConnectionConfig = resolvedConnectionConfig;
|
||||||
const canManageMongoIndexes = computed(() => resolvedDatabaseType.value === "mongodb" && !!props.connectionId && !!props.database && !!props.tableMeta?.tableName && supportsMongoIndexMutations(mongoConnectionConfig.value, props.tableMeta?.tableType));
|
const canManageMongoIndexes = computed(() => resolvedDatabaseType.value === "mongodb" && !!props.connectionId && !!props.database && !!props.tableMeta?.tableName && supportsMongoIndexMutations(mongoConnectionConfig.value, props.tableMeta?.tableType));
|
||||||
const canShowTableIndexes = computed(() => tableMetadataCapabilities.value.indexes && (resolvedDatabaseType.value !== "mongodb" || mongoCollectionSupportsIndexes(props.tableMeta?.tableType)));
|
const canShowTableIndexes = computed(() => tableMetadataCapabilities.value.indexes && (resolvedDatabaseType.value !== "mongodb" || mongoCollectionSupportsIndexes(props.tableMeta?.tableType)));
|
||||||
@@ -12324,6 +12348,7 @@ watch(
|
|||||||
|
|
||||||
defineExpose({
|
defineExpose({
|
||||||
tableInfoToolbarCapability,
|
tableInfoToolbarCapability,
|
||||||
|
goToColumnToolbarCapability,
|
||||||
useTransaction,
|
useTransaction,
|
||||||
transactionActive,
|
transactionActive,
|
||||||
isSaving,
|
isSaving,
|
||||||
@@ -12931,7 +12956,6 @@ useUpdateBlocker(() => (hasPendingChanges.value || hasPendingDataEditorDraft.val
|
|||||||
data-grid-topbar-row="actions"
|
data-grid-topbar-row="actions"
|
||||||
:class="splitDataGridToolbar ? 'col-start-2 row-start-1' : 'ml-auto'"
|
:class="splitDataGridToolbar ? 'col-start-2 row-start-1' : 'ml-auto'"
|
||||||
:compact-action-count="compactDataGridToolbarActionCount"
|
:compact-action-count="compactDataGridToolbarActionCount"
|
||||||
:navigation-visible="props.result.columns.length > 0"
|
|
||||||
:refresh="refreshToolbarCapability"
|
:refresh="refreshToolbarCapability"
|
||||||
:auto-refresh="autoRefreshToolbarCapability"
|
:auto-refresh="autoRefreshToolbarCapability"
|
||||||
:add-row="addRowToolbarCapability"
|
:add-row="addRowToolbarCapability"
|
||||||
@@ -12996,57 +13020,6 @@ useUpdateBlocker(() => (hasPendingChanges.value || hasPendingDataEditorDraft.val
|
|||||||
<TooltipContent side="bottom">{{ t("grid.mongoJsonPreview") }}</TooltipContent>
|
<TooltipContent side="bottom">{{ t("grid.mongoJsonPreview") }}</TooltipContent>
|
||||||
</Tooltip>
|
</Tooltip>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<template #navigation="{ compact }">
|
|
||||||
<Popover v-if="props.result.columns.length" v-model:open="goToColumnOpen">
|
|
||||||
<Tooltip>
|
|
||||||
<TooltipTrigger as-child>
|
|
||||||
<PopoverTrigger as-child>
|
|
||||||
<Button ref="goToColumnTriggerRef" data-toolbar-action="navigation" variant="ghost" size="sm" :class="['data-grid-topbar-action-button h-5 shrink-0 text-xs px-1.5', compact ? 'data-grid-topbar-action-button--compact' : '', goToColumnOpen ? 'text-primary bg-primary/10' : '']">
|
|
||||||
<Columns3 class="data-grid-topbar-action-icon w-3 h-3" />
|
|
||||||
<span
|
|
||||||
class="data-grid-topbar-action-label"
|
|
||||||
:class="{
|
|
||||||
'data-grid-topbar-action-label--compact': compact,
|
|
||||||
}"
|
|
||||||
>{{ t("grid.goToColumn") }}</span
|
|
||||||
>
|
|
||||||
</Button>
|
|
||||||
</PopoverTrigger>
|
|
||||||
</TooltipTrigger>
|
|
||||||
<TooltipContent side="bottom">{{ goToColumnTooltip }}</TooltipContent>
|
|
||||||
</Tooltip>
|
|
||||||
<PopoverContent :reference="goToColumnTriggerElement()" align="end" class="w-56 p-2" @keydown="onGoToColumnKeydown">
|
|
||||||
<div class="relative mb-1">
|
|
||||||
<Search class="pointer-events-none absolute left-2 top-1/2 h-3.5 w-3.5 -translate-y-1/2 text-muted-foreground" />
|
|
||||||
<input ref="goToColumnSearchInput" v-model="goToColumnSearch" :placeholder="t('grid.searchColumn')" class="h-8 w-full rounded-md border bg-transparent pl-7 pr-6 text-xs outline-none focus-visible:border-ring/50 focus-visible:ring-1 focus-visible:ring-ring/25" />
|
|
||||||
<button v-if="goToColumnSearch" type="button" class="absolute right-1.5 top-1/2 -translate-y-1/2 text-muted-foreground hover:text-foreground" @click="goToColumnSearch = ''">
|
|
||||||
<X class="h-3.5 w-3.5" />
|
|
||||||
</button>
|
|
||||||
</div>
|
|
||||||
<div ref="goToColumnListRef" class="max-h-56 overflow-auto rounded border">
|
|
||||||
<button
|
|
||||||
v-for="(column, index) in filteredGoToColumns"
|
|
||||||
:key="column.index"
|
|
||||||
type="button"
|
|
||||||
:class="[
|
|
||||||
'grid w-full grid-cols-[minmax(0,1fr)_auto] items-center gap-x-2 gap-y-0.5 px-2 py-1.5 text-left text-xs hover:bg-accent hover:text-accent-foreground focus-visible:bg-accent focus-visible:text-accent-foreground focus-visible:outline-none',
|
|
||||||
index === goToColumnSelectedIndex ? 'bg-accent text-accent-foreground' : '',
|
|
||||||
]"
|
|
||||||
@pointerenter="goToColumnSelectedIndex = index"
|
|
||||||
@click="scrollToColumn(column.index)"
|
|
||||||
>
|
|
||||||
<span class="min-w-0 truncate">{{ column.name }}</span>
|
|
||||||
<span class="shrink-0 font-mono text-[10px] text-muted-foreground">#{{ column.index + 1 }}</span>
|
|
||||||
<span v-if="column.comment" class="col-span-2 min-w-0 truncate text-[11px] leading-4 text-muted-foreground" :title="column.comment">{{ column.comment }}</span>
|
|
||||||
</button>
|
|
||||||
<div v-if="!filteredGoToColumns.length" class="px-2 py-3 text-center text-xs text-muted-foreground">
|
|
||||||
{{ t("grid.noColumnsFound") }}
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</PopoverContent>
|
|
||||||
</Popover>
|
|
||||||
</template>
|
|
||||||
</DataGridToolbar>
|
</DataGridToolbar>
|
||||||
</div>
|
</div>
|
||||||
<DataGridFilterWorkbench
|
<DataGridFilterWorkbench
|
||||||
@@ -13154,7 +13127,7 @@ useUpdateBlocker(() => (hasPendingChanges.value || hasPendingDataEditorDraft.val
|
|||||||
<span>{{ t(truncationHintKey, { count: result.rows.length }) }}</span>
|
<span>{{ t(truncationHintKey, { count: result.rows.length }) }}</span>
|
||||||
</div>
|
</div>
|
||||||
<!-- Content area: table + side/bottom detail panes -->
|
<!-- Content area: table + side/bottom detail panes -->
|
||||||
<div class="flex-1 grid min-h-0 overflow-hidden" :style="contentGridStyle">
|
<div class="relative flex-1 grid min-h-0 overflow-hidden" :style="contentGridStyle">
|
||||||
<div class="col-start-1 row-start-1 flex flex-col min-w-0 overflow-hidden relative">
|
<div class="col-start-1 row-start-1 flex flex-col min-w-0 overflow-hidden relative">
|
||||||
<!-- Search overlay (Ctrl+F) -->
|
<!-- Search overlay (Ctrl+F) -->
|
||||||
<DataGridSearchBar
|
<DataGridSearchBar
|
||||||
@@ -14442,13 +14415,51 @@ useUpdateBlocker(() => (hasPendingChanges.value || hasPendingDataEditorDraft.val
|
|||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
</div>
|
</div>
|
||||||
|
<!-- Column lookup panel -->
|
||||||
|
<div v-if="goToColumnOpen" data-column-lookup-panel class="column-lookup-panel relative col-start-2 row-start-1 z-30 flex min-w-0 max-w-full flex-col overflow-hidden border-l bg-background shadow-lg" @keydown="onGoToColumnKeydown">
|
||||||
|
<div class="flex items-center gap-2 px-3 py-1.5 border-b shrink-0 bg-muted/20 h-9">
|
||||||
|
<Columns3 class="w-3.5 h-3.5 text-muted-foreground" />
|
||||||
|
<span class="text-xs font-medium flex-1 truncate">{{ t("grid.goToColumn") }}</span>
|
||||||
|
<Button variant="ghost" size="icon" class="h-5 w-5" :class="{ 'bg-accent text-primary': goToColumnPanelPinned }" :title="goToColumnPanelPinned ? t('grid.unpinGoToColumn') : t('grid.pinGoToColumn')" @click="toggleGoToColumnPanelPinned">
|
||||||
|
<Pin class="w-3 h-3" :class="{ 'fill-current': goToColumnPanelPinned }" />
|
||||||
|
</Button>
|
||||||
|
<Button variant="ghost" size="icon" class="h-5 w-5" :title="t('common.close')" @click="goToColumnOpen = false">
|
||||||
|
<X class="w-3 h-3" />
|
||||||
|
</Button>
|
||||||
|
</div>
|
||||||
|
<div class="relative m-2 shrink-0">
|
||||||
|
<Search class="pointer-events-none absolute left-2 top-1/2 h-3.5 w-3.5 -translate-y-1/2 text-muted-foreground" />
|
||||||
|
<input ref="goToColumnSearchInput" v-model="goToColumnSearch" :placeholder="t('grid.searchColumn')" class="h-8 w-full rounded-md border bg-transparent pl-7 pr-6 text-xs outline-none focus-visible:border-ring/50 focus-visible:ring-1 focus-visible:ring-ring/25" />
|
||||||
|
<button v-if="goToColumnSearch" type="button" class="absolute right-1.5 top-1/2 -translate-y-1/2 text-muted-foreground hover:text-foreground" @click="goToColumnSearch = ''">
|
||||||
|
<X class="h-3.5 w-3.5" />
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
<div ref="goToColumnListRef" class="mx-2 mb-2 min-h-0 flex-1 overflow-auto rounded border">
|
||||||
|
<button
|
||||||
|
v-for="(column, index) in filteredGoToColumns"
|
||||||
|
:key="column.index"
|
||||||
|
type="button"
|
||||||
|
:class="[
|
||||||
|
'grid w-full grid-cols-[minmax(0,1fr)_auto] items-center gap-x-2 gap-y-0.5 px-2 py-1.5 text-left text-xs hover:bg-accent hover:text-accent-foreground focus-visible:bg-accent focus-visible:text-accent-foreground focus-visible:outline-none',
|
||||||
|
index === goToColumnSelectedIndex ? 'bg-accent text-accent-foreground' : '',
|
||||||
|
]"
|
||||||
|
@pointerenter="goToColumnSelectedIndex = index"
|
||||||
|
@click="scrollToColumn(column.index)"
|
||||||
|
>
|
||||||
|
<span class="min-w-0 truncate">{{ column.name }}</span>
|
||||||
|
<span class="shrink-0 font-mono text-[10px] text-muted-foreground">#{{ column.index + 1 }}</span>
|
||||||
|
<span v-if="column.comment" class="col-span-2 min-w-0 truncate text-[11px] leading-4 text-muted-foreground" :title="column.comment">{{ column.comment }}</span>
|
||||||
|
</button>
|
||||||
|
<div v-if="!filteredGoToColumns.length" class="px-2 py-3 text-center text-xs text-muted-foreground">{{ t("grid.noColumnsFound") }}</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
<!-- Table Info Drawer -->
|
<!-- Table Info Drawer -->
|
||||||
<div
|
<div
|
||||||
v-if="showTableInfo"
|
v-if="showTableInfo"
|
||||||
data-native-clipboard
|
data-native-clipboard
|
||||||
data-table-info-drawer
|
data-table-info-drawer
|
||||||
class="table-info-drawer relative col-start-2 row-start-1 border-l flex flex-col bg-background min-w-0 max-w-full"
|
class="table-info-drawer relative row-start-1 border-l flex flex-col bg-background min-w-0 max-w-full"
|
||||||
:class="[{ 'row-span-2': cellDetailPanelIsBottom }, { 'ddl-drawer-resizing': isResizingDdl }]"
|
:class="['col-start-3', { 'row-span-2': cellDetailPanelIsBottom }, { 'ddl-drawer-resizing': isResizingDdl }]"
|
||||||
:style="ddlDrawerStyle"
|
:style="ddlDrawerStyle"
|
||||||
@contextmenu="onDrawerContextMenu"
|
@contextmenu="onDrawerContextMenu"
|
||||||
>
|
>
|
||||||
@@ -14597,7 +14608,7 @@ useUpdateBlocker(() => (hasPendingChanges.value || hasPendingDataEditorDraft.val
|
|||||||
<div
|
<div
|
||||||
v-if="showCellDetail && activeCellDetail"
|
v-if="showCellDetail && activeCellDetail"
|
||||||
class="relative flex flex-col bg-background min-w-0"
|
class="relative flex flex-col bg-background min-w-0"
|
||||||
:class="[cellDetailPanelIsBottom ? 'col-start-1 row-start-2 border-t' : 'col-start-3 row-start-1 border-l', { 'detail-drawer-resizing': isResizingDetail }]"
|
:class="[cellDetailPanelIsBottom ? 'col-start-1 row-start-2 border-t' : 'col-start-4 row-start-1 border-l', { 'detail-drawer-resizing': isResizingDetail }]"
|
||||||
:style="detailPanelStyle"
|
:style="detailPanelStyle"
|
||||||
@contextmenu="onDrawerContextMenu"
|
@contextmenu="onDrawerContextMenu"
|
||||||
>
|
>
|
||||||
|
|||||||
@@ -55,7 +55,7 @@ watch(
|
|||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<div class="relative col-start-3 row-start-1 flex min-w-0 flex-col border-l bg-background" :class="{ 'detail-drawer-resizing': resizing }" :style="panelStyle" @contextmenu="emit('contextMenu', $event)">
|
<div class="relative col-start-4 row-start-1 flex min-w-0 flex-col border-l bg-background" :class="{ 'detail-drawer-resizing': resizing }" :style="panelStyle" @contextmenu="emit('contextMenu', $event)">
|
||||||
<div class="absolute bottom-0 left-0 top-0 z-20 w-1.5 -translate-x-1/2 cursor-col-resize hover:bg-primary/30" @mousedown.prevent="emit('resizeStart', $event)" />
|
<div class="absolute bottom-0 left-0 top-0 z-20 w-1.5 -translate-x-1/2 cursor-col-resize hover:bg-primary/30" @mousedown.prevent="emit('resizeStart', $event)" />
|
||||||
<div class="flex h-9 shrink-0 items-center gap-2 border-b bg-muted/20 px-3">
|
<div class="flex h-9 shrink-0 items-center gap-2 border-b bg-muted/20 px-3">
|
||||||
<Code2 class="h-3.5 w-3.5 text-muted-foreground" />
|
<Code2 class="h-3.5 w-3.5 text-muted-foreground" />
|
||||||
|
|||||||
@@ -30,7 +30,6 @@ import {
|
|||||||
const props = defineProps<{
|
const props = defineProps<{
|
||||||
compact?: boolean;
|
compact?: boolean;
|
||||||
compactActionCount?: number;
|
compactActionCount?: number;
|
||||||
navigationVisible?: boolean;
|
|
||||||
refresh: DataGridToolbarActionCapability;
|
refresh: DataGridToolbarActionCapability;
|
||||||
autoRefresh?: DataGridToolbarAutoRefreshCapability;
|
autoRefresh?: DataGridToolbarAutoRefreshCapability;
|
||||||
addRow?: DataGridToolbarAddRowCapability;
|
addRow?: DataGridToolbarAddRowCapability;
|
||||||
@@ -62,7 +61,6 @@ const visibleActionOrder = computed<DataGridToolbarActionKey[]>(() => {
|
|||||||
const visibility: Record<DataGridToolbarActionKey, boolean> = {
|
const visibility: Record<DataGridToolbarActionKey, boolean> = {
|
||||||
refresh: isDataGridToolbarCapabilityVisible(props.refresh),
|
refresh: isDataGridToolbarCapabilityVisible(props.refresh),
|
||||||
autoRefresh: isDataGridToolbarCapabilityVisible(props.autoRefresh),
|
autoRefresh: isDataGridToolbarCapabilityVisible(props.autoRefresh),
|
||||||
navigation: props.navigationVisible === true,
|
|
||||||
copyData: isDataGridToolbarCapabilityVisible(props.copyData),
|
copyData: isDataGridToolbarCapabilityVisible(props.copyData),
|
||||||
addRow: isDataGridToolbarCapabilityVisible(props.addRow),
|
addRow: isDataGridToolbarCapabilityVisible(props.addRow),
|
||||||
deleteRow: isDataGridToolbarCapabilityVisible(props.deleteRow),
|
deleteRow: isDataGridToolbarCapabilityVisible(props.deleteRow),
|
||||||
@@ -140,8 +138,6 @@ function actionLabelClass(action: DataGridToolbarActionKey) {
|
|||||||
</DropdownMenuContent>
|
</DropdownMenuContent>
|
||||||
</DropdownMenu>
|
</DropdownMenu>
|
||||||
|
|
||||||
<slot name="navigation" :compact="actionIsCompact('navigation')" />
|
|
||||||
|
|
||||||
<div v-if="isDataGridToolbarCapabilityVisible(copyData)" class="flex h-5 shrink-0 items-stretch overflow-hidden rounded-md border border-border">
|
<div v-if="isDataGridToolbarCapabilityVisible(copyData)" class="flex h-5 shrink-0 items-stretch overflow-hidden rounded-md border border-border">
|
||||||
<Tooltip>
|
<Tooltip>
|
||||||
<TooltipTrigger as-child>
|
<TooltipTrigger as-child>
|
||||||
|
|||||||
+25
-12
@@ -83,7 +83,7 @@ function mountGrid(
|
|||||||
hidden_column_indexes: options.displayableColumns === false ? [0] : undefined,
|
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");
|
const host = document.createElement("div");
|
||||||
document.body.append(host);
|
document.body.append(host);
|
||||||
const Root = defineComponent({
|
const Root = defineComponent({
|
||||||
@@ -139,12 +139,6 @@ function gridRoot(host: HTMLElement): HTMLElement {
|
|||||||
return root;
|
return root;
|
||||||
}
|
}
|
||||||
|
|
||||||
function goToColumnButton(host: HTMLElement): HTMLButtonElement {
|
|
||||||
const button = [...host.querySelectorAll<HTMLButtonElement>("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 {
|
function goToColumnItem(name: string, position: number): HTMLButtonElement {
|
||||||
const button = [...document.querySelectorAll<HTMLButtonElement>("button")].find((candidate) => candidate.textContent?.replaceAll(/\s/g, "") === `${name}#${position}`);
|
const button = [...document.querySelectorAll<HTMLButtonElement>("button")].find((candidate) => candidate.textContent?.replaceAll(/\s/g, "") === `${name}#${position}`);
|
||||||
if (!button) throw new Error(`Go-to-column item ${name} not found`);
|
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(event.defaultPrevented).toBe(true);
|
||||||
expect(bubbled).not.toHaveBeenCalled();
|
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...");
|
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 () => {
|
it("moves the lookup selection with arrows and chooses it with Enter", async () => {
|
||||||
const { host } = mountGrid({ columns: ["id", "name"] });
|
const { host } = mountGrid({ columns: ["id", "name"] });
|
||||||
await settle();
|
await settle();
|
||||||
@@ -294,7 +307,7 @@ describe("DataGrid go-to-column shortcut", () => {
|
|||||||
await settle();
|
await settle();
|
||||||
|
|
||||||
expect(enter.defaultPrevented).toBe(true);
|
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 () => {
|
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(event.defaultPrevented).toBe(false);
|
||||||
expect(bubbled).toHaveBeenCalledOnce();
|
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 () => {
|
it("does not trigger or consume shortcuts from editable targets", async () => {
|
||||||
@@ -330,7 +343,7 @@ describe("DataGrid go-to-column shortcut", () => {
|
|||||||
await settle();
|
await settle();
|
||||||
|
|
||||||
expect(bubbled).toHaveBeenCalledTimes(targets.length);
|
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 () => {
|
it("leaves an unmatched root event untouched", async () => {
|
||||||
@@ -346,6 +359,6 @@ describe("DataGrid go-to-column shortcut", () => {
|
|||||||
|
|
||||||
expect(event.defaultPrevented).toBe(false);
|
expect(event.defaultPrevented).toBe(false);
|
||||||
expect(bubbled).toHaveBeenCalledOnce();
|
expect(bubbled).toHaveBeenCalledOnce();
|
||||||
expect(goToColumnButton(host).getAttribute("aria-expanded")).toBe("false");
|
expect(host.querySelector("[data-column-lookup-panel]")).toBeNull();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
+23
-15
@@ -1,11 +1,12 @@
|
|||||||
// @vitest-environment happy-dom
|
// @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 { createPinia, setActivePinia } from "pinia";
|
||||||
import { afterEach, describe, expect, it, vi } from "vitest";
|
import { afterEach, describe, expect, it, vi } from "vitest";
|
||||||
import i18n from "@/i18n";
|
import i18n from "@/i18n";
|
||||||
import type { QueryResult } from "@/types/database";
|
import type { QueryResult } from "@/types/database";
|
||||||
import { TooltipProvider } from "@/components/ui/tooltip";
|
import { TooltipProvider } from "@/components/ui/tooltip";
|
||||||
|
import type { DataGridToolbarActionCapability } from "@/lib/dataGrid/dataGridToolbar";
|
||||||
|
|
||||||
vi.mock("@/composables/useDataGridColumnResize", async (importOriginal) => {
|
vi.mock("@/composables/useDataGridColumnResize", async (importOriginal) => {
|
||||||
const actual = await importOriginal<typeof import("@/composables/useDataGridColumnResize")>();
|
const actual = await importOriginal<typeof import("@/composables/useDataGridColumnResize")>();
|
||||||
@@ -103,16 +104,17 @@ function mountGrid() {
|
|||||||
shortcuts: { ...settingsStore.editorSettings.shortcuts, goToColumn: "Mod+G" },
|
shortcuts: { ...settingsStore.editorSettings.shortcuts, goToColumn: "Mod+G" },
|
||||||
});
|
});
|
||||||
const result = markRaw<QueryResult>({
|
const result = markRaw<QueryResult>({
|
||||||
columns: ["id"],
|
columns: ["id", "name"],
|
||||||
rows: [[1]],
|
rows: [[1, "Ada"]],
|
||||||
affected_rows: 0,
|
affected_rows: 0,
|
||||||
execution_time_ms: 0,
|
execution_time_ms: 0,
|
||||||
});
|
});
|
||||||
|
const grid = ref<{ goToColumnToolbarCapability: DataGridToolbarActionCapability }>();
|
||||||
const host = document.createElement("div");
|
const host = document.createElement("div");
|
||||||
document.body.append(host);
|
document.body.append(host);
|
||||||
const Root = defineComponent({
|
const Root = defineComponent({
|
||||||
setup() {
|
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);
|
const app = createApp(Root);
|
||||||
@@ -122,7 +124,7 @@ function mountGrid() {
|
|||||||
app.mount(host);
|
app.mount(host);
|
||||||
const mounted = { app, host };
|
const mounted = { app, host };
|
||||||
mountedApps.push(mounted);
|
mountedApps.push(mounted);
|
||||||
return mounted;
|
return { ...mounted, grid };
|
||||||
}
|
}
|
||||||
|
|
||||||
async function settle() {
|
async function settle() {
|
||||||
@@ -197,15 +199,18 @@ describe("data grid icon-only toolbar tooltips", () => {
|
|||||||
expect(showsTooltip("Auto-refresh results")).toBe(true);
|
expect(showsTooltip("Auto-refresh results")).toBe(true);
|
||||||
});
|
});
|
||||||
|
|
||||||
it("shows a tooltip for the go to column control", async () => {
|
it("opens the column lookup side panel through its toolbar capability", async () => {
|
||||||
const { host } = mountGrid();
|
const { host, grid } = mountGrid();
|
||||||
await settle();
|
await settle();
|
||||||
|
|
||||||
const button = toolbarButton(host, "navigation");
|
expect(grid.value?.goToColumnToolbarCapability.visible).toBe(true);
|
||||||
await hover(button);
|
expect(grid.value?.goToColumnToolbarCapability.label).toBe("Go to column");
|
||||||
|
|
||||||
expect(showsTooltip("Go to column")).toBe(true);
|
await grid.value!.goToColumnToolbarCapability.onTrigger();
|
||||||
expect(visibleTooltipTexts().some((text) => text.includes("Go to column (") && text.includes("G)"))).toBe(true);
|
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");
|
expectPositionedSurface("dropdown-menu-content");
|
||||||
});
|
});
|
||||||
|
|
||||||
it("positions the go to column popover after a click", async () => {
|
it("keeps the column lookup surface in the grid side panel", async () => {
|
||||||
const { host } = mountGrid();
|
const { host, grid } = mountGrid();
|
||||||
await settle();
|
await settle();
|
||||||
|
|
||||||
await click(toolbarButton(host, "navigation"));
|
await grid.value!.goToColumnToolbarCapability.onTrigger();
|
||||||
|
await settle();
|
||||||
|
|
||||||
expectPositionedSurface("popover-content");
|
const panel = host.querySelector<HTMLElement>("[data-column-lookup-panel]");
|
||||||
|
expect(panel).not.toBeNull();
|
||||||
|
expect(panel?.querySelector('input[placeholder="Search column/comment..."]')).not.toBeNull();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { computed, ref, watch } from "vue";
|
import { computed, ref, watch } from "vue";
|
||||||
import { Braces, DatabaseZap, ListFilter, Loader2, Plus, RefreshCw, ScanSearch, TableProperties, Trash2 } from "@lucide/vue";
|
import { Braces, Columns3, DatabaseZap, ListFilter, Loader2, Plus, RefreshCw, ScanSearch, TableProperties, Trash2 } from "@lucide/vue";
|
||||||
import { useI18n } from "vue-i18n";
|
import { useI18n } from "vue-i18n";
|
||||||
|
|
||||||
import DataGrid from "@/components/grid/DataGrid.vue";
|
import DataGrid from "@/components/grid/DataGrid.vue";
|
||||||
@@ -24,6 +24,8 @@ import type { QueryResult } from "@/types/database";
|
|||||||
import type { HBaseCellInput, HBasePutRowInput, HBaseRow, HBaseTableSchema, HBaseValueEncoding } from "@/types/hbase";
|
import type { HBaseCellInput, HBasePutRowInput, HBaseRow, HBaseTableSchema, HBaseValueEncoding } from "@/types/hbase";
|
||||||
import { useTabUiState } from "@/lib/tabs/tabUiState";
|
import { useTabUiState } from "@/lib/tabs/tabUiState";
|
||||||
|
|
||||||
|
const dataGridRef = ref<InstanceType<typeof DataGrid>>();
|
||||||
|
|
||||||
const props = defineProps<{
|
const props = defineProps<{
|
||||||
tabId: string;
|
tabId: string;
|
||||||
connectionId: string;
|
connectionId: string;
|
||||||
@@ -422,6 +424,19 @@ function errorMessage(value: unknown): string {
|
|||||||
<TableProperties class="h-3.5 w-3.5" />
|
<TableProperties class="h-3.5 w-3.5" />
|
||||||
{{ t("hbase.createTable") }}
|
{{ t("hbase.createTable") }}
|
||||||
</Button>
|
</Button>
|
||||||
|
<Button
|
||||||
|
v-if="hasTable && dataGridRef?.goToColumnToolbarCapability?.visible"
|
||||||
|
variant="ghost"
|
||||||
|
size="icon-sm"
|
||||||
|
class="h-7 w-7"
|
||||||
|
:class="{ 'bg-accent': dataGridRef?.goToColumnToolbarCapability?.active }"
|
||||||
|
:title="dataGridRef?.goToColumnToolbarCapability?.label"
|
||||||
|
:aria-label="dataGridRef?.goToColumnToolbarCapability?.label"
|
||||||
|
:aria-pressed="dataGridRef?.goToColumnToolbarCapability?.active"
|
||||||
|
@click="dataGridRef?.goToColumnToolbarCapability?.onTrigger()"
|
||||||
|
>
|
||||||
|
<Columns3 class="h-3.5 w-3.5" />
|
||||||
|
</Button>
|
||||||
<Button
|
<Button
|
||||||
v-if="hasTable && !readOnly"
|
v-if="hasTable && !readOnly"
|
||||||
variant="ghost"
|
variant="ghost"
|
||||||
@@ -446,6 +461,7 @@ function errorMessage(value: unknown): string {
|
|||||||
<ErrorBanner v-if="error" :message="error" dismissible @dismiss="error = ''" />
|
<ErrorBanner v-if="error" :message="error" dismissible @dismiss="error = ''" />
|
||||||
<DataGrid
|
<DataGrid
|
||||||
v-if="hasTable"
|
v-if="hasTable"
|
||||||
|
ref="dataGridRef"
|
||||||
class="min-h-0 flex-1"
|
class="min-h-0 flex-1"
|
||||||
:result="gridResult"
|
:result="gridResult"
|
||||||
context="results"
|
context="results"
|
||||||
|
|||||||
@@ -17,6 +17,7 @@ import { provideTabUiState } from "@/lib/tabs/tabUiState";
|
|||||||
import {
|
import {
|
||||||
Check,
|
Check,
|
||||||
CheckSquare2,
|
CheckSquare2,
|
||||||
|
Columns3,
|
||||||
Columns3Cog,
|
Columns3Cog,
|
||||||
Copy,
|
Copy,
|
||||||
EyeOff,
|
EyeOff,
|
||||||
@@ -207,6 +208,7 @@ import { isAiRedisConsoleTarget, type AiConversationBinding } from "@/lib/ai/aiC
|
|||||||
|
|
||||||
type DataGridHandle = DataGridColumnLayoutHandle & {
|
type DataGridHandle = DataGridColumnLayoutHandle & {
|
||||||
tableInfoToolbarCapability: DataGridToolbarActionCapability;
|
tableInfoToolbarCapability: DataGridToolbarActionCapability;
|
||||||
|
goToColumnToolbarCapability: DataGridToolbarActionCapability;
|
||||||
onToolbarRefresh: () => Promise<void> | void;
|
onToolbarRefresh: () => Promise<void> | void;
|
||||||
focusSearch: (target?: Element | null) => boolean;
|
focusSearch: (target?: Element | null) => boolean;
|
||||||
focusWhere: () => boolean;
|
focusWhere: () => boolean;
|
||||||
@@ -2053,6 +2055,21 @@ defineExpose({
|
|||||||
<div class="ml-auto flex shrink-0 items-center gap-1">
|
<div class="ml-auto flex shrink-0 items-center gap-1">
|
||||||
<template v-if="activeOutputView === 'result' && redisResultViewMode === 'grid' && activeTab.result && hasTabularResult && !activeElasticsearchJsonResponse && !showElasticsearchRawJson">
|
<template v-if="activeOutputView === 'result' && redisResultViewMode === 'grid' && activeTab.result && hasTabularResult && !activeElasticsearchJsonResponse && !showElasticsearchRawJson">
|
||||||
<DataGridColumnLayoutPopover :grid="dataGridRef" trigger-class="px-1.5" />
|
<DataGridColumnLayoutPopover :grid="dataGridRef" trigger-class="px-1.5" />
|
||||||
|
<LightTooltip v-if="dataGridRef?.goToColumnToolbarCapability?.visible" :text="dataGridRef.goToColumnToolbarCapability.tooltip ?? dataGridRef.goToColumnToolbarCapability.label" side="bottom" nowrap>
|
||||||
|
<Button
|
||||||
|
data-toolbar-action="navigation"
|
||||||
|
variant="ghost"
|
||||||
|
size="sm"
|
||||||
|
class="h-6 shrink-0 gap-1 px-1.5 text-xs"
|
||||||
|
:class="{ 'bg-accent': dataGridRef.goToColumnToolbarCapability.active }"
|
||||||
|
:aria-label="dataGridRef.goToColumnToolbarCapability.label"
|
||||||
|
:aria-pressed="dataGridRef.goToColumnToolbarCapability.active"
|
||||||
|
@click="dataGridRef.goToColumnToolbarCapability.onTrigger()"
|
||||||
|
>
|
||||||
|
<Columns3 class="h-3.5 w-3.5" />
|
||||||
|
{{ dataGridRef.goToColumnToolbarCapability.label }}
|
||||||
|
</Button>
|
||||||
|
</LightTooltip>
|
||||||
<LightTooltip v-if="dataGridRef?.tableInfoToolbarCapability?.visible" :text="t('contextMenu.viewDdl')" side="bottom" nowrap>
|
<LightTooltip v-if="dataGridRef?.tableInfoToolbarCapability?.visible" :text="t('contextMenu.viewDdl')" side="bottom" nowrap>
|
||||||
<Button
|
<Button
|
||||||
data-query-result-ddl
|
data-query-result-ddl
|
||||||
@@ -2732,6 +2749,20 @@ defineExpose({
|
|||||||
</Button>
|
</Button>
|
||||||
</LightTooltip>
|
</LightTooltip>
|
||||||
<DataGridColumnLayoutPopover v-if="activeTab.result?.columns.length" :grid="dataGridRef" trigger-class="px-1.5" />
|
<DataGridColumnLayoutPopover v-if="activeTab.result?.columns.length" :grid="dataGridRef" trigger-class="px-1.5" />
|
||||||
|
<LightTooltip v-if="dataGridRef?.goToColumnToolbarCapability?.visible" :text="dataGridRef.goToColumnToolbarCapability.tooltip ?? dataGridRef.goToColumnToolbarCapability.label" side="bottom" nowrap>
|
||||||
|
<Button
|
||||||
|
data-toolbar-action="navigation"
|
||||||
|
variant="ghost"
|
||||||
|
size="sm"
|
||||||
|
class="h-5 text-xs px-1.5 shrink-0"
|
||||||
|
:class="{ 'bg-accent': dataGridRef.goToColumnToolbarCapability.active }"
|
||||||
|
:aria-label="dataGridRef.goToColumnToolbarCapability.label"
|
||||||
|
:aria-pressed="dataGridRef.goToColumnToolbarCapability.active"
|
||||||
|
@click="dataGridRef.goToColumnToolbarCapability.onTrigger()"
|
||||||
|
>
|
||||||
|
<Columns3 class="h-3.5 w-3.5" /><span v-if="!dataToolbarCompact">{{ dataGridRef.goToColumnToolbarCapability.label }}</span>
|
||||||
|
</Button>
|
||||||
|
</LightTooltip>
|
||||||
<Button v-if="activeTab.result && activeDataTabTableMeta && activeTab.connectionId" variant="ghost" size="sm" class="h-5 text-xs px-1.5 shrink-0" :class="{ 'bg-accent': dataGridRef?.showDdl }" :title="dataToolbarCompact ? t('grid.tableInfo') : undefined" @click="dataGridRef?.toggleDdl()"
|
<Button v-if="activeTab.result && activeDataTabTableMeta && activeTab.connectionId" variant="ghost" size="sm" class="h-5 text-xs px-1.5 shrink-0" :class="{ 'bg-accent': dataGridRef?.showDdl }" :title="dataToolbarCompact ? t('grid.tableInfo') : undefined" @click="dataGridRef?.toggleDdl()"
|
||||||
><TableProperties class="h-3.5 w-3.5" /><span v-if="!dataToolbarCompact">{{ t("grid.tableInfo") }}</span></Button
|
><TableProperties class="h-3.5 w-3.5" /><span v-if="!dataToolbarCompact">{{ t("grid.tableInfo") }}</span></Button
|
||||||
>
|
>
|
||||||
|
|||||||
@@ -2420,6 +2420,8 @@ export default withEnglishFallback({
|
|||||||
tableOwnerUnavailable: "Əlçatan deyil",
|
tableOwnerUnavailable: "Əlçatan deyil",
|
||||||
tableInfoNoResults: "Nəticə yoxdur",
|
tableInfoNoResults: "Nəticə yoxdur",
|
||||||
goToColumn: "Sütuna keç",
|
goToColumn: "Sütuna keç",
|
||||||
|
pinGoToColumn: "Sütun axtarış panelini bərkid",
|
||||||
|
unpinGoToColumn: "Sütun axtarış panelinin bərkidilməsini ləğv et",
|
||||||
columnWidth: "Sütun eni",
|
columnWidth: "Sütun eni",
|
||||||
columnWidthCompact: "Yığcam",
|
columnWidthCompact: "Yığcam",
|
||||||
columnWidthStandard: "Standart",
|
columnWidthStandard: "Standart",
|
||||||
|
|||||||
@@ -2852,6 +2852,8 @@ export default {
|
|||||||
tableOwnerUnavailable: "Unavailable",
|
tableOwnerUnavailable: "Unavailable",
|
||||||
tableInfoNoResults: "No results",
|
tableInfoNoResults: "No results",
|
||||||
goToColumn: "Go to column",
|
goToColumn: "Go to column",
|
||||||
|
pinGoToColumn: "Pin column lookup panel",
|
||||||
|
unpinGoToColumn: "Unpin column lookup panel",
|
||||||
columnWidth: "Column Width",
|
columnWidth: "Column Width",
|
||||||
columnWidthCompact: "Compact",
|
columnWidthCompact: "Compact",
|
||||||
columnWidthStandard: "Standard",
|
columnWidthStandard: "Standard",
|
||||||
|
|||||||
@@ -2630,6 +2630,8 @@ export default withEnglishFallback({
|
|||||||
tableOwnerUnavailable: "No disponible",
|
tableOwnerUnavailable: "No disponible",
|
||||||
tableInfoNoResults: "Sin resultados",
|
tableInfoNoResults: "Sin resultados",
|
||||||
goToColumn: "Ir a la columna",
|
goToColumn: "Ir a la columna",
|
||||||
|
pinGoToColumn: "Fijar el panel de búsqueda de columnas",
|
||||||
|
unpinGoToColumn: "Desfijar el panel de búsqueda de columnas",
|
||||||
columnWidth: "Ancho de columna",
|
columnWidth: "Ancho de columna",
|
||||||
columnWidthCompact: "Compacto",
|
columnWidthCompact: "Compacto",
|
||||||
columnWidthStandard: "Estándar",
|
columnWidthStandard: "Estándar",
|
||||||
|
|||||||
@@ -2701,6 +2701,8 @@ export default withEnglishFallback({
|
|||||||
tableOwnerUnavailable: "Tidak tersedia",
|
tableOwnerUnavailable: "Tidak tersedia",
|
||||||
tableInfoNoResults: "Tidak ada hasil",
|
tableInfoNoResults: "Tidak ada hasil",
|
||||||
goToColumn: "Buka kolom",
|
goToColumn: "Buka kolom",
|
||||||
|
pinGoToColumn: "Sematkan panel pencarian kolom",
|
||||||
|
unpinGoToColumn: "Lepas sematan panel pencarian kolom",
|
||||||
columnWidth: "Lebar Kolom",
|
columnWidth: "Lebar Kolom",
|
||||||
columnWidthCompact: "Ringkas",
|
columnWidthCompact: "Ringkas",
|
||||||
columnWidthStandard: "Standar",
|
columnWidthStandard: "Standar",
|
||||||
|
|||||||
@@ -2555,6 +2555,8 @@ export default withEnglishFallback({
|
|||||||
tableOwnerUnavailable: "Non disponibile",
|
tableOwnerUnavailable: "Non disponibile",
|
||||||
tableInfoNoResults: "Nessun risultato",
|
tableInfoNoResults: "Nessun risultato",
|
||||||
goToColumn: "Vai alla colonna",
|
goToColumn: "Vai alla colonna",
|
||||||
|
pinGoToColumn: "Fissa pannello ricerca colonne",
|
||||||
|
unpinGoToColumn: "Sblocca pannello ricerca colonne",
|
||||||
columnWidth: "Larghezza colonna",
|
columnWidth: "Larghezza colonna",
|
||||||
columnWidthCompact: "Compatto",
|
columnWidthCompact: "Compatto",
|
||||||
columnWidthStandard: "Standard",
|
columnWidthStandard: "Standard",
|
||||||
|
|||||||
@@ -2562,6 +2562,8 @@ export default withEnglishFallback({
|
|||||||
tableOwnerUnavailable: "取得できません",
|
tableOwnerUnavailable: "取得できません",
|
||||||
tableInfoNoResults: "結果なし",
|
tableInfoNoResults: "結果なし",
|
||||||
goToColumn: "列へ移動",
|
goToColumn: "列へ移動",
|
||||||
|
pinGoToColumn: "列検索パネルを固定",
|
||||||
|
unpinGoToColumn: "列検索パネルの固定を解除",
|
||||||
columnWidth: "列幅",
|
columnWidth: "列幅",
|
||||||
columnWidthCompact: "コンパクト",
|
columnWidthCompact: "コンパクト",
|
||||||
columnWidthStandard: "標準",
|
columnWidthStandard: "標準",
|
||||||
|
|||||||
@@ -2599,6 +2599,8 @@ export default withEnglishFallback({
|
|||||||
tableOwnerUnavailable: "사용할 수 없음",
|
tableOwnerUnavailable: "사용할 수 없음",
|
||||||
tableInfoNoResults: "결과 없음",
|
tableInfoNoResults: "결과 없음",
|
||||||
goToColumn: "컬럼으로 이동",
|
goToColumn: "컬럼으로 이동",
|
||||||
|
pinGoToColumn: "열 검색 패널 고정",
|
||||||
|
unpinGoToColumn: "열 검색 패널 고정 해제",
|
||||||
columnWidth: "컬럼 너비",
|
columnWidth: "컬럼 너비",
|
||||||
columnWidthCompact: "좁게",
|
columnWidthCompact: "좁게",
|
||||||
columnWidthStandard: "표준",
|
columnWidthStandard: "표준",
|
||||||
|
|||||||
@@ -2557,6 +2557,8 @@ export default withEnglishFallback({
|
|||||||
tableOwnerUnavailable: "Indisponível",
|
tableOwnerUnavailable: "Indisponível",
|
||||||
tableInfoNoResults: "Nenhum resultado",
|
tableInfoNoResults: "Nenhum resultado",
|
||||||
goToColumn: "Ir para a coluna",
|
goToColumn: "Ir para a coluna",
|
||||||
|
pinGoToColumn: "Fixar painel de busca de colunas",
|
||||||
|
unpinGoToColumn: "Desafixar painel de busca de colunas",
|
||||||
columnWidth: "Largura da coluna",
|
columnWidth: "Largura da coluna",
|
||||||
columnWidthCompact: "Compacto",
|
columnWidthCompact: "Compacto",
|
||||||
columnWidthStandard: "Padrão",
|
columnWidthStandard: "Padrão",
|
||||||
|
|||||||
@@ -2736,6 +2736,8 @@ export default withEnglishFallback({
|
|||||||
tableOwnerUnavailable: "Недоступно",
|
tableOwnerUnavailable: "Недоступно",
|
||||||
tableInfoNoResults: "Нет результатов",
|
tableInfoNoResults: "Нет результатов",
|
||||||
goToColumn: "Перейти к столбцу",
|
goToColumn: "Перейти к столбцу",
|
||||||
|
pinGoToColumn: "Закрепить панель поиска столбцов",
|
||||||
|
unpinGoToColumn: "Открепить панель поиска столбцов",
|
||||||
columnWidth: "Ширина столбца",
|
columnWidth: "Ширина столбца",
|
||||||
columnWidthCompact: "Компактная",
|
columnWidthCompact: "Компактная",
|
||||||
columnWidthStandard: "Стандартная",
|
columnWidthStandard: "Стандартная",
|
||||||
|
|||||||
@@ -2413,6 +2413,8 @@ export default withEnglishFallback({
|
|||||||
tableOwnerUnavailable: "Kullanılamıyor",
|
tableOwnerUnavailable: "Kullanılamıyor",
|
||||||
tableInfoNoResults: "Sonuç yok",
|
tableInfoNoResults: "Sonuç yok",
|
||||||
goToColumn: "Sütuna git",
|
goToColumn: "Sütuna git",
|
||||||
|
pinGoToColumn: "Sütun arama panelini sabitle",
|
||||||
|
unpinGoToColumn: "Sütun arama panelinin sabitlemesini kaldır",
|
||||||
columnWidth: "Sütun Genişliği",
|
columnWidth: "Sütun Genişliği",
|
||||||
columnWidthCompact: "Sıkışık",
|
columnWidthCompact: "Sıkışık",
|
||||||
columnWidthStandard: "Standart",
|
columnWidthStandard: "Standart",
|
||||||
|
|||||||
@@ -2787,6 +2787,8 @@ export default withEnglishFallback({
|
|||||||
tableOwnerUnavailable: "无法获取",
|
tableOwnerUnavailable: "无法获取",
|
||||||
tableInfoNoResults: "无匹配结果",
|
tableInfoNoResults: "无匹配结果",
|
||||||
goToColumn: "跳转列",
|
goToColumn: "跳转列",
|
||||||
|
pinGoToColumn: "固定跳转列面板",
|
||||||
|
unpinGoToColumn: "取消固定跳转列面板",
|
||||||
columnWidth: "列宽",
|
columnWidth: "列宽",
|
||||||
columnWidthCompact: "紧凑",
|
columnWidthCompact: "紧凑",
|
||||||
columnWidthStandard: "标准",
|
columnWidthStandard: "标准",
|
||||||
|
|||||||
@@ -2562,6 +2562,8 @@ export default withEnglishFallback({
|
|||||||
tableOwnerUnavailable: "無法取得",
|
tableOwnerUnavailable: "無法取得",
|
||||||
tableInfoNoResults: "沒有相符結果",
|
tableInfoNoResults: "沒有相符結果",
|
||||||
goToColumn: "跳轉欄",
|
goToColumn: "跳轉欄",
|
||||||
|
pinGoToColumn: "固定跳轉欄面板",
|
||||||
|
unpinGoToColumn: "取消固定跳轉欄面板",
|
||||||
columnWidth: "列寬",
|
columnWidth: "列寬",
|
||||||
columnWidthCompact: "緊湊",
|
columnWidthCompact: "緊湊",
|
||||||
columnWidthStandard: "標準",
|
columnWidthStandard: "標準",
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ const DATA_GRID_COMPACT_TOPBAR_VIEWPORT_RATIO = 0.75;
|
|||||||
const DATA_GRID_TOOLBAR_ACTION_COLLAPSE_STEP = 40;
|
const DATA_GRID_TOOLBAR_ACTION_COLLAPSE_STEP = 40;
|
||||||
export const DATA_GRID_CONDITION_TOOLBAR_MIN_WIDTH = DATA_GRID_COMPACT_TOPBAR_MAX_WIDTH;
|
export const DATA_GRID_CONDITION_TOOLBAR_MIN_WIDTH = DATA_GRID_COMPACT_TOPBAR_MAX_WIDTH;
|
||||||
|
|
||||||
export const DATA_GRID_TOOLBAR_ACTION_COLLAPSE_ORDER = ["refresh", "autoRefresh", "navigation", "copyData", "addRow", "deleteRow", "exportData", "transpose", "tableInfo", "layerPreview", "preview", "save", "rollback"] as const;
|
export const DATA_GRID_TOOLBAR_ACTION_COLLAPSE_ORDER = ["refresh", "autoRefresh", "copyData", "addRow", "deleteRow", "exportData", "transpose", "tableInfo", "layerPreview", "preview", "save", "rollback"] as const;
|
||||||
|
|
||||||
export type DataGridToolbarActionKey = (typeof DATA_GRID_TOOLBAR_ACTION_COLLAPSE_ORDER)[number];
|
export type DataGridToolbarActionKey = (typeof DATA_GRID_TOOLBAR_ACTION_COLLAPSE_ORDER)[number];
|
||||||
|
|
||||||
|
|||||||
@@ -1012,6 +1012,7 @@ export interface EditorSettings {
|
|||||||
tableInfoActiveTab: TableInfoTab;
|
tableInfoActiveTab: TableInfoTab;
|
||||||
tableInfoDrawerPinned: boolean;
|
tableInfoDrawerPinned: boolean;
|
||||||
tableInfoDrawerWidth: number;
|
tableInfoDrawerWidth: number;
|
||||||
|
goToColumnPanelPinned: boolean;
|
||||||
cellDetailDrawerWidth: number;
|
cellDetailDrawerWidth: number;
|
||||||
cellDetailPanelLayout: CellDetailPanelLayout;
|
cellDetailPanelLayout: CellDetailPanelLayout;
|
||||||
cellDetailJsonFormatted: boolean;
|
cellDetailJsonFormatted: boolean;
|
||||||
@@ -1329,6 +1330,7 @@ export const DEFAULT_EDITOR_SETTINGS: EditorSettings = {
|
|||||||
tableInfoActiveTab: "ddl",
|
tableInfoActiveTab: "ddl",
|
||||||
tableInfoDrawerPinned: false,
|
tableInfoDrawerPinned: false,
|
||||||
tableInfoDrawerWidth: 320,
|
tableInfoDrawerWidth: 320,
|
||||||
|
goToColumnPanelPinned: false,
|
||||||
cellDetailDrawerWidth: 380,
|
cellDetailDrawerWidth: 380,
|
||||||
cellDetailPanelLayout: "bottom",
|
cellDetailPanelLayout: "bottom",
|
||||||
cellDetailJsonFormatted: false,
|
cellDetailJsonFormatted: false,
|
||||||
@@ -1954,6 +1956,7 @@ export function normalizeEditorSettings(settings: Partial<EditorSettings>, exist
|
|||||||
tableInfoActiveTab: normalizeTableInfoTab(settings.tableInfoActiveTab),
|
tableInfoActiveTab: normalizeTableInfoTab(settings.tableInfoActiveTab),
|
||||||
tableInfoDrawerPinned: settings.tableInfoDrawerPinned === true,
|
tableInfoDrawerPinned: settings.tableInfoDrawerPinned === true,
|
||||||
tableInfoDrawerWidth: normalizeDrawerWidth(settings.tableInfoDrawerWidth, 240, DEFAULT_EDITOR_SETTINGS.tableInfoDrawerWidth),
|
tableInfoDrawerWidth: normalizeDrawerWidth(settings.tableInfoDrawerWidth, 240, DEFAULT_EDITOR_SETTINGS.tableInfoDrawerWidth),
|
||||||
|
goToColumnPanelPinned: settings.goToColumnPanelPinned === true,
|
||||||
cellDetailDrawerWidth: normalizeDrawerWidth(settings.cellDetailDrawerWidth, 260, DEFAULT_EDITOR_SETTINGS.cellDetailDrawerWidth),
|
cellDetailDrawerWidth: normalizeDrawerWidth(settings.cellDetailDrawerWidth, 260, DEFAULT_EDITOR_SETTINGS.cellDetailDrawerWidth),
|
||||||
cellDetailPanelLayout: normalizeCellDetailPanelLayout(settings.cellDetailPanelLayout),
|
cellDetailPanelLayout: normalizeCellDetailPanelLayout(settings.cellDetailPanelLayout),
|
||||||
cellDetailJsonFormatted: typeof settings.cellDetailJsonFormatted === "boolean" ? settings.cellDetailJsonFormatted : DEFAULT_EDITOR_SETTINGS.cellDetailJsonFormatted,
|
cellDetailJsonFormatted: typeof settings.cellDetailJsonFormatted === "boolean" ? settings.cellDetailJsonFormatted : DEFAULT_EDITOR_SETTINGS.cellDetailJsonFormatted,
|
||||||
@@ -2824,6 +2827,7 @@ export const useSettingsStore = defineStore("settings", () => {
|
|||||||
if (partial.tableInfoActiveTab !== undefined) editorSettings.value.tableInfoActiveTab = normalizeTableInfoTab(partial.tableInfoActiveTab);
|
if (partial.tableInfoActiveTab !== undefined) editorSettings.value.tableInfoActiveTab = normalizeTableInfoTab(partial.tableInfoActiveTab);
|
||||||
if (partial.tableInfoDrawerPinned !== undefined) editorSettings.value.tableInfoDrawerPinned = partial.tableInfoDrawerPinned === true;
|
if (partial.tableInfoDrawerPinned !== undefined) editorSettings.value.tableInfoDrawerPinned = partial.tableInfoDrawerPinned === true;
|
||||||
if (partial.tableInfoDrawerWidth !== undefined) editorSettings.value.tableInfoDrawerWidth = normalizeDrawerWidth(partial.tableInfoDrawerWidth, 240, DEFAULT_EDITOR_SETTINGS.tableInfoDrawerWidth);
|
if (partial.tableInfoDrawerWidth !== undefined) editorSettings.value.tableInfoDrawerWidth = normalizeDrawerWidth(partial.tableInfoDrawerWidth, 240, DEFAULT_EDITOR_SETTINGS.tableInfoDrawerWidth);
|
||||||
|
if (partial.goToColumnPanelPinned !== undefined) editorSettings.value.goToColumnPanelPinned = partial.goToColumnPanelPinned === true;
|
||||||
if (partial.cellDetailDrawerWidth !== undefined) editorSettings.value.cellDetailDrawerWidth = normalizeDrawerWidth(partial.cellDetailDrawerWidth, 260, DEFAULT_EDITOR_SETTINGS.cellDetailDrawerWidth);
|
if (partial.cellDetailDrawerWidth !== undefined) editorSettings.value.cellDetailDrawerWidth = normalizeDrawerWidth(partial.cellDetailDrawerWidth, 260, DEFAULT_EDITOR_SETTINGS.cellDetailDrawerWidth);
|
||||||
if (partial.cellDetailPanelLayout !== undefined) editorSettings.value.cellDetailPanelLayout = normalizeCellDetailPanelLayout(partial.cellDetailPanelLayout);
|
if (partial.cellDetailPanelLayout !== undefined) editorSettings.value.cellDetailPanelLayout = normalizeCellDetailPanelLayout(partial.cellDetailPanelLayout);
|
||||||
if (partial.cellDetailJsonFormatted !== undefined) editorSettings.value.cellDetailJsonFormatted = partial.cellDetailJsonFormatted === true;
|
if (partial.cellDetailJsonFormatted !== undefined) editorSettings.value.cellDetailJsonFormatted = partial.cellDetailJsonFormatted === true;
|
||||||
|
|||||||
Reference in new issue
Block a user