From 506e052fe3d7895e1ca827e9baf2fdceb5095372 Mon Sep 17 00:00:00 2001 From: mario Date: Thu, 10 Jul 2025 14:29:16 +0700 Subject: [PATCH] no expertise btn on only ecg file --- platform/app/public/config/default.js | 10 +- .../src/components/StudyItem/StudyItem.tsx | 110 +++++++++++++++--- 2 files changed, 99 insertions(+), 21 deletions(-) diff --git a/platform/app/public/config/default.js b/platform/app/public/config/default.js index 672445c..b4d0ebb 100644 --- a/platform/app/public/config/default.js +++ b/platform/app/public/config/default.js @@ -23,9 +23,9 @@ window.config = { // above, the number of requests can be go a lot higher. prefetch: 25, }, - expertise_host: `http://10.9.10.86`, // IP ke NV di PACS Server, untuk fetch expertise bawaan versi NV - pacs_document_host: `10.9.10.86`, // IP ke NV di PACS Server untuk ambil pdf - pacs_document_port: 8080, + expertise_host: `http://152.42.173.210`, // IP ke NV di PACS Server, untuk fetch expertise bawaan versi NV + pacs_document_host: `152.42.173.210`, // IP ke NV di PACS Server untuk ambil pdf + pacs_document_port: 8585, defaultDataSourceName: 'local-proxy', dataSources: [ { @@ -34,8 +34,8 @@ window.config = { configuration: { friendlyName: 'Static WADO Local Data', name: 'DCM4CHEE', - qidoRoot: `http://10.9.10.86:5000/rs`, // IP ke dicomweb-proxy PACS Server. URI selalu /rs - wadoRoot: `http://10.9.10.86:5000/rs`, // IP ke dicomweb-proxy PACS Server. URI selalu /rs + qidoRoot: `http://152.42.173.210:5000/rs`, // IP ke dicomweb-proxy PACS Server. URI selalu /rs + wadoRoot: `http://152.42.173.210:5000/rs`, // IP ke dicomweb-proxy PACS Server. URI selalu /rs qidoSupportsIncludeField: false, supportsReject: true, supportsStow: true, diff --git a/platform/ui-next/src/components/StudyItem/StudyItem.tsx b/platform/ui-next/src/components/StudyItem/StudyItem.tsx index 9a6bb9d..7a6c163 100644 --- a/platform/ui-next/src/components/StudyItem/StudyItem.tsx +++ b/platform/ui-next/src/components/StudyItem/StudyItem.tsx @@ -1,4 +1,4 @@ -import React from 'react'; +import React, { useMemo, useEffect, useRef } from 'react'; import PropTypes from 'prop-types'; import classnames from 'classnames'; import { ThumbnailList } from '../ThumbnailList'; @@ -23,7 +23,85 @@ const StudyItem = ({ servicesManager, // Tambah servicesManager as a prop studyInstanceUid = '', }: withAppTypes) => { - // FETCHING ACCESSION NUMBER DAN EXPERTISE + const prevShowExpertiseRef = useRef(false); + + /* + * V1: If the display sets only contain ECG or PDFs, don't show expertise button + * Tips: use .every + */ + const shouldShowExpertiseButton = useMemo(() => { + // If no display sets, don't show expertise by default + if (!displaySets?.length) { + return false; + } + + // Check if all display sets are ECG or PDF + const allECGOrPDF = displaySets.every( + ds => ds.modality === 'ECG' || (ds.modality === 'OT' && ds.description === 'PDF') + ); + + // If all display sets are ECG or PDF, don't show expertise button + return !allECGOrPDF; + }, [displaySets]); + + /* + * V2: Show expertise button only if: + * - There are display sets and active display set + * - The active display set is not ECG or PDF + * - If the active display is ECG, don't show expertise button and close the panel reset expertise panel + * + * This logic ensures that the expertise button is shown only when appropriate. + TODO: Need to fix this logic + */ + // const shouldShowExpertiseButton = useMemo(() => { + // // If no display sets or no active display set, didnt show expertise by default + // if (!displaySets?.length || !activeDisplaySetInstanceUIDs?.length) { + // return false; + // } + + // // Get the active display set UID (first item in the array) + // const activeUID = activeDisplaySetInstanceUIDs[0]; + + // // Find the active display set + // const activeDisplaySet = displaySets.find(ds => ds.displaySetInstanceUID === activeUID); + + // // If active display set not found, show expertise button + // if (!activeDisplaySet) { + // return false; + // } + + // // Hide expertise button for ECG + // if (activeDisplaySet.modality === 'ECG') { + // return false; + // } + + // // Hide expertise button for PDFs + // if (activeDisplaySet.modality === 'OT' && activeDisplaySet.description === 'PDF') { + // return false; + // } + + // // Default to showing expertise + // return true; + // }, [displaySets, activeDisplaySetInstanceUIDs]); + + // console.log('Display sets:', displaySets); + // console.log('Prev show expertise:', prevShowExpertiseRef.current); + // console.log('Current show expertise button:', shouldShowExpertiseButton); + + // // TODO: Fix this logic + // // Kalau ganti dari Series yang ada Expertise ke Series yang tidak ada Expertise, deactivate panel (jarang terjadi) (masih bug) + // useEffect(() => { + // // If changing from true to false + // if (prevShowExpertiseRef.current === true && shouldShowExpertiseButton === false) { + // servicesManager.services.panelService.activatePanel( + // `@ohif/extension-cornerstone.panelModule.panelSegmentation-exp-${studyInstanceUid}`, + // true + // ); + // } + + // // Update ref with current value for next comparison + // prevShowExpertiseRef.current = shouldShowExpertiseButton; + // }, [shouldShowExpertiseButton, servicesManager, studyInstanceUid]); return ( {isExpanded && displaySets && ( <> - {/* Expertise Button */} -
{ - // Trigger the expertise panel in the right side panel (segmentation Panel) - servicesManager.services.panelService.activatePanel( - // '@ohif/extension-cornerstone.panelModule.panelSegmentation-exp', - `@ohif/extension-cornerstone.panelModule.panelSegmentation-exp-${studyInstanceUid}`, - true - ); - }} - > - Expertise -
+ {/* Expertise Button - Only show if not ECG */} + {shouldShowExpertiseButton && ( +
{ + servicesManager.services.panelService.activatePanel( + `@ohif/extension-cornerstone.panelModule.panelSegmentation-exp-${studyInstanceUid}`, + true + ); + }} + > + Expertise +
+ )} {/* Thumbnails */}