From cdf777e8c5474a10ca357bea1667397dd752fb08 Mon Sep 17 00:00:00 2001 From: Tatiana Date: Tue, 10 Sep 2024 22:13:09 -0700 Subject: [PATCH 1/2] Enhancement: Files & Links tab on patient view --- .../components/resources/ResourceTab.tsx | 24 ++++++++++++------- .../components/resources/ResourceTable.tsx | 5 +++- .../resources/SampleResourcesTable.tsx | 15 +++++++----- 3 files changed, 29 insertions(+), 15 deletions(-) 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 && (
From d598a773867f697611bada64e64d90569b13afd4 Mon Sep 17 00:00:00 2001 From: Tatiana Date: Wed, 11 Sep 2024 14:44:17 -0700 Subject: [PATCH 2/2] add view option for Files & Links tab --- .../studyView/resources/FilesAndLinks.tsx | 33 ++++++++++++++++--- src/shared/api/urls.ts | 9 +++++ 2 files changed, 38 insertions(+), 4 deletions(-) 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 (
+ ); + }, + }, + + { + ...this.getDefaultColumnConfig('resourceUrl', ''), + render: (data: { [id: string]: string }) => { + return ( + ); @@ -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,