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
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ export const BasicCell = ({
getValue,
}: CellContext<ReadRun, ReadRun[keyof ReadRun]>): JSX.Element => {
return (
<Typography noWrap variant={TYPOGRAPHY_PROPS.VARIANT.INHERIT}>
<Typography variant={TYPOGRAPHY_PROPS.VARIANT.INHERIT}>
{getValue()}
</Typography>
);
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import { COLUMN_DEF } from "@databiosphere/findable-ui/lib/components/Table/comm
import { META } from "./constants";
import { BasicCell } from "../../components/Table/components/TableCell/components/BasicCell/basicCell";
import { useMemo } from "react";
import { getFastqFTP } from "./accessorFn";
import { buildFastqFTP } from "./viewBuilders";

export const useTable = (
readRuns: ReadRun[] | undefined = []
Expand All @@ -23,73 +23,62 @@ export const useTable = (
COLUMN_DEF.ROW_SELECTION as ColumnDef<ReadRun>,
{
accessorKey: "run_accession",
cell: BasicCell,
header: "Run Accession",
meta: { width: { max: "1fr", min: "140px" } },
},
{
accessorFn: getFastqFTP,
cell: BasicCell,
accessorKey: "fastq_ftp",
cell: (props) => BasicCell(buildFastqFTP(props)),
header: "Fastq FTP",
meta: { width: { max: "1.8fr", min: "200px" } },
},
{
accessorKey: "experiment_accession",
cell: BasicCell,
header: "Experiment Accession",
meta: META,
},
{
accessorKey: "sample_accession",
cell: BasicCell,
header: "Sample Accession",
meta: META,
},
{
accessorKey: "study_accession",
cell: BasicCell,
header: "Study Accession",
meta: META,
},
{
accessorKey: "scientific_name",
cell: BasicCell,
header: "Scientific Name",
meta: META,
},
{
accessorKey: "instrument_platform",
cell: BasicCell,
header: "Instrument Platform",
meta: META,
},
{
accessorKey: "instrument_model",
cell: BasicCell,
header: "Instrument Model",
meta: META,
},
{
accessorKey: "library_strategy",
cell: BasicCell,
header: "Library Strategy",
meta: META,
},
{
accessorKey: "library_layout",
cell: BasicCell,
header: "Library Layout",
meta: META,
},
{
accessorKey: "read_count",
cell: BasicCell,
header: "Read Count",
meta: META,
},
{
accessorKey: "base_count",
cell: BasicCell,
header: "Base Count",
meta: META,
},
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
import { CellContext } from "@tanstack/react-table";
import { ReadRun } from "../../../../types";
import { LABEL } from "@databiosphere/findable-ui/lib/apis/azul/common/entities";

/**
* Returns Fastq FTP cell context.
* @param cellContext - Cell context.
* @returns Model to be used as cellContext for the BasicCell component.
*/
export function buildFastqFTP(
cellContext: CellContext<ReadRun, ReadRun["fastq_ftp"]>
): CellContext<ReadRun, string> {
const value = cellContext.getValue();

// Fastq FTP is a semicolon-separated list of URLs.
// Grab the last part of each URL.
const values = value
.split(";")
.map((v) => v.trim().split("/").pop())
.filter(Boolean);

// If no values, return "None".
if (values.length === 0)
return { getValue: () => LABEL.NONE } as CellContext<ReadRun, string>;

// Otherwise, return the values as a comma-separated string.
return {
getValue: () => values.join(", "),
} as CellContext<ReadRun, string>;
}
Loading