import * as React from 'react'; import styles from './styles/styles.module.scss'; import _ from 'lodash'; import ReactSelect from 'react-select1'; import { observer } from 'mobx-react'; import { computed, action, makeObservable } from 'mobx'; import { FlexCol, FlexRow } from '../flexbox/FlexBox'; import { QueryStore, QueryStoreComponent, CUSTOM_CASE_LIST_ID, ALL_CASES_LIST_ID, } from './QueryStore'; import { getStudySummaryUrl } from '../../api/urls'; import { DefaultTooltip } from 'cbioportal-frontend-commons'; import SectionHeader from '../sectionHeader/SectionHeader'; import { getFilteredCustomCaseSets } from 'shared/components/query/CaseSetSelectorUtils'; import { ModifyQueryParams } from 'pages/resultsView/ResultsViewPageStore'; export type ReactSelectOption = { label: React.ReactChild; value: T }; export interface ReactSelectOptionWithName extends ReactSelectOption { textLabel: string; } export function filterCaseSetOptions( opt: ReactSelectOptionWithName, filter: string ) { return _.includes(opt.textLabel.toLowerCase(), filter.toLowerCase()); } @observer export default class CaseSetSelector extends QueryStoreComponent< { modifyQueryParams: ModifyQueryParams | undefined }, {} > { constructor(props: any) { super(props); makeObservable(this); } private isQueryModified = false; @computed get caseSetOptions(): ReactSelectOptionWithName[] { let ret = this.store.sampleLists.result.map(sampleList => { return { label: ( {sampleList.description} } > {`${sampleList.name} (${sampleList.sampleCount})`} ), value: sampleList.sampleListId, textLabel: sampleList.name, }; }); let filteredcustomCaseSets = getFilteredCustomCaseSets( this.store.isVirtualStudySelected, this.store.isMultipleNonVirtualStudiesSelected, this.store.profiledSamplesCount.result ); let customCaseSets = filteredcustomCaseSets.map(s => { return { value: s.value, label: ( {s.description} } > {s.name} ), textLabel: s.name, }; }); return ret.concat(customCaseSets); } render() { if (!this.isQueryModified && this.props.modifyQueryParams) { this.modifyQuery(); } if (!this.store.selectableSelectedStudyIds.length) return null; return (
To build your own case set,
try out our enhanced Study View. } promises={[ this.store.sampleLists, this.store.asyncCustomCaseSet, this.store.profiledSamplesCount, ]} > Select Patient/Case Set:
(this.store.selectedSampleListId = option ? option.value : undefined) } data-test="caseSetSelector" /> {!!( this.store.selectedSampleListId === CUSTOM_CASE_LIST_ID ) && (
Enter case IDs below: