Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 14 additions & 3 deletions PanTS-Demo/src/components/ProcessingSummaryBar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,16 @@ type Props = {
done: number; // scans finished in this batch
statusLabel: string; // dominant phase, e.g. "Running…"
title?: string; // defaults to "Processing scans"
closeNote?: string; // e.g. "safe to close" - whether the tab is still needed
closeReady?: boolean; // true once nothing is uploading (tints the note green)
onViewDetails?: () => void; // per-scan status / view / download for the batch
onCancelAll?: () => void;
};

const SIZE = 46;
const STROKE = 4;

const ProcessingSummaryBar: React.FC<Props> = ({ running, done, statusLabel, title = "Processing scans", onViewDetails, onCancelAll }) => {
const ProcessingSummaryBar: React.FC<Props> = ({ running, done, statusLabel, title = "Processing scans", closeNote, closeReady, onViewDetails, onCancelAll }) => {
const total = running + done;
const pct = total > 0 ? Math.round((done / total) * 100) : 0;

Expand Down Expand Up @@ -59,8 +61,17 @@ const ProcessingSummaryBar: React.FC<Props> = ({ running, done, statusLabel, tit
</div>
<div className="proc-sub">
<span className="upload-spinner proc-spinner" />
{statusLabel}
{running > 0 && ` · ${running} in progress`}
{/* One text run, not sibling flex items - otherwise the row's gap
opens a hole before the note and wraps it onto its own line. */}
<span>
{statusLabel}
{running > 0 && ` · ${running} in progress`}
{closeNote && (
<span className={`proc-close-note${closeReady ? " proc-close-note--ready" : ""}`}>
{" "}· {closeNote}
</span>
)}
</span>
</div>
</div>

Expand Down
35 changes: 35 additions & 0 deletions PanTS-Demo/src/helpers/pendingUploads.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,11 @@ export type PendingUpload = {
// over the server's existing chunk-N files and finalize into a corrupt image.
// Absent on records written before this field existed - treat those as 256 KiB.
chunkSize?: number;
// Set once the file is fully transferred and finalized server-side, but before
// its inference job exists. Its presence flips the meaning of the record from
// "resume the upload" to "just re-issue the inference call" - the bytes are
// already on the server, so `file` is emptied at the same time.
uploadedFilename?: string;
};

/** Chunk size to use when resuming `p`, honouring what it was originally cut at. */
Expand Down Expand Up @@ -96,6 +101,36 @@ export async function setPendingNextChunk(sessionId: string, nextChunk: number):
}
}

/** Flag an upload as fully transferred and finalized, awaiting its inference job.
* Drops the file blob at the same time - the bytes live on the server now, so a
* resume only needs to re-issue the inference call, and holding a multi-hundred-MB
* copy until then would be pure quota pressure. */
export async function setPendingUploaded(
sessionId: string,
uploadedFilename: string,
): Promise<void> {
try {
const db = await openDb();
await new Promise<void>((resolve, reject) => {
const tx = db.transaction(STORE, "readwrite");
const store = tx.objectStore(STORE);
const getReq = store.get(sessionId);
getReq.onsuccess = () => {
const rec = getReq.result as PendingUpload | undefined;
if (rec) {
rec.uploadedFilename = uploadedFilename;
rec.file = new Blob();
store.put(rec);
}
};
tx.oncomplete = () => { db.close(); resolve(); };
tx.onerror = () => { db.close(); reject(tx.error); };
});
} catch (e) {
console.warn("setPendingUploaded failed", e);
}
}

export async function deletePendingUpload(sessionId: string): Promise<void> {
try {
await withStore("readwrite", store => store.delete(sessionId));
Expand Down
8 changes: 8 additions & 0 deletions PanTS-Demo/src/routes/UploadPage.css
Original file line number Diff line number Diff line change
Expand Up @@ -1130,6 +1130,14 @@
height: 12px;
border-width: 2px;
}
/* "safe to close" hint, tucked onto the status line - lighter than the status
beside it so it reads as an aside, not another piece of state. */
.proc-close-note {
color: #9a9a9a;
}
.proc-close-note--ready {
color: #15803d;
}
.proc-cancel {
flex-shrink: 0;
}
Expand Down
Loading
Loading