Skip to content

Commit

Permalink
rebase
Browse files Browse the repository at this point in the history
  • Loading branch information
bchu1 committed Dec 23, 2024
1 parent 9b823e1 commit fab1434
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
9 changes: 9 additions & 0 deletions frontend/packages/data-portal/app/graphql/getRunByIdDiffer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -304,6 +304,15 @@ export function logIfHasDiff(
})),
},
})),
depositions:
v1.deposition != null
? [
{
id: v1.deposition.id,
title: v1.deposition.title,
},
]
: [],
}

const diffObject = diff(v1Transformed, v2)
Expand Down
10 changes: 10 additions & 0 deletions frontend/packages/data-portal/app/graphql/getRunByIdV2.server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -272,6 +273,13 @@ const GET_RUN_BY_ID_QUERY_V2 = gql(`
title
}
}
# Deposition banner
# Returns empty array if $depositionId not defined
depositions(where: { id: { _eq: $depositionId }}) {
id
title
}
}
# Tomograms table + download selector
Expand Down Expand Up @@ -419,6 +427,7 @@ export async function getRunByIdV2(
id: number,
annotationsPage: number,
params: URLSearchParams = new URLSearchParams(),
depositionId?: number,
): Promise<ApolloQueryResult<GetRunByIdV2Query>> {
return client.query({
query: GET_RUN_BY_ID_QUERY_V2,
Expand All @@ -430,6 +439,7 @@ export async function getRunByIdV2(
id,
getFilterState(params),
),
depositionId,
},
})
}
12 changes: 9 additions & 3 deletions frontend/packages/data-portal/app/routes/runs.$id.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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(
apolloClientV2,
id,
annotationsPage,
url.searchParams,
Number.isNaN(depositionId) ? undefined : depositionId,
),
])

if (responseV1.runs.length === 0) {
Expand Down

0 comments on commit fab1434

Please sign in to comment.