Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 9 additions & 4 deletions src/components/ExportSubmissionsButton/index.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { userEvent, within, screen } from "@storybook/test";

import { Context as AuthContext } from "@/components/Contexts/AuthContext";
import { Column } from "@/components/GenericTable";
import { approvedStudyFactory } from "@/factories/approved-study/ApprovedStudyFactory";
import { authCtxStateFactory } from "@/factories/auth/AuthCtxStateFactory";
import { organizationFactory } from "@/factories/auth/OrganizationFactory";
import { userFactory } from "@/factories/auth/UserFactory";
Expand All @@ -27,8 +28,12 @@ const baseSubmissions = submissionFactory.build(2, (idx) => ({
name: `Test Organization ${idx}`,
abbreviation: `ORG-${idx}`,
}),
study: approvedStudyFactory.pick(["studyName", "studyAbbreviation", "dbGaPID"]).build({
studyName: `TEST-NAME-${idx}`,
studyAbbreviation: `TEST-${idx}`,
dbGaPID: `phs00000${idx}`,
}),
studyAbbreviation: `TEST-${idx}`,
dbGaPID: `phs00000${idx}`,
status: "In Progress",
conciergeName: `Test Concierge ${idx}`,
nodeCount: 1000 + idx,
Expand Down Expand Up @@ -118,9 +123,9 @@ const defaultColumns: Column<Submission>[] = [
},
{
label: "dbGaP ID",
renderValue: (a) => a.dbGaPID,
field: "dbGaPID",
exportValue: (a) => ({ label: "dbGaP ID", value: a.dbGaPID }),
renderValue: (a) => a.study.dbGaPID,
fieldKey: "study.dbGaPID",
exportValue: (a) => ({ label: "dbGaP ID", value: a.study.dbGaPID }),
},
{
label: "Status",
Expand Down
14 changes: 9 additions & 5 deletions src/components/ExportSubmissionsButton/index.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import userEvent from "@testing-library/user-event";
import { FC } from "react";
import { axe } from "vitest-axe";

import { approvedStudyFactory } from "@/factories/approved-study/ApprovedStudyFactory";
import { authCtxStateFactory } from "@/factories/auth/AuthCtxStateFactory";
import { organizationFactory } from "@/factories/auth/OrganizationFactory";
import { userFactory } from "@/factories/auth/UserFactory";
Expand Down Expand Up @@ -45,8 +46,11 @@ const baseSubmissions = submissionFactory.build(10, (idx) => ({
name: `Organization ${idx}`,
abbreviation: `ORG-${idx}`,
}),
studyAbbreviation: `STUDY-${idx}`,
dbGaPID: `phs00${idx}`,
study: approvedStudyFactory.pick(["studyName", "studyAbbreviation", "dbGaPID"]).build({
studyName: `Study ${idx}`,
studyAbbreviation: `STUDY-${idx}`,
dbGaPID: `phs00${idx}`,
}),
status: "In Progress",
conciergeName: `Concierge ${idx}`,
nodeCount: 100 + idx,
Expand Down Expand Up @@ -145,9 +149,9 @@ const defaultColumns: Column<Submission>[] = [
},
{
label: "dbGaP ID",
renderValue: (a) => a.dbGaPID,
field: "dbGaPID",
exportValue: (a) => ({ label: "dbGaP ID", value: a.dbGaPID }),
renderValue: (a) => a.study?.dbGaPID,
fieldKey: "study.dbGaPID",
exportValue: (a) => ({ label: "dbGaP ID", value: a.study?.dbGaPID }),
},
{
label: "Status",
Expand Down
6 changes: 3 additions & 3 deletions src/content/dataSubmissions/DataSubmissionsListView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -181,10 +181,10 @@ const columns: Column<T>[] = [
},
{
label: "dbGaP ID",
renderValue: (a) => <TruncatedText text={a.dbGaPID} maxCharacters={15} />,
field: "dbGaPID",
renderValue: (a) => <TruncatedText text={a?.study?.dbGaPID} maxCharacters={15} />,
fieldKey: "study.dbGaPID",
hideable: true,
exportValue: (a) => ({ label: "dbGaP ID", value: a.dbGaPID }),
exportValue: (a) => ({ label: "dbGaP ID", value: a.study?.dbGaPID || "" }),
},

{
Expand Down
3 changes: 1 addition & 2 deletions src/graphql/listSubmissions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,8 @@ export const query: TypedDocumentNode<Response, Input> = gql`
study {
studyName
studyAbbreviation
dbGaPID
}
dbGaPID
modelVersion
status
archived
Expand Down Expand Up @@ -92,7 +92,6 @@ export type Response = {
| "dataCommonsDisplayName"
| "organization"
| "study"
| "dbGaPID"
| "modelVersion"
| "status"
| "archived"
Expand Down
9 changes: 7 additions & 2 deletions src/types/Submissions.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,13 @@ type Submission = {
/**
* The study associated with the submission.
*/
study: Pick<ApprovedStudy, "studyName" | "studyAbbreviation">;
dbGaPID: string; // # aka. phs number
study: Pick<ApprovedStudy, "studyName" | "studyAbbreviation" | "dbGaPID">;
/**
* The dbGaP PHS Accession number associated with the submission's study.
*
* @deprecated Use `study.dbGaPID` instead.
*/
dbGaPID: string;
bucketName: string; // # populated from organization
rootPath: string; // # a submission folder will be created under this path, default is / or "" meaning root folder
status: SubmissionStatus;
Expand Down
Loading