mirror of
https://github.com/t8y2/dbx.git
synced 2026-11-01 08:26:35 +00:00
feat(runtime): 同步前端状态到 agent runtime
- 新增 snapshot 构造 helper 和 agent runtime store - 同步 active tab、连接、库、schema、SQL、选中 SQL、表格选择和结果采样 - 补充 snapshot payload 组装测试
This commit is contained in:
@@ -62,9 +62,17 @@ import type { QueryResult, ColumnInfo, DatabaseType } from "@/types/database";
|
||||
import * as api from "@/lib/api";
|
||||
import { buildTableSelectSql, quoteTableIdentifier } from "@/lib/tableSelectSql";
|
||||
import { isHiddenGridColumn, usesSyntheticRowIdKey } from "@/lib/tableEditing";
|
||||
import { formatGridSqlLiteral } from "@/lib/dataGridSql";
|
||||
import { matchesRowStatusFilter, type RowStatus, type RowStatusFilter } from "@/lib/gridRowStatus";
|
||||
import { displayCellValue, type CellValue } from "@/lib/cellValue";
|
||||
import { buildDataGridSaveStatements, formatGridSqlLiteral } from "@/lib/dataGridSql";
|
||||
import { formatMarkdownTable } from "@/lib/markdownTable";
|
||||
import { buildXlsxWorkbook } from "@/lib/xlsxExport";
|
||||
import {
|
||||
matchesRowStatusFilter,
|
||||
rowStatusFilterAfterAddingRow,
|
||||
type RowStatus,
|
||||
type RowStatusFilter,
|
||||
} from "@/lib/gridRowStatus";
|
||||
import { useAgentRuntimeStore } from "@/stores/agentRuntimeStore";
|
||||
|
||||
import { useToast } from "@/composables/useToast";
|
||||
import { useDataGridExport } from "@/composables/useDataGridExport";
|
||||
@@ -74,6 +82,7 @@ import { useDataGridEditor } from "@/composables/useDataGridEditor";
|
||||
|
||||
const { t } = useI18n();
|
||||
const { toast } = useToast();
|
||||
const agentRuntimeStore = useAgentRuntimeStore();
|
||||
|
||||
const props = defineProps<{
|
||||
result: QueryResult;
|
||||
@@ -1090,6 +1099,22 @@ const activeCellDetail = computed(() => {
|
||||
const detailEditValue = ref("");
|
||||
const isEditingDetail = ref(false);
|
||||
|
||||
watch(
|
||||
selectedCells,
|
||||
(data) => {
|
||||
agentRuntimeStore.setSelection(
|
||||
selectedCellCount.value > 0
|
||||
? {
|
||||
type: "grid-cells",
|
||||
range: selectedRange.value,
|
||||
data,
|
||||
}
|
||||
: { type: "none" },
|
||||
);
|
||||
},
|
||||
{ deep: true },
|
||||
);
|
||||
|
||||
function startDetailEdit() {
|
||||
const detail = activeCellDetail.value;
|
||||
if (!detail || !detail.isEditable) return;
|
||||
@@ -1611,6 +1636,7 @@ watch(
|
||||
|
||||
onUnmounted(() => {
|
||||
cleanupFrames();
|
||||
agentRuntimeStore.setSelection({ type: "none" });
|
||||
onDdlResizeEnd();
|
||||
finishCellSelection();
|
||||
clearTimeout(_searchTimer);
|
||||
|
||||
Reference in New Issue
Block a user