feat(monitor): add Refresh ALL UATs button with delta sync
New endpoint POST /api/eterra/refresh-all processes all 43 UATs sequentially. UATs with >30% enrichment get magic mode, others get base sync only. Each UAT uses the new delta engine (quick-count + VALID_FROM + rolling doc check). Progress tracked via progress store. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -235,6 +235,19 @@ export default function MonitorPage() {
|
||||
loading={actionLoading === "warm-cache"}
|
||||
onClick={triggerWarmCache}
|
||||
/>
|
||||
<SyncTestButton
|
||||
label="Refresh ALL UATs"
|
||||
description="Delta sync pe toate cele 43 UATs (magic unde e cazul)"
|
||||
siruta=""
|
||||
mode="base"
|
||||
includeNoGeometry={false}
|
||||
actionKey="refresh-all"
|
||||
actionLoading={actionLoading}
|
||||
setActionLoading={setActionLoading}
|
||||
addLog={addLog}
|
||||
pollRef={pollRef}
|
||||
customEndpoint="/api/eterra/refresh-all"
|
||||
/>
|
||||
<SyncTestButton
|
||||
label="Test Delta — Cluj-Napoca (baza)"
|
||||
description="Doar sync parcele+cladiri existente, fara magic (54975)"
|
||||
@@ -353,12 +366,13 @@ function ActionButton({ label, description, loading, onClick }: {
|
||||
);
|
||||
}
|
||||
|
||||
function SyncTestButton({ label, description, siruta, mode, includeNoGeometry, actionKey, actionLoading, setActionLoading, addLog, pollRef }: {
|
||||
function SyncTestButton({ label, description, siruta, mode, includeNoGeometry, actionKey, actionLoading, setActionLoading, addLog, pollRef, customEndpoint }: {
|
||||
label: string; description: string; siruta: string; mode: "base" | "magic";
|
||||
includeNoGeometry: boolean; actionKey: string; actionLoading: string;
|
||||
setActionLoading: (v: string) => void;
|
||||
addLog: (type: "info" | "ok" | "error" | "wait", msg: string) => void;
|
||||
pollRef: React.MutableRefObject<ReturnType<typeof setInterval> | null>;
|
||||
customEndpoint?: string;
|
||||
}) {
|
||||
const startTimeRef = useRef<number>(0);
|
||||
const formatElapsed = () => {
|
||||
@@ -372,12 +386,14 @@ function SyncTestButton({ label, description, siruta, mode, includeNoGeometry, a
|
||||
onClick={async () => {
|
||||
setActionLoading(actionKey);
|
||||
startTimeRef.current = Date.now();
|
||||
addLog("info", `[${label}] Pornire sync (${mode}, noGeom=${includeNoGeometry})...`);
|
||||
addLog("info", `[${label}] Pornire...`);
|
||||
try {
|
||||
const res = await fetch("/api/eterra/sync-background", {
|
||||
const endpoint = customEndpoint ?? "/api/eterra/sync-background";
|
||||
const body = customEndpoint ? {} : { siruta, mode, includeNoGeometry };
|
||||
const res = await fetch(endpoint, {
|
||||
method: "POST",
|
||||
headers: { "Content-Type": "application/json" },
|
||||
body: JSON.stringify({ siruta, mode, includeNoGeometry }),
|
||||
body: JSON.stringify(body),
|
||||
});
|
||||
const d = await res.json() as { jobId?: string; error?: string };
|
||||
if (!res.ok) {
|
||||
|
||||
Reference in New Issue
Block a user