From 5300874b8074370f5160ea59e2eb77f0f444faf3 Mon Sep 17 00:00:00 2001 From: Tom Butcher Date: Fri, 5 Sep 2025 23:17:20 +0100 Subject: [PATCH] Enhance ObjectTable component to support Electron context; adjust scroll height based on Electron environment and improve action button handling with dynamic disabled state. --- .../Dashboard/common/ObjectTable.jsx | 74 ++++++++++++------- 1 file changed, 49 insertions(+), 25 deletions(-) diff --git a/src/components/Dashboard/common/ObjectTable.jsx b/src/components/Dashboard/common/ObjectTable.jsx index 664712c..5934ce5 100644 --- a/src/components/Dashboard/common/ObjectTable.jsx +++ b/src/components/Dashboard/common/ObjectTable.jsx @@ -39,7 +39,8 @@ import CheckIcon from '../../Icons/CheckIcon' import { useNavigate } from 'react-router-dom' import QuestionCircleIcon from '../../Icons/QuestionCircleIcon' import { AuthContext } from '../context/AuthContext' -import unionBy from 'lodash/unionBy' +import { ElectronContext } from '../context/ElectronContext' + const logger = loglevel.getLogger('DasboardTable') logger.setLevel(config.logLevel) @@ -58,6 +59,7 @@ const ObjectTable = forwardRef( ref ) => { const { token } = useContext(AuthContext) + const { isElectron } = useContext(ElectronContext) const { fetchObjects, connected, @@ -73,6 +75,15 @@ const ObjectTable = forwardRef( if (cards) { adjustedScrollHeight = 'calc(var(--unit-100vh) - 280px)' } + if (isElectron) { + adjustedScrollHeight = 'calc(var(--unit-100vh) - 244px)' + } + if (isMobile && isElectron) { + adjustedScrollHeight = 'calc(var(--unit-100vh) - 282px)' + } + if (cards && isElectron) { + adjustedScrollHeight = 'calc(var(--unit-100vh) - 260px)' + } const [, contextHolder] = message.useMessage() const tableRef = useRef(null) const model = getModelByName(type) @@ -108,26 +119,37 @@ const ObjectTable = forwardRef( const renderActions = (objectData) => { return ( - {rowActions.map((action, index) => ( - -