diff --git a/src/pages/studyView/resources/FilesAndLinks.tsx b/src/pages/studyView/resources/FilesAndLinks.tsx index 0a7b2e52858..ec4a728d121 100644 --- a/src/pages/studyView/resources/FilesAndLinks.tsx +++ b/src/pages/studyView/resources/FilesAndLinks.tsx @@ -10,6 +10,7 @@ import { Else, If, Then } from 'react-if'; import { WindowWidthBox } from '../../../shared/components/WindowWidthBox/WindowWidthBox'; import LoadingIndicator from 'shared/components/loadingIndicator/LoadingIndicator'; import { + getResourceViewUrlWithPathname, getSampleViewUrlWithPathname, getPatientViewUrlWithPathname, } from 'shared/api/urls'; @@ -86,6 +87,7 @@ function buildItemsAndResources(resourceData: { typeOfResource: resource?.resourceDefinition?.displayName, description: resource?.resourceDefinition?.description, url: resource?.url, + resourceId: resource?.resourceId, })) ) .value(); @@ -259,18 +261,41 @@ export class FilesAndLinks extends React.Component { 'Type Of Resource' ), render: (data: { [id: string]: string }) => { + const path = `patient/openResource_${data.resourceId}`; return (
- + + {data.typeOfResource} + +
+ ); + }, + }, + + { + ...this.getDefaultColumnConfig('resourceUrl', ''), + render: (data: { [id: string]: string }) => { + return ( +
+ - {data.typeOfResource} + Open in new window
); @@ -287,7 +312,7 @@ export class FilesAndLinks extends React.Component { { ...this.getDefaultColumnConfig( 'resourcesPerPatient', - 'Number of Resource Per Patient', + 'Resources per Patient', true ), render: (data: { [id: string]: number }) => { diff --git a/src/shared/api/urls.ts b/src/shared/api/urls.ts index 771af857233..5ade1d701c6 100644 --- a/src/shared/api/urls.ts +++ b/src/shared/api/urls.ts @@ -139,6 +139,15 @@ export function getSampleViewUrlWithPathname( return buildCBioPortalPageUrl(pathname, { sampleId, studyId }, hash); } +export function getResourceViewUrlWithPathname( + studyId: string, + pathname: string, + patientId: string +) { + let caseId: string = `${patientId}`; + return buildCBioPortalPageUrl(pathname, { studyId, caseId }); +} + export function getPatientViewUrl( studyId: string, caseId: string, diff --git a/src/shared/components/resources/ResourceTab.tsx b/src/shared/components/resources/ResourceTab.tsx index 2e75e311c83..cef8680d1c4 100644 --- a/src/shared/components/resources/ResourceTab.tsx +++ b/src/shared/components/resources/ResourceTab.tsx @@ -115,14 +115,22 @@ export default class ResourceTab extends React.Component< return (
- +
+ +

+ {this.currentResourceDatum.sampleId + ? this.currentResourceDatum.sampleId + : this.currentResourceDatum.patientId} +

+
boolean; openResource: (resource: ResourceData) => void; + sampleId?: React.ReactNode; } function icon(resource: ResourceData) { @@ -45,7 +46,7 @@ function icon(resource: ResourceData) { } const ResourceTable = observer( - ({ resources, isTabOpen, openResource }: IResourceTableProps) => { + ({ resources, isTabOpen, openResource, sampleId }: IResourceTableProps) => { const resourceTable = useLocalObservable(() => ({ get data() { return _.sortBy(resources, r => r.resourceDefinition.priority); @@ -56,6 +57,7 @@ const ResourceTable = observer( + {sampleId && } @@ -64,6 +66,7 @@ const ResourceTable = observer( {resourceTable.data.map(resource => ( + {sampleId && }
Sample IDResource Description
{sampleId} openResource(resource)}> {icon(resource)} diff --git a/src/shared/components/resources/SampleResourcesTable.tsx b/src/shared/components/resources/SampleResourcesTable.tsx index 80605db9787..d43eb6a3e92 100644 --- a/src/shared/components/resources/SampleResourcesTable.tsx +++ b/src/shared/components/resources/SampleResourcesTable.tsx @@ -38,18 +38,21 @@ export default class SampleResourcesTable extends React.Component< return ( <> {this.data.map((datum, index) => { + const sampleId = ( +

+ {datum.sample.sampleId}{' '} + {this.props.sampleManager.getComponentForSample( + datum.sample.sampleId + )} +

+ ); return ( <> -
- Sample {datum.sample.sampleId}{' '} - {this.props.sampleManager.getComponentForSample( - datum.sample.sampleId - )} -
{index < this.data.length - 1 && (