Skip to content

Add save-to-server option for linelist exports#1805

Open
joshsadam wants to merge 20 commits intomainfrom
feature/linelist-v2-save-to-server
Open

Add save-to-server option for linelist exports#1805
joshsadam wants to merge 20 commits intomainfrom
feature/linelist-v2-save-to-server

Conversation

@joshsadam
Copy link
Copy Markdown
Contributor

@joshsadam joshsadam commented Apr 23, 2026

What does this PR do and why?

Adds a save-to-server option to the v2 linelist export dialog. Users can still download CSV/XLSX exports locally, or save the generated export as a ready data export that can be opened later from the data exports page.

This also adds GraphQL support for client-side linelist row loading, direct-upload-backed linelist export creation, and JavaScript test coverage for the v2 client export flow.

Screenshots or screen recordings

Screenshots are required for UI changes, and strongly recommended for all other pull requests.

How to set up and validate locally

  1. Enable the v2 client linelist export feature flag:
    bin/rails console
    Flipper.enable(:client_linelist_exports_v1)
  2. Start the app with bin/dev.
  3. Open a project samples page, for example http://localhost:3000/<group>/<project>/samples.
  4. Select one or more samples, open the actions dropdown, and choose Linelist Export.
  5. Verify the default flow still downloads locally when Save export to server is unchecked.
  6. Check Save export to server, enter a name, export both CSV and XLSX, and verify the progress window shows a saved-export link.
  7. Break the upload path and confirm Retry upload and Download locally instead work for the failed save-to-server flow.
  8. Run the focused checks:
    bin/rails test test/graphql/create_linelist_data_export_test.rb test/graphql/linelist_export_rows_query_test.rb test/services/data_exports/linelist_create_service_test.rb
    bin/rails test:system test/system/data_exports_test.rb
    pnpm run test:js
    node --check app/javascript/controllers/linelist_export_controller.js

PR acceptance checklist

This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.

@joshsadam joshsadam self-assigned this Apr 23, 2026
Comment thread app/javascript/controllers/linelist_export_controller.js Fixed
@joshsadam joshsadam changed the title Linelist V2: Client side create --> server save Add save-to-server option for linelist exports Apr 23, 2026
joshsadam added a commit that referenced this pull request Apr 23, 2026
@joshsadam
Copy link
Copy Markdown
Contributor Author

Addressed #1805 (comment). Fix in fe9f8b9

Comment thread app/javascript/controllers/linelist_export_controller.js Fixed
joshsadam added a commit that referenced this pull request Apr 23, 2026
@joshsadam
Copy link
Copy Markdown
Contributor Author

Addressed #1805 (comment). Fix in 64c56ca

joshsadam added a commit that referenced this pull request Apr 23, 2026
joshsadam added a commit that referenced this pull request Apr 23, 2026
@joshsadam joshsadam force-pushed the feature/linelist-v2-save-to-server branch from 8beff60 to 09b0161 Compare April 23, 2026 17:21
@joshsadam joshsadam marked this pull request as ready for review April 23, 2026 18:38
joshsadam added a commit that referenced this pull request Apr 24, 2026
joshsadam added a commit that referenced this pull request Apr 24, 2026
@joshsadam joshsadam force-pushed the feature/linelist-v2-save-to-server branch from 09b0161 to 62817c1 Compare April 24, 2026 15:13
Copy link
Copy Markdown
Collaborator

@ChrisHuynh333 ChrisHuynh333 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems to work well. In addition to what we discussed, just a couple phrasing things I think should be changed (up to you!)

Comment thread config/locales/en.yml Outdated
@ChrisHuynh333
Copy link
Copy Markdown
Collaborator

Some issues to dig into:

  • User with shared guest access to a sample can export the sample locally, bypassing permissions check. Permissions blocks this if trying to save to the server.
    • To recreate: with user1, create a group + project + sample. On user2, create a group + project + sample, and then at the group level, invite user1's group at guest level. Re login as user1, go to user1's group, and export both samples without saving to server.
  • I'm having a failed export (not saving to server) on user1 when exporting from a group containing/shared to all samples (with new seed). Error is: An object of type Sample was hidden due to permissions. I believe user1 has at least analyst access to all samples, and this export works fine on main.

joshsadam added a commit that referenced this pull request Apr 29, 2026
joshsadam added a commit that referenced this pull request Apr 29, 2026
@joshsadam joshsadam force-pushed the feature/linelist-v2-save-to-server branch from 070c2f6 to 1de9bc0 Compare April 29, 2026 03:41
@joshsadam
Copy link
Copy Markdown
Contributor Author

Some issues to dig into:

  • User with shared guest access to a sample can export the sample locally, bypassing permissions check. Permissions blocks this if trying to save to the server.

    • To recreate: with user1, create a group + project + sample. On user2, create a group + project + sample, and then at the group level, invite user1's group at guest level. Re login as user1, go to user1's group, and export both samples without saving to server.
  • I'm having a failed export (not saving to server) on user1 when exporting from a group containing/shared to all samples (with new seed). Error is: An object of type Sample was hidden due to permissions. I believe user1 has at least analyst access to all samples, and this export works fine on main.

Think I got this sorted out now:
image

joshsadam added a commit that referenced this pull request Apr 29, 2026
joshsadam added a commit that referenced this pull request Apr 29, 2026
@joshsadam joshsadam force-pushed the feature/linelist-v2-save-to-server branch from 1de9bc0 to 05639d1 Compare April 29, 2026 17:55
joshsadam and others added 16 commits April 30, 2026 12:45
…rm field styles

Co-authored-by: Copilot <copilot@github.com>
…ver checkbox

Co-authored-by: Copilot <copilot@github.com>
Expose linelistExportRows with resolver that enforces export permissions
and returns ordered rows backed by DataExports::LinelistExportRow.
Includes GraphQL types and resolver tests.
Replace nodes(ids) sample fetch with namespaced export field, pass
namespace_id from the main thread, and chunk by database sample ids.
@joshsadam joshsadam force-pushed the feature/linelist-v2-save-to-server branch from 05639d1 to 95d8b8e Compare April 30, 2026 19:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants