Skip to content

Commit

Permalink
Remove prepareSamplesDataForAgGrid prop
Browse files Browse the repository at this point in the history
We no longer need this function because all of the samples data
processing logic has been moved to the GraphQL server.
  • Loading branch information
qu8n authored and ao508 committed Aug 7, 2024
1 parent 1f90470 commit 73c9ca6
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 24 deletions.
10 changes: 1 addition & 9 deletions frontend/src/components/RecordsList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,7 @@ import {
} from "ag-grid-community";
import { DataName, useHookLazyGeneric } from "../shared/types";
import SamplesList from "./SamplesList";
import {
Sample,
SamplesListQuery,
SampleWhere,
SortDirection,
} from "../generated/graphql";
import { Sample, SampleWhere, SortDirection } from "../generated/graphql";
import { defaultColDef } from "../shared/helpers";
import { PatientIdsTriplet } from "../pages/patients/PatientsPage";
import { ErrorMessage, LoadingSpinner, Toolbar } from "../shared/tableElements";
Expand Down Expand Up @@ -54,7 +49,6 @@ interface IRecordsListProps {
showDownloadModal: boolean;
setShowDownloadModal: Dispatch<SetStateAction<boolean>>;
handleDownload: () => void;
prepareSamplesDataForAgGrid?: (samples: SamplesListQuery["samples"]) => any[];
samplesColDefs: ColDef[];
samplesParentWhereVariables: SampleWhere;
samplesRefetchWhereVariables: (
Expand Down Expand Up @@ -84,7 +78,6 @@ export default function RecordsList({
showDownloadModal,
setShowDownloadModal,
handleDownload,
prepareSamplesDataForAgGrid,
samplesColDefs,
samplesParentWhereVariables,
samplesRefetchWhereVariables,
Expand Down Expand Up @@ -272,7 +265,6 @@ export default function RecordsList({
<div className={styles.popupHeight}>
<SamplesList
columnDefs={samplesColDefs}
prepareDataForAgGrid={prepareSamplesDataForAgGrid}
parentDataName={dataName}
parentWhereVariables={samplesParentWhereVariables}
refetchWhereVariables={samplesRefetchWhereVariables}
Expand Down
17 changes: 2 additions & 15 deletions frontend/src/components/SamplesList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import {
Sample,
SampleWhere,
useSamplesListQuery,
SamplesListQuery,
} from "../generated/graphql";
import AutoSizer from "react-virtualized-auto-sizer";
import { Button, Col, Container } from "react-bootstrap";
Expand Down Expand Up @@ -48,7 +47,6 @@ const TEMPO_EVENT_OPTIONS = {

interface ISampleListProps {
columnDefs: ColDef[];
prepareDataForAgGrid?: (samples: SamplesListQuery["samples"]) => any[];
setUnsavedChanges?: (unsavedChanges: boolean) => void;
parentDataName?: DataName;
parentWhereVariables?: SampleWhere;
Expand All @@ -61,7 +59,6 @@ interface ISampleListProps {

export default function SamplesList({
columnDefs,
prepareDataForAgGrid,
parentDataName,
parentWhereVariables,
refetchWhereVariables,
Expand Down Expand Up @@ -120,7 +117,6 @@ export default function SamplesList({
}, [data]);

const samples = data?.samples;
console.log(samples);

const popupParamId = useMemo(() => {
if (parentWhereVariables && samples && params) {
Expand Down Expand Up @@ -268,14 +264,7 @@ export default function SamplesList({
{showDownloadModal && (
<DownloadModal
loader={() => {
return Promise.resolve(
buildTsvString(
prepareDataForAgGrid
? prepareDataForAgGrid(samples!)
: samples!,
columnDefs
)
);
return Promise.resolve(buildTsvString(samples!, columnDefs));
}}
onComplete={() => {
setShowDownloadModal(false);
Expand Down Expand Up @@ -379,9 +368,7 @@ export default function SamplesList({
},
}}
columnDefs={columnDefs}
rowData={
prepareDataForAgGrid ? prepareDataForAgGrid(samples!) : samples!
}
rowData={samples!}
onCellEditRequest={onCellValueChanged}
readOnlyEdit={true}
defaultColDef={defaultColDef}
Expand Down

0 comments on commit 73c9ca6

Please sign in to comment.