Repository navigation
feat: export chosen samples from the By sample page - #48
Conversation
Export opens a dialog with the current sample picked; the user can add other samples or take all of them. The model builds a separate export table with the sample sheet replaced by a filter on the selection. Replaces the All samples / One sample switch. Updates the SDK to 1.84.19.
The model rebuilds the export table in place, so waiting on the output object alone missed the change. Wait on the selection and table handle the output carries instead.
| defaultFileName: `samples_${formatTimestamp(new Date())}.csv`, | ||
| filters, | ||
| }); | ||
| if (canceled || path === undefined || !hasFilterExtension(path, filters)) return; |
There was a problem hiding this comment.
Export silently skips filenames
A confirmed filename such as samples.CSV, or one without an extension, fails the case-sensitive extension check. The function returns without writing a file, and runExport closes the dialog as if it succeeded. Add the selected extension when missing, accept supported extensions without case sensitivity, and show an error for unsupported names instead of returning silently.
Prompt To Fix With AI
This is a comment left during a code review.
Path: ui/src/sampleExport.ts
Line: 46
Comment:
**Export silently skips filenames**
A confirmed filename such as `samples.CSV`, or one without an extension, fails the case-sensitive extension check. The function returns without writing a file, and `runExport` closes the dialog as if it succeeded. Add the selected extension when missing, accept supported extensions without case sensitivity, and show an error for unsupported names instead of returning silently.
---
For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.There was a problem hiding this comment.
Fixed in 67dc85c. The extension now matches regardless of case, so samples.CSV is accepted. A name with no supported extension makes exportSampleTable throw, and the dialog stays open showing the error. The extension is not added automatically, because the save dialog returns only the path and does not say which format was picked.
| function dropSampleSheetFilter( | ||
| filters: null | PlDataTableFilters, | ||
| sampleAxis: AxisId, | ||
| ): null | PlDataTableFilters { | ||
| if (filters === null || isSampleSheetFilter(filters, sampleAxis)) return null; | ||
| if (filters.type !== "and") return filters; | ||
| const kept = filters.filters.filter((f) => !isSampleSheetFilter(f, sampleAxis)); | ||
| return kept.length === 0 ? null : { type: "and", filters: kept }; | ||
| } |
There was a problem hiding this comment.
The new export path has no tests for replacing the sample-sheet filter while keeping other filters, or for choosing columns from labels and visibility settings. These rules replace behavior previously owned by the grid, so later changes can silently alter exported rows or columns. Add focused tests for one sample, several samples, all samples, retained user filters, and hidden or labeled columns.
Prompt To Fix With AI
This is a comment left during a code review.
Path: model/src/index.ts
Line: 450-458
Comment:
**Export rules lack tests**
The new export path has no tests for replacing the sample-sheet filter while keeping other filters, or for choosing columns from labels and visibility settings. These rules replace behavior previously owned by the grid, so later changes can silently alter exported rows or columns. Add focused tests for one sample, several samples, all samples, retained user filters, and hidden or labeled columns.
---
For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!
There was a problem hiding this comment.
Agreed these rules need tests. The block has no unit-test setup yet: neither model nor ui runs vitest, and the test package only holds a disabled workflow test. Adding them means setting up vitest in both packages and moving the export helpers out of model/src/index.ts into a module that can be tested. That will be a separate PR covering one sample, several samples, all samples, kept user filters, and hidden or labeled columns.
Match the extension case-insensitively and show an error instead of closing the dialog without writing a file.
Purpose
Export on the By sample page was limited to the one sample selected in the sheet. Users need to export several samples, or all of them, into one file.
Changes
ui/src/components/SampleExportModal.vue): the page's Export button opens a dialog with the current sample picked. The user can add other samples or check "All samples". The table's built-in export button is off on this page.sampleExportTableinmodel/src/index.ts): the By sample table with the sample sheet replaced by aninSetfilter on the selection (no sample filter for "All samples"). The page's filters, search, hidden columns and sorting carry over. It is built from primary columns, socreatePlDataTableV3adds the Sample label column and each exported row names its sample.sampleExport, migrationVer_2026_10_13): the model output is computed from data, so the dialog writes the selection there, waits for the output built for it, then exports.ui/src/sampleExport.ts): there is no grid behind the export table, so the block picks the columns the grid would show. A label column replaces the axis it labels; linker and hidden columns are left out. Headers come fromcolumnsMeta. The file is written withpframe.exportPTable(CSV, TSV, Parquet, Excel).Known limitation
Unlike the built-in export, there is no
writePTableToFsfallback for Desktop versions withoutexportPTable. On those the dialog shows an error.The PR appears safe to merge, with non-blocking improvements to filename feedback and export tests.
Fix with agent prompt
Summary
Adds a By sample export dialog for one, several, or all samples.
Important touched types:
SampleExportSelection: new choice between all samples and a list of sample IDs.BlockData: saved browser state; now includessampleExport.StoredV3: the previous saved shape; excludessampleExportbefore migration.ExportColumn: new internal description of a file column's index, header, and order.PlDataTableModel: SDK table description; now also carries the separate export table used by the dialog.Acknowledged limitation: AStaroverov states that older Desktop versions without
exportPTableshow an error because this path has nowritePTableToFsfallback. This was not reported again.Validation: source review only. Tests and UI capture were not run because dependencies are not installed.
Diagram
Reviews (1) · Last reviewed commit: "fix: second sample export no longer wait..." · Reviewed by Greptile