Skip to content

Commit 1159d62

Browse files
sshaderConvex, Inc.
authored and
Convex, Inc.
committed
Add basic UI for snapshot import progress to the dashboard (#27272)
We currently show progress messages in the CLI, but if you disconnect or kill the CLI command you can no longer see the status of your import. This is a minimal UI in the dashboard and put behind a flag. We probably want to slightly change the backend to make this sort of UI easier to build (e.g. split out the import summary from the confirmation message, potentially back this with a deployment audit log so we can know who performed it, potentially save the file name), but that's a more involved change. We can also change the CLI to list the ongoing imports before starting a new one to prevent developers from inadvertently starting two overlapping imports as a separate change. GitOrigin-RevId: 64106f597705b0fba1c4f226e62f850f87c560d2
1 parent 0bf20b1 commit 1159d62

File tree

4 files changed

+23
-0
lines changed

4 files changed

+23
-0
lines changed

npm-packages/system-udfs/convex/_generated/api.d.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ import type * as _system_frontend_paginatedScheduledJobs from "../_system/fronte
4848
import type * as _system_frontend_paginatedTableDocuments from "../_system/frontend/paginatedTableDocuments.js";
4949
import type * as _system_frontend_patchDocumentsFields from "../_system/frontend/patchDocumentsFields.js";
5050
import type * as _system_frontend_replaceDocument from "../_system/frontend/replaceDocument.js";
51+
import type * as _system_frontend_snapshotImport from "../_system/frontend/snapshotImport.js";
5152
import type * as _system_frontend_tableSize from "../_system/frontend/tableSize.js";
5253
import type * as _system_paginationLimits from "../_system/paginationLimits.js";
5354
import type * as _system_repl_wrappers from "../_system/repl/wrappers.js";
@@ -99,6 +100,7 @@ declare const fullApi: ApiFromModules<{
99100
"_system/frontend/paginatedTableDocuments": typeof _system_frontend_paginatedTableDocuments;
100101
"_system/frontend/patchDocumentsFields": typeof _system_frontend_patchDocumentsFields;
101102
"_system/frontend/replaceDocument": typeof _system_frontend_replaceDocument;
103+
"_system/frontend/snapshotImport": typeof _system_frontend_snapshotImport;
102104
"_system/frontend/tableSize": typeof _system_frontend_tableSize;
103105
"_system/paginationLimits": typeof _system_paginationLimits;
104106
"_system/repl/wrappers": typeof _system_repl_wrappers;
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,17 @@
11
import { v } from "convex/values";
22
import { queryPrivateSystem } from "../secretSystemTables";
3+
import { Doc } from "../../_generated/dataModel";
34

45
export default queryPrivateSystem({
56
args: { importId: v.id("_snapshot_imports") },
67
handler: async ({ db }, args) => {
78
return await db.get(args.importId);
89
},
910
});
11+
12+
export const list = queryPrivateSystem({
13+
args: {},
14+
handler: async function ({ db }): Promise<Doc<"_snapshot_imports">[]> {
15+
return await db.query("_snapshot_imports").order("desc").take(20);
16+
},
17+
});
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
import { queryPrivateSystem } from "../secretSystemTables";
2+
import { Doc } from "../../_generated/dataModel";
3+
4+
export const list = queryPrivateSystem({
5+
args: {},
6+
handler: async function ({ db }): Promise<Doc<"_snapshot_imports">[]> {
7+
return await db.query("_snapshot_imports").order("desc").take(20);
8+
},
9+
});

npm-packages/system-udfs/convex/schema.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -244,9 +244,13 @@ const snapshotImportsTable = defineTable({
244244
}),
245245
v.object({
246246
state: v.literal("waiting_for_confirmation"),
247+
message_to_confirm: v.string(),
248+
require_manual_confirmation: v.boolean(),
247249
}),
248250
v.object({
249251
state: v.literal("in_progress"),
252+
progress_message: v.string(),
253+
checkpoint_messages: v.array(v.string()),
250254
}),
251255
v.object({
252256
state: v.literal("completed"),

0 commit comments

Comments
 (0)