Skip to content

refactor(Dataset): change endpoints from V3 to V4#2380

Open
abdimo101 wants to merge 29 commits into
masterfrom
change-dataset-endpoints-to-v4
Open

refactor(Dataset): change endpoints from V3 to V4#2380
abdimo101 wants to merge 29 commits into
masterfrom
change-dataset-endpoints-to-v4

Conversation

@abdimo101

@abdimo101 abdimo101 commented May 18, 2026

Copy link
Copy Markdown
Member

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:

  • datasets-metadata.cy.js

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

  • Items added

Changes:

Please provide a list of the changes implemented by this PR

  • changes made

Tests included

  • Included for each change/fix?
  • Passing? (Merge will not be approved unless this is checked)

Documentation

  • swagger documentation updated [required]
  • official documentation updated [nice-to-have]

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

  • Does it require a specific version of the backend
  • which version of the backend is required:

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:

  • Introduce a unified CurrentDataset type that can represent both V3 and V4 dataset payloads with optional attachments, datablocks, origdatablocks, and history.

Enhancements:

  • Update NgRx dataset state, actions, and effects to store and work with the new CurrentDataset type instead of the obsolete V3-only DTO.
  • Adjust components and services that consume datasets (details, batch view, reduce flow, lifecycle, logbooks, admin, uploader, archiving) to operate on CurrentDataset and related V4 DTOs.
  • Simplify related datasets queries by delegating sorting to the backend rather than passing a client-side sort field.

abdimo101 added 24 commits May 18, 2026 16:48
… 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
…ject/frontend into change-dataset-endpoints-to-v4
@abdimo101 abdimo101 marked this pull request as ready for review June 22, 2026 15:04
@abdimo101 abdimo101 requested a review from a team as a code owner June 22, 2026 15:04

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Sorry @abdimo101, you have reached your weekly rate limit of 500000 diff characters.

Please try again later or upgrade to continue using Sourcery

@abdimo101 abdimo101 requested a review from Junjiequan June 22, 2026 15:05
@abdimo101 abdimo101 assigned nitrosx and unassigned nitrosx Jun 22, 2026

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

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 PartialOutputDatasetDto plus a CurrentDataset union type.
  • Update components/services/tests to accept V4 DTO shapes (notably proposalIds/sampleIds/instrumentIds) and new query/sort structures.
  • Add shared-condition/utils.ts for scientific-metadata query building; update Cypress config and intercepts to /api/v3//api/v4 as 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.

Comment thread src/app/state-management/actions/datasets.actions.ts
Comment thread src/app/datasets/dataset-details-dashboard/dataset-details-dashboard.component.ts Outdated
Comment thread src/app/datasets/dataset-details-dashboard/dataset-details-dashboard.component.ts Outdated
Comment thread src/app/datasets/dataset-details-dashboard/dataset-details-dashboard.component.ts Outdated
Comment thread src/app/shared/modules/shared-condition/shared-condition.component.ts Outdated
Comment thread src/app/datasets/dataset-detail/dataset-detail/dataset-detail.component.html Outdated
Comment thread src/app/datasets/dataset-detail/dataset-detail/dataset-detail.component.html Outdated
Comment thread cypress/e2e/datasets/datasets-general.cy.js
Comment thread src/app/state-management/reducers/datasets.reducer.ts
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants