Skip to content
This repository has been archived by the owner on Jul 9, 2024. It is now read-only.

Commit

Permalink
[PRTL-2281] Hide Survival selectable columns from arrange column butt…
Browse files Browse the repository at this point in the history
…on (#2446)

Hide Survival selectable columns from arrangecolumn button in case entity page and gene entity page
  • Loading branch information
yuanhengzhao authored Jan 17, 2019
1 parent 392a6cd commit d37955f
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 6 deletions.
17 changes: 14 additions & 3 deletions src/packages/@ncigdc/components/ArrangeColumns.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ interface IArrangeColumnsProps {
state: IState;
searchTerm: string;
entityType: string;
hideColumns?: string[];
}
const ArrangeColumns = compose<IArrangeColumnsProps, JSX.Element>(
connect(
Expand All @@ -52,11 +53,19 @@ const ArrangeColumns = compose<IArrangeColumnsProps, JSX.Element>(
};
[x: string]: any;
},
props: { entityType: string; searchTerm: string; [x: string]: any }
props: {
entityType: string;
searchTerm: string;
[x: string]: any;
hideColumns: string[];
}
) => ({
localTableColumns: state.tableColumns[props.entityType],
localTableColumns: state.tableColumns[props.entityType].filter(
(t: IColumnProps<boolean>) => !(props.hideColumns || []).includes(t.id)
),
filteredTableColumns: state.tableColumns[props.entityType].filter(
(t: IColumnProps<boolean>) => !t.subHeading
(t: IColumnProps<boolean>) =>
!(props.hideColumns || []).includes(t.id) && !t.subHeading
),
})
),
Expand Down Expand Up @@ -84,10 +93,12 @@ const ArrangeColumns = compose<IArrangeColumnsProps, JSX.Element>(
state,
searchTerm,
entityType,
hideColumns,
}) => {
const subHeadings =
localTableColumns.filter((t: IColumnProps<boolean>) => t.subHeading) ||
[];

return (
<div className="test-arrange-columns">
{filteredTableColumns.map(
Expand Down
11 changes: 8 additions & 3 deletions src/packages/@ncigdc/components/ArrangeColumnsButton.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ const RestoreDefaults = styled(Row, {

const ArrangeColumnsButton = compose(
connect(),
withState('searchTerm', 'setSearchTerm', ''),
withState('searchTerm', 'setSearchTerm', '')
)(
class extends React.Component {
searchInput;
Expand All @@ -43,6 +43,7 @@ const ArrangeColumnsButton = compose(
dispatch,
entityType,
style = {},
hideColumns,
} = this.props;
return (
<Dropdown
Expand Down Expand Up @@ -86,12 +87,16 @@ const ArrangeColumnsButton = compose(
>
Restore Defaults
</RestoreDefaults>
<ArrangeColumns entityType={entityType} searchTerm={searchTerm} />
<ArrangeColumns
entityType={entityType}
searchTerm={searchTerm}
hideColumns={hideColumns}
/>
</Column>
</Dropdown>
);
}
},
}
);

export default ArrangeColumnsButton;
3 changes: 3 additions & 0 deletions src/packages/@ncigdc/components/TableActions.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ interface IProps {
AppendSetButton?: React.ComponentClass;
downloadClinical?: boolean;
downloadBiospecimen?: boolean;
hideColumns?: string[];
}

const TableActions: React.SFC<IProps> = ({
Expand Down Expand Up @@ -110,6 +111,7 @@ const TableActions: React.SFC<IProps> = ({
downloadBiospecimen,
theme,
totalCases,
hideColumns,
}: IProps) => {
const fieldContains = ({
filters,
Expand All @@ -128,6 +130,7 @@ const TableActions: React.SFC<IProps> = ({
<ArrangeColumnsButton
entityType={arrangeColumnKey}
style={visualizingButton}
hideColumns={hideColumns}
/>
)}
{sortOptions && (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,7 @@ export default compose(
RemoveFromSetButton={RemoveFromExploreSsmSetButton}
idField="ssms.ssm_id"
selectedIds={selectedIds}
hideColumns={hideSurvival ? ['survival_plot'] : []}
/>
</Row>
</Row>
Expand Down

0 comments on commit d37955f

Please sign in to comment.