Skip to content

Commit 7002e70

Browse files
authored
Merge branch 'main' into artic-measles
2 parents dcf40be + f5a0ed0 commit 7002e70

File tree

23 files changed

+327
-61
lines changed

23 files changed

+327
-61
lines changed
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,13 @@
11
import styled from "@emotion/styled";
22
import { PALETTE } from "@databiosphere/findable-ui/lib/styles/common/constants/palette";
3+
import { SearchAllFilters } from "@databiosphere/findable-ui/lib/components/Filter/components/SearchAllFilters/searchAllFilters";
34

45
export const StyledContainer = styled("div")`
56
box-shadow: inset -1px 0 ${PALETTE.SMOKE_MAIN};
67
overflow: auto;
78
`;
9+
10+
export const StyledSearchAllFilters = styled(SearchAllFilters)`
11+
margin: 8px 0;
12+
padding: 0 16px;
13+
`;

app/components/Entity/components/ConfigureWorkflowInputs/components/Main/components/Stepper/components/Step/SequencingStep/components/ENASequencingData/components/CollectionSelector/components/ColumnFilters/columnFilters.tsx

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ import { SurfaceProps } from "@databiosphere/findable-ui/lib/components/Filter/c
44
import { Filters } from "@databiosphere/findable-ui/lib/components/Filter/components/Filters/filters";
55
import { StyledContainer } from "./columnFilters.styles";
66
import { Controls } from "@databiosphere/findable-ui/lib/components/Filter/components/controls/Controls/controls";
7+
import { StyledSearchAllFilters } from "./columnFilters.styles";
8+
import { getCategoryViews } from "./utils";
79

810
export const ColumnFilters = ({ table }: Props): JSX.Element => {
911
return (
@@ -12,6 +14,10 @@ export const ColumnFilters = ({ table }: Props): JSX.Element => {
1214
renderSurface={(props: SurfaceProps) => (
1315
<>
1416
<Controls onFilter={props.onFilter} />
17+
<StyledSearchAllFilters
18+
categoryViews={getCategoryViews(props.categoryFilters)}
19+
onFilter={props.onFilter}
20+
/>
1521
<Filters {...props} />
1622
</>
1723
)}
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
import { CategoryFilter } from "@databiosphere/findable-ui/lib/components/Filter/components/Filters/filters";
2+
import { CategoryView } from "@databiosphere/findable-ui/lib/common/categories/views/types";
3+
4+
/**
5+
* Returns all category views from the given category filters.
6+
* @param categoryFilters - Category filters.
7+
* @returns Category views.
8+
*/
9+
export function getCategoryViews(
10+
categoryFilters: CategoryFilter[]
11+
): CategoryView[] {
12+
return categoryFilters.flatMap(
13+
(categoryFilter) => categoryFilter.categoryViews
14+
);
15+
}

app/components/Entity/components/ConfigureWorkflowInputs/components/Main/components/Stepper/components/Step/SequencingStep/components/ENASequencingData/components/CollectionSelector/hooks/UseTable/categoryConfigs.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,18 @@
11
import { CategoryConfig } from "@databiosphere/findable-ui/lib/common/categories/config/types";
2+
import { VIEW_KIND } from "@databiosphere/findable-ui/lib/common/categories/views/types";
23

34
export const CATEGORY_CONFIGS: Record<string, CategoryConfig> = {
45
BASE_COUNT: {
56
key: "base_count",
67
label: "Base Count",
8+
viewKind: VIEW_KIND.RANGE,
79
},
810
EXPERIMENT_ACCESSION: {
911
key: "experiment_accession",
1012
label: "Experiment Accession",
1113
},
1214
FASTQ_FTP: { key: "fastq_ftp", label: "Fastq FTP" },
13-
FIRST_PUBLIC: { key: "first_public", label: "First Public" },
15+
FIRST_CREATED: { key: "first_created", label: "First Created" },
1416
INSTRUMENT_MODEL: { key: "instrument_model", label: "Instrument Model" },
1517
INSTRUMENT_PLATFORM: {
1618
key: "instrument_platform",
@@ -21,6 +23,7 @@ export const CATEGORY_CONFIGS: Record<string, CategoryConfig> = {
2123
READ_COUNT: {
2224
key: "read_count",
2325
label: "Read Count",
26+
viewKind: VIEW_KIND.RANGE,
2427
},
2528
RUN_ACCESSION: { key: "run_accession", label: "Run Accession" },
2629
SAMPLE_ACCESSION: { key: "sample_accession", label: "Sample Accession" },
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
import { CategoryGroup } from "@databiosphere/findable-ui/lib/config/entities";
2+
import { CATEGORY_CONFIGS } from "./categoryConfigs";
3+
4+
export const CATEGORY_GROUPS: CategoryGroup[] = [
5+
{
6+
categoryConfigs: [CATEGORY_CONFIGS.SCIENTIFIC_NAME],
7+
label: "Organism",
8+
},
9+
{
10+
categoryConfigs: [
11+
CATEGORY_CONFIGS.SAMPLE_ACCESSION,
12+
CATEGORY_CONFIGS.STUDY_ACCESSION,
13+
CATEGORY_CONFIGS.RUN_ACCESSION,
14+
CATEGORY_CONFIGS.EXPERIMENT_ACCESSION,
15+
],
16+
label: "Accession",
17+
},
18+
{
19+
categoryConfigs: [
20+
CATEGORY_CONFIGS.INSTRUMENT_PLATFORM,
21+
CATEGORY_CONFIGS.INSTRUMENT_MODEL,
22+
],
23+
label: "Instrument",
24+
},
25+
{
26+
categoryConfigs: [
27+
CATEGORY_CONFIGS.LIBRARY_STRATEGY,
28+
CATEGORY_CONFIGS.LIBRARY_LAYOUT,
29+
],
30+
label: "Library",
31+
},
32+
{
33+
categoryConfigs: [CATEGORY_CONFIGS.READ_COUNT, CATEGORY_CONFIGS.BASE_COUNT],
34+
label: "Count",
35+
},
36+
];

app/components/Entity/components/ConfigureWorkflowInputs/components/Main/components/Stepper/components/Step/SequencingStep/components/ENASequencingData/components/CollectionSelector/hooks/UseTable/columnDef.ts

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -4,18 +4,19 @@ import { buildFastqFTP } from "./viewBuilders";
44
import { COLUMN_DEF } from "@databiosphere/findable-ui/lib/components/Table/common/columnDef";
55
import { BasicCell } from "../../components/Table/components/TableCell/components/BasicCell/basicCell";
66
import { CATEGORY_CONFIGS } from "./categoryConfigs";
7+
import { formatNumber } from "../../../../../../../../../../../../../../../../../viewModelBuilders/catalog/brc-analytics-catalog/common/viewModelBuilders";
78

8-
// const RANGE_FILTER_FN = "inNumberRange";
9+
const RANGE_FILTER_FN = "inNumberRange";
910
const SELECT_FILTER_FN = "arrIncludesSome";
1011

1112
const META: ColumnMeta<ReadRun, unknown> = {
12-
width: { max: "1.2fr", min: "120px" },
13+
width: { max: "1.2fr", min: "140px" },
1314
};
1415

1516
const BASE_COUNT: ColumnDef<ReadRun> = {
1617
accessorKey: CATEGORY_CONFIGS.BASE_COUNT.key,
17-
// filterFn: RANGE_FILTER_FN,
18-
filterFn: SELECT_FILTER_FN,
18+
cell: (ctx) => formatNumber(Number(ctx.getValue())),
19+
filterFn: RANGE_FILTER_FN,
1920
header: CATEGORY_CONFIGS.BASE_COUNT.label,
2021
meta: META,
2122
};
@@ -35,10 +36,10 @@ const FASTQ_FTP: ColumnDef<ReadRun> = {
3536
meta: { width: { max: "1.8fr", min: "200px" } },
3637
};
3738

38-
const FIRST_PUBLIC: ColumnDef<ReadRun> = {
39-
accessorKey: CATEGORY_CONFIGS.FIRST_PUBLIC.key,
39+
const FIRST_CREATED: ColumnDef<ReadRun> = {
40+
accessorKey: CATEGORY_CONFIGS.FIRST_CREATED.key,
4041
enableColumnFilter: false,
41-
header: CATEGORY_CONFIGS.FIRST_PUBLIC.label,
42+
header: CATEGORY_CONFIGS.FIRST_CREATED.label,
4243
meta: META,
4344
};
4445

@@ -72,8 +73,8 @@ const LIBRARY_STRATEGY: ColumnDef<ReadRun> = {
7273

7374
const READ_COUNT: ColumnDef<ReadRun> = {
7475
accessorKey: CATEGORY_CONFIGS.READ_COUNT.key,
75-
// filterFn: RANGE_FILTER_FN,
76-
filterFn: SELECT_FILTER_FN,
76+
cell: (ctx) => formatNumber(Number(ctx.getValue())),
77+
filterFn: RANGE_FILTER_FN,
7778
header: CATEGORY_CONFIGS.READ_COUNT.label,
7879
meta: META,
7980
};
@@ -109,7 +110,7 @@ const STUDY_ACCESSION: ColumnDef<ReadRun> = {
109110
export const columns: ColumnDef<ReadRun>[] = [
110111
COLUMN_DEF.ROW_SELECTION as ColumnDef<ReadRun>,
111112
RUN_ACCESSION,
112-
FIRST_PUBLIC,
113+
FIRST_CREATED,
113114
FASTQ_FTP,
114115
EXPERIMENT_ACCESSION,
115116
SAMPLE_ACCESSION,

app/components/Entity/components/ConfigureWorkflowInputs/components/Main/components/Stepper/components/Step/SequencingStep/components/ENASequencingData/components/CollectionSelector/hooks/UseTable/constants.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,6 @@ import { CATEGORY_CONFIGS } from "./categoryConfigs";
44
export const SORTING: SortingState = [
55
{
66
desc: true,
7-
id: CATEGORY_CONFIGS.FIRST_PUBLIC.key,
7+
id: CATEGORY_CONFIGS.FIRST_CREATED.key,
88
},
99
];

app/components/Entity/components/ConfigureWorkflowInputs/components/Main/components/Stepper/components/Step/SequencingStep/components/ENASequencingData/components/CollectionSelector/hooks/UseTable/hook.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@ import { ENA_QUERY_METHOD } from "../../../../../../types";
1919
import { updateColumnFilters } from "./utils";
2020
import { SORTING } from "./constants";
2121
import { getSortedRowModel } from "@tanstack/react-table";
22+
import { CATEGORY_GROUPS } from "./categoryGroups";
23+
import { getFacetedMinMaxValues } from "@databiosphere/findable-ui/lib/components/Table/featureOptions/facetedColumn/getFacetedMinMaxValues";
2224

2325
export const useTable = (
2426
enaQueryMethod: ENA_QUERY_METHOD,
@@ -50,7 +52,7 @@ export const useTable = (
5052

5153
const initialState = { sorting: SORTING };
5254

53-
const meta = { enaQueryMethod };
55+
const meta = { categoryGroups: CATEGORY_GROUPS, enaQueryMethod };
5456

5557
const state = { columnFilters: columnFiltersByMethod[enaQueryMethod] };
5658

@@ -64,6 +66,7 @@ export const useTable = (
6466
enableSorting: true,
6567
filterFns: { arrIncludesSome },
6668
getCoreRowModel: getCoreRowModel(),
69+
getFacetedMinMaxValues: getFacetedMinMaxValues(),
6770
getFacetedRowModel: getFacetedRowModel(),
6871
getFacetedUniqueValues: getFacetedUniqueValuesWithArrayValues(),
6972
getFilteredRowModel: getFilteredRowModel(),

app/components/Entity/components/ConfigureWorkflowInputs/components/Main/components/Stepper/components/Step/SequencingStep/components/ENASequencingData/hooks/UseENADataByAccession/constants.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ export const ENA_FIELDS = [
1313
"fastq_ftp",
1414
"fastq_md5",
1515
"fastq_aspera",
16-
"first_public",
16+
"first_created",
1717
"instrument_model",
1818
"instrument_platform",
1919
"library_layout",

app/components/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ export { FluidPaper } from "@databiosphere/findable-ui/lib/components/common/Pap
1515
export { SectionTitle } from "@databiosphere/findable-ui/lib/components/common/Section/components/SectionTitle/sectionTitle";
1616
export { Stack } from "@databiosphere/findable-ui/lib/components/common/Stack/stack";
1717
export { StaticImage } from "@databiosphere/findable-ui/lib/components/common/StaticImage/staticImage";
18+
export { ChipCell } from "@databiosphere/findable-ui/lib/components/Table/components/TableCell/components/ChipCell/chipCell";
1819
export {
1920
BackPageContentMainColumn,
2021
BackPageContentSideColumn,

0 commit comments

Comments
 (0)