fix(export): support uuid fallback on http

This commit is contained in:
t8y2 committed 2026-05-19 17:24:55 +08:00
1 parent b76efa56d6
commit 94f680ac7a
5 files changed
+45 -4

No files matched your search

@@ -10,6 +10,7 @@ import DatabaseIcon from "@/components/icons/DatabaseIcon.vue";
import * as api from "@/lib/api";
import type { ExportProgress } from "@/lib/api";
import { isSchemaAware } from "@/lib/databaseCapabilities";
import { generateDatabaseExportId } from "@/lib/databaseExport";
import { buildSelectedTablesPayload } from "@/lib/databaseExportSelection";
import { isTauriRuntime } from "@/lib/tauriRuntime";
import { useToast } from "@/composables/useToast";
@@ -161,7 +162,7 @@ async function startExport() {
exportCancelled.value = false;
exportProgress.value = null;
exportId.value = crypto.randomUUID();
exportId.value = generateDatabaseExportId();
let filePath = "";
@@ -77,6 +77,7 @@ import {
normalizeWhereInput,
quoteTableIdentifier,
} from "@/lib/tableSelectSql";
import { uuid } from "@/lib/utils";
import {
canEditExistingTableRows,
hiveTablePropertiesIndicateTransactional,
@@ -580,8 +581,7 @@ function selectCustomFormatter(value: string) {
}
function createCustomFormatterId(): string {
if (typeof crypto !== "undefined" && "randomUUID" in crypto) return `fmt_${crypto.randomUUID()}`;
return `fmt_${Date.now().toString(36)}_${Math.random().toString(36).slice(2)}`;
return `fmt_${uuid()}`;
}
function formatterPreviewRows(columnIndex: number) {
+5
View File
@@ -1,5 +1,6 @@
import type { DatabaseType, QueryResult } from "../types/database.ts";
import { buildTableSelectSql } from "./tableSelectSql.ts";
import { uuid } from "./utils.ts";
type SqlValue = QueryResult["rows"][number][number];
@@ -72,6 +73,10 @@ export function buildExportPageSql(options: BuildExportPageSqlOptions): string {
});
}
export function generateDatabaseExportId(): string {
return uuid();
}
export function buildDatabaseSqlExport(options: BuildDatabaseSqlExportOptions): string {
const exportedAt = options.exportedAt ?? new Date();
const rowLimit = options.rowLimitPerTable ?? DATABASE_EXPORT_ROW_LIMIT;