Numerious fixes.

This commit is contained in:
Tom Butcher 2026-05-17 19:11:25 +01:00
parent c57446836e
commit 7a5ea5416b
81 changed files with 320 additions and 516 deletions

View File

@ -64,10 +64,6 @@ const InvoiceInfo = () => {
const [newPaymentOpen, setNewPaymentOpen] = useState(false)
const actions = {
reload: () => {
objectFormRef?.current?.handleFetchObject?.()
return true
},
edit: () => {
objectFormRef?.current?.startEditing?.()
return false
@ -313,7 +309,7 @@ const InvoiceInfo = () => {
<PostInvoice
onOk={() => {
setPostInvoiceOpen(false)
actions.reload()
objectFormRef?.current.handleFetchObject()
}}
objectData={objectFormState.objectData}
/>
@ -331,7 +327,7 @@ const InvoiceInfo = () => {
<AcknowledgeInvoice
onOk={() => {
setAcknowledgeInvoiceOpen(false)
actions.reload()
objectFormRef?.current.handleFetchObject()
}}
objectData={objectFormState.objectData}
/>
@ -349,7 +345,7 @@ const InvoiceInfo = () => {
<NewPayment
onOk={() => {
setNewPaymentOpen(false)
actions.reload()
objectFormRef?.current.handleFetchObject()
}}
reset={newPaymentOpen}
defaultValues={{

View File

@ -50,10 +50,6 @@ const PaymentInfo = () => {
const [postPaymentOpen, setPostPaymentOpen] = useState(false)
const actions = {
reload: () => {
objectFormRef?.current?.handleFetchObject?.()
return true
},
edit: () => {
objectFormRef?.current?.startEditing?.()
return false
@ -233,7 +229,7 @@ const PaymentInfo = () => {
<PostPayment
onOk={() => {
setPostPaymentOpen(false)
actions.reload()
objectFormRef?.current.handleFetchObject()
}}
objectData={objectFormState.objectData}
/>

View File

@ -47,10 +47,6 @@ const FilamentStockInfo = () => {
})
const actions = {
reload: () => {
objectFormRef?.current?.fetchObject?.()
return true
},
edit: () => {
objectFormRef?.current?.startEditing?.()
return false

View File

@ -49,10 +49,6 @@ const OrderItemInfo = () => {
})
const actions = {
reload: () => {
objectFormRef?.current?.handleFetchObject?.()
return true
},
edit: () => {
objectFormRef?.current?.startEditing?.()
return false

View File

@ -51,10 +51,6 @@ const PartStockInfo = () => {
})
const actions = {
reload: () => {
objectFormRef?.current.handleFetchObject()
return true
},
edit: () => {
objectFormRef?.current.startEditing()
return false

View File

@ -58,10 +58,6 @@ const ProductStockInfo = () => {
})
const actions = {
reload: () => {
objectFormRef?.current.handleFetchObject()
return true
},
edit: () => {
objectFormRef?.current.startEditing()
return false
@ -262,7 +258,7 @@ const ProductStockInfo = () => {
<PostProductStock
onOk={() => {
setPostProductStockOpen(false)
actions.reload()
objectFormRef?.current.handleFetchObject()
}}
objectData={objectFormState.objectData}
/>

View File

@ -74,10 +74,6 @@ const PurchaseOrderInfo = () => {
})
const actions = {
reload: () => {
objectFormRef?.current?.handleFetchObject?.()
return true
},
edit: () => {
orderItemsTableRef?.current?.startEditing?.()
objectFormRef?.current?.startEditing?.()
@ -427,7 +423,7 @@ const PurchaseOrderInfo = () => {
<PostPurchaseOrder
onOk={() => {
setPostPurchaseOrderOpen(false)
actions.reload()
objectFormRef?.current.handleFetchObject()
}}
objectData={objectFormState.objectData}
/>
@ -445,7 +441,7 @@ const PurchaseOrderInfo = () => {
<AcknowledgePurchaseOrder
onOk={() => {
setAcknowledgePurchaseOrderOpen(false)
actions.reload()
objectFormRef?.current.handleFetchObject()
}}
objectData={objectFormState.objectData}
/>
@ -463,7 +459,7 @@ const PurchaseOrderInfo = () => {
<CancelPurchaseOrder
onOk={() => {
setCancelPurchaseOrderOpen(false)
actions.reload()
objectFormRef?.current.handleFetchObject()
}}
objectData={objectFormState.objectData}
/>

View File

@ -64,10 +64,6 @@ const PurchaseOrderInfo = () => {
})
const actions = {
reload: () => {
objectFormRef?.current?.handleFetchObject?.()
return true
},
edit: () => {
orderItemsTableRef?.current?.startEditing?.()
objectFormRef?.current?.startEditing?.()
@ -332,7 +328,7 @@ const PurchaseOrderInfo = () => {
<PostPurchaseOrder
onOk={() => {
setPostPurchaseOrderOpen(false)
actions.reload()
objectFormRef?.current.handleFetchObject()
}}
objectData={objectFormState.objectData}
/>
@ -350,7 +346,7 @@ const PurchaseOrderInfo = () => {
<AcknowledgePurchaseOrder
onOk={() => {
setAcknowledgePurchaseOrderOpen(false)
actions.reload()
objectFormRef?.current.handleFetchObject()
}}
objectData={objectFormState.objectData}
/>

View File

@ -57,10 +57,6 @@ const ShipmentInfo = () => {
const [receiveShipmentOpen, setReceiveShipmentOpen] = useState(false)
const [cancelShipmentOpen, setCancelShipmentOpen] = useState(false)
const actions = {
reload: () => {
objectFormRef?.current?.handleFetchObject?.()
return true
},
edit: () => {
objectFormRef?.current?.startEditing?.()
return false
@ -261,7 +257,7 @@ const ShipmentInfo = () => {
<ShipShipment
onOk={() => {
setShipShipmentOpen(false)
actions.reload()
objectFormRef?.current.handleFetchObject()
}}
objectData={objectFormState.objectData}
/>
@ -279,7 +275,7 @@ const ShipmentInfo = () => {
<ReceiveShipment
onOk={() => {
setReceiveShipmentOpen(false)
actions.reload()
objectFormRef?.current.handleFetchObject()
}}
objectData={objectFormState.objectData}
/>
@ -297,7 +293,7 @@ const ShipmentInfo = () => {
<CancelShipment
onOk={() => {
setCancelShipmentOpen(false)
actions.reload()
objectFormRef?.current.handleFetchObject()
}}
objectData={objectFormState.objectData}
/>

View File

@ -51,10 +51,6 @@ const StockAuditInfo = () => {
})
const actions = {
reload: () => {
objectFormRef?.current.handleFetchObject()
return true
},
edit: () => {
objectFormRef?.current.startEditing()
return false

View File

@ -52,10 +52,6 @@ const StockLocationInfo = () => {
})
const actions = {
reload: () => {
objectFormRef?.current.handleFetchObject()
return true
},
edit: () => {
objectFormRef?.current.startEditing()
return false

View File

@ -53,10 +53,6 @@ const StockTransferInfo = () => {
})
const actions = {
reload: () => {
objectFormRef?.current.handleFetchObject()
return true
},
edit: () => {
objectFormRef?.current.startEditing()
return false
@ -257,7 +253,7 @@ const StockTransferInfo = () => {
<PostStockTransfer
onOk={() => {
setPostOpen(false)
actions.reload()
objectFormRef?.current.handleFetchObject()
}}
objectData={objectFormState.objectData}
/>

View File

@ -48,10 +48,6 @@ const AppPasswordInfo = () => {
})
const actions = {
reload: () => {
objectFormRef?.current?.handleFetchObject?.()
return true
},
regenerateSecret: () => {
setRegenerateSecretOpen(true)
return false

View File

@ -50,10 +50,6 @@ const CourierServiceInfo = () => {
})
const actions = {
reload: () => {
objectFormRef?.current?.handleFetchObject?.()
return true
},
edit: () => {
objectFormRef?.current?.startEditing?.()
return false

View File

@ -46,10 +46,6 @@ const CourierInfo = () => {
})
const actions = {
reload: () => {
objectFormRef?.current?.handleFetchObject?.()
return true
},
edit: () => {
objectFormRef?.current?.startEditing?.()
return false

View File

@ -51,10 +51,6 @@ const DocumentJobInfo = () => {
})
const actions = {
reload: () => {
objectFormRef?.current?.fetchObject?.()
return true
},
edit: () => {
objectFormRef?.current?.startEditing?.()
return false

View File

@ -53,10 +53,6 @@ const DocumentPrinterInfo = () => {
})
const actions = {
reload: () => {
objectFormRef?.current.handleFetchObject()
return true
},
edit: () => {
objectFormRef?.current.startEditing()
return false

View File

@ -51,10 +51,6 @@ const DocumentSizeInfo = () => {
})
const actions = {
reload: () => {
objectFormRef?.current?.fetchObject?.()
return true
},
edit: () => {
objectFormRef?.current?.startEditing?.()
return false

View File

@ -47,10 +47,6 @@ const DocumentTemplateDesign = () => {
})
const actions = {
reload: () => {
objectFormRef?.current.handleFetchObject()
return true
},
edit: () => {
objectFormRef?.current.startEditing()
return false

View File

@ -53,10 +53,6 @@ const DocumentTemplateInfo = () => {
})
const actions = {
reload: () => {
objectFormRef?.current.handleFetchObject()
return true
},
edit: () => {
objectFormRef?.current.startEditing()
return false

View File

@ -43,10 +43,6 @@ const FilamentSkuInfo = () => {
})
const actions = {
reload: () => {
objectFormRef?.current?.fetchObject?.()
return true
},
edit: () => {
objectFormRef?.current?.startEditing?.()
return false

View File

@ -57,10 +57,6 @@ const FilamentInfo = () => {
})
const actions = {
reload: () => {
objectFormRef?.current?.fetchObject?.()
return true
},
newFilamentSku: () => {
setNewFilamentSkuOpen(true)
return true
@ -218,10 +214,9 @@ const FilamentInfo = () => {
) : (
<ObjectTable
type='filamentStock'
masterFilter={{ 'filamentSku.filament._id': filamentId }}
masterFilter={{ filament: filamentId }}
visibleColumns={{
filamentSku: false,
'filamentSku.filament._id': false,
filament: false,
startingWeight: false
}}
/>

View File

@ -52,10 +52,6 @@ const FileInfo = () => {
const { fetchFileContent } = useContext(ApiServerContext)
const actions = {
reload: () => {
objectFormRef?.current?.handleFetchObject?.()
return true
},
edit: () => {
objectFormRef?.current?.startEditing?.()
return false

View File

@ -53,10 +53,6 @@ const HostInfo = () => {
})
const actions = {
reload: () => {
objectFormRef?.current.handleFetchObject()
return true
},
hostOTP: () => {
setHostOTPOpen(true)
return false

View File

@ -45,10 +45,6 @@ const MaterialInfo = () => {
})
const actions = {
reload: () => {
objectFormRef?.current?.handleFetchObject?.()
return true
},
edit: () => {
objectFormRef?.current?.startEditing?.()
return false

View File

@ -41,10 +41,6 @@ const NoteTypeInfo = () => {
})
const actions = {
reload: () => {
objectFormRef?.current?.fetchObject?.()
return true
},
edit: () => {
objectFormRef?.current?.startEditing?.()
return false

View File

@ -50,10 +50,6 @@ const NoteInfo = () => {
})
const actions = {
reload: () => {
objectFormRef?.current?.handleFetchObject?.()
return true
},
edit: () => {
objectFormRef?.current?.startEditing?.()
return false

View File

@ -40,10 +40,6 @@ const PartSkuInfo = () => {
})
const actions = {
reload: () => {
objectFormRef?.current?.fetchObject?.()
return true
},
edit: () => {
objectFormRef?.current?.startEditing?.()
return false

View File

@ -45,10 +45,6 @@ const PartInfo = () => {
})
const actions = {
reload: () => {
objectFormRef?.current?.fetchObject?.()
return true
},
newPartSku: () => {
setNewPartSkuOpen(true)
return true

View File

@ -47,10 +47,6 @@ const ProductSkuInfo = () => {
})
const actions = {
reload: () => {
objectFormRef?.current?.fetchObject?.()
return true
},
edit: () => {
objectFormRef?.current?.startEditing?.()
return false

View File

@ -46,10 +46,6 @@ const ProductInfo = () => {
})
const actions = {
reload: () => {
objectFormRef?.current?.fetchObject?.()
return true
},
newProductSku: () => {
setNewProductSkuOpen(true)
return true

View File

@ -45,10 +45,6 @@ const TaxRateInfo = () => {
})
const actions = {
reload: () => {
objectFormRef?.current?.handleFetchObject?.()
return true
},
edit: () => {
objectFormRef?.current?.startEditing?.()
return false

View File

@ -48,10 +48,6 @@ const TaxRecordInfo = () => {
})
const actions = {
reload: () => {
objectFormRef?.current?.handleFetchObject?.()
return true
},
edit: () => {
objectFormRef?.current?.startEditing?.()
return false

View File

@ -46,10 +46,6 @@ const UserInfo = () => {
})
const actions = {
reload: () => {
objectFormRef?.current?.handleFetchObject?.()
return true
},
newAppPassword: () => {
setNewAppPasswordOpen(true)
return false

View File

@ -45,10 +45,6 @@ const VendorInfo = () => {
})
const actions = {
reload: () => {
objectFormRef?.current?.handleFetchObject?.()
return true
},
edit: () => {
objectFormRef?.current?.startEditing?.()
return false

View File

@ -20,11 +20,8 @@ import ActionHandler from '../../common/ActionHandler.jsx'
import ObjectActions from '../../common/ObjectActions.jsx'
import ObjectTable from '../../common/ObjectTable.jsx'
import InfoCollapsePlaceholder from '../../common/InfoCollapsePlaceholder.jsx'
import EyeIcon from '../../../Icons/EyeIcon.jsx'
import DocumentPrintButton from '../../common/DocumentPrintButton.jsx'
import UserNotifierToggle from '../../common/UserNotifierToggle.jsx'
import MissingPlaceholder from '../../common/MissingPlaceholder.jsx'
import FilePreview from '../../common/FilePreview.jsx'
import ScrollBox from '../../common/ScrollBox.jsx'
import { getModelProperty } from '../../../../database/ObjectModels.js'
import PartIcon from '../../../Icons/PartIcon.jsx'
@ -42,7 +39,6 @@ const GCodeFileInfo = () => {
{
info: true,
parts: true,
preview: true,
notes: true,
auditLogs: true
}
@ -58,10 +54,6 @@ const GCodeFileInfo = () => {
})
const actions = {
reload: () => {
objectFormRef?.current.handleFetchObject()
return true
},
edit: () => {
objectFormRef?.current.startEditing()
return false
@ -100,7 +92,6 @@ const GCodeFileInfo = () => {
items={[
{ key: 'info', label: 'GCode File Information' },
{ key: 'parts', label: 'Parts' },
{ key: 'preview', label: 'GCode File Preview' },
{ key: 'notes', label: 'Notes' },
{ key: 'auditLogs', label: 'Audit Logs' }
]}
@ -196,26 +187,6 @@ const GCodeFileInfo = () => {
loading={loading}
/>
</InfoCollapse>
<InfoCollapse
title='GCode File Preview'
icon={<EyeIcon />}
active={collapseState.preview}
onToggle={(expanded) =>
updateCollapseState('preview', expanded)
}
collapseKey='preview'
>
{objectData?.file?._id ? (
<Card>
<FilePreview
file={objectData?.file}
style={{ width: '100%', height: '100%' }}
/>
</Card>
) : (
<MissingPlaceholder message={'No file.'} />
)}
</InfoCollapse>
</Flex>
)
}}

View File

@ -0,0 +1,140 @@
import { useRef, useState } from 'react'
import { useLocation } from 'react-router-dom'
import { Space, Flex, Card } from 'antd'
import loglevel from 'loglevel'
import config from '../../../../config.js'
import useCollapseState from '../../hooks/useCollapseState.jsx'
import NotesPanel from '../../common/NotesPanel.jsx'
import InfoCollapse from '../../common/InfoCollapse.jsx'
import ViewButton from '../../common/ViewButton.jsx'
import NoteIcon from '../../../Icons/NoteIcon.jsx'
import EyeIcon from '../../../Icons/EyeIcon.jsx'
import ObjectForm from '../../common/ObjectForm.jsx'
import LockIndicator from '../../common/LockIndicator.jsx'
import ObjectActions from '../../common/ObjectActions.jsx'
import ScrollBox from '../../common/ScrollBox.jsx'
import FilePreview from '../../common/FilePreview.jsx'
import MissingPlaceholder from '../../common/MissingPlaceholder.jsx'
import InfoCollapsePlaceholder from '../../common/InfoCollapsePlaceholder.jsx'
import DocumentPrintButton from '../../common/DocumentPrintButton.jsx'
import UserNotifierToggle from '../../common/UserNotifierToggle.jsx'
const log = loglevel.getLogger('GCodeFilePreview')
log.setLevel(config.logLevel)
const GCodeFilePreview = () => {
const location = useLocation()
const objectFormRef = useRef(null)
const gcodeFileId = new URLSearchParams(location.search).get('gcodeFileId')
const [collapseState, updateCollapseState] = useCollapseState(
'GCodeFilePreview',
{
preview: true,
notes: true
}
)
const [objectFormState, setEditFormState] = useState({
loading: false,
objectData: {},
lock: null
})
return (
<Flex
gap='large'
vertical='true'
style={{
maxHeight: '100%',
minHeight: 0
}}
>
<Flex justify={'space-between'}>
<Space size='middle'>
<Space size='small'>
<ObjectActions
type='gcodeFile'
id={gcodeFileId}
disabled={objectFormState.loading}
objectData={objectFormState.objectData}
visibleActions={{ edit: false }}
/>
<ViewButton
disabled={objectFormState.loading}
items={[
{ key: 'preview', label: 'GCode File Preview' },
{ key: 'notes', label: 'Notes' }
]}
visibleState={collapseState}
updateVisibleState={updateCollapseState}
/>
<UserNotifierToggle
type='gcodeFile'
objectData={objectFormState.objectData}
disabled={objectFormState.loading}
/>
<DocumentPrintButton
type='gcodeFile'
objectData={objectFormState.objectData}
disabled={objectFormState.loading}
/>
</Space>
<LockIndicator lock={objectFormState.lock} />
</Space>
</Flex>
<ScrollBox>
<Flex vertical gap={'large'}>
<ObjectForm
id={gcodeFileId}
type='gcodeFile'
style={{ height: '100%' }}
ref={objectFormRef}
onStateChange={(state) => {
setEditFormState((prev) => ({ ...prev, ...state }))
}}
>
{({ loading, objectData }) => (
<InfoCollapse
title='GCode File Preview'
icon={<EyeIcon />}
active={collapseState.preview}
onToggle={(expanded) =>
updateCollapseState('preview', expanded)
}
collapseKey='preview'
>
{loading ? (
<InfoCollapsePlaceholder />
) : objectData?.file?._id ? (
<Card>
<FilePreview
file={objectData?.file}
style={{ width: '100%', height: '72vh' }}
/>
</Card>
) : (
<MissingPlaceholder message={'No file.'} />
)}
</InfoCollapse>
)}
</ObjectForm>
<InfoCollapse
title='Notes'
icon={<NoteIcon />}
active={collapseState.notes}
onToggle={(expanded) => updateCollapseState('notes', expanded)}
collapseKey='notes'
>
<Card>
<NotesPanel _id={gcodeFileId} type='gcodeFile' />
</Card>
</InfoCollapse>
</Flex>
</ScrollBox>
</Flex>
)
}
export default GCodeFilePreview

View File

@ -54,10 +54,6 @@ const JobInfo = () => {
})
const actions = {
reload: () => {
objectFormRef?.current.handleFetchObject()
return true
},
edit: () => {
objectFormRef?.current.startEditing()
return false

View File

@ -85,10 +85,6 @@ const ControlPrinter = () => {
})
const actions = {
reload: () => {
objectFormRef?.current.handleFetchObject()
return true
},
edit: () => {
objectFormRef?.current.startEditing()
return false

View File

@ -48,10 +48,6 @@ const PrinterInfo = () => {
})
const actions = {
reload: () => {
objectFormRef?.current.handleFetchObject()
return true
},
edit: () => {
objectFormRef?.current.startEditing()
return false

View File

@ -42,10 +42,6 @@ const SubJobInfo = () => {
})
const actions = {
reload: () => {
objectFormRef?.current.handleFetchObject()
return true
},
edit: () => {
objectFormRef?.current.startEditing()
return false

View File

@ -45,10 +45,6 @@ const ClientInfo = () => {
})
const actions = {
reload: () => {
objectFormRef?.current?.handleFetchObject?.()
return true
},
edit: () => {
objectFormRef?.current?.startEditing?.()
return false

View File

@ -55,10 +55,6 @@ const ListingVarientInfo = () => {
})
const actions = {
reload: () => {
objectFormRef?.current?.handleFetchObject?.()
return true
},
edit: () => {
objectFormRef?.current?.startEditing?.()
return false
@ -226,7 +222,7 @@ const ListingVarientInfo = () => {
objectData={objectFormState.objectData}
onOk={() => {
setPublishOpen(false)
actions.reload()
objectFormRef?.current.handleFetchObject()
}}
/>
</Modal>
@ -242,7 +238,7 @@ const ListingVarientInfo = () => {
objectData={objectFormState.objectData}
onOk={() => {
setUnpublishOpen(false)
actions.reload()
objectFormRef?.current.handleFetchObject()
}}
/>
</Modal>

View File

@ -55,10 +55,6 @@ const ListingInfo = () => {
})
const actions = {
reload: () => {
objectFormRef?.current?.handleFetchObject?.()
return true
},
edit: () => {
objectFormRef?.current?.startEditing?.()
return false
@ -269,7 +265,7 @@ const ListingInfo = () => {
objectData={objectFormState.objectData}
onOk={() => {
setPublishListingOpen(false)
actions.reload()
objectFormRef?.current.handleFetchObject()
listingVarientsTableRef.current?.reload?.()
}}
/>
@ -286,7 +282,7 @@ const ListingInfo = () => {
objectData={objectFormState.objectData}
onOk={() => {
setUnpublishListingOpen(false)
actions.reload()
objectFormRef?.current.handleFetchObject()
listingVarientsTableRef.current?.reload?.()
}}
/>

View File

@ -112,10 +112,6 @@ const MarketplaceInfo = () => {
}
const actions = {
reload: () => {
objectFormRef?.current?.handleFetchObject?.()
return true
},
edit: () => {
objectFormRef?.current?.startEditing?.()
return false
@ -295,7 +291,7 @@ const MarketplaceInfo = () => {
<SyncListings
onOk={() => {
setSyncListingsOpen(false)
actions.reload()
objectFormRef?.current.handleFetchObject()
}}
objectData={objectFormState.objectData}
/>
@ -311,7 +307,7 @@ const MarketplaceInfo = () => {
<SyncOrders
onOk={() => {
setSyncOrdersOpen(false)
actions.reload()
objectFormRef?.current.handleFetchObject()
}}
objectData={objectFormState.objectData}
/>

View File

@ -71,10 +71,6 @@ const SalesOrderInfo = () => {
})
const actions = {
reload: () => {
objectFormRef?.current?.handleFetchObject?.()
return true
},
edit: () => {
orderItemsTableRef?.current?.startEditing?.()
objectFormRef?.current?.startEditing?.()
@ -424,7 +420,7 @@ const SalesOrderInfo = () => {
<PostSalesOrder
onOk={() => {
setPostSalesOrderOpen(false)
actions.reload()
objectFormRef?.current.handleFetchObject()
}}
objectData={objectFormState.objectData}
/>
@ -442,7 +438,7 @@ const SalesOrderInfo = () => {
<ConfirmSalesOrder
onOk={() => {
setConfirmSalesOrderOpen(false)
actions.reload()
objectFormRef?.current.handleFetchObject()
}}
objectData={objectFormState.objectData}
/>
@ -460,7 +456,7 @@ const SalesOrderInfo = () => {
<CancelSalesOrder
onOk={() => {
setCancelSalesOrderOpen(false)
actions.reload()
objectFormRef?.current.handleFetchObject()
}}
objectData={objectFormState.objectData}
/>

View File

@ -15,7 +15,8 @@ const breadcrumbNameMap = {
overview: 'Overview',
info: 'Info',
design: 'Design',
control: 'Control'
control: 'Control',
preview: 'Preview'
}
const mainSections = ['production', 'inventory', 'management', 'developer']

View File

@ -2,7 +2,7 @@ import { Upload, Button, Flex, Typography, Space, Progress, Card } from 'antd'
import PropTypes from 'prop-types'
import { ApiServerContext } from '../context/ApiServerContext'
import UploadIcon from '../../Icons/UploadIcon'
import { useContext, useState, useEffect } from 'react'
import { useCallback, useContext, useEffect, useMemo, useRef, useState } from 'react'
import ObjectSelect from './ObjectSelect'
import FileList from './FileList'
import PlusIcon from '../../Icons/PlusIcon'
@ -11,6 +11,16 @@ import FileIcon from '../../Icons/FileIcon'
const { Text } = Typography
const getFileIdentity = (value, multiple) => {
if (multiple) {
return Array.isArray(value)
? value.map((file) => file?._id || file).join(',')
: ''
}
return value?._id || value || ''
}
const FileUpload = ({
value,
onChange,
@ -23,6 +33,11 @@ const FileUpload = ({
const { uploadFile } = useContext(ApiServerContext)
const [uploading, setUploading] = useState(false)
const [uploadProgress, setUploadProgress] = useState(0)
const onChangeRef = useRef(onChange)
useEffect(() => {
onChangeRef.current = onChange
}, [onChange])
// Track current files using useState
const [currentFiles, setCurrentFiles] = useState(() => {
@ -35,29 +50,32 @@ const FileUpload = ({
// Update currentFiles when value prop changes
useEffect(() => {
if (multiple) {
setCurrentFiles(Array.isArray(value) ? value : [])
} else {
setCurrentFiles(value || null)
}
}, [value, multiple])
setCurrentFiles((prev) => {
if (getFileIdentity(prev, multiple) === getFileIdentity(value, multiple)) {
return prev
}
// Track if there are no items in the list
const [hasNoItems, setHasNoItems] = useState(false)
return multiple ? (Array.isArray(value) ? value : []) : value || null
})
}, [value, multiple])
// Track the selected file from ObjectSelect
const [selectedFile, setSelectedFile] = useState(null)
// Update hasNoItems when currentFiles changes
useEffect(() => {
const noItems = multiple
? !currentFiles ||
!Array.isArray(currentFiles) ||
currentFiles.length === 0
: !currentFiles
setHasNoItems(noItems)
onChange(currentFiles)
}, [currentFiles, multiple, onChange])
const hasNoItems = useMemo(
() =>
multiple
? !currentFiles ||
!Array.isArray(currentFiles) ||
currentFiles.length === 0
: !currentFiles,
[currentFiles, multiple]
)
const updateCurrentFiles = useCallback((nextFiles) => {
setCurrentFiles(nextFiles)
onChangeRef.current?.(nextFiles)
}, [])
const handleFileUpload = async (file) => {
try {
@ -70,10 +88,10 @@ const FileUpload = ({
if (multiple) {
// For multiple files, add to existing array
const newFiles = [...currentFiles, uploadedFile]
setCurrentFiles(newFiles)
updateCurrentFiles(newFiles)
} else {
// For single file, replace the value
setCurrentFiles(uploadedFile)
updateCurrentFiles(uploadedFile)
}
}
} catch (error) {
@ -88,10 +106,10 @@ const FileUpload = ({
if (multiple) {
// For multiple files, add to existing array
const newFiles = [...currentFiles, selectedFile]
setCurrentFiles(newFiles)
updateCurrentFiles(newFiles)
} else {
// For single file, replace the value
setCurrentFiles(selectedFile)
updateCurrentFiles(selectedFile)
}
// Clear the selection
setSelectedFile(null)
@ -168,7 +186,7 @@ const FileUpload = ({
showPreview={showPreview}
defaultPreviewOpen={defaultPreviewOpen}
onChange={(updatedFiles) => {
setCurrentFiles(updatedFiles)
updateCurrentFiles(updatedFiles)
}}
/>
</Flex>

View File

@ -1,6 +1,6 @@
import * as GCodePreview from 'gcode-preview'
import PropTypes from 'prop-types'
import { useCallback, useEffect, useRef, useState } from 'react'
import { useCallback, useEffect, useRef } from 'react'
import * as THREE from 'three'
function GCodePreviewUI(props) {
@ -14,33 +14,36 @@ function GCodePreviewUI(props) {
style = {}
} = props
const canvasRef = useRef(null)
const [preview, setPreview] = useState()
const previewRef = useRef(null)
const resizePreview = useCallback(() => {
preview?.resize()
}, [preview])
previewRef.current?.resize()
}, [])
// Ex-ref methods removed; this component is now a regular functional component
useEffect(() => {
setPreview(
GCodePreview.init({
canvas: canvasRef.current,
startLayer,
endLayer,
lineWidth,
topLayerColor: new THREE.Color(topLayerColor).getHex(),
lastSegmentColor: new THREE.Color(lastSegmentColor).getHex(),
buildVolume: { x: 250, y: 220, z: 150 },
initialCameraPosition: [0, 400, 450],
allowDragNDrop: false
})
)
if (!canvasRef.current) return
previewRef.current?.dispose?.()
previewRef.current = GCodePreview.init({
canvas: canvasRef.current,
startLayer,
endLayer,
lineWidth,
topLayerColor: new THREE.Color(topLayerColor).getHex(),
lastSegmentColor: new THREE.Color(lastSegmentColor).getHex(),
buildVolume: { x: 250, y: 220, z: 150 },
initialCameraPosition: [0, 400, 450],
allowDragNDrop: false
})
window.addEventListener('resize', resizePreview)
return () => {
window.removeEventListener('resize', resizePreview)
previewRef.current?.dispose?.()
previewRef.current = null
}
}, [
endLayer,
@ -52,18 +55,27 @@ function GCodePreviewUI(props) {
])
useEffect(() => {
let cancelled = false
const loadFromSrc = async () => {
const preview = previewRef.current
if (!src || !preview) return
try {
const response = await fetch(src)
const text = await response.text()
if (cancelled || previewRef.current !== preview) return
preview.processGCode(text)
} catch (e) {
if (cancelled) return
console.error('Failed to load G-code from src', e)
}
}
loadFromSrc()
}, [src, preview])
return () => {
cancelled = true
}
}, [endLayer, lastSegmentColor, lineWidth, src, startLayer, topLayerColor])
return <canvas ref={canvasRef} style={style}></canvas>
}

View File

@ -17,6 +17,8 @@ import merge from 'lodash/merge'
import { getModelProperty } from '../../../database/ObjectModels'
const { SHOW_CHILD } = TreeSelect
const EMPTY_OBJECT = {}
// Helper to check if two values are equal (handling objects/ids)
const areValuesEqual = (v1, v2) => {
const id1 = v1 && typeof v1 === 'object' && v1._id ? v1._id : v1
@ -28,10 +30,11 @@ const ObjectSelect = ({
type = 'unknown',
showSearch = false,
multiple = false,
treeSelectProps = {},
filter = {},
masterFilter = {},
treeSelectProps = EMPTY_OBJECT,
filter = EMPTY_OBJECT,
masterFilter = EMPTY_OBJECT,
value,
onChange,
disabled = false,
...rest
}) => {
@ -55,11 +58,6 @@ const ObjectSelect = ({
const prevValueRef = useRef(value)
const isInternalChangeRef = useRef(false)
useEffect(() => {
console.log('type', type)
console.log('value', value)
}, [value, type])
// Normalize a value to an identity string so we can detect in-place _id updates
const getValueIdentity = useCallback((val) => {
if (val && typeof val === 'object') {
@ -359,15 +357,15 @@ const ObjectSelect = ({
.filter(Boolean)
}
setTreeSelectValue(value)
if (rest.onChange) rest.onChange(selectedObjects)
onChange?.(selectedObjects)
} else {
// Single selection
const selectedObject = objectList.find((obj) => obj._id === value)
setTreeSelectValue(value)
if (rest.onChange) rest.onChange(selectedObject)
onChange?.(selectedObject)
}
},
[multiple, objectList, rest]
[multiple, objectList, onChange]
)
// Update treeData when objectPropertiesTree changes

View File

@ -438,9 +438,13 @@ const ObjectTable = forwardRef(
// Store the latest updateEventHandler in a ref
updateEventHandlerRef.current = updateEventHandler
const newEventHandler = useCallback(() => {
reload()
}, [reload])
const newEventHandler = useCallback(
(params) => {
logger.debug('New event handler:', params)
reload()
},
[reload]
)
// Subscribe to real-time updates for all items
useEffect(() => {

View File

@ -1,6 +1,5 @@
import AppPasswordIcon from '../../components/Icons/AppPasswordIcon'
import InfoCircleIcon from '../../components/Icons/InfoCircleIcon'
import ReloadIcon from '../../components/Icons/ReloadIcon'
import EditIcon from '../../components/Icons/EditIcon'
import CheckIcon from '../../components/Icons/CheckIcon'
import XMarkIcon from '../../components/Icons/XMarkIcon'
@ -21,13 +20,6 @@ export const AppPassword = {
url: (_id) =>
`/dashboard/management/apppasswords/info?appPasswordId=${_id}`
},
{
name: 'reload',
label: 'Reload',
icon: ReloadIcon,
url: (_id) =>
`/dashboard/management/apppasswords/info?appPasswordId=${_id}&action=reload`
},
{
name: 'edit',

View File

@ -3,7 +3,6 @@ import InfoCircleIcon from '../../components/Icons/InfoCircleIcon'
import EditIcon from '../../components/Icons/EditIcon'
import CheckIcon from '../../components/Icons/CheckIcon'
import XMarkIcon from '../../components/Icons/XMarkIcon'
import ReloadIcon from '../../components/Icons/ReloadIcon'
import BinIcon from '../../components/Icons/BinIcon'
export const Client = {
@ -20,13 +19,6 @@ export const Client = {
icon: InfoCircleIcon,
url: (_id) => `/dashboard/sales/clients/info?clientId=${_id}`
},
{
name: 'reload',
label: 'Reload',
icon: ReloadIcon,
url: (_id) =>
`/dashboard/sales/clients/info?clientId=${_id}&action=reload`
},
{
name: 'edit',
label: 'Edit',

View File

@ -3,7 +3,6 @@ import InfoCircleIcon from '../../components/Icons/InfoCircleIcon'
import EditIcon from '../../components/Icons/EditIcon'
import CheckIcon from '../../components/Icons/CheckIcon'
import XMarkIcon from '../../components/Icons/XMarkIcon'
import ReloadIcon from '../../components/Icons/ReloadIcon'
import BinIcon from '../../components/Icons/BinIcon'
export const Courier = {
@ -20,13 +19,6 @@ export const Courier = {
icon: InfoCircleIcon,
url: (_id) => `/dashboard/management/couriers/info?courierId=${_id}`
},
{
name: 'reload',
label: 'Reload',
icon: ReloadIcon,
url: (_id) =>
`/dashboard/management/couriers/info?courierId=${_id}&action=reload`
},
{
name: 'edit',
label: 'Edit',

View File

@ -3,7 +3,6 @@ import InfoCircleIcon from '../../components/Icons/InfoCircleIcon'
import EditIcon from '../../components/Icons/EditIcon'
import CheckIcon from '../../components/Icons/CheckIcon'
import XMarkIcon from '../../components/Icons/XMarkIcon'
import ReloadIcon from '../../components/Icons/ReloadIcon'
import BinIcon from '../../components/Icons/BinIcon'
export const CourierService = {
@ -21,13 +20,6 @@ export const CourierService = {
url: (_id) =>
`/dashboard/management/courierservices/info?courierServiceId=${_id}`
},
{
name: 'reload',
label: 'Reload',
icon: ReloadIcon,
url: (_id) =>
`/dashboard/management/courierservices/info?courierServiceId=${_id}&action=reload`
},
{
name: 'edit',
label: 'Edit',

View File

@ -1,5 +1,4 @@
import InfoCircleIcon from '../../components/Icons/InfoCircleIcon'
import ReloadIcon from '../../components/Icons/ReloadIcon'
import EditIcon from '../../components/Icons/EditIcon'
import CheckIcon from '../../components/Icons/CheckIcon'
import XMarkIcon from '../../components/Icons/XMarkIcon'
@ -22,13 +21,6 @@ export const DocumentJob = {
`/dashboard/management/documentjobs/info?documentJobId=${_id}`
},
{
name: 'reload',
label: 'Reload',
icon: ReloadIcon,
url: (_id) =>
`/dashboard/management/documentjobs/info?documentJobId=${_id}&action=reload`
},
{
name: 'edit',
label: 'Edit',

View File

@ -1,5 +1,4 @@
import InfoCircleIcon from '../../components/Icons/InfoCircleIcon'
import ReloadIcon from '../../components/Icons/ReloadIcon'
import EditIcon from '../../components/Icons/EditIcon'
import DocumentPrinterIcon from '../../components/Icons/DocumentPrinterIcon'
import CheckIcon from '../../components/Icons/CheckIcon'
@ -21,13 +20,6 @@ export const DocumentPrinter = {
`/dashboard/management/documentprinters/info?documentPrinterId=${_id}`
},
{
name: 'reload',
label: 'Reload',
icon: ReloadIcon,
url: (_id) =>
`/dashboard/management/documentprinters/info?documentPrinterId=${_id}&action=reload`
},
{
name: 'edit',
label: 'Edit',

View File

@ -1,5 +1,4 @@
import InfoCircleIcon from '../../components/Icons/InfoCircleIcon'
import ReloadIcon from '../../components/Icons/ReloadIcon'
import EditIcon from '../../components/Icons/EditIcon'
import CheckIcon from '../../components/Icons/CheckIcon'
import XMarkIcon from '../../components/Icons/XMarkIcon'
@ -21,13 +20,6 @@ export const DocumentSize = {
`/dashboard/management/documentsizes/info?documentSizeId=${_id}`
},
{
name: 'reload',
label: 'Reload',
icon: ReloadIcon,
url: (_id) =>
`/dashboard/management/documentsizes/info?documentSizeId=${_id}&action=reload`
},
{
name: 'edit',
label: 'Edit',

View File

@ -1,5 +1,4 @@
import InfoCircleIcon from '../../components/Icons/InfoCircleIcon'
import ReloadIcon from '../../components/Icons/ReloadIcon'
import EditIcon from '../../components/Icons/EditIcon'
import CheckIcon from '../../components/Icons/CheckIcon'
import XMarkIcon from '../../components/Icons/XMarkIcon'
@ -30,13 +29,6 @@ export const DocumentTemplate = {
`/dashboard/management/documenttemplates/info?documentTemplateId=${_id}`
},
{
name: 'reload',
label: 'Reload',
icon: ReloadIcon,
url: (_id) =>
`/dashboard/management/documenttemplates/info?documentTemplateId=${_id}&action=reload`
},
{
name: 'edit',
label: 'Edit',

View File

@ -1,7 +1,6 @@
import EditIcon from '../../components/Icons/EditIcon'
import FilamentIcon from '../../components/Icons/FilamentIcon'
import InfoCircleIcon from '../../components/Icons/InfoCircleIcon'
import ReloadIcon from '../../components/Icons/ReloadIcon'
import CheckIcon from '../../components/Icons/CheckIcon'
import XMarkIcon from '../../components/Icons/XMarkIcon'
import PlusIcon from '../../components/Icons/PlusIcon'
@ -21,13 +20,6 @@ export const Filament = {
icon: InfoCircleIcon,
url: (_id) => `/dashboard/management/filaments/info?filamentId=${_id}`
},
{
name: 'reload',
label: 'Reload',
icon: ReloadIcon,
url: (_id) =>
`/dashboard/management/filaments/info?filamentId=${_id}&action=reload`
},
{
name: 'edit',
label: 'Edit',

View File

@ -4,7 +4,6 @@ import EditIcon from '../../components/Icons/EditIcon'
import CheckIcon from '../../components/Icons/CheckIcon'
import XMarkIcon from '../../components/Icons/XMarkIcon'
import BinIcon from '../../components/Icons/BinIcon'
import ReloadIcon from '../../components/Icons/ReloadIcon'
export const FilamentSku = {
name: 'filamentSku',
@ -21,13 +20,6 @@ export const FilamentSku = {
url: (_id) =>
`/dashboard/management/filamentskus/info?filamentSkuId=${_id}`
},
{
name: 'reload',
label: 'Reload',
icon: ReloadIcon,
url: (_id) =>
`/dashboard/management/filamentskus/info?filamentSkuId=${_id}&action=reload`
},
{
name: 'edit',
label: 'Edit',
@ -102,6 +94,7 @@ export const FilamentSku = {
'createdAt',
'updatedAt'
],
group: ['filament'],
properties: [
{
name: '_id',

View File

@ -22,14 +22,15 @@ export const FilamentStock = {
'state',
'currentWeight',
'startingWeight',
'filament',
'filamentSku',
'stockLocation',
'createdAt',
'updatedAt'
],
filters: ['_id'],
sorters: ['createdAt', 'updatedAt'],
group: ['filamentSku'],
filters: ['_id', 'filament', 'filament._id', 'filamentSku', 'filamentSku._id'],
sorters: ['createdAt', 'updatedAt', 'filament', 'filamentSku'],
group: ['filament', 'filamentSku'],
properties: [
{
name: '_id',
@ -71,6 +72,17 @@ export const FilamentStock = {
readOnly: true,
columnWidth: 175
},
{
name: 'filament',
label: 'Filament',
type: 'object',
value: null,
objectType: 'filament',
required: true,
showHyperlink: true,
columnWidth: 200,
initial: true
},
{
name: 'filamentSku',
label: 'Filament SKU',
@ -80,7 +92,12 @@ export const FilamentStock = {
initial: true,
required: true,
showHyperlink: true,
columnWidth: 200
columnWidth: 200,
masterFilter: (objectData) => {
return {
filament: objectData?.filament?._id
}
}
},
{
name: 'stockLocation',

View File

@ -4,7 +4,6 @@ import InfoCircleIcon from '../../components/Icons/InfoCircleIcon'
import EditIcon from '../../components/Icons/EditIcon'
import CheckIcon from '../../components/Icons/CheckIcon'
import XMarkIcon from '../../components/Icons/XMarkIcon'
import ReloadIcon from '../../components/Icons/ReloadIcon'
import BinIcon from '../../components/Icons/BinIcon'
export const File = {
@ -21,13 +20,6 @@ export const File = {
icon: InfoCircleIcon,
url: (_id) => `/dashboard/management/files/info?fileId=${_id}`
},
{
name: 'reload',
label: 'Reload',
icon: ReloadIcon,
url: (_id) =>
`/dashboard/management/files/info?fileId=${_id}&action=reload`
},
{
name: 'edit',
label: 'Edit',

View File

@ -4,7 +4,7 @@ import CheckIcon from '../../components/Icons/CheckIcon'
import XMarkIcon from '../../components/Icons/XMarkIcon'
import GCodeFileIcon from '../../components/Icons/GCodeFileIcon'
import InfoCircleIcon from '../../components/Icons/InfoCircleIcon'
import ReloadIcon from '../../components/Icons/ReloadIcon'
import EyeIcon from '../../components/Icons/EyeIcon'
export const GCodeFile = {
name: 'gcodeFile',
@ -12,6 +12,14 @@ export const GCodeFile = {
prefix: 'GCF',
icon: GCodeFileIcon,
actions: [
{
name: 'preview',
label: 'Preview',
row: true,
icon: EyeIcon,
url: (_id) =>
`/dashboard/production/gcodefiles/preview?gcodeFileId=${_id}`
},
{
name: 'info',
label: 'Info',
@ -20,13 +28,6 @@ export const GCodeFile = {
icon: InfoCircleIcon,
url: (_id) => `/dashboard/production/gcodefiles/info?gcodeFileId=${_id}`
},
{
name: 'reload',
label: 'Reload',
icon: ReloadIcon,
url: (_id) =>
`/dashboard/production/gcodefiles/info?gcodeFileId=${_id}&action=reload`
},
{
name: 'download',
label: 'Download',
@ -71,6 +72,7 @@ export const GCodeFile = {
columns: [
'_reference',
'name',
'filament',
'filamentSku',
'cost',
'gcodeFileInfo.estimatedPrintingTimeNormalMode',
@ -80,9 +82,9 @@ export const GCodeFile = {
'gcodeFileInfo.hotPlateTemp',
'updatedAt'
],
filters: ['_id', 'name', 'cost', 'updatedAt'],
sorters: ['name', 'cost', 'createdAt', 'updatedAt'],
group: ['filamentSku'],
filters: ['_id', 'name', 'filament', 'filament._id', 'filamentSku', 'cost', 'updatedAt'],
sorters: ['name', 'filament', 'filamentSku', 'cost', 'createdAt', 'updatedAt'],
group: ['filament', 'filamentSku'],
properties: [
{
name: '_id',
@ -139,6 +141,16 @@ export const GCodeFile = {
filter: ['.gcode', '.g'],
columnWidth: 200
},
{
name: 'filament',
label: 'Filament',
type: 'object',
value: null,
objectType: 'filament',
required: true,
showHyperlink: true,
columnWidth: 200
},
{
name: 'filamentSku',
label: 'Filament SKU',
@ -147,7 +159,12 @@ export const GCodeFile = {
objectType: 'filamentSku',
required: true,
showHyperlink: true,
columnWidth: 200
columnWidth: 200,
masterFilter: (objectData) => {
return {
filament: objectData?.filament?._id
}
}
},
{
name: 'cost',
@ -156,9 +173,9 @@ export const GCodeFile = {
roundNumber: 2,
value: (objectData) => {
const fs = objectData?.filamentSku
const costPerKg =
fs?.overrideCost ? fs?.cost : fs?.filament?.cost
if (!costPerKg || !objectData?.file?.metaData?.filamentUsedG) return undefined
const costPerKg = fs?.overrideCost ? fs?.cost : fs?.filament?.cost
if (!costPerKg || !objectData?.file?.metaData?.filamentUsedG)
return undefined
return objectData.file.metaData.filamentUsedG * (costPerKg / 1000)
},
readOnly: true,

View File

@ -1,6 +1,5 @@
import HostIcon from '../../components/Icons/HostIcon'
import InfoCircleIcon from '../../components/Icons/InfoCircleIcon'
import ReloadIcon from '../../components/Icons/ReloadIcon'
import EditIcon from '../../components/Icons/EditIcon'
import CheckIcon from '../../components/Icons/CheckIcon'
import XMarkIcon from '../../components/Icons/XMarkIcon'
@ -21,13 +20,6 @@ export const Host = {
url: (_id) => `/dashboard/management/hosts/info?hostId=${_id}`
},
{
name: 'reload',
label: 'Reload',
icon: ReloadIcon,
url: (_id) =>
`/dashboard/management/hosts/info?hostId=${_id}&action=reload`
},
{
name: 'edit',
label: 'Edit',

View File

@ -1,6 +1,5 @@
import JobIcon from '../../components/Icons/JobIcon'
import InfoCircleIcon from '../../components/Icons/InfoCircleIcon'
import ReloadIcon from '../../components/Icons/ReloadIcon'
import CheckIcon from '../../components/Icons/CheckIcon'
import dayjs from 'dayjs'
@ -30,12 +29,6 @@ export const Job = {
return objectData?.state?.type != 'draft'
}
},
{
name: 'reload',
label: 'Reload',
icon: ReloadIcon,
url: (_id) => `/dashboard/production/jobs/info?jobId=${_id}&action=reload`
}
],
columns: ['_reference', 'quantity', 'state', 'gcodeFile', 'createdAt'],
filters: ['state', '_id', 'gcodeFile', 'quantity'],

View File

@ -3,7 +3,6 @@ import InfoCircleIcon from '../../components/Icons/InfoCircleIcon'
import EditIcon from '../../components/Icons/EditIcon'
import CheckIcon from '../../components/Icons/CheckIcon'
import XMarkIcon from '../../components/Icons/XMarkIcon'
import ReloadIcon from '../../components/Icons/ReloadIcon'
import BinIcon from '../../components/Icons/BinIcon'
import PlusIcon from '../../components/Icons/PlusIcon'
@ -21,13 +20,6 @@ export const Listing = {
icon: InfoCircleIcon,
url: (_id) => `/dashboard/sales/listings/info?listingId=${_id}`
},
{
name: 'reload',
label: 'Reload',
icon: ReloadIcon,
url: (_id) =>
`/dashboard/sales/listings/info?listingId=${_id}&action=reload`
},
{
name: 'edit',
label: 'Edit',

View File

@ -3,7 +3,6 @@ import InfoCircleIcon from '../../components/Icons/InfoCircleIcon'
import EditIcon from '../../components/Icons/EditIcon'
import CheckIcon from '../../components/Icons/CheckIcon'
import XMarkIcon from '../../components/Icons/XMarkIcon'
import ReloadIcon from '../../components/Icons/ReloadIcon'
import BinIcon from '../../components/Icons/BinIcon'
export const ListingVarient = {
@ -20,13 +19,6 @@ export const ListingVarient = {
icon: InfoCircleIcon,
url: (_id) => `/dashboard/sales/listingvarients/info?listingVarientId=${_id}`
},
{
name: 'reload',
label: 'Reload',
icon: ReloadIcon,
url: (_id) =>
`/dashboard/sales/listingvarients/info?listingVarientId=${_id}&action=reload`
},
{
name: 'edit',
label: 'Edit',

View File

@ -21,13 +21,6 @@ export const Marketplace = {
icon: InfoCircleIcon,
url: (_id) => `/dashboard/sales/marketplaces/info?marketplaceId=${_id}`
},
{
name: 'reload',
label: 'Reload',
icon: ReloadIcon,
url: (_id) =>
`/dashboard/sales/marketplaces/info?marketplaceId=${_id}&action=reload`
},
{
name: 'edit',
label: 'Edit',

View File

@ -3,7 +3,6 @@ import InfoCircleIcon from '../../components/Icons/InfoCircleIcon'
import EditIcon from '../../components/Icons/EditIcon'
import CheckIcon from '../../components/Icons/CheckIcon'
import XMarkIcon from '../../components/Icons/XMarkIcon'
import ReloadIcon from '../../components/Icons/ReloadIcon'
import BinIcon from '../../components/Icons/BinIcon'
export const Material = {
@ -20,13 +19,6 @@ export const Material = {
icon: InfoCircleIcon,
url: (_id) => `/dashboard/management/materials/info?materialId=${_id}`
},
{
name: 'reload',
label: 'Reload',
icon: ReloadIcon,
url: (_id) =>
`/dashboard/management/materials/info?materialId=${_id}&action=reload`
},
{
name: 'edit',
label: 'Edit',

View File

@ -1,6 +1,5 @@
import NoteTypeIcon from '../../components/Icons/NoteTypeIcon'
import InfoCircleIcon from '../../components/Icons/InfoCircleIcon'
import ReloadIcon from '../../components/Icons/ReloadIcon'
import EditIcon from '../../components/Icons/EditIcon'
import CheckIcon from '../../components/Icons/CheckIcon'
import XMarkIcon from '../../components/Icons/XMarkIcon'
@ -19,13 +18,6 @@ export const NoteType = {
icon: InfoCircleIcon,
url: (_id) => `/dashboard/management/notetypes/info?noteTypeId=${_id}`
},
{
name: 'reload',
label: 'Reload',
icon: ReloadIcon,
url: (_id) =>
`/dashboard/management/notetypes/info?noteTypeId=${_id}&action=reload`
},
{
name: 'edit',
label: 'Edit',

View File

@ -230,7 +230,7 @@ export const OrderItem = {
},
{
name: 'sku',
label: 'SKU',
label: 'Item SKU',
type: 'object',
objectType: (objectData) => {
if (objectData?.itemType === 'filament') return 'filamentSku'
@ -238,11 +238,9 @@ export const OrderItem = {
if (objectData?.itemType === 'product') return 'productSku'
return undefined
},
required: false,
required: true,
showHyperlink: true,
columnWidth: 300,
visible: (objectData) =>
['filament', 'part', 'product'].includes(objectData?.itemType),
masterFilter: (objectData) => {
console.log(objectData)
if (objectData?.itemType === 'filament' && objectData?.item?._id) {

View File

@ -1,7 +1,6 @@
import EditIcon from '../../components/Icons/EditIcon'
import InfoCircleIcon from '../../components/Icons/InfoCircleIcon'
import PartIcon from '../../components/Icons/PartIcon'
import ReloadIcon from '../../components/Icons/ReloadIcon'
import CheckIcon from '../../components/Icons/CheckIcon'
import XMarkIcon from '../../components/Icons/XMarkIcon'
import PlusIcon from '../../components/Icons/PlusIcon'
@ -20,13 +19,6 @@ export const Part = {
icon: InfoCircleIcon,
url: (_id) => `/dashboard/management/parts/info?partId=${_id}`
},
{
name: 'reload',
label: 'Reload',
icon: ReloadIcon,
url: (_id) =>
`/dashboard/management/parts/info?partId=${_id}&action=reload`
},
{
name: 'edit',
label: 'Edit',

View File

@ -4,7 +4,6 @@ import EditIcon from '../../components/Icons/EditIcon'
import CheckIcon from '../../components/Icons/CheckIcon'
import XMarkIcon from '../../components/Icons/XMarkIcon'
import BinIcon from '../../components/Icons/BinIcon'
import ReloadIcon from '../../components/Icons/ReloadIcon'
export const PartSku = {
name: 'partSku',
@ -20,13 +19,6 @@ export const PartSku = {
icon: InfoCircleIcon,
url: (_id) => `/dashboard/management/partskus/info?partSkuId=${_id}`
},
{
name: 'reload',
label: 'Reload',
icon: ReloadIcon,
url: (_id) =>
`/dashboard/management/partskus/info?partSkuId=${_id}&action=reload`
},
{
name: 'edit',
label: 'Edit',

View File

@ -26,13 +26,6 @@ export const Printer = {
url: (_id) => `/dashboard/production/printers/info?printerId=${_id}`
},
{
name: 'reload',
label: 'Reload',
icon: ReloadIcon,
url: (_id) =>
`/dashboard/production/printers/info?printerId=${_id}&action=reload`
},
{
name: 'control',
label: 'Control',

View File

@ -1,6 +1,5 @@
import ProductIcon from '../../components/Icons/ProductIcon'
import InfoCircleIcon from '../../components/Icons/InfoCircleIcon'
import ReloadIcon from '../../components/Icons/ReloadIcon'
import EditIcon from '../../components/Icons/EditIcon'
import CheckIcon from '../../components/Icons/CheckIcon'
import XMarkIcon from '../../components/Icons/XMarkIcon'
@ -20,13 +19,6 @@ export const Product = {
icon: InfoCircleIcon,
url: (_id) => `/dashboard/management/products/info?productId=${_id}`
},
{
name: 'reload',
label: 'Reload',
icon: ReloadIcon,
url: (_id) =>
`/dashboard/management/products/info?productId=${_id}&action=reload`
},
{
name: 'edit',
label: 'Edit',

View File

@ -4,7 +4,6 @@ import EditIcon from '../../components/Icons/EditIcon'
import CheckIcon from '../../components/Icons/CheckIcon'
import XMarkIcon from '../../components/Icons/XMarkIcon'
import BinIcon from '../../components/Icons/BinIcon'
import ReloadIcon from '../../components/Icons/ReloadIcon'
export const ProductSku = {
name: 'productSku',
@ -20,13 +19,6 @@ export const ProductSku = {
icon: InfoCircleIcon,
url: (_id) => `/dashboard/management/productskus/info?productSkuId=${_id}`
},
{
name: 'reload',
label: 'Reload',
icon: ReloadIcon,
url: (_id) =>
`/dashboard/management/productskus/info?productSkuId=${_id}&action=reload`
},
{
name: 'edit',
label: 'Edit',

View File

@ -3,7 +3,6 @@ import InfoCircleIcon from '../../components/Icons/InfoCircleIcon'
import EditIcon from '../../components/Icons/EditIcon'
import CheckIcon from '../../components/Icons/CheckIcon'
import XMarkIcon from '../../components/Icons/XMarkIcon'
import ReloadIcon from '../../components/Icons/ReloadIcon'
import BinIcon from '../../components/Icons/BinIcon'
export const TaxRate = {
@ -20,13 +19,6 @@ export const TaxRate = {
icon: InfoCircleIcon,
url: (_id) => `/dashboard/management/taxrates/info?taxRateId=${_id}`
},
{
name: 'reload',
label: 'Reload',
icon: ReloadIcon,
url: (_id) =>
`/dashboard/management/taxrates/info?taxRateId=${_id}&action=reload`
},
{
name: 'edit',
label: 'Edit',

View File

@ -3,7 +3,6 @@ import InfoCircleIcon from '../../components/Icons/InfoCircleIcon'
import EditIcon from '../../components/Icons/EditIcon'
import CheckIcon from '../../components/Icons/CheckIcon'
import XMarkIcon from '../../components/Icons/XMarkIcon'
import ReloadIcon from '../../components/Icons/ReloadIcon'
import BinIcon from '../../components/Icons/BinIcon'
export const TaxRecord = {
@ -20,13 +19,6 @@ export const TaxRecord = {
icon: InfoCircleIcon,
url: (_id) => `/dashboard/management/taxrecords/info?taxRecordId=${_id}`
},
{
name: 'reload',
label: 'Reload',
icon: ReloadIcon,
url: (_id) =>
`/dashboard/management/taxrecords/info?taxRecordId=${_id}&action=reload`
},
{
name: 'edit',
label: 'Edit',

View File

@ -3,7 +3,6 @@ import InfoCircleIcon from '../../components/Icons/InfoCircleIcon'
import EditIcon from '../../components/Icons/EditIcon'
import CheckIcon from '../../components/Icons/CheckIcon'
import XMarkIcon from '../../components/Icons/XMarkIcon'
import ReloadIcon from '../../components/Icons/ReloadIcon'
import BinIcon from '../../components/Icons/BinIcon'
export const Vendor = {
@ -20,13 +19,6 @@ export const Vendor = {
icon: InfoCircleIcon,
url: (_id) => `/dashboard/management/vendors/info?vendorId=${_id}`
},
{
name: 'reload',
label: 'Reload',
icon: ReloadIcon,
url: (_id) =>
`/dashboard/management/vendors/info?vendorId=${_id}&action=reload`
},
{
name: 'edit',
label: 'Edit',

View File

@ -30,6 +30,10 @@ const GCodeFileInfo = lazy(
() =>
import('../components/Dashboard/Production/GCodeFiles/GCodeFileInfo.jsx')
)
const GCodeFilePreview = lazy(
() =>
import('../components/Dashboard/Production/GCodeFiles/GCodeFilePreview.jsx')
)
const ProductionRoutes = [
<Route
@ -65,6 +69,11 @@ const ProductionRoutes = [
key='gcodefiles-info'
path='production/gcodefiles/info'
element={<GCodeFileInfo />}
/>,
<Route
key='gcodefiles-preview'
path='production/gcodefiles/preview'
element={<GCodeFilePreview />}
/>
]