refactor(Dataset): change endpoints from V3 to V4#2380
Conversation
… with new ones, html changes in dataset details page
…ject/frontend into change-dataset-endpoints-to-v4
…ject/frontend into change-dataset-endpoints-to-v4
… not yet support encoding/decoding
…ject/frontend into change-dataset-endpoints-to-v4
There was a problem hiding this comment.
Sorry @abdimo101, you have reached your weekly rate limit of 500000 diff characters.
Please try again later or upgrade to continue using Sourcery
There was a problem hiding this comment.
Pull request overview
This PR migrates dataset-related frontend logic from V3 to V4 APIs, updating NgRx state/actions/effects and multiple consuming components to use V4 DTOs (including new array-based relations like proposalIds/sampleIds/instrumentIds). It also introduces a shared utility for converting scientific condition filters into a Mongo-style query for the V4 findAll endpoint, and updates Cypress API paths/config to match the new versioned endpoints.
Changes:
- Switch dataset fetch/create/count/facet effects from V3 controllers to V4/public V4 controllers; update state to use
PartialOutputDatasetDtoplus aCurrentDatasetunion type. - Update components/services/tests to accept V4 DTO shapes (notably
proposalIds/sampleIds/instrumentIds) and new query/sort structures. - Add
shared-condition/utils.tsfor scientific-metadata query building; update Cypress config and intercepts to/api/v3//api/v4as appropriate.
Reviewed changes
Copilot reviewed 54 out of 54 changed files in this pull request and generated 13 comments.
Show a summary per file
| File | Description |
|---|---|
| src/app/state-management/state/samples.store.ts | Update sample state dataset DTO type to V4 partial dataset DTO. |
| src/app/state-management/state/proposals.store.ts | Update proposals state dataset DTO type to V4 partial dataset DTO. |
| src/app/state-management/state/datasets.store.ts | Introduce CurrentDataset type and migrate dataset state collections to V4 DTOs. |
| src/app/state-management/selectors/datasets.selectors.ts | Build V4-compatible query/limits, including scientific-condition query conversion and sort object. |
| src/app/state-management/reducers/proposals.reducer.spec.ts | Update proposal reducer tests to V4 dataset DTO shape. |
| src/app/state-management/reducers/datasets.reducer.ts | Adjust reducer logic for optional attachments/origdatablocks handling with new types. |
| src/app/state-management/reducers/datasets.reducer.spec.ts | Update dataset reducer tests for V4 DTO fields (e.g. principalInvestigators, datasetName). |
| src/app/state-management/effects/published-data.effects.ts | Update dataset batch selection typing to V4 dataset DTO. |
| src/app/state-management/effects/ingestor.effects.ts | Switch ingestor dataset creation from V3 service to V4 service. |
| src/app/state-management/effects/ingestor.effects.spec.ts | Update ingestor effects tests for V4 dataset creation call. |
| src/app/state-management/effects/datasets.effects.ts | Migrate core dataset effects to V4/public V4 endpoints and new filter payload shape. |
| src/app/state-management/effects/datasets.effects.spec.ts | Update dataset effects tests for V4 services and new filter/sort payload shape. |
| src/app/state-management/actions/samples.actions.ts | Update sample datasets action payload types to V4 partial dataset DTO. |
| src/app/state-management/actions/proposals.actions.ts | Update proposal datasets action payload types to V4 partial dataset DTO. |
| src/app/state-management/actions/ingestor.actions.ts | Update ingestor create-dataset success payload to V4 output dataset DTO. |
| src/app/state-management/actions/datasets.actions.ts | Update dataset action payload types for V4 DTO usage and V4 create request type. |
| src/app/state-management/actions/datasets.actions.spec.ts | Update dataset actions tests for V4 DTO/request types. |
| src/app/shared/services/ownership.service.ts | Update ownership checks to accept CurrentDataset. |
| src/app/shared/services/datasets-list.service.ts | Update instrument display logic to use V4 instrumentIds array. |
| src/app/shared/modules/shared-condition/utils.ts | New: convert scientific conditions (incl. unit conversion) into Mongo-style query for V4 endpoints. |
| src/app/shared/modules/shared-condition/shared-condition.component.ts | Add range-input buffering to support decimal range entry and improved display text. |
| src/app/shared/MockStubs.ts | Update shared mock dataset type to CurrentDataset. |
| src/app/samples/sample-detail/sample-detail.component.ts | Update sample detail dataset table typing to V4 partial dataset DTO. |
| src/app/proposals/proposal-table/proposal-table.component.ts | Update proposal table dataset typing to V4 dataset DTO. |
| src/app/proposals/proposal-datasets/proposal-datasets.component.ts | Update proposal datasets table and row events to V4 partial dataset DTO. |
| src/app/proposals/proposal-datasets/proposal-datasets.component.spec.ts | Update proposal datasets component tests to V4 dataset DTO. |
| src/app/logbooks/logbooks-dashboard/logbooks-dashboard.component.ts | Update current dataset typing to CurrentDataset. |
| src/app/ingestor/ingestor-page/helper/ingestor.component-helper.ts | Update ingestor schema builder to V4 create dataset DTO fields (arrays for relations, plural PI). |
| src/app/ingestor/ingestor-dialogs/creation-dialog/creation-pages/ingestor.new-transfer-dialog-page.component.ts | Update ingestor transfer header PI field to principalInvestigators array. |
| src/app/datasets/related-datasets/related-datasets.component.ts | Update related datasets typing and click handler to V4 partial dataset DTO. |
| src/app/datasets/reduce/reduce.component.ts | Update reduce flow dataset typing to CurrentDataset. |
| src/app/datasets/dataset-table/dataset-table.component.ts | Update dataset table typing and selection events to V4 partial dataset DTO. |
| src/app/datasets/dataset-table/dataset-inline-edit-cell.component.ts | Update inline edit row typing to V4 dataset DTO. |
| src/app/datasets/dataset-table-actions/dataset-table-actions.component.ts | Update selected set typing to V4 partial dataset DTO. |
| src/app/datasets/dataset-lifecycle/dataset-lifecycle.component.ts | Update lifecycle dataset typing to CurrentDataset. |
| src/app/datasets/dataset-lifecycle/dataset-lifecycle.component.spec.ts | Update lifecycle tests to V4 partial dataset DTO + history. |
| src/app/datasets/dataset-file-uploader/dataset-file-uploader.component.ts | Update uploader dataset typing to CurrentDataset. |
| src/app/datasets/dataset-details-dashboard/dataset-details-dashboard.component.ts | Update related document fetching to array-based IDs and CurrentDataset typing. |
| src/app/datasets/dataset-detail/dataset-detail/dataset-detail.component.ts | Update dataset detail component typing to CurrentDataset. |
| src/app/datasets/dataset-detail/dataset-detail/dataset-detail.component.spec.ts | Update dataset detail tests to V4 dataset DTO. |
| src/app/datasets/dataset-detail/dataset-detail/dataset-detail.component.html | Render related documents for array-based IDs (proposals/samples/instruments). |
| src/app/datasets/dataset-detail/dataset-detail-dynamic/dataset-detail-dynamic.component.ts | Update dynamic detail component typing to CurrentDataset. |
| src/app/datasets/dashboard/dashboard.component.ts | Update dashboard row click typing to V4 partial dataset DTO. |
| src/app/datasets/batch-view/batch-view.component.ts | Update batch view typing and export helpers to V4 partial dataset DTO. |
| src/app/datasets/archiving.service.ts | Update archiving service typing to CurrentDataset[]. |
| src/app/datasets/admin-tab/admin-tab.component.ts | Update admin tab dataset typing to CurrentDataset. |
| cypress/support/commands.js | Update Cypress API command URLs to include explicit /v3 or /v4 prefixes. |
| cypress/fixtures/testData.js | Update dataset fixture fields for V4 (plural PI, plural relation IDs). |
| cypress/e2e/mainPage/main-page.cy.js | Update dataset creation payload to use proposalIds array. |
| cypress/e2e/datasets/datasets-public.cy.js | Update intercept path to V4 datasets endpoint. |
| cypress/e2e/datasets/datasets-metadata.cy.js | Skip metadata test and update intercept to V4 datasets endpoint. |
| cypress/e2e/datasets/datasets-keyword.cy.js | Update intercept path to V4 datasets endpoint. |
| cypress/e2e/datasets/datasets-general.cy.js | Update dataset creation payload for V4 and add scientific-condition range/decimal coverage. |
| cypress.config.ts | Change Cypress API base URL to /api and rely on per-command version prefixes. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Description
This PR replaces dataset related API calls from V3 to V4, updating DTOs, effects, reducers, components and various tests to align with V4. Also added a utils file inside shared-condition folder that handles the scientific metadata query logic to be used for the findAllV4 endpoint.
Skipped test file:
Reason for the test skips are because backend does not yet support:
Motivation
Background on use case, changes needed
Fixes:
Please provide a list of the fixes implemented in this PR
Changes:
Please provide a list of the changes implemented by this PR
Tests included
Documentation
official documentation info
If you have updated the official documentation, please provide PR # and URL of the pages where the updates are included
Backend version
Summary by Sourcery
Migrate dataset-related frontend logic to support both legacy and V4 dataset representations while using V4 APIs for dataset retrieval and related data.
New Features:
Enhancements: