File uploads external source

This commit is contained in:
sriram
2026-08-28 08:54:00 +05:30
parent e073d68d60
commit 8f8f370566
4 changed files with 402 additions and 3 deletions

View File

@@ -50,7 +50,7 @@ function fmtBytes(n) {
return `${(n / (1024 * 1024)).toFixed(1)} MB`;
}
export function BatchCatalogPanel() {
export function BatchCatalogPanel({ adoptBatch = null }) {
const [files, setFiles] = useState([]);
const [preview, setPreview] = useState(null);
const [previewing, setPreviewing] = useState(false);
@@ -63,6 +63,18 @@ export function BatchCatalogPanel() {
const pollRef = useRef(null);
const batchIdRef = useRef(null);
// A batch started from the Review Inbox tab. Without this, switching tabs
// after pressing "Start selected" would land on an empty panel and the run
// would look like it had not happened.
useEffect(() => {
if (!adoptBatch?.batch_id) return;
setBatch(adoptBatch);
setFiles([]);
setPreview(null);
setError('');
if (!TERMINAL.has(adoptBatch.status)) batchIdRef.current = adoptBatch.batch_id;
}, [adoptBatch]);
// One interval for the component's lifetime, reading the id from a ref
// rather than closing over it. Same reasoning as StoreCatalogPanel: starting
// a second batch must not leave an older interval polling the previous one.