Skip to content

Commit

Permalink
feat(variants): SKFP-1410 remove export tsv
Browse files Browse the repository at this point in the history
  • Loading branch information
GaelleA committed Dec 18, 2024
1 parent 0f6484f commit 18135bf
Show file tree
Hide file tree
Showing 5 changed files with 3 additions and 76 deletions.
3 changes: 0 additions & 3 deletions .env.schema
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,6 @@ REACT_APP_FT_DASHBOARD_BANNER=true
REACT_APP_FT_DASHBOARD_BANNER_TYPE=info
REACT_APP_FT_DASHBOARD_BANNER_MSG="A wonderful notification"

# FEATURE TOGGLE Variant
REACT_APP_FT_VARIANTS_EXPORT=true

# MOCK
REACT_MOCK_AUTORIZE_STUDIES=true
REACT_MOCK_LOGIN=true
Expand Down
6 changes: 0 additions & 6 deletions src/locales/en.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1238,12 +1238,6 @@ const en = {
variant: 'Variant',
variant_class: 'Variant class',
variant_id: 'Variant ID',
exportModal: {
title: 'Maximum number exceeded',
content:
'A maximum of 10,000 items can be exported at a time. Please narrow your selection and try again.',
button: 'Close',
},
},
summary: {
summary: 'Summary',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,3 @@
.partCell {
padding-left: 4px;
}

.okButtonConfirmModal {
display: none;
}
45 changes: 3 additions & 42 deletions src/views/Variants/components/PageContent/VariantsTable/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import { useEffect, useState } from 'react';
import intl from 'react-intl-universal';
import { useDispatch } from 'react-redux';
import { Link } from 'react-router-dom';
import { ExclamationCircleOutlined } from '@ant-design/icons';
import ConsequencesCell from '@ferlab/ui/core/components/Consequences/Cell';
import ExternalLink from '@ferlab/ui/core/components/ExternalLink';
import FixedSizeTable from '@ferlab/ui/core/components/FixedSizeTable';
Expand All @@ -22,7 +21,7 @@ import {
} from '@ferlab/ui/core/graphql/types';
import { numberWithCommas, toExponentialNotation } from '@ferlab/ui/core/utils/numberUtils';
import GridCard from '@ferlab/ui/core/view/v2/GridCard';
import { Modal, Space, Tooltip } from 'antd';
import { Space, Tooltip } from 'antd';
import { INDEXES } from 'graphql/constants';
import { hydrateResults } from 'graphql/models';
import {
Expand All @@ -34,16 +33,14 @@ import {
IVariantInternalFrequencies,
IVariantStudyEntity,
} from 'graphql/variants/models';
import { getFTEnvVarByKey } from 'helpers/EnvVariables';
import { capitalize, isEmpty } from 'lodash';
import { capitalize } from 'lodash';
import SetsManagementDropdown from 'views/DataExploration/components/SetsManagementDropdown';
import { DATA_EXPLORATION_QB_ID, DEFAULT_PAGE_INDEX } from 'views/DataExploration/utils/constant';

import { TABLE_EMPTY_PLACE_HOLDER } from 'common/constants';
import ExternalLinkIcon from 'components/Icons/ExternalLinkIcon';
import ManeCell from 'components/ManeCell';
import { SetType } from 'services/api/savedSet/models';
import { fetchTsvReport } from 'store/report/thunks';
import { useUser } from 'store/user';
import { updateUserConfig } from 'store/user/thunks';
import { formatQuerySortList, scrollToTop } from 'utils/helper';
Expand All @@ -53,12 +50,10 @@ import { getProTableDictionary } from 'utils/translation';

import { SCROLL_WRAPPER_ID, VARIANT_SAVED_SETS_FIELD } from '../../../utils/constants';

import { exportTsvColumns, GnomadCircle, renderClinvar, renderOmim } from './utils';
import { GnomadCircle, renderClinvar, renderOmim } from './utils';

import styles from './index.module.css';

const EXPORT_TSV_LIMIT = 10000;

interface OwnProps {
pageIndex: number;
sqon?: ISqonGroupFilter;
Expand Down Expand Up @@ -465,8 +460,6 @@ const VariantsTable = ({
const [selectedRows, setSelectedRows] = useState<IVariantEntity[]>([]);
const [selectedAllResults, setSelectedAllResults] = useState(false);

const variantsExport = getFTEnvVarByKey('VARIANTS_EXPORT');

const getCurrentSqon = (): any =>
selectedAllResults || !selectedKeys.length
? sqon
Expand Down Expand Up @@ -521,7 +514,6 @@ const VariantsTable = ({
total: results.total,
},
enableColumnSort: true,
enableTableExport: variantsExport === 'true' ? true : false,
onColumnSortChange: (newState) =>
dispatch(
updateUserConfig({
Expand All @@ -539,37 +531,6 @@ const VariantsTable = ({
setSelectedKeys(keys);
setSelectedRows(selectedRows);
},
onTableExportClick: () => {
if (
selectedRows.length > EXPORT_TSV_LIMIT ||
(isEmpty(selectedRows) &&
!selectedAllResults &&
results.total > EXPORT_TSV_LIMIT) ||
(selectedAllResults && results.total > EXPORT_TSV_LIMIT)
) {
Modal.confirm({
title: intl.get('screen.variants.table.exportModal.title'),
icon: <ExclamationCircleOutlined />,
content: intl.get('screen.variants.table.exportModal.content'),
cancelText: intl.get('screen.variants.table.exportModal.button'),
okButtonProps: { className: styles.okButtonConfirmModal },
cancelButtonProps: { type: 'primary' },
type: 'warn',
});
} else {
dispatch(
fetchTsvReport({
columnStates: exportTsvColumns,
columns: getDefaultColumns(
queryBuilderId,
results.data.length === 0 ? true : false,
),
index: INDEXES.VARIANTS,
sqon: getCurrentSqon(),
}),
);
}
},
extra: [
<SetsManagementDropdown
idField={VARIANT_SAVED_SETS_FIELD}
Expand Down
21 changes: 0 additions & 21 deletions src/views/Variants/components/PageContent/VariantsTable/utils.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import intl from 'react-intl-universal';
import { TABLE_EMPTY_PLACE_HOLDER } from '@ferlab/ui/core/common/constants';
import ExternalLink from '@ferlab/ui/core/components/ExternalLink';
import { TColumnStates } from '@ferlab/ui/core/components/ProTable/types';
import { IArrangerResultsTree } from '@ferlab/ui/core/graphql/types';
import StackLayout from '@ferlab/ui/core/layout/StackLayout';
import { Space, Tag, Tooltip } from 'antd';
Expand Down Expand Up @@ -119,23 +118,3 @@ export const GnomadCircle = ({ underOnePercent }: GnomadCircleProps) => (
)}
/>
);

export const exportTsvColumns: TColumnStates = [
{ index: 0, key: 'hgvsg', visible: true },
{ index: 1, key: 'variant_class', visible: true },
{ index: 2, key: 'rsnumber', visible: true },
{ index: 3, key: 'genes.symbol', visible: true },
{ index: 4, key: 'genes.consequences.consequence', visible: true },
{ index: 5, key: 'genes.consequences.aa_change', visible: true },
{ index: 6, key: 'genes.omim_gene_id', visible: true },
{ index: 7, key: 'genes.omim.inheritance', visible: true },
{ index: 8, key: 'clinvar.clin_sig', visible: true },
{ index: 9, key: 'external_frequencies.gnomad_genomes_3.af', visible: true },
{ index: 10, key: 'external_frequencies.gnomad_genomes_3.ac', visible: true },
{ index: 11, key: 'internal_frequencies.total.pc', visible: true },
{ index: 12, key: 'studies.study_code', visible: true },
{ index: 13, key: 'genes.consequences.predictions.cadd_phred', visible: true },
{ index: 14, key: 'genes.consequences.predictions.revel_score', visible: true },
{ index: 15, key: 'internal_frequencies.total.ac', visible: true },
{ index: 16, key: 'internal_frequencies.total.hom', visible: true },
];

0 comments on commit 18135bf

Please sign in to comment.