Enhance layout and styling across various components
- Added min-height: 0 to Flex components in multiple files to improve layout consistency. - Updated App.css with new styles for .farmcontrol-splitter and .objectTableCards to enhance visual structure and overflow handling. - Refactored ObjectTable component to utilize ScrollBox for better scrolling behavior and layout management.
This commit is contained in:
parent
95e02dcd63
commit
c6ad465ad6
@ -640,6 +640,7 @@ body {
|
||||
|
||||
.h-100 {
|
||||
height: 100%;
|
||||
min-height: 0;
|
||||
}
|
||||
|
||||
.ant-table.ant-table-middle .ant-table-filter-trigger {
|
||||
@ -804,6 +805,14 @@ span.ant-skeleton-input.ant-skeleton-input-sm.text-skeleton {
|
||||
margin-left: 4px;
|
||||
}
|
||||
|
||||
.farmcontrol-splitter .ant-splitter-panel {
|
||||
overflow: visible;
|
||||
}
|
||||
|
||||
.farmcontrol-splitter.ant-splitter-horizontal .ant-splitter-panel {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.farmcontrol-splitter
|
||||
.ant-splitter-panel:has(~ .ant-splitter-panel)
|
||||
.info-collapse.ant-collapse.ant-collapse-icon-position-end
|
||||
@ -812,3 +821,22 @@ span.ant-skeleton-input.ant-skeleton-input-sm.text-skeleton {
|
||||
.ant-collapse-expand-icon {
|
||||
padding-inline-end: 2px;
|
||||
}
|
||||
|
||||
.objectTableCards {
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.objectTableCardsContainer {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
.objectTableCardsContainer .ant-spin-nested-loading {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
.objectTableCardsContainer .ant-spin-container {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
@ -50,7 +50,7 @@ const Invoices = () => {
|
||||
return (
|
||||
<>
|
||||
<Flex vertical={'true'} gap='large' className='h-100'>
|
||||
<Flex justify={'space-between'}>
|
||||
<Flex justify={'space-between'} style={{ minHeight: 0 }}>
|
||||
<Space size='small'>
|
||||
<Dropdown menu={actionItems}>
|
||||
<Button>Actions</Button>
|
||||
|
||||
@ -50,7 +50,7 @@ const Payments = () => {
|
||||
return (
|
||||
<>
|
||||
<Flex vertical={'true'} gap='large' className='h-100'>
|
||||
<Flex justify={'space-between'}>
|
||||
<Flex justify={'space-between'} style={{ minHeight: 0 }}>
|
||||
<Space size='small'>
|
||||
<Dropdown menu={actionItems}>
|
||||
<Button>Actions</Button>
|
||||
|
||||
@ -50,7 +50,7 @@ const TaxRecords = () => {
|
||||
return (
|
||||
<>
|
||||
<Flex vertical={'true'} gap='large' className='h-100'>
|
||||
<Flex justify={'space-between'}>
|
||||
<Flex justify={'space-between'} style={{ minHeight: 0 }}>
|
||||
<Space size='small'>
|
||||
<Dropdown menu={actionItems}>
|
||||
<Button>Actions</Button>
|
||||
|
||||
@ -55,7 +55,7 @@ const FilamentStocks = () => {
|
||||
return (
|
||||
<>
|
||||
<Flex vertical={'true'} gap='large' className='h-100'>
|
||||
<Flex justify={'space-between'}>
|
||||
<Flex justify={'space-between'} style={{ minHeight: 0 }}>
|
||||
<Space size='small'>
|
||||
<Dropdown menu={actionItems}>
|
||||
<Button>Actions</Button>
|
||||
|
||||
@ -50,7 +50,7 @@ const OrderItems = () => {
|
||||
return (
|
||||
<>
|
||||
<Flex vertical={'true'} gap='large' className='h-100'>
|
||||
<Flex justify={'space-between'}>
|
||||
<Flex justify={'space-between'} style={{ minHeight: 0 }}>
|
||||
<Space size='small'>
|
||||
<Dropdown menu={actionItems}>
|
||||
<Button>Actions</Button>
|
||||
|
||||
@ -55,7 +55,7 @@ const PartStocks = () => {
|
||||
return (
|
||||
<>
|
||||
<Flex vertical={'true'} gap='large' className='h-100'>
|
||||
<Flex justify={'space-between'}>
|
||||
<Flex justify={'space-between'} style={{ minHeight: 0 }}>
|
||||
<Space size='small'>
|
||||
<Dropdown menu={actionItems}>
|
||||
<Button>Actions</Button>
|
||||
|
||||
@ -56,7 +56,7 @@ const ProductStocks = () => {
|
||||
return (
|
||||
<>
|
||||
<Flex vertical={'true'} gap='large' className='h-100'>
|
||||
<Flex justify={'space-between'}>
|
||||
<Flex justify={'space-between'} style={{ minHeight: 0 }}>
|
||||
<Space size='small'>
|
||||
<Dropdown menu={actionItems}>
|
||||
<Button>Actions</Button>
|
||||
|
||||
@ -50,7 +50,7 @@ const PurchaseOrders = () => {
|
||||
return (
|
||||
<>
|
||||
<Flex vertical={'true'} gap='large' className='h-100'>
|
||||
<Flex justify={'space-between'}>
|
||||
<Flex justify={'space-between'} style={{ minHeight: 0 }}>
|
||||
<Space size='small'>
|
||||
<Dropdown menu={actionItems}>
|
||||
<Button>Actions</Button>
|
||||
|
||||
@ -50,7 +50,7 @@ const Shipments = () => {
|
||||
return (
|
||||
<>
|
||||
<Flex vertical={'true'} gap='large' className='h-100'>
|
||||
<Flex justify={'space-between'}>
|
||||
<Flex justify={'space-between'} style={{ minHeight: 0 }}>
|
||||
<Space size='small'>
|
||||
<Dropdown menu={actionItems}>
|
||||
<Button>Actions</Button>
|
||||
|
||||
@ -55,7 +55,7 @@ const StockAudits = () => {
|
||||
return (
|
||||
<>
|
||||
<Flex vertical={'true'} gap='large' className='h-100'>
|
||||
<Flex justify={'space-between'}>
|
||||
<Flex justify={'space-between'} style={{ minHeight: 0 }}>
|
||||
<Space size='small'>
|
||||
<Dropdown menu={actionItems}>
|
||||
<Button>Actions</Button>
|
||||
|
||||
@ -38,7 +38,7 @@ const StockEvents = () => {
|
||||
return (
|
||||
<>
|
||||
<Flex vertical={'true'} gap='large' className='h-100'>
|
||||
<Flex justify={'space-between'}>
|
||||
<Flex justify={'space-between'} style={{ minHeight: 0 }}>
|
||||
<Space size='small'>
|
||||
<Dropdown menu={actionItems}>
|
||||
<Button>Actions</Button>
|
||||
|
||||
@ -53,7 +53,7 @@ const StockLocations = () => {
|
||||
return (
|
||||
<>
|
||||
<Flex vertical={'true'} gap='large' className='h-100'>
|
||||
<Flex justify={'space-between'}>
|
||||
<Flex justify={'space-between'} style={{ minHeight: 0 }}>
|
||||
<Space size='small'>
|
||||
<Dropdown menu={actionItems}>
|
||||
<Button>Actions</Button>
|
||||
|
||||
@ -53,7 +53,7 @@ const StockTransfers = () => {
|
||||
return (
|
||||
<>
|
||||
<Flex vertical={'true'} gap='large' className='h-100'>
|
||||
<Flex justify={'space-between'}>
|
||||
<Flex justify={'space-between'} style={{ minHeight: 0 }}>
|
||||
<Space size='small'>
|
||||
<Dropdown menu={actionItems}>
|
||||
<Button>Actions</Button>
|
||||
|
||||
@ -49,7 +49,7 @@ const AppPasswords = () => {
|
||||
return (
|
||||
<>
|
||||
<Flex vertical={'true'} gap='large' className='h-100'>
|
||||
<Flex justify={'space-between'}>
|
||||
<Flex justify={'space-between'} style={{ minHeight: 0 }}>
|
||||
<Space>
|
||||
<Dropdown menu={actionItems}>
|
||||
<Button>Actions</Button>
|
||||
|
||||
@ -36,7 +36,7 @@ const AuditLogs = () => {
|
||||
return (
|
||||
<>
|
||||
<Flex vertical={'true'} gap='large' className='h-100'>
|
||||
<Flex justify={'space-between'}>
|
||||
<Flex justify={'space-between'} style={{ minHeight: 0 }}>
|
||||
<Space size='small'>
|
||||
<Dropdown menu={actionItems}>
|
||||
<Button>Actions</Button>
|
||||
|
||||
@ -50,7 +50,7 @@ const CourierServices = () => {
|
||||
return (
|
||||
<>
|
||||
<Flex vertical={'true'} gap='large' className='h-100'>
|
||||
<Flex justify={'space-between'}>
|
||||
<Flex justify={'space-between'} style={{ minHeight: 0 }}>
|
||||
<Space size='small'>
|
||||
<Dropdown menu={actionItems}>
|
||||
<Button>Actions</Button>
|
||||
|
||||
@ -49,7 +49,7 @@ const Couriers = () => {
|
||||
return (
|
||||
<>
|
||||
<Flex vertical={'true'} gap='large' className='h-100'>
|
||||
<Flex justify={'space-between'}>
|
||||
<Flex justify={'space-between'} style={{ minHeight: 0 }}>
|
||||
<Space size='small'>
|
||||
<Dropdown menu={actionItems}>
|
||||
<Button>Actions</Button>
|
||||
|
||||
@ -50,7 +50,7 @@ const DocumentJobs = () => {
|
||||
return (
|
||||
<>
|
||||
<Flex vertical={'true'} gap='large' className='h-100'>
|
||||
<Flex justify={'space-between'}>
|
||||
<Flex justify={'space-between'} style={{ minHeight: 0 }}>
|
||||
<Space size='small'>
|
||||
<Dropdown menu={actionItems}>
|
||||
<Button>Actions</Button>
|
||||
|
||||
@ -49,7 +49,7 @@ const DocumentPrinters = () => {
|
||||
return (
|
||||
<>
|
||||
<Flex vertical={'true'} gap='large' className='h-100'>
|
||||
<Flex justify={'space-between'}>
|
||||
<Flex justify={'space-between'} style={{ minHeight: 0 }}>
|
||||
<Space size='small'>
|
||||
<Dropdown menu={actionItems}>
|
||||
<Button>Actions</Button>
|
||||
|
||||
@ -48,7 +48,7 @@ const DocumentSizes = () => {
|
||||
return (
|
||||
<>
|
||||
<Flex vertical={'true'} gap='large' className='h-100'>
|
||||
<Flex justify={'space-between'}>
|
||||
<Flex justify={'space-between'} style={{ minHeight: 0 }}>
|
||||
<Space size='small'>
|
||||
<Dropdown menu={actionItems}>
|
||||
<Button>Actions</Button>
|
||||
|
||||
@ -50,7 +50,7 @@ const DocumentTemplates = () => {
|
||||
return (
|
||||
<>
|
||||
<Flex vertical={'true'} gap='large' className='h-100'>
|
||||
<Flex justify={'space-between'}>
|
||||
<Flex justify={'space-between'} style={{ minHeight: 0 }}>
|
||||
<Space size='small'>
|
||||
<Dropdown menu={actionItems}>
|
||||
<Button>Actions</Button>
|
||||
|
||||
@ -53,7 +53,7 @@ const FilamentSkus = () => {
|
||||
return (
|
||||
<>
|
||||
<Flex vertical={'true'} gap='large' className='h-100'>
|
||||
<Flex justify={'space-between'}>
|
||||
<Flex justify={'space-between'} style={{ minHeight: 0 }}>
|
||||
<Space size='small'>
|
||||
<Dropdown menu={actionItems}>
|
||||
<Button>Actions</Button>
|
||||
|
||||
@ -55,7 +55,7 @@ const Filaments = () => {
|
||||
return (
|
||||
<>
|
||||
<Flex vertical={'true'} gap='large' className='h-100'>
|
||||
<Flex justify={'space-between'}>
|
||||
<Flex justify={'space-between'} style={{ minHeight: 0 }}>
|
||||
<Space>
|
||||
<Dropdown menu={actionItems}>
|
||||
<Button>Actions</Button>
|
||||
|
||||
@ -38,7 +38,7 @@ const Files = () => {
|
||||
return (
|
||||
<>
|
||||
<Flex vertical={'true'} gap='large' className='h-100'>
|
||||
<Flex justify={'space-between'}>
|
||||
<Flex justify={'space-between'} style={{ minHeight: 0 }}>
|
||||
<Space size='small'>
|
||||
<Dropdown menu={actionItems}>
|
||||
<Button>Actions</Button>
|
||||
|
||||
@ -54,7 +54,7 @@ const Hosts = () => {
|
||||
return (
|
||||
<>
|
||||
<Flex vertical={'true'} gap='large' className='h-100'>
|
||||
<Flex justify={'space-between'}>
|
||||
<Flex justify={'space-between'} style={{ minHeight: 0 }}>
|
||||
<Space>
|
||||
<Dropdown menu={actionItems}>
|
||||
<Button>Actions</Button>
|
||||
|
||||
@ -52,7 +52,7 @@ const Materials = () => {
|
||||
return (
|
||||
<>
|
||||
<Flex vertical={'true'} gap='large' className='h-100'>
|
||||
<Flex justify={'space-between'}>
|
||||
<Flex justify={'space-between'} style={{ minHeight: 0 }}>
|
||||
<Space>
|
||||
<Dropdown menu={actionItems}>
|
||||
<Button>Actions</Button>
|
||||
|
||||
@ -50,7 +50,7 @@ const NoteTypes = () => {
|
||||
return (
|
||||
<>
|
||||
<Flex vertical={'true'} gap='large' className='h-100'>
|
||||
<Flex justify={'space-between'}>
|
||||
<Flex justify={'space-between'} style={{ minHeight: 0 }}>
|
||||
<Space size='small'>
|
||||
<Dropdown menu={actionItems}>
|
||||
<Button>Actions</Button>
|
||||
|
||||
@ -52,7 +52,7 @@ const PartSkus = () => {
|
||||
return (
|
||||
<>
|
||||
<Flex vertical={'true'} gap='large' className='h-100'>
|
||||
<Flex justify={'space-between'}>
|
||||
<Flex justify={'space-between'} style={{ minHeight: 0 }}>
|
||||
<Space size='small'>
|
||||
<Dropdown menu={actionItems}>
|
||||
<Button>Actions</Button>
|
||||
|
||||
@ -54,7 +54,7 @@ const Parts = (filter) => {
|
||||
return (
|
||||
<>
|
||||
<Flex vertical={'true'} gap='large' className='h-100'>
|
||||
<Flex justify={'space-between'}>
|
||||
<Flex justify={'space-between'} style={{ minHeight: 0 }}>
|
||||
<Space size='small'>
|
||||
<Dropdown menu={actionItems}>
|
||||
<Button>Actions</Button>
|
||||
|
||||
@ -52,7 +52,7 @@ const ProductCategories = () => {
|
||||
return (
|
||||
<>
|
||||
<Flex vertical={'true'} gap='large' className='h-100'>
|
||||
<Flex justify={'space-between'}>
|
||||
<Flex justify={'space-between'} style={{ minHeight: 0 }}>
|
||||
<Space>
|
||||
<Dropdown menu={actionItems}>
|
||||
<Button>Actions</Button>
|
||||
|
||||
@ -53,7 +53,7 @@ const ProductSkus = () => {
|
||||
return (
|
||||
<>
|
||||
<Flex vertical={'true'} gap='large' className='h-100'>
|
||||
<Flex justify={'space-between'}>
|
||||
<Flex justify={'space-between'} style={{ minHeight: 0 }}>
|
||||
<Space size='small'>
|
||||
<Dropdown menu={actionItems}>
|
||||
<Button>Actions</Button>
|
||||
|
||||
@ -325,7 +325,7 @@ const Products = () => {
|
||||
return (
|
||||
<>
|
||||
<Flex vertical={'true'} gap='large' className='h-100'>
|
||||
<Flex justify={'space-between'}>
|
||||
<Flex justify={'space-between'} style={{ minHeight: 0 }}>
|
||||
<Space size='small'>
|
||||
<Dropdown menu={actionItems}>
|
||||
<Button>Actions</Button>
|
||||
|
||||
@ -49,7 +49,7 @@ const TaxRates = () => {
|
||||
return (
|
||||
<>
|
||||
<Flex vertical={'true'} gap='large' className='h-100'>
|
||||
<Flex justify={'space-between'}>
|
||||
<Flex justify={'space-between'} style={{ minHeight: 0 }}>
|
||||
<Space size='small'>
|
||||
<Dropdown menu={actionItems}>
|
||||
<Button>Actions</Button>
|
||||
|
||||
@ -37,7 +37,7 @@ const Users = () => {
|
||||
|
||||
return (
|
||||
<Flex vertical={'true'} gap='large' className='h-100'>
|
||||
<Flex justify={'space-between'}>
|
||||
<Flex justify={'space-between'} style={{ minHeight: 0 }}>
|
||||
<Space size='small'>
|
||||
<Dropdown menu={actionItems}>
|
||||
<Button>Actions</Button>
|
||||
|
||||
@ -49,7 +49,7 @@ const Vendors = () => {
|
||||
return (
|
||||
<>
|
||||
<Flex vertical={'true'} gap='large' className='h-100'>
|
||||
<Flex justify={'space-between'}>
|
||||
<Flex justify={'space-between'} style={{ minHeight: 0 }}>
|
||||
<Space size='small'>
|
||||
<Dropdown menu={actionItems}>
|
||||
<Button>Actions</Button>
|
||||
|
||||
@ -77,7 +77,7 @@ const FilamentProfiles = () => {
|
||||
return (
|
||||
<>
|
||||
<Flex vertical={'true'} gap='large' className='h-100'>
|
||||
<Flex justify={'space-between'}>
|
||||
<Flex justify={'space-between'} style={{ minHeight: 0 }}>
|
||||
<Space>
|
||||
<Dropdown menu={actionItems}>
|
||||
<Button>Actions</Button>
|
||||
|
||||
@ -52,7 +52,7 @@ const GCodeFiles = () => {
|
||||
return (
|
||||
<>
|
||||
<Flex vertical={'true'} gap='large' className='h-100'>
|
||||
<Flex justify={'space-between'}>
|
||||
<Flex justify={'space-between'} style={{ minHeight: 0 }}>
|
||||
<Space>
|
||||
<Dropdown menu={actionItems}>
|
||||
<Button>Actions</Button>
|
||||
|
||||
@ -54,7 +54,7 @@ const Jobs = () => {
|
||||
return (
|
||||
<>
|
||||
<Flex vertical={'true'} gap='large' className='h-100'>
|
||||
<Flex justify={'space-between'}>
|
||||
<Flex justify={'space-between'} style={{ minHeight: 0 }}>
|
||||
<Space size='small'>
|
||||
<Dropdown menu={actionItems}>
|
||||
<Button>Actions</Button>
|
||||
|
||||
@ -66,7 +66,7 @@ const PrinterProfiles = () => {
|
||||
return (
|
||||
<>
|
||||
<Flex vertical={'true'} gap='large' className='h-100'>
|
||||
<Flex justify={'space-between'}>
|
||||
<Flex justify={'space-between'} style={{ minHeight: 0 }}>
|
||||
<Space>
|
||||
<Dropdown menu={actionItems}>
|
||||
<Button>Actions</Button>
|
||||
|
||||
@ -55,7 +55,7 @@ const Printers = () => {
|
||||
return (
|
||||
<>
|
||||
<Flex vertical={'true'} gap='large' className='h-100'>
|
||||
<Flex justify={'space-between'}>
|
||||
<Flex justify={'space-between'} style={{ minHeight: 0 }}>
|
||||
<Space>
|
||||
<Dropdown menu={actionItems}>
|
||||
<Button>Actions</Button>
|
||||
|
||||
@ -39,7 +39,7 @@ const SubJobs = () => {
|
||||
return (
|
||||
<>
|
||||
<Flex vertical={'true'} gap='large' className='h-100'>
|
||||
<Flex justify={'space-between'}>
|
||||
<Flex justify={'space-between'} style={{ minHeight: 0 }}>
|
||||
<Space size='small'>
|
||||
<Dropdown menu={actionItems}>
|
||||
<Button>Actions</Button>
|
||||
|
||||
@ -49,7 +49,7 @@ const Clients = () => {
|
||||
return (
|
||||
<>
|
||||
<Flex vertical={'true'} gap='large' className='h-100'>
|
||||
<Flex justify={'space-between'}>
|
||||
<Flex justify={'space-between'} style={{ minHeight: 0 }}>
|
||||
<Space size='small'>
|
||||
<Dropdown menu={actionItems}>
|
||||
<Button>Actions</Button>
|
||||
|
||||
@ -50,7 +50,7 @@ const Listings = () => {
|
||||
return (
|
||||
<>
|
||||
<Flex vertical={'true'} gap='large' className='h-100'>
|
||||
<Flex justify={'space-between'}>
|
||||
<Flex justify={'space-between'} style={{ minHeight: 0 }}>
|
||||
<Space size='small'>
|
||||
<Dropdown menu={actionItems}>
|
||||
<Button>Actions</Button>
|
||||
|
||||
@ -50,7 +50,7 @@ const Marketplaces = () => {
|
||||
return (
|
||||
<>
|
||||
<Flex vertical={'true'} gap='large' className='h-100'>
|
||||
<Flex justify={'space-between'}>
|
||||
<Flex justify={'space-between'} style={{ minHeight: 0 }}>
|
||||
<Space size='small'>
|
||||
<Dropdown menu={actionItems}>
|
||||
<Button>Actions</Button>
|
||||
|
||||
@ -50,7 +50,7 @@ const SalesOrders = () => {
|
||||
return (
|
||||
<>
|
||||
<Flex vertical={'true'} gap='large' className='h-100'>
|
||||
<Flex justify={'space-between'}>
|
||||
<Flex justify={'space-between'} style={{ minHeight: 0 }}>
|
||||
<Space size='small'>
|
||||
<Dropdown menu={actionItems}>
|
||||
<Button>Actions</Button>
|
||||
|
||||
@ -36,6 +36,8 @@ const FilePreview = ({ file, style = {} }) => {
|
||||
}
|
||||
}, [file._id, file?.type, fetchPreview, token])
|
||||
|
||||
console.log(file)
|
||||
|
||||
if (loading == true || !file?.type) {
|
||||
return <LoadingPlaceholder message={'Loading file preview...'} />
|
||||
}
|
||||
@ -44,13 +46,11 @@ const FilePreview = ({ file, style = {} }) => {
|
||||
return <div style={{ color: 'red' }}>{error}</div>
|
||||
}
|
||||
|
||||
const isGcode = ['.g', '.gcode'].includes(
|
||||
(file?.extension || '').toLowerCase()
|
||||
)
|
||||
const isGcode =
|
||||
['.g', '.gcode'].includes((file?.extension || '').toLowerCase()) || false
|
||||
|
||||
const is3DModel = ['.stl', '.3mf'].includes(
|
||||
(file?.extension || '').toLowerCase()
|
||||
)
|
||||
const is3DModel =
|
||||
['.stl', '.3mf'].includes((file?.extension || '').toLowerCase()) || false
|
||||
|
||||
const isImage = file?.type.startsWith('image/')
|
||||
|
||||
|
||||
@ -45,6 +45,7 @@ import { AuthContext } from '../context/AuthContext'
|
||||
import { ElectronContext } from '../context/ElectronContext'
|
||||
import ActionsIcon from '../../Icons/ActionsIcon'
|
||||
import FilterIcon from '../../Icons/FilterIcon'
|
||||
import ScrollBox from './ScrollBox'
|
||||
|
||||
const logger = loglevel.getLogger('DasboardTable')
|
||||
logger.setLevel(config.logLevel)
|
||||
@ -132,7 +133,7 @@ const ObjectTable = forwardRef(
|
||||
const navigate = useNavigate()
|
||||
var adjustedScrollHeight = scrollHeight
|
||||
if (isMobile) {
|
||||
adjustedScrollHeight = 'calc(var(--unit-100vh) - 316px)'
|
||||
adjustedScrollHeight = 'calc(var(--unit-100vh) - 298px)'
|
||||
}
|
||||
if (cards) {
|
||||
adjustedScrollHeight = 'calc(var(--unit-100vh) - 210px)'
|
||||
@ -1071,14 +1072,13 @@ const ObjectTable = forwardRef(
|
||||
|
||||
const renderCards = () => {
|
||||
return (
|
||||
<Row
|
||||
gutter={[16, 16]}
|
||||
<ScrollBox
|
||||
style={{
|
||||
overflowY: 'auto',
|
||||
maxHeight: adjustedScrollHeight
|
||||
maxHeight: `100%`
|
||||
}}
|
||||
ref={cardsContainerRef}
|
||||
>
|
||||
<div className='objectTableCards'>
|
||||
<Row gutter={[16, 16]} ref={cardsContainerRef}>
|
||||
{tableData.map((record) => {
|
||||
if (record?._id == undefined) {
|
||||
return null
|
||||
@ -1117,6 +1117,8 @@ const ObjectTable = forwardRef(
|
||||
)
|
||||
})}
|
||||
</Row>
|
||||
</div>
|
||||
</ScrollBox>
|
||||
)
|
||||
}
|
||||
|
||||
@ -1143,9 +1145,15 @@ const ObjectTable = forwardRef(
|
||||
<Splitter className={'farmcontrol-splitter'}>
|
||||
<Splitter.Panel>
|
||||
{cards ? (
|
||||
<Spin indicator={<LoadingOutlined />} spinning={loading}>
|
||||
<div className='objectTableCardsContainer'>
|
||||
<Spin
|
||||
indicator={<LoadingOutlined />}
|
||||
spinning={loading}
|
||||
style={{ height: '100%' }}
|
||||
>
|
||||
{renderCards()}
|
||||
</Spin>
|
||||
</div>
|
||||
) : (
|
||||
<Table
|
||||
ref={tableRef}
|
||||
|
||||
@ -145,17 +145,23 @@ const ApiServerProvider = ({ children }) => {
|
||||
notificationListenersRef.current.clear()
|
||||
}, [])
|
||||
|
||||
const resubscribeActivityListeners = useCallback((socket = socketRef.current) => {
|
||||
const resubscribeActivityListeners = useCallback(
|
||||
(socket = socketRef.current) => {
|
||||
if (!socket?.connected) {
|
||||
return
|
||||
}
|
||||
|
||||
subscribedActivityCallbacksRef.current.forEach((callbacks, callbacksRefKey) => {
|
||||
subscribedActivityCallbacksRef.current.forEach(
|
||||
(callbacks, callbacksRefKey) => {
|
||||
if (!callbacks?.length) {
|
||||
return
|
||||
}
|
||||
|
||||
if (subscribedActivityServerSubscriptionsRef.current.has(callbacksRefKey)) {
|
||||
if (
|
||||
subscribedActivityServerSubscriptionsRef.current.has(
|
||||
callbacksRefKey
|
||||
)
|
||||
) {
|
||||
return
|
||||
}
|
||||
|
||||
@ -172,21 +178,29 @@ const ApiServerProvider = ({ children }) => {
|
||||
{ _id: objectId, objectType },
|
||||
(result) => {
|
||||
if (result?.success) {
|
||||
subscribedActivityServerSubscriptionsRef.current.add(callbacksRefKey)
|
||||
subscribedActivityServerSubscriptionsRef.current.add(
|
||||
callbacksRefKey
|
||||
)
|
||||
if (Array.isArray(result.activities)) {
|
||||
callbacks.forEach((callback) => {
|
||||
try {
|
||||
callback(null, result.activities)
|
||||
} catch (error) {
|
||||
logger.error('Error in activity resubscribe callback:', error)
|
||||
logger.error(
|
||||
'Error in activity resubscribe callback:',
|
||||
error
|
||||
)
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
)
|
||||
})
|
||||
}, [])
|
||||
}
|
||||
)
|
||||
},
|
||||
[]
|
||||
)
|
||||
|
||||
const registerNotificationListener = useCallback((callback) => {
|
||||
notificationListenersRef.current.add(callback)
|
||||
@ -966,7 +980,9 @@ const ApiServerProvider = ({ children }) => {
|
||||
{ _id: id, objectType: type },
|
||||
(result) => {
|
||||
if (result?.success) {
|
||||
subscribedActivityServerSubscriptionsRef.current.add(callbacksRefKey)
|
||||
subscribedActivityServerSubscriptionsRef.current.add(
|
||||
callbacksRefKey
|
||||
)
|
||||
if (Array.isArray(result.activities)) {
|
||||
subscribedActivityCallbacksRef.current
|
||||
.get(callbacksRefKey)
|
||||
@ -974,7 +990,10 @@ const ApiServerProvider = ({ children }) => {
|
||||
try {
|
||||
activityCallback(null, result.activities)
|
||||
} catch (error) {
|
||||
logger.error('Error in activity subscribe callback:', error)
|
||||
logger.error(
|
||||
'Error in activity subscribe callback:',
|
||||
error
|
||||
)
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user