diff --git a/src/pages/patientView/PatientViewPage.tsx b/src/pages/patientView/PatientViewPage.tsx index fa027c4a2e3..107b17a0ee9 100644 --- a/src/pages/patientView/PatientViewPage.tsx +++ b/src/pages/patientView/PatientViewPage.tsx @@ -28,7 +28,7 @@ import { } from '../../shared/api/urls'; import { PageLayout } from '../../shared/components/PageLayout/PageLayout'; import Helmet from 'react-helmet'; -import { getServerConfig } from '../../config/config'; +import { getServerConfig, ServerConfigHelpers } from '../../config/config'; import autobind from 'autobind-decorator'; import { showCustomTab } from '../../shared/lib/customTabs'; import { StudyLink } from '../../shared/components/StudyLink/StudyLink'; @@ -64,6 +64,9 @@ import setWindowVariable from 'shared/lib/setWindowVariable'; import { getNavCaseIdsCache } from 'shared/lib/handleLongUrls'; import PatientViewPageHeader from 'pages/patientView/PatientViewPageHeader'; import { MAX_URL_LENGTH } from 'pages/studyView/studyPageHeader/ActionButtons'; +import { StudyViewPageStore } from 'pages/studyView/StudyViewPageStore'; +import { StudyView } from 'config/IAppConfig'; +import StudyViewURLWrapper from 'pages/studyView/StudyViewURLWrapper'; export interface IPatientViewPageProps { routing: any; @@ -149,10 +152,12 @@ export class PatientViewPageInner extends React.Component< // use this wrapper rather than interacting with the url directly @observable public urlWrapper: PatientViewUrlWrapper; + public studyViewUrlWrapper: StudyViewURLWrapper; public patientViewMutationDataStore: PatientViewMutationsDataStore; public patientViewCnaDataStore: PatientViewCnaDataStore; public patientViewPageStore: PatientViewPageStore; + public studyViewPageStore: StudyViewPageStore; constructor(props: IPatientViewPageProps) { super(props); @@ -161,6 +166,9 @@ export class PatientViewPageInner extends React.Component< this.urlWrapper = new PatientViewUrlWrapper(props.routing); setWindowVariable('urlWrapper', this.urlWrapper); + this.studyViewUrlWrapper = new StudyViewURLWrapper(props.routing); + setWindowVariable('urlWrapper', this.urlWrapper); + this.patientViewPageStore = new PatientViewPageStore( this.props.appStore, this.urlWrapper.query.studyId!, @@ -169,6 +177,13 @@ export class PatientViewPageInner extends React.Component< props.cohortIds ); + this.studyViewPageStore = new StudyViewPageStore( + this.props.appStore, + ServerConfigHelpers.sessionServiceIsEnabled(), + this.studyViewUrlWrapper + ); + setWindowVariable('studyViewPageStore', this.studyViewPageStore); + // views don't fire the getData callback (first arg) until it's known that // mutation data is loaded // this is not a good pattern. awaits should be explicit diff --git a/src/pages/patientView/PatientViewPageTabs.tsx b/src/pages/patientView/PatientViewPageTabs.tsx index 86c84489da1..4f81064a674 100644 --- a/src/pages/patientView/PatientViewPageTabs.tsx +++ b/src/pages/patientView/PatientViewPageTabs.tsx @@ -55,6 +55,7 @@ export enum PatientViewPageTabs { Mtb = 'mtb', FollowUp = 'followUp', ClinicalTrialsGov = 'clinicaltrialsGov', + Similarity = 'similarity', } export const PatientViewResourceTabPrefix = 'openResource_'; @@ -876,6 +877,25 @@ export function tabs( ); + pageComponent.studyViewPageStore.getDataForClinicalDataTab.isComplete && + tabs.push( + +
+ { + pageComponent.studyViewPageStore + .getDataForClinicalDataTab.result.length + } + {pageComponent.studyViewPageStore.studyIds.length} + {pageComponent.studyViewPageStore.selectedPatients.length} +
+
+ ); + pageComponent.resourceTabs.component && /* @ts-ignore */ tabs.push(...pageComponent.resourceTabs.component);