Skip to content

Commit

Permalink
init studyviewpagestore in patientview
Browse files Browse the repository at this point in the history
  • Loading branch information
BoehmDo committed Jul 14, 2024
1 parent cb06505 commit a08874f
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 1 deletion.
17 changes: 16 additions & 1 deletion src/pages/patientView/PatientViewPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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);
Expand All @@ -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!,
Expand All @@ -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
Expand Down
20 changes: 20 additions & 0 deletions src/pages/patientView/PatientViewPageTabs.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ export enum PatientViewPageTabs {
Mtb = 'mtb',
FollowUp = 'followUp',
ClinicalTrialsGov = 'clinicaltrialsGov',
Similarity = 'similarity',
}

export const PatientViewResourceTabPrefix = 'openResource_';
Expand Down Expand Up @@ -876,6 +877,25 @@ export function tabs(
</MSKTab>
);

pageComponent.studyViewPageStore.getDataForClinicalDataTab.isComplete &&
tabs.push(
<MSKTab
key={44}
id={PatientViewPageTabs.Similarity}
linkText={'Similarity'}
unmountOnHide={false}
>
<div>
{
pageComponent.studyViewPageStore
.getDataForClinicalDataTab.result.length
}
{pageComponent.studyViewPageStore.studyIds.length}
{pageComponent.studyViewPageStore.selectedPatients.length}
</div>
</MSKTab>
);

pageComponent.resourceTabs.component &&
/* @ts-ignore */
tabs.push(...pageComponent.resourceTabs.component);
Expand Down

0 comments on commit a08874f

Please sign in to comment.