diff --git a/frontend/packages/data-portal/app/graphql/getDatasetByIdV2.server.ts b/frontend/packages/data-portal/app/graphql/getDatasetByIdV2.server.ts index 3ab12bc82..733b3c6a7 100644 --- a/frontend/packages/data-portal/app/graphql/getDatasetByIdV2.server.ts +++ b/frontend/packages/data-portal/app/graphql/getDatasetByIdV2.server.ts @@ -202,6 +202,7 @@ const GET_DATASET_BY_ID_QUERY_V2 = gql(` } # Deposition banner + # Returns empty array if $depositionId not defined depositions(where: { id: { _eq: $depositionId }}) { id title diff --git a/frontend/packages/data-portal/app/graphql/getRunByIdDiffer.ts b/frontend/packages/data-portal/app/graphql/getRunByIdDiffer.ts index 8a2114017..e414a2ba3 100644 --- a/frontend/packages/data-portal/app/graphql/getRunByIdDiffer.ts +++ b/frontend/packages/data-portal/app/graphql/getRunByIdDiffer.ts @@ -304,6 +304,15 @@ export function logIfHasDiff( })), }, })), + depositions: + v1.deposition != null + ? [ + { + id: v1.deposition.id, + title: v1.deposition.title, + }, + ] + : [], } const diffObject = diff(v1Transformed, v2) diff --git a/frontend/packages/data-portal/app/graphql/getRunByIdV2.server.ts b/frontend/packages/data-portal/app/graphql/getRunByIdV2.server.ts index ff4a14225..503d72226 100644 --- a/frontend/packages/data-portal/app/graphql/getRunByIdV2.server.ts +++ b/frontend/packages/data-portal/app/graphql/getRunByIdV2.server.ts @@ -20,6 +20,7 @@ const GET_RUN_BY_ID_QUERY_V2 = gql(` $limit: Int $annotationShapesOffset: Int $annotationShapesFilter: AnnotationShapeWhereClause + $depositionId: Int ) { runs(where: { id: { _eq: $id } }) { id @@ -334,6 +335,13 @@ const GET_RUN_BY_ID_QUERY_V2 = gql(` } } } + + # Deposition banner + # Returns empty array if $depositionId not defined + depositions(where: { id: { _eq: $depositionId }}) { + id + title + } } `) @@ -414,12 +422,21 @@ function getAnnotationShapesFilter( return where } -export async function getRunByIdV2( - client: ApolloClient, - id: number, - annotationsPage: number, - params: URLSearchParams = new URLSearchParams(), -): Promise> { +export interface GetRunByIdV2Params { + client: ApolloClient + id: number + annotationsPage: number + params: URLSearchParams + depositionId?: number +} + +export async function getRunByIdV2({ + client, + id, + annotationsPage, + params, + depositionId, +}: GetRunByIdV2Params): Promise> { return client.query({ query: GET_RUN_BY_ID_QUERY_V2, variables: { @@ -430,6 +447,7 @@ export async function getRunByIdV2( id, getFilterState(params), ), + depositionId, }, }) } diff --git a/frontend/packages/data-portal/app/routes/runs.$id.tsx b/frontend/packages/data-portal/app/routes/runs.$id.tsx index 25638e7d5..895b921b4 100644 --- a/frontend/packages/data-portal/app/routes/runs.$id.tsx +++ b/frontend/packages/data-portal/app/routes/runs.$id.tsx @@ -47,17 +47,23 @@ export async function loader({ request, params }: LoaderFunctionArgs) { const annotationsPage = +( url.searchParams.get(QueryParams.AnnotationsPage) ?? '1' ) - const depositionId = +(url.searchParams.get(QueryParams.DepositionId) ?? '-1') + const depositionId = Number(url.searchParams.get(QueryParams.DepositionId)) const [{ data: responseV1 }, { data: responseV2 }] = await Promise.all([ getRunById({ id, annotationsPage, - depositionId, + depositionId: Number.isNaN(depositionId) ? undefined : depositionId, client: apolloClient, params: url.searchParams, }), - getRunByIdV2(apolloClientV2, id, annotationsPage, url.searchParams), + getRunByIdV2({ + client: apolloClientV2, + id, + annotationsPage, + params: url.searchParams, + depositionId: Number.isNaN(depositionId) ? undefined : depositionId, + }), ]) if (responseV1.runs.length === 0) { diff --git a/frontend/packages/data-portal/e2e/pageObjects/metadataDrawer/utils.ts b/frontend/packages/data-portal/e2e/pageObjects/metadataDrawer/utils.ts index aa1b7aa73..5953e8282 100644 --- a/frontend/packages/data-portal/e2e/pageObjects/metadataDrawer/utils.ts +++ b/frontend/packages/data-portal/e2e/pageObjects/metadataDrawer/utils.ts @@ -299,7 +299,12 @@ export async function getAnnotationTestData( export async function getTomogramTestData( client: ApolloClient, ) { - const { data } = await getRunByIdV2(client, +E2E_CONFIG.runId, 1) + const { data } = await getRunByIdV2({ + client, + id: +E2E_CONFIG.runId, + annotationsPage: 1, + params: new URLSearchParams(), + }) const tomogram = data.tomograms[0] const { dataset } = data.runs[0]