Skip to content

Commit 819d64d

Browse files
authored
Update gi table (oncokb#1277)
1 parent 70739af commit 819d64d

File tree

2 files changed

+20
-4
lines changed

2 files changed

+20
-4
lines changed

src/main/webapp/app/pages/genePage/GenomicIndicatorTable.tsx

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,15 +13,21 @@ import {
1313
import { LongText } from 'app/oncokb-frontend-commons/src/components/LongText';
1414
import { Evidence } from 'app/shared/api/generated/OncoKbAPI';
1515
import AlleleStateTag from 'app/components/tag/AlleleStateTag';
16+
import { genomicIndicatorNameSortMethod } from 'app/shared/utils/ReactTableUtils';
1617

1718
export const GenomicIndicatorTable: React.FunctionComponent<{
1819
data: Evidence[];
1920
isPending: boolean;
2021
}> = props => {
22+
const sortedData = [...props.data].sort((a, b) =>
23+
genomicIndicatorNameSortMethod(a.name, b.name)
24+
);
25+
2126
const columns: SearchColumn<Evidence>[] = [
2227
{
2328
Header: <span>Genomic Indicator</span>,
2429
maxWidth: 200,
30+
accessor: 'name',
2531
Cell(row: { original: Evidence }) {
2632
const alleleState = getAlleleStatesFromEvidence(row.original);
2733
return (
@@ -55,14 +61,11 @@ export const GenomicIndicatorTable: React.FunctionComponent<{
5561
{
5662
Header: <span>Description</span>,
5763
accessor: 'description',
58-
Cell(row: { original: Evidence }) {
59-
return <LongText text={row.original.description} cutoff={180} />;
60-
},
6164
},
6265
];
6366
return (
6467
<OncoKBTable
65-
data={props.data}
68+
data={sortedData}
6669
columns={columns}
6770
loading={props.isPending}
6871
showPagination={false}

src/main/webapp/app/shared/utils/ReactTableUtils.ts

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,19 @@ export function sortByAlteration(a: Alteration, b: Alteration): number {
108108
return result;
109109
}
110110

111+
export function genomicIndicatorNameSortMethod(a: string, b: string) {
112+
const nameA = (a ?? '').toLowerCase().includes('carrier');
113+
const nameB = (b ?? '').toLowerCase().includes('carrier');
114+
115+
if (nameA && !nameB) {
116+
return 1;
117+
}
118+
if (!nameA && nameB) {
119+
return -1;
120+
}
121+
return defaultSortMethod(a, b);
122+
}
123+
111124
const oncogenicityOrder = [
112125
ONCOGENICITY.ONCOGENIC,
113126
ONCOGENICITY.LIKELY_ONCOGENIC,

0 commit comments

Comments
 (0)