@parhelia/localization 0.4.12877 → 0.4.12880
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -59,6 +59,11 @@ export type TranslationJobRecord = {
|
|
|
59
59
|
lastHeartbeatUtc?: string | null;
|
|
60
60
|
attemptCount?: number;
|
|
61
61
|
totalCost?: number | null;
|
|
62
|
+
/**
|
|
63
|
+
* Row version, bumped by the database on every write. A row carried by a
|
|
64
|
+
* socket event replaces the held one only when this is higher.
|
|
65
|
+
*/
|
|
66
|
+
version?: number;
|
|
62
67
|
};
|
|
63
68
|
export declare function listBatchTranslationJobs(batchId: string): Promise<import("@parhelia/core").ExecutionResult<TranslationJobRecord[]>>;
|
|
64
69
|
export type TranslationJobLastPayload = {
|
|
@@ -90,6 +95,14 @@ export type TranslationBatchInfo = {
|
|
|
90
95
|
lastUpdatedUtc?: string;
|
|
91
96
|
totalCost?: number | null;
|
|
92
97
|
exists?: boolean;
|
|
98
|
+
/** Batch row version, bumped by the database on every write to the row. */
|
|
99
|
+
version?: number;
|
|
100
|
+
/**
|
|
101
|
+
* Highest job row version in the batch, from the list endpoint. When it
|
|
102
|
+
* exceeds the highest version among the held jobs, a job write was missed
|
|
103
|
+
* and the job list is re-read.
|
|
104
|
+
*/
|
|
105
|
+
jobsVersion?: number | null;
|
|
93
106
|
};
|
|
94
107
|
export declare function getBatchInfo(batchId: string): Promise<import("@parhelia/core").ExecutionResult<TranslationBatchInfo>>;
|
|
95
108
|
export type ListBatchesFilters = {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"translationService.d.ts","sourceRoot":"","sources":["../../src/services/translationService.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,UAAU,CAAC;AAC7C,OAAO,EAAE,uBAAuB,EAAE,MAAM,gBAAgB,CAAC;AAGzD,MAAM,MAAM,sBAAsB,CAAC,CAAC,IAAI;IACtC,OAAO,EAAE,OAAO,C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EAAE,MAAM,CAAC;IACf,cAAc,EAAE,MAAM,CAAC;IACvB,cAAc,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACzB,KAAK,EAAE,MAAM,CAAC;CACf,CAAC;AAEF,MAAM,MAAM,+BAA+B,GAAG;IAC5C,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAC7B,MAAM,EAAE,MAAM,CAAC;IACf,cAAc,EAAE,MAAM,CAAC;IACvB,cAAc,EAAE,MAAM,CAAC;IACvB,KAAK,EAAE,MAAM,CAAC;CACf,CAAC;AAEF,MAAM,MAAM,6BAA6B,GAAG;IAC1C,aAAa,EAAE,MAAM,CAAC;IACtB,YAAY,EAAE,MAAM,CAAC;IACrB,QAAQ,EAAE,MAAM,CAAC;IACjB,OAAO,EAAE,+BAA+B,EAAE,CAAC;IAC3C,OAAO,EAAE,+BAA+B,EAAE,CAAC;CAC5C,CAAC;AAEF,wBAAsB,qBAAqB,CAAC,EAC1C,SAAS,EACT,aAAa,EACb,QAAQ,EACR,IAAI,GACL,EAAE;IACD,SAAS,EAAE,MAAM,CAAC;IAClB,aAAa,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,IAAI,EAAE,+BAA+B,EAAE,CAAC;CACzC,oFAKA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TranslationBatches.d.ts","sourceRoot":"","sources":["../../src/translation-center/TranslationBatches.tsx"],"names":[],"mappings":"AAQA,OAAO,KAAK,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"TranslationBatches.d.ts","sourceRoot":"","sources":["../../src/translation-center/TranslationBatches.tsx"],"names":[],"mappings":"AAQA,OAAO,KAAK,MAAM,OAAO,CAAC;AA4Z1B,wBAAgB,kBAAkB,sBAmvCjC;AAED,eAAO,MAAM,oCAAoC,8BAA8B,CAAC;AAEhF,wBAAgB,8BAA8B,sBA+Y7C"}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { useCallback, useEffect, useRef, useState, useMemo, useSyncExternalStore, } from "react";
|
|
3
3
|
import React from "react";
|
|
4
|
-
import { Button, Badge, Select, Input, UserPicker, Popover, PopoverContent, PopoverTrigger, Tooltip, TooltipContent, TooltipTrigger, ContentTree, ContentInspectorPopover, PageHeader, fetchItemStubs, searchUsers as searchBackendUsers, useEditContext, getLanguages, SimpleIconButton, WorkspaceHomeView, capitalizeFirstLetter,
|
|
4
|
+
import { Button, Badge, Select, Input, UserPicker, Popover, PopoverContent, PopoverTrigger, Tooltip, TooltipContent, TooltipTrigger, ContentTree, ContentInspectorPopover, PageHeader, fetchItemStubs, searchUsers as searchBackendUsers, useEditContext, getLanguages, SimpleIconButton, WorkspaceHomeView, capitalizeFirstLetter, formatDateTime, } from "@parhelia/core";
|
|
5
5
|
import { listBatches, getTranslationProviders, getTranslationJobLastPayload, listBatchTranslationJobs, retryBatchTranslation, abortJob, abortBatch, subscribeToBatch, unsubscribeFromBatch, } from "../services/translationService";
|
|
6
6
|
import { TRANSLATION_BATCH_STARTED_EVENT, } from "../translationEvents";
|
|
7
|
-
import { useDebouncedCallback
|
|
7
|
+
import { useDebouncedCallback } from "use-debounce";
|
|
8
8
|
import { X, ChevronDown, Languages, Loader2, Globe, FolderTree, ExternalLink, Check, AlertCircle, CircleStop, Hourglass, Copy, Sparkles, RotateCcw, Plus, Bug, } from "lucide-react";
|
|
9
9
|
import { toast } from "sonner";
|
|
10
10
|
import { openLocalizeItemDialog } from "../LocalizeItemCommand";
|
|
@@ -142,76 +142,54 @@ function normalizeGuid(value) {
|
|
|
142
142
|
function normalizeLanguageCode(value) {
|
|
143
143
|
return (value ?? "").toString().trim().toLowerCase();
|
|
144
144
|
}
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
const value = payload[key];
|
|
154
|
-
if (value !== undefined && value !== null)
|
|
155
|
-
return value;
|
|
156
|
-
}
|
|
157
|
-
return undefined;
|
|
145
|
+
/** A row carried by a socket event, in either property casing. */
|
|
146
|
+
function readEventRow(payload, key) {
|
|
147
|
+
const record = (payload ?? {});
|
|
148
|
+
const row = record[key] ?? record[key.charAt(0).toUpperCase() + key.slice(1)];
|
|
149
|
+
if (!row || typeof row !== "object")
|
|
150
|
+
return undefined;
|
|
151
|
+
const typed = row;
|
|
152
|
+
return typed.id ? typed : undefined;
|
|
158
153
|
}
|
|
159
154
|
/**
|
|
160
|
-
*
|
|
161
|
-
*
|
|
162
|
-
*
|
|
163
|
-
*
|
|
164
|
-
*
|
|
165
|
-
* Returns `undefined` when the event's job is not in the list (the caller
|
|
166
|
-
* then needs a reload), the same array when nothing changed, and a new array
|
|
167
|
-
* with the patched record otherwise.
|
|
155
|
+
* Replaces the held row with the incoming one when the incoming version is
|
|
156
|
+
* newer. Fields the event row does not carry (the item name and path, which
|
|
157
|
+
* only the list endpoint resolves) are kept from the held row. Returns the
|
|
158
|
+
* same array when nothing changed, so duplicate and stale deliveries are
|
|
159
|
+
* no-ops.
|
|
168
160
|
*/
|
|
169
|
-
function
|
|
170
|
-
const
|
|
171
|
-
const
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
const
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
}
|
|
183
|
-
if (index < 0 && itemId && language) {
|
|
184
|
-
const candidates = jobs
|
|
185
|
-
.map((job, i) => ({ job, i }))
|
|
186
|
-
.filter(({ job }) => normalizeGuid(job.itemId) === itemId &&
|
|
187
|
-
job.targetLanguage === language);
|
|
188
|
-
// Retries add records for the same item and language; a running one is
|
|
189
|
-
// the event's subject, otherwise the newest record.
|
|
190
|
-
const active = candidates.find(({ job }) => !isTerminalBatchStatus(job.status));
|
|
191
|
-
index = (active ?? candidates[candidates.length - 1])?.i ?? -1;
|
|
161
|
+
function upsertByVersion(rows, incoming) {
|
|
162
|
+
const incomingId = normalizeGuid(incoming.id);
|
|
163
|
+
const index = rows.findIndex((row) => normalizeGuid(row.id) === incomingId);
|
|
164
|
+
if (index < 0)
|
|
165
|
+
return rows;
|
|
166
|
+
const held = rows[index];
|
|
167
|
+
if ((incoming.version ?? 0) <= (held.version ?? 0))
|
|
168
|
+
return rows;
|
|
169
|
+
const merged = { ...held };
|
|
170
|
+
for (const [key, value] of Object.entries(incoming)) {
|
|
171
|
+
if (value !== undefined && value !== null) {
|
|
172
|
+
merged[key] = value;
|
|
173
|
+
}
|
|
192
174
|
}
|
|
193
|
-
const
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
return jobs;
|
|
212
|
-
const result = jobs.slice();
|
|
213
|
-
result[index] = next;
|
|
214
|
-
return result;
|
|
175
|
+
const next = rows.slice();
|
|
176
|
+
next[index] = merged;
|
|
177
|
+
return next;
|
|
178
|
+
}
|
|
179
|
+
/**
|
|
180
|
+
* Whether the batch list reports job writes this view has not applied: a job
|
|
181
|
+
* version above the highest held one, or terminal counters that do not match
|
|
182
|
+
* the held rows. Either means an event was missed (dropped frame, reconnect)
|
|
183
|
+
* and the job list must be re-read.
|
|
184
|
+
*/
|
|
185
|
+
function batchNeedsJobReload(info, jobs) {
|
|
186
|
+
const heldVersion = jobs.reduce((max, job) => Math.max(max, job.version ?? 0), 0);
|
|
187
|
+
if ((info.jobsVersion ?? 0) > heldVersion)
|
|
188
|
+
return true;
|
|
189
|
+
const heldCompleted = jobs.filter((j) => j.status === "Completed").length;
|
|
190
|
+
const heldErrors = jobs.filter((j) => j.status === "Error").length;
|
|
191
|
+
return ((info.completedJobs ?? heldCompleted) !== heldCompleted ||
|
|
192
|
+
(info.errorJobs ?? heldErrors) !== heldErrors);
|
|
215
193
|
}
|
|
216
194
|
function dateRangeToFromUtc(range) {
|
|
217
195
|
const now = new Date();
|
|
@@ -246,10 +224,8 @@ function dateRangeToFromUtc(range) {
|
|
|
246
224
|
}
|
|
247
225
|
return cutoff.toISOString();
|
|
248
226
|
}
|
|
249
|
-
/**
|
|
250
|
-
const
|
|
251
|
-
/** Longest a running batch's row counters lag behind its job events. */
|
|
252
|
-
const BATCH_LIST_RELOAD_THROTTLE_MS = 3000;
|
|
227
|
+
/** A running job whose heartbeat is older than this is shown as stalled. */
|
|
228
|
+
const JOB_HEARTBEAT_STALE_MS = 45_000;
|
|
253
229
|
const EMPTY_STATE_SLOGANS = [
|
|
254
230
|
"It's quiet here. In every language.",
|
|
255
231
|
"Zero translations. Nada. Nichts. Rien.",
|
|
@@ -412,10 +388,6 @@ export function TranslationBatches() {
|
|
|
412
388
|
}
|
|
413
389
|
}, []);
|
|
414
390
|
const debouncedReload = useDebouncedCallback(() => loadRecentBatches(0, false, effectiveFilters), 800);
|
|
415
|
-
// Per-job events only move a row's counters; one list read every few
|
|
416
|
-
// seconds keeps the rings honest without a read per job. Batch completion
|
|
417
|
-
// still goes through the quicker debounced reload above.
|
|
418
|
-
const throttledReload = useThrottledCallback(() => loadRecentBatches(0, false, effectiveFilters), BATCH_LIST_RELOAD_THROTTLE_MS);
|
|
419
391
|
const loadMore = () => {
|
|
420
392
|
if (!isLoadingMore && hasMore) {
|
|
421
393
|
loadRecentBatches(currentOffset, true, effectiveFilters);
|
|
@@ -498,13 +470,9 @@ export function TranslationBatches() {
|
|
|
498
470
|
useEffect(() => {
|
|
499
471
|
debouncedReloadRef.current = debouncedReload;
|
|
500
472
|
}, [debouncedReload]);
|
|
501
|
-
const throttledReloadRef = useRef(throttledReload);
|
|
502
|
-
useEffect(() => {
|
|
503
|
-
throttledReloadRef.current = throttledReload;
|
|
504
|
-
}, [throttledReload]);
|
|
505
473
|
// Mirror of the loaded job lists for the socket listener, which must know
|
|
506
|
-
// synchronously whether an event's
|
|
507
|
-
//
|
|
474
|
+
// synchronously whether an event's batch is loaded before deciding between
|
|
475
|
+
// applying the event's row and a fallback read.
|
|
508
476
|
const batchJobsRef = useRef(batchJobs);
|
|
509
477
|
useEffect(() => {
|
|
510
478
|
batchJobsRef.current = batchJobs;
|
|
@@ -514,12 +482,6 @@ export function TranslationBatches() {
|
|
|
514
482
|
expandedBatchIdRef.current = expandedBatchId;
|
|
515
483
|
}, [expandedBatchId]);
|
|
516
484
|
const loadBatchJobsRef = useRef(null);
|
|
517
|
-
// Job events arrive in bursts: one per job start and finish, and the
|
|
518
|
-
// initiator's session receives each twice (sent directly and again through
|
|
519
|
-
// the batch subscription). Every one used to trigger its own full job-list
|
|
520
|
-
// read. Collapse them into one read per batch per window, never two at once.
|
|
521
|
-
const batchJobsReload = useMemo(() => createCoalescedReload((batchId) => loadBatchJobsRef.current?.(batchId) ?? Promise.resolve([]), BATCH_JOBS_RELOAD_WINDOW_MS), []);
|
|
522
|
-
useEffect(() => () => batchJobsReload.dispose(), [batchJobsReload]);
|
|
523
485
|
// Listen for batch-related events to refresh the list
|
|
524
486
|
useEffect(() => {
|
|
525
487
|
const removeSocketMessageListener = editContext?.addSocketMessageListener((message) => {
|
|
@@ -543,6 +505,9 @@ export function TranslationBatches() {
|
|
|
543
505
|
const nextJobs = jobs.map((job) => {
|
|
544
506
|
if (normalizeGuid(job.itemId) === itemIdFromPayload &&
|
|
545
507
|
job.targetLanguage === languageFromPayload &&
|
|
508
|
+
// A late progress text must not replace a terminal
|
|
509
|
+
// outcome (an error text, or the final record).
|
|
510
|
+
!isTerminalBatchStatus(job.status) &&
|
|
546
511
|
job.message !== progressMessage) {
|
|
547
512
|
changed = true;
|
|
548
513
|
return { ...job, message: progressMessage };
|
|
@@ -556,14 +521,19 @@ export function TranslationBatches() {
|
|
|
556
521
|
}
|
|
557
522
|
return;
|
|
558
523
|
}
|
|
524
|
+
// Events carry the job and batch rows as the database holds them
|
|
525
|
+
// after the write they report, each with its row version. Applying a
|
|
526
|
+
// row only when its version is newer makes duplicate, reordered and
|
|
527
|
+
// stale deliveries harmless, and removes the need to re-read anything
|
|
528
|
+
// on a normal event. Rows are only replaced, never added: a batch the
|
|
529
|
+
// current filters exclude stays excluded until the next list read.
|
|
530
|
+
const applyBatchRow = (payload) => {
|
|
531
|
+
const row = readEventRow(payload, "batch");
|
|
532
|
+
if (row)
|
|
533
|
+
setBatches((prev) => upsertByVersion(prev, row));
|
|
534
|
+
};
|
|
559
535
|
if (message.type === "batch-completed") {
|
|
560
|
-
|
|
561
|
-
// job records (attempts, costs, messages) for the open batch.
|
|
562
|
-
debouncedReloadRef.current();
|
|
563
|
-
if (batchIdFromPayload &&
|
|
564
|
-
expandedBatchIdRef.current === batchIdFromPayload) {
|
|
565
|
-
batchJobsReload.request(batchIdFromPayload);
|
|
566
|
-
}
|
|
536
|
+
applyBatchRow(message.payload);
|
|
567
537
|
return;
|
|
568
538
|
}
|
|
569
539
|
if ((message.type === "translation-started" ||
|
|
@@ -571,29 +541,28 @@ export function TranslationBatches() {
|
|
|
571
541
|
message.type === "translation-error" ||
|
|
572
542
|
message.type === "translation-aborted") &&
|
|
573
543
|
batchIdFromPayload) {
|
|
574
|
-
|
|
544
|
+
applyBatchRow(message.payload);
|
|
575
545
|
if (expandedBatchIdRef.current !== batchIdFromPayload)
|
|
576
546
|
return;
|
|
577
|
-
|
|
578
|
-
// chips are patched in place. A full job-list read (hundreds of KB
|
|
579
|
-
// for a large batch) is only needed when the job is not loaded,
|
|
580
|
-
// e.g. a retry that added records, or a list still being fetched.
|
|
547
|
+
const jobRow = readEventRow(message.payload, "job");
|
|
581
548
|
const loadedJobs = batchJobsRef.current[batchIdFromPayload];
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
549
|
+
if (!loadedJobs)
|
|
550
|
+
return; // the expand read in flight brings the rows
|
|
551
|
+
const isHeld = !!jobRow &&
|
|
552
|
+
loadedJobs.some((job) => normalizeGuid(job.id) === normalizeGuid(jobRow.id));
|
|
553
|
+
if (!isHeld) {
|
|
554
|
+
// A whole-batch abort carries no job row, and a retry can add
|
|
555
|
+
// records this view has not seen: one read of the job list.
|
|
556
|
+
void loadBatchJobsRef.current?.(batchIdFromPayload);
|
|
587
557
|
return;
|
|
588
558
|
}
|
|
589
|
-
//
|
|
590
|
-
// arrive before the ref mirror
|
|
559
|
+
// Apply against React's own previous state: several events can
|
|
560
|
+
// arrive before the ref mirror catches up.
|
|
591
561
|
setBatchJobs((prev) => {
|
|
592
562
|
const current = prev[batchIdFromPayload];
|
|
593
563
|
if (!current)
|
|
594
564
|
return prev;
|
|
595
|
-
const next =
|
|
596
|
-
current;
|
|
565
|
+
const next = upsertByVersion(current, jobRow);
|
|
597
566
|
return next === current
|
|
598
567
|
? prev
|
|
599
568
|
: { ...prev, [batchIdFromPayload]: next };
|
|
@@ -621,6 +590,33 @@ export function TranslationBatches() {
|
|
|
621
590
|
}, 10_000);
|
|
622
591
|
return () => window.clearInterval(reconciliationTimer);
|
|
623
592
|
}, []);
|
|
593
|
+
// Reconcile the open batch against the list. Each listed batch carries the
|
|
594
|
+
// highest job row version and its terminal counters, so a job write whose
|
|
595
|
+
// event never reached this session (dropped frame, reconnect window) shows
|
|
596
|
+
// up as a version above the held rows or as a counter mismatch. Only then
|
|
597
|
+
// is the job list re-read; applied events keep the held rows in step.
|
|
598
|
+
useEffect(() => {
|
|
599
|
+
if (!expandedBatchId)
|
|
600
|
+
return;
|
|
601
|
+
const info = batches.find((b) => b.id === expandedBatchId);
|
|
602
|
+
const jobs = batchJobs[expandedBatchId];
|
|
603
|
+
if (!info || !jobs)
|
|
604
|
+
return;
|
|
605
|
+
if (batchNeedsJobReload(info, jobs)) {
|
|
606
|
+
void loadBatchJobsRef.current?.(expandedBatchId);
|
|
607
|
+
}
|
|
608
|
+
}, [batches, batchJobs, expandedBatchId]);
|
|
609
|
+
// A reconnect may have lost a window of events: read the list, and the
|
|
610
|
+
// open batch's jobs, straight away instead of waiting for the next poll.
|
|
611
|
+
const socketConnectionVersion = editContext?.socketConnectionVersion ?? 0;
|
|
612
|
+
useEffect(() => {
|
|
613
|
+
if (socketConnectionVersion === 0)
|
|
614
|
+
return;
|
|
615
|
+
debouncedReloadRef.current();
|
|
616
|
+
const batchId = expandedBatchIdRef.current;
|
|
617
|
+
if (batchId)
|
|
618
|
+
void loadBatchJobsRef.current?.(batchId);
|
|
619
|
+
}, [socketConnectionVersion]);
|
|
624
620
|
// Group by date. Filtering happens server-side, so we operate on `batches` directly.
|
|
625
621
|
const groupedBatches = useMemo(() => {
|
|
626
622
|
if (batches.length === 0)
|
|
@@ -1385,7 +1381,11 @@ function BatchProgressIndicator({ counts, status, testId, variant = "circle", })
|
|
|
1385
1381
|
// track. "Still running" is conveyed by the soft halo around the ring (and
|
|
1386
1382
|
// bar) rather than by a segment, so the ring stays calm and readable.
|
|
1387
1383
|
const segments = [
|
|
1388
|
-
{
|
|
1384
|
+
{
|
|
1385
|
+
key: "succeeded",
|
|
1386
|
+
count: succeeded,
|
|
1387
|
+
color: BATCH_SEGMENT_COLORS.succeeded,
|
|
1388
|
+
},
|
|
1389
1389
|
{ key: "failed", count: failed, color: BATCH_SEGMENT_COLORS.failed },
|
|
1390
1390
|
{ key: "aborted", count: aborted, color: BATCH_SEGMENT_COLORS.aborted },
|
|
1391
1391
|
{ key: "running", count: running, color: BATCH_SEGMENT_COLORS.running },
|
|
@@ -1799,6 +1799,12 @@ function LanguageJobChip({ job, language, provider, batchStartedAtUtc, onOpen, i
|
|
|
1799
1799
|
? new Date(job.lastHeartbeatUtc)
|
|
1800
1800
|
: null;
|
|
1801
1801
|
const lastHeartbeatValid = !!(lastHeartbeat && !isNaN(lastHeartbeat.getTime()));
|
|
1802
|
+
// The worker heartbeats every few seconds while it holds the job. A
|
|
1803
|
+
// running job without a recent heartbeat is not running: its worker is
|
|
1804
|
+
// gone, and the queue will hand it to another one once the lease expires.
|
|
1805
|
+
const heartbeatStale = jobInProgress &&
|
|
1806
|
+
lastHeartbeatValid &&
|
|
1807
|
+
Date.now() - lastHeartbeat.getTime() > JOB_HEARTBEAT_STALE_MS;
|
|
1802
1808
|
// Fall back to the batch's start time when the job didn't record one of its
|
|
1803
1809
|
// own — older jobs (and provider-less paths) skip ClaimedAtUtc.
|
|
1804
1810
|
const batchStart = batchStartedAtUtc ? new Date(batchStartedAtUtc) : null;
|
|
@@ -1848,10 +1854,16 @@ function LanguageJobChip({ job, language, provider, batchStartedAtUtc, onOpen, i
|
|
|
1848
1854
|
const emptyFieldText = statistics && statistics.emptyFieldCount > 0
|
|
1849
1855
|
? `${formatCount(statistics.emptyFieldCount)} empty`
|
|
1850
1856
|
: null;
|
|
1851
|
-
return (_jsxs(Popover, { open: open, onOpenChange: setOpen, children: [_jsx(PopoverTrigger, { asChild: true, children: _jsxs("button", { type: "button", className: `group inline-flex items-center gap-1.5 rounded border badge-pad-sm text-[12px] transition-colors cursor-pointer ${chipCls}`, children: [language?.icon ? (_jsx("img", { src: language.icon, alt: langName, className: "h-3.5 shrink-0" })) : null, _jsx("span", { className: "font-mono tracking-tight", children: job.targetLanguage }), jobInProgress && (_jsx(LoaderIcon, { className: "h-3 w-3 shrink-0 animate-spin" })), jobPending && (_jsx(QueuedIcon, { className: "h-3 w-3 shrink-0", strokeWidth: 1, "aria-label": "Queued" })), jobError && _jsx(AlertCircleIcon, { className: "h-3 w-3 shrink-0" }), !jobInProgress && !jobError && !jobPending && !jobAborted && (_jsx(CheckIcon, { className: "h-3 w-3 shrink-0 text-feedback-green" }))] }) }), _jsxs(PopoverContent, { align: "start", sideOffset: 6, className: "w-[26rem] max-w-[calc(100vw-2rem)] p-0", children: [_jsxs("div", { className: "flex items-center gap-2 border-b border-border-default px-3 py-2", children: [language?.icon ? (_jsx("img", { src: language.icon, alt: langName, className: "h-4 shrink-0" })) : null, _jsxs("div", { className: "min-w-0 flex-1", children: [_jsx("div", { className: "text-[13px] font-medium text-neutral-grey-100 truncate", children: langName }), _jsxs("div", { className: "text-[11px] text-neutral-grey-50 font-mono truncate", children: [job.targetLanguage, job.sourceLanguage ? ` ← ${job.sourceLanguage}` : ""] })] }), _jsxs(Badge, { size: "sm", className: statusBadgeCls, children: [jobInProgress && (_jsx(LoaderIcon, { className: "h-2.5 w-2.5 animate-spin" })), capitalizeFirstLetter(jobStatus || "Unknown")] })] }), _jsxs("dl", { className: "divide-y divide-border-default/60", children: [claimedAtValid && (_jsxs("div", { className: "flex items-baseline gap-3 px-3 py-2", children: [_jsx("dt", { className: "w-20 shrink-0 text-[10px] tracking-wide text-neutral-grey-50", children: "Claimed" }), _jsx("dd", { className: "text-[12px] text-neutral-grey-100", children: formatDateTime(claimedAt) })] })), timestampValid && (jobInProgress || jobPending) && (_jsxs("div", { className: "flex items-baseline gap-3 px-3 py-2", children: [_jsx("dt", { className: "w-20 shrink-0 text-[10px] tracking-wide text-neutral-grey-50", children: "Updated" }), _jsx("dd", { className: "text-[12px] text-neutral-grey-100", children: formatDateTime(timestamp) })] })), durationMs != null && (_jsxs("div", { className: "flex items-baseline gap-3 px-3 py-2", children: [_jsx("dt", { className: "w-20 shrink-0 text-[10px] tracking-wide text-neutral-grey-50", children:
|
|
1857
|
+
return (_jsxs(Popover, { open: open, onOpenChange: setOpen, children: [_jsx(PopoverTrigger, { asChild: true, children: _jsxs("button", { type: "button", className: `group inline-flex items-center gap-1.5 rounded border badge-pad-sm text-[12px] transition-colors cursor-pointer ${chipCls}`, children: [language?.icon ? (_jsx("img", { src: language.icon, alt: langName, className: "h-3.5 shrink-0" })) : null, _jsx("span", { className: "font-mono tracking-tight", children: job.targetLanguage }), jobInProgress && (_jsx(LoaderIcon, { className: "h-3 w-3 shrink-0 animate-spin" })), jobPending && (_jsx(QueuedIcon, { className: "h-3 w-3 shrink-0", strokeWidth: 1, "aria-label": "Queued" })), jobError && _jsx(AlertCircleIcon, { className: "h-3 w-3 shrink-0" }), !jobInProgress && !jobError && !jobPending && !jobAborted && (_jsx(CheckIcon, { className: "h-3 w-3 shrink-0 text-feedback-green" }))] }) }), _jsxs(PopoverContent, { align: "start", sideOffset: 6, className: "w-[26rem] max-w-[calc(100vw-2rem)] p-0", children: [_jsxs("div", { className: "flex items-center gap-2 border-b border-border-default px-3 py-2", children: [language?.icon ? (_jsx("img", { src: language.icon, alt: langName, className: "h-4 shrink-0" })) : null, _jsxs("div", { className: "min-w-0 flex-1", children: [_jsx("div", { className: "text-[13px] font-medium text-neutral-grey-100 truncate", children: langName }), _jsxs("div", { className: "text-[11px] text-neutral-grey-50 font-mono truncate", children: [job.targetLanguage, job.sourceLanguage ? ` ← ${job.sourceLanguage}` : ""] })] }), _jsxs(Badge, { size: "sm", className: statusBadgeCls, children: [jobInProgress && (_jsx(LoaderIcon, { className: "h-2.5 w-2.5 animate-spin" })), capitalizeFirstLetter(jobStatus || "Unknown")] })] }), _jsxs("dl", { className: "divide-y divide-border-default/60", children: [claimedAtValid && (_jsxs("div", { className: "flex items-baseline gap-3 px-3 py-2", children: [_jsx("dt", { className: "w-20 shrink-0 text-[10px] tracking-wide text-neutral-grey-50", children: "Claimed" }), _jsx("dd", { className: "text-[12px] text-neutral-grey-100", children: formatDateTime(claimedAt) })] })), timestampValid && (jobInProgress || jobPending) && (_jsxs("div", { className: "flex items-baseline gap-3 px-3 py-2", children: [_jsx("dt", { className: "w-20 shrink-0 text-[10px] tracking-wide text-neutral-grey-50", children: "Updated" }), _jsx("dd", { className: "text-[12px] text-neutral-grey-100", children: formatDateTime(timestamp) })] })), durationMs != null && (_jsxs("div", { className: "flex items-baseline gap-3 px-3 py-2", children: [_jsx("dt", { className: "w-20 shrink-0 text-[10px] tracking-wide text-neutral-grey-50", children: heartbeatStale
|
|
1858
|
+
? "Stalled"
|
|
1859
|
+
: jobInProgress || jobPending
|
|
1860
|
+
? "Running"
|
|
1861
|
+
: "Duration" }), _jsxs("dd", { className: "text-[12px] tabular-nums text-neutral-grey-100", title: durationApproximated
|
|
1852
1862
|
? "Approximate — measured from batch start"
|
|
1853
|
-
: undefined, children: [durationApproximated ? "~" : "", formatDuration(durationMs)] })] })), statistics && (_jsxs("div", { className: "flex items-baseline gap-3 px-3 py-2", children: [_jsx("dt", { className: "w-20 shrink-0 text-[10px] tracking-wide text-neutral-grey-50", children: "Fields" }), _jsxs("dd", { className: "text-[12px] tabular-nums text-neutral-grey-100", children: [fieldText, emptyFieldText ? (_jsxs("span", { className: "ml-1.5 text-neutral-grey-50", children: ["(", emptyFieldText, ")"] })) : null] })] })), statistics && (_jsxs("div", { className: "flex items-baseline gap-3 px-3 py-2", children: [_jsx("dt", { className: "w-20 shrink-0 text-[10px] tracking-wide text-neutral-grey-50", children: "Text" }), _jsxs("dd", { className: "text-[12px] tabular-nums text-neutral-grey-100", children: [formatCount(statistics.sourceCharacterCount), " chars"] })] })), job.totalCost != null && (_jsxs("div", { className: "flex items-baseline gap-3 px-3 py-2", children: [_jsx("dt", { className: "w-20 shrink-0 text-[10px] tracking-wide text-neutral-grey-50", children: "Cost" }), _jsx("dd", { className: "text-[12px] tabular-nums text-neutral-grey-100", children: formatUsdCost(job.totalCost) })] })), lastHeartbeatValid && (jobInProgress || jobPending) && (_jsxs("div", { className: "flex items-baseline gap-3 px-3 py-2", children: [_jsx("dt", { className: "w-20 shrink-0 text-[10px] tracking-wide text-neutral-grey-50", children: "Heartbeat" }),
|
|
1854
|
-
|
|
1863
|
+
: undefined, children: [durationApproximated ? "~" : "", formatDuration(durationMs)] })] })), statistics && (_jsxs("div", { className: "flex items-baseline gap-3 px-3 py-2", children: [_jsx("dt", { className: "w-20 shrink-0 text-[10px] tracking-wide text-neutral-grey-50", children: "Fields" }), _jsxs("dd", { className: "text-[12px] tabular-nums text-neutral-grey-100", children: [fieldText, emptyFieldText ? (_jsxs("span", { className: "ml-1.5 text-neutral-grey-50", children: ["(", emptyFieldText, ")"] })) : null] })] })), statistics && (_jsxs("div", { className: "flex items-baseline gap-3 px-3 py-2", children: [_jsx("dt", { className: "w-20 shrink-0 text-[10px] tracking-wide text-neutral-grey-50", children: "Text" }), _jsxs("dd", { className: "text-[12px] tabular-nums text-neutral-grey-100", children: [formatCount(statistics.sourceCharacterCount), " chars"] })] })), job.totalCost != null && (_jsxs("div", { className: "flex items-baseline gap-3 px-3 py-2", children: [_jsx("dt", { className: "w-20 shrink-0 text-[10px] tracking-wide text-neutral-grey-50", children: "Cost" }), _jsx("dd", { className: "text-[12px] tabular-nums text-neutral-grey-100", children: formatUsdCost(job.totalCost) })] })), lastHeartbeatValid && (jobInProgress || jobPending) && (_jsxs("div", { className: "flex items-baseline gap-3 px-3 py-2", children: [_jsx("dt", { className: "w-20 shrink-0 text-[10px] tracking-wide text-neutral-grey-50", children: "Heartbeat" }), _jsxs("dd", { className: `text-[12px] ${heartbeatStale ? "text-feedback-orange" : "text-neutral-grey-100"}`, children: [formatDateTime(lastHeartbeat), heartbeatStale
|
|
1864
|
+
? " · stale, the job will be picked up again"
|
|
1865
|
+
: ""] })] })), attemptCount > 1 && (_jsxs("div", { className: "flex items-baseline gap-3 px-3 py-2", children: [_jsx("dt", { className: "w-20 shrink-0 text-[10px] tracking-wide text-neutral-grey-50", children: "Attempts" }), _jsx("dd", { className: "text-[12px] tabular-nums text-neutral-grey-100", children: attemptCount })] })), job.hash && (_jsxs("div", { className: "flex items-baseline gap-3 px-3 py-2", children: [_jsx("dt", { className: "w-20 shrink-0 text-[10px] tracking-wide text-neutral-grey-50", children: "Hash" }), _jsx("dd", { className: "text-[11px] font-mono text-neutral-grey-100 break-all", children: job.hash })] })), job.message &&
|
|
1866
|
+
(jobError || jobAborted ? (_jsxs("div", { className: "flex flex-col gap-1 px-3 py-2", children: [_jsx("dt", { className: "text-[10px] tracking-wide text-neutral-grey-50", children: jobError ? "Error" : "Aborted" }), _jsx("dd", { className: `max-h-40 overflow-auto whitespace-pre-wrap break-words rounded-sm bg-neutral-grey-5 p-2 font-mono text-[11px] leading-snug ${jobError ? "text-feedback-red" : "text-feedback-orange"}`, children: job.message })] })) : jobInProgress || jobPending ? (_jsxs("div", { className: "flex items-baseline gap-3 px-3 py-2", children: [_jsx("dt", { className: "w-20 shrink-0 text-[10px] tracking-wide text-neutral-grey-50", children: "Progress" }), _jsx("dd", { className: "text-[12px] break-words text-neutral-grey-100", children: job.message })] })) : null), job.batchId && (_jsxs("div", { className: "flex items-baseline gap-3 px-3 py-2", children: [_jsx("dt", { className: "w-20 shrink-0 text-[10px] tracking-wide text-neutral-grey-50", children: "Batch" }), _jsx("dd", { className: "text-[11px] font-mono text-neutral-grey-50 break-all", children: job.batchId })] }))] }), _jsxs("div", { className: "flex flex-wrap items-center justify-end gap-2 border-t border-border-default px-3 py-2", children: [canInspectRawResponse && (_jsx(ContentInspectorPopover, { title: "Raw AI response", emptyMessage: "Nothing captured for this job yet. Captures are kept in memory only and exist for AI provider jobs that ran since the last restart.", downloadFileName: `translation-job-${job.id}-raw-response.txt`, className: "w-[min(64rem,calc(100vw-2rem))]", side: "bottom", align: "end", loadSections: async () => {
|
|
1855
1867
|
const { payload, rawResponse } = await getTranslationJobLastPayload(job.id);
|
|
1856
1868
|
const sections = [];
|
|
1857
1869
|
if (rawResponse) {
|