@xeplr/ui-utils 1.1.12 → 1.1.14
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.
package/README.md
CHANGED
|
@@ -343,7 +343,7 @@ Requests carry the headers `configureUpload` was given (`uploadHeaders()`), so s
|
|
|
343
343
|
|
|
344
344
|
- `createImportsApi(basePath)` makes every route call.
|
|
345
345
|
- `createRunWatcher({ api, events?, pollMs? })` → `{ wait(runId, onProgress) → Promise<run>, open(), close() }`: waits for a check or an import as described under `events`, without React. `open()` undoes `close()` — `useImportsController` calls it on every mount, because React's StrictMode (development) mounts, cleans up and mounts again, and a watcher closed by that cleanup never heard a run finish ("Checking the file…" forever although the server had finished). A run whose `GET /runs/:id` fails (with several API processes it may be held by another one) is still heard ending on the stream.
|
|
346
|
-
- Pure helpers: `importProgressText`, `checkProgressText`, `runResults`, `checkResult` (a finished check in `onInspect`'s shape, or its error), `historyJob`, `databasesOf`, `fileNameOf`, `uploaderFor(api, upload)` (how a picked file is sent), `ACCEPT` (exported as `IMPORT_ACCEPT`: the files it reads, Parquet among them).
|
|
346
|
+
- Pure helpers: `importProgressText`, `checkProgressText`, `runResults`, `checkResult` (a finished check in `onInspect`'s shape — `{ format, parts, checks, rows }`, `rows` each part's `{ rows, over }` count from @xeplr/imports 2.0.6+, else null — or its error), `historyJob`, `databasesOf`, `fileNameOf`, `uploaderFor(api, upload)` (how a picked file is sent), `ACCEPT` (exported as `IMPORT_ACCEPT`: the files it reads, Parquet among them).
|
|
347
347
|
|
|
348
348
|
A custom design receives the controller's values plus `importSection` and `historySection` as elements.
|
|
349
349
|
|
package/package.json
CHANGED
|
@@ -185,7 +185,8 @@ export function checkResult(run) {
|
|
|
185
185
|
if (run.status === 'error') throw new Error(run.error || 'The check failed');
|
|
186
186
|
if (run.status === 'stopped') throw new Error(run.error === 'Stopped' || !run.error ? 'The check was stopped.' : run.error);
|
|
187
187
|
var found = run.result || {};
|
|
188
|
-
|
|
188
|
+
// rows: each part's row count ({ rows, over }) — @xeplr/imports 2.0.6+.
|
|
189
|
+
return { format: found.format, parts: found.sheets, checks: found.checks, rows: found.rows || null };
|
|
189
190
|
}
|
|
190
191
|
|
|
191
192
|
/** "Checking the file · 1.2 GB of 3.0 GB (40%) · 412,000 rows" — how far a check has got. */
|
|
@@ -73,7 +73,7 @@ export function useImportsController(props = {}) {
|
|
|
73
73
|
// at once, without a run.
|
|
74
74
|
var onInspect = useCallback(async function(filePath) {
|
|
75
75
|
var found = await api.inspect(filePath);
|
|
76
|
-
if (!found.runId) return { format: found.format, parts: found.sheets, checks: found.checks };
|
|
76
|
+
if (!found.runId) return { format: found.format, parts: found.sheets, checks: found.checks, rows: found.rows || null };
|
|
77
77
|
return checkResult(await follow(found.runId, 'check'));
|
|
78
78
|
}, [api, follow]);
|
|
79
79
|
|