Changes
Co-authored-by: renee-png <262607627+renee-png@users.noreply.github.com>
This commit is contained in:
co-authored by
renee-png
parent
62310e462f
commit
1afa2d67c0
@@ -930,6 +930,33 @@ function ImportPage() {
|
||||
|
||||
const summary = { total: rawRows.length, inserted, skipped, errors, skipReasons };
|
||||
setResults((r) => ({ ...r, [cfg.key]: summary }));
|
||||
|
||||
// Persist run history (best-effort)
|
||||
const runRow = {
|
||||
importer_key: cfg.key,
|
||||
total: rawRows.length,
|
||||
inserted,
|
||||
skipped,
|
||||
error_count: errors.length,
|
||||
ran_by: user.id,
|
||||
};
|
||||
void supabase.from("import_runs" as any).insert(runRow as any).then(({ error: runErr }) => {
|
||||
if (runErr) {
|
||||
console.warn("[import] failed to record run", runErr);
|
||||
return;
|
||||
}
|
||||
setLastRuns((prev) => ({
|
||||
...prev,
|
||||
[cfg.key]: {
|
||||
ran_at: new Date().toISOString(),
|
||||
total: rawRows.length,
|
||||
inserted,
|
||||
skipped,
|
||||
error_count: errors.length,
|
||||
},
|
||||
}));
|
||||
});
|
||||
|
||||
if (errors.length === 0) {
|
||||
const extra = mirrored > 0 ? ` (+${mirrored} mirrored to Clients)` : "";
|
||||
toast.success(`${cfg.label}: ${inserted} imported${extra}`);
|
||||
|
||||
Reference in New Issue
Block a user