import * as React from 'react'; import { observer } from 'mobx-react'; import { ResultsViewPageStore } from '../ResultsViewPageStore'; import { CancerStudy } from 'cbioportal-ts-api-client'; import classNames from 'classnames'; import './styles.scss'; import { DefaultTooltip } from 'cbioportal-frontend-commons'; import LoadingIndicator from 'shared/components/loadingIndicator/LoadingIndicator'; import { action, computed, makeObservable } from 'mobx'; import QueryAndDownloadTabs from '../../../shared/components/query/QueryAndDownloadTabs'; import autobind from 'autobind-decorator'; import ExtendedRouterStore from '../../../shared/lib/ExtendedRouterStore'; import { ShareUI } from './ShareUI'; import { ServerConfigHelpers } from '../../../config/config'; import { getServerConfig } from 'config/config'; import { StudyLink } from '../../../shared/components/StudyLink/StudyLink'; import { getAlterationSummary, getGeneSummary, getPatientSampleSummary, submitToStudyViewPage, } from './QuerySummaryUtils'; import { MakeMobxView } from '../../../shared/components/MobxView'; import { getGAInstance } from '../../../shared/lib/tracking'; import { buildCBioPortalPageUrl } from '../../../shared/api/urls'; import { createQueryStore } from 'shared/lib/createQueryStore'; import _ from 'lodash'; import { mixedReferenceGenomeWarning } from 'shared/lib/referenceGenomeUtils'; import SettingsMenuButton from 'shared/components/driverAnnotations/SettingsMenuButton'; interface QuerySummaryProps { routingStore: ExtendedRouterStore; store: ResultsViewPageStore; onToggleQueryFormVisibility: (visible: boolean) => void; onToggleOQLEditUIVisibility: () => void; } @observer export default class QuerySummary extends React.Component< QuerySummaryProps, {} > { constructor(props: any) { super(props); makeObservable(this); } @action.bound private toggleQueryFormVisibility() { this.props.onToggleQueryFormVisibility( this.props.store.queryFormVisible ); // if clicked the query button in the download tab and want to close the query form, clear the selected sample ids if ( this.props.store.modifyQueryParams && this.props.store.queryFormVisible === true ) { this.props.store.modifyQueryParams = undefined; } this.props.store.queryFormVisible = !this.props.store.queryFormVisible; } @computed get queryFormVisible() { return this.props.store.queryFormVisible || this.isQueryOrGeneInvalid; } @computed get studyPageFilteredCasesLink() { return ( { submitToStudyViewPage( this.props.store.queriedStudies.result, this.props.store.filteredSamples.result!, this.props.store.filteredSamples.result!.length < this.props.store.samples.result!.length, this.props.store.queriedVirtualStudies.result.length > 0, this.props.store.sampleLists.result ); }} > {getPatientSampleSummary( this.props.store.filteredSamples.result!, this.props.store.filteredPatients.result! )} ); } readonly singleStudyUI = MakeMobxView({ await: () => [ this.props.store.queriedStudies, this.props.store.sampleLists, this.props.store.filteredSamples, this.props.store.filteredPatients, ], render: () => { const sampleListName = this.props.store.sampleLists.result!.length > 0 ? ( {this.props.store.sampleLists.result![0].name} ) : ( User-defined Patient List ); return (