Compare commits
3 Commits
94406a1bfc
...
7e1ec9f3ae
| Author | SHA1 | Date | |
|---|---|---|---|
| 7e1ec9f3ae | |||
| f6986a45cd | |||
| e6ebc16009 |
@ -87,6 +87,5 @@ ipcMain.handle('auth-session-clear', async () => {
|
|||||||
|
|
||||||
// IPC handler for opening external URLs
|
// IPC handler for opening external URLs
|
||||||
ipcMain.handle('open-external-url', (event, url) => {
|
ipcMain.handle('open-external-url', (event, url) => {
|
||||||
console.log('Opening external url...')
|
|
||||||
shell.openExternal(url)
|
shell.openExternal(url)
|
||||||
})
|
})
|
||||||
|
|||||||
@ -155,7 +155,6 @@ export function setupMainWindowAppEvents(app) {
|
|||||||
|
|
||||||
app.on('open-url', (event, url) => {
|
app.on('open-url', (event, url) => {
|
||||||
event.preventDefault()
|
event.preventDefault()
|
||||||
console.log('App opened with URL:', url)
|
|
||||||
if (url.startsWith('farmcontrol://app')) {
|
if (url.startsWith('farmcontrol://app')) {
|
||||||
// Extract the path/query after 'farmcontrol://app'
|
// Extract the path/query after 'farmcontrol://app'
|
||||||
const redirectPath = url.replace('farmcontrol://app', '') || '/'
|
const redirectPath = url.replace('farmcontrol://app', '') || '/'
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"short_name": "React App",
|
"short_name": "Farm Control",
|
||||||
"name": "Create React App Sample",
|
"name": "Farm Control",
|
||||||
"icons": [
|
"icons": [
|
||||||
{
|
{
|
||||||
"src": "favicon.ico",
|
"src": "favicon.ico",
|
||||||
|
|||||||
@ -17,6 +17,10 @@ import CloudIcon from '../../Icons/CloudIcon.jsx'
|
|||||||
import { ApiServerContext } from '../context/ApiServerContext.jsx'
|
import { ApiServerContext } from '../context/ApiServerContext.jsx'
|
||||||
import BoolDisplay from '../common/BoolDisplay.jsx'
|
import BoolDisplay from '../common/BoolDisplay.jsx'
|
||||||
import InfoCollapse from '../common/InfoCollapse.jsx'
|
import InfoCollapse from '../common/InfoCollapse.jsx'
|
||||||
|
import loglevel from 'loglevel'
|
||||||
|
import config from '../../../config'
|
||||||
|
const logger = loglevel.getLogger('ApiContextDebug')
|
||||||
|
logger.setLevel(config.logLevel)
|
||||||
|
|
||||||
const { Text, Paragraph } = Typography
|
const { Text, Paragraph } = Typography
|
||||||
|
|
||||||
@ -140,11 +144,10 @@ const ApiContextDebug = () => {
|
|||||||
)
|
)
|
||||||
msgApi.destroy()
|
msgApi.destroy()
|
||||||
msgApi.success('fetchObject test completed')
|
msgApi.success('fetchObject test completed')
|
||||||
console.log('fetchObject result:', result)
|
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
msgApi.destroy()
|
msgApi.destroy()
|
||||||
msgApi.error('fetchObject test failed')
|
msgApi.error('fetchObject test failed')
|
||||||
console.error('fetchObject error:', err)
|
logger.error('fetchObject error:', err)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -157,11 +160,10 @@ const ApiContextDebug = () => {
|
|||||||
})
|
})
|
||||||
msgApi.destroy()
|
msgApi.destroy()
|
||||||
msgApi.success('fetchObjects test completed')
|
msgApi.success('fetchObjects test completed')
|
||||||
console.log('fetchObjects result:', result)
|
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
msgApi.destroy()
|
msgApi.destroy()
|
||||||
msgApi.error('fetchObjects test failed')
|
msgApi.error('fetchObjects test failed')
|
||||||
console.error('fetchObjects error:', err)
|
logger.error('fetchObjects error:', err)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -171,7 +173,7 @@ const ApiContextDebug = () => {
|
|||||||
msgApi.success('Lock command sent')
|
msgApi.success('Lock command sent')
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
msgApi.error('Lock command failed')
|
msgApi.error('Lock command failed')
|
||||||
console.error('Lock error:', err)
|
logger.error('Lock error:', err)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -181,7 +183,7 @@ const ApiContextDebug = () => {
|
|||||||
msgApi.success('Unlock command sent')
|
msgApi.success('Unlock command sent')
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
msgApi.error('Unlock command failed')
|
msgApi.error('Unlock command failed')
|
||||||
console.error('Unlock error:', err)
|
logger.error('Unlock error:', err)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -194,11 +196,10 @@ const ApiContextDebug = () => {
|
|||||||
)
|
)
|
||||||
msgApi.destroy()
|
msgApi.destroy()
|
||||||
msgApi.success('fetchObjectLock test completed')
|
msgApi.success('fetchObjectLock test completed')
|
||||||
console.log('fetchObjectLock result:', result)
|
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
msgApi.destroy()
|
msgApi.destroy()
|
||||||
msgApi.error('fetchObjectLock test failed')
|
msgApi.error('fetchObjectLock test failed')
|
||||||
console.error('fetchObjectLock error:', err)
|
logger.error('fetchObjectLock error:', err)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -216,11 +217,10 @@ const ApiContextDebug = () => {
|
|||||||
)
|
)
|
||||||
msgApi.destroy()
|
msgApi.destroy()
|
||||||
msgApi.success('updateObject test completed')
|
msgApi.success('updateObject test completed')
|
||||||
console.log('updateObject result:', result)
|
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
msgApi.destroy()
|
msgApi.destroy()
|
||||||
msgApi.error('updateObject test failed')
|
msgApi.error('updateObject test failed')
|
||||||
console.error('updateObject error:', err)
|
logger.error('updateObject error:', err)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -234,11 +234,10 @@ const ApiContextDebug = () => {
|
|||||||
const result = await createObject(testInputs.objectType, testData)
|
const result = await createObject(testInputs.objectType, testData)
|
||||||
msgApi.destroy()
|
msgApi.destroy()
|
||||||
msgApi.success('createObject test completed')
|
msgApi.success('createObject test completed')
|
||||||
console.log('createObject result:', result)
|
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
msgApi.destroy()
|
msgApi.destroy()
|
||||||
msgApi.error('createObject test failed')
|
msgApi.error('createObject test failed')
|
||||||
console.error('createObject error:', err)
|
logger.error('createObject error:', err)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -251,11 +250,10 @@ const ApiContextDebug = () => {
|
|||||||
)
|
)
|
||||||
msgApi.destroy()
|
msgApi.destroy()
|
||||||
msgApi.success('deleteObject test completed')
|
msgApi.success('deleteObject test completed')
|
||||||
console.log('deleteObject result:', result)
|
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
msgApi.destroy()
|
msgApi.destroy()
|
||||||
msgApi.error('deleteObject test failed')
|
msgApi.error('deleteObject test failed')
|
||||||
console.error('deleteObject error:', err)
|
logger.error('deleteObject error:', err)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -270,11 +268,10 @@ const ApiContextDebug = () => {
|
|||||||
const result = await fetchObjectsByProperty(testInputs.objectType, params)
|
const result = await fetchObjectsByProperty(testInputs.objectType, params)
|
||||||
msgApi.destroy()
|
msgApi.destroy()
|
||||||
msgApi.success('fetchObjectsByProperty test completed')
|
msgApi.success('fetchObjectsByProperty test completed')
|
||||||
console.log('fetchObjectsByProperty result:', result)
|
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
msgApi.destroy()
|
msgApi.destroy()
|
||||||
msgApi.error('fetchObjectsByProperty test failed')
|
msgApi.error('fetchObjectsByProperty test failed')
|
||||||
console.error('fetchObjectsByProperty error:', err)
|
logger.error('fetchObjectsByProperty error:', err)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -284,11 +281,10 @@ const ApiContextDebug = () => {
|
|||||||
const result = await fetchSpotlightData(testInputs.query)
|
const result = await fetchSpotlightData(testInputs.query)
|
||||||
msgApi.destroy()
|
msgApi.destroy()
|
||||||
msgApi.success('fetchSpotlightData test completed')
|
msgApi.success('fetchSpotlightData test completed')
|
||||||
console.log('fetchSpotlightData result:', result)
|
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
msgApi.destroy()
|
msgApi.destroy()
|
||||||
msgApi.error('fetchSpotlightData test failed')
|
msgApi.error('fetchSpotlightData test failed')
|
||||||
console.error('fetchSpotlightData error:', err)
|
logger.error('fetchSpotlightData error:', err)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -305,7 +301,7 @@ const ApiContextDebug = () => {
|
|||||||
} catch (err) {
|
} catch (err) {
|
||||||
msgApi.destroy()
|
msgApi.destroy()
|
||||||
msgApi.error('fetchFileContent test failed')
|
msgApi.error('fetchFileContent test failed')
|
||||||
console.error('fetchFileContent error:', err)
|
logger.error('fetchFileContent error:', err)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -325,13 +321,12 @@ const ApiContextDebug = () => {
|
|||||||
} else {
|
} else {
|
||||||
msgApi.error('fetchTemplatePreview test failed')
|
msgApi.error('fetchTemplatePreview test failed')
|
||||||
}
|
}
|
||||||
console.log('fetchTemplatePreview result:', result)
|
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
msgApi.destroy()
|
msgApi.destroy()
|
||||||
msgApi.error('fetchTemplatePreview test failed')
|
msgApi.error('fetchTemplatePreview test failed')
|
||||||
console.error('fetchTemplatePreview error:', err)
|
logger.error('fetchTemplatePreview error:', err)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -341,11 +336,10 @@ const ApiContextDebug = () => {
|
|||||||
const result = await fetchNotes(testInputs.parentId)
|
const result = await fetchNotes(testInputs.parentId)
|
||||||
msgApi.destroy()
|
msgApi.destroy()
|
||||||
msgApi.success('fetchNotes test completed')
|
msgApi.success('fetchNotes test completed')
|
||||||
console.log('fetchNotes result:', result)
|
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
msgApi.destroy()
|
msgApi.destroy()
|
||||||
msgApi.error('fetchNotes test failed')
|
msgApi.error('fetchNotes test failed')
|
||||||
console.error('fetchNotes error:', err)
|
logger.error('fetchNotes error:', err)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -360,12 +354,11 @@ const ApiContextDebug = () => {
|
|||||||
} else {
|
} else {
|
||||||
msgApi.error('fetchHostOTP test failed')
|
msgApi.error('fetchHostOTP test failed')
|
||||||
}
|
}
|
||||||
console.log('fetchHostOTP result:', result)
|
|
||||||
})
|
})
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
msgApi.destroy()
|
msgApi.destroy()
|
||||||
msgApi.error('fetchHostOTP test failed')
|
msgApi.error('fetchHostOTP test failed')
|
||||||
console.error('fetchHostOTP error:', err)
|
logger.error('fetchHostOTP error:', err)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -384,20 +377,19 @@ const ApiContextDebug = () => {
|
|||||||
} else {
|
} else {
|
||||||
msgApi.error('sendObjectAction test failed')
|
msgApi.error('sendObjectAction test failed')
|
||||||
}
|
}
|
||||||
console.log('sendObjectAction result:', result)
|
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
msgApi.destroy()
|
msgApi.destroy()
|
||||||
msgApi.error('sendObjectAction test failed')
|
msgApi.error('sendObjectAction test failed')
|
||||||
console.error('sendObjectAction error:', err)
|
logger.error('sendObjectAction error:', err)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const testSubscribeToObjectUpdates = () => {
|
const testSubscribeToObjectUpdates = () => {
|
||||||
try {
|
try {
|
||||||
const callback = (data) => {
|
const callback = (data) => {
|
||||||
console.log('Object update received:', data)
|
logger.debug('Object update received:', data)
|
||||||
}
|
}
|
||||||
const unsubscribe = subscribeToObjectUpdates(
|
const unsubscribe = subscribeToObjectUpdates(
|
||||||
testInputs.objectId,
|
testInputs.objectId,
|
||||||
@ -405,25 +397,25 @@ const ApiContextDebug = () => {
|
|||||||
callback
|
callback
|
||||||
)
|
)
|
||||||
msgApi.success('Subscribed to object updates')
|
msgApi.success('Subscribed to object updates')
|
||||||
console.log('Subscribed to object updates for test-id')
|
logger.debug('Subscribed to object updates for test-id')
|
||||||
|
|
||||||
// Store unsubscribe function for cleanup
|
// Store unsubscribe function for cleanup
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
if (unsubscribe) {
|
if (unsubscribe) {
|
||||||
unsubscribe()
|
unsubscribe()
|
||||||
console.log('Unsubscribed from object updates')
|
logger.debug('Unsubscribed from object updates')
|
||||||
}
|
}
|
||||||
}, 10000) // Auto-unsubscribe after 10 seconds
|
}, 10000) // Auto-unsubscribe after 10 seconds
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
msgApi.error('Subscribe to object updates failed')
|
msgApi.error('Subscribe to object updates failed')
|
||||||
console.error('Subscribe error:', err)
|
logger.error('Subscribe error:', err)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const testSubscribeToObjectEvent = () => {
|
const testSubscribeToObjectEvent = () => {
|
||||||
try {
|
try {
|
||||||
const callback = (event) => {
|
const callback = (event) => {
|
||||||
console.log('Object event received:', event)
|
logger.debug('Object event received:', event)
|
||||||
}
|
}
|
||||||
const unsubscribe = subscribeToObjectEvent(
|
const unsubscribe = subscribeToObjectEvent(
|
||||||
testInputs.objectId,
|
testInputs.objectId,
|
||||||
@ -432,50 +424,50 @@ const ApiContextDebug = () => {
|
|||||||
callback
|
callback
|
||||||
)
|
)
|
||||||
msgApi.success('Subscribed to object events')
|
msgApi.success('Subscribed to object events')
|
||||||
console.log('Subscribed to object events for test-id')
|
logger.debug('Subscribed to object events for test-id')
|
||||||
|
|
||||||
// Store unsubscribe function for cleanup
|
// Store unsubscribe function for cleanup
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
if (unsubscribe) {
|
if (unsubscribe) {
|
||||||
unsubscribe()
|
unsubscribe()
|
||||||
console.log('Unsubscribed from object events')
|
logger.debug('Unsubscribed from object events')
|
||||||
}
|
}
|
||||||
}, 10000) // Auto-unsubscribe after 10 seconds
|
}, 10000) // Auto-unsubscribe after 10 seconds
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
msgApi.error('Subscribe to object events failed')
|
msgApi.error('Subscribe to object events failed')
|
||||||
console.error('Subscribe error:', err)
|
logger.error('Subscribe error:', err)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const testSubscribeToObjectTypeUpdates = () => {
|
const testSubscribeToObjectTypeUpdates = () => {
|
||||||
try {
|
try {
|
||||||
const callback = (data) => {
|
const callback = (data) => {
|
||||||
console.log('Object type update received:', data)
|
logger.debug('Object type update received:', data)
|
||||||
}
|
}
|
||||||
const unsubscribe = subscribeToObjectTypeUpdates(
|
const unsubscribe = subscribeToObjectTypeUpdates(
|
||||||
testInputs.objectType,
|
testInputs.objectType,
|
||||||
callback
|
callback
|
||||||
)
|
)
|
||||||
msgApi.success('Subscribed to object type updates')
|
msgApi.success('Subscribed to object type updates')
|
||||||
console.log('Subscribed to object type updates for user')
|
logger.debug('Subscribed to object type updates for user')
|
||||||
|
|
||||||
// Store unsubscribe function for cleanup
|
// Store unsubscribe function for cleanup
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
if (unsubscribe) {
|
if (unsubscribe) {
|
||||||
unsubscribe()
|
unsubscribe()
|
||||||
console.log('Unsubscribed from object type updates')
|
logger.debug('Unsubscribed from object type updates')
|
||||||
}
|
}
|
||||||
}, 10000) // Auto-unsubscribe after 10 seconds
|
}, 10000) // Auto-unsubscribe after 10 seconds
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
msgApi.error('Subscribe to object type updates failed')
|
msgApi.error('Subscribe to object type updates failed')
|
||||||
console.error('Subscribe error:', err)
|
logger.error('Subscribe error:', err)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const testSubscribeToObjectLock = () => {
|
const testSubscribeToObjectLock = () => {
|
||||||
try {
|
try {
|
||||||
const callback = (lockData) => {
|
const callback = (lockData) => {
|
||||||
console.log('Object lock update received:', lockData)
|
logger.debug('Object lock update received:', lockData)
|
||||||
}
|
}
|
||||||
const unsubscribe = subscribeToObjectLock(
|
const unsubscribe = subscribeToObjectLock(
|
||||||
testInputs.objectId,
|
testInputs.objectId,
|
||||||
@ -483,18 +475,18 @@ const ApiContextDebug = () => {
|
|||||||
callback
|
callback
|
||||||
)
|
)
|
||||||
msgApi.success('Subscribed to object lock updates')
|
msgApi.success('Subscribed to object lock updates')
|
||||||
console.log('Subscribed to object lock updates for test-id')
|
logger.debug('Subscribed to object lock updates for test-id')
|
||||||
|
|
||||||
// Store unsubscribe function for cleanup
|
// Store unsubscribe function for cleanup
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
if (unsubscribe) {
|
if (unsubscribe) {
|
||||||
unsubscribe()
|
unsubscribe()
|
||||||
console.log('Unsubscribed from object lock updates')
|
logger.debug('Unsubscribed from object lock updates')
|
||||||
}
|
}
|
||||||
}, 10000) // Auto-unsubscribe after 10 seconds
|
}, 10000) // Auto-unsubscribe after 10 seconds
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
msgApi.error('Subscribe to object lock updates failed')
|
msgApi.error('Subscribe to object lock updates failed')
|
||||||
console.error('Subscribe error:', err)
|
logger.error('Subscribe error:', err)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -67,7 +67,6 @@ const LoadFilamentStock = ({
|
|||||||
'printer',
|
'printer',
|
||||||
'filamentSensor',
|
'filamentSensor',
|
||||||
(event) => {
|
(event) => {
|
||||||
console.log('filamentSensor', event.data)
|
|
||||||
setFilamentSensorDetected(event.data.detected)
|
setFilamentSensorDetected(event.data.detected)
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
@ -76,7 +75,7 @@ const LoadFilamentStock = ({
|
|||||||
if (filamentStockEventUnsubscribe) filamentStockEventUnsubscribe()
|
if (filamentStockEventUnsubscribe) filamentStockEventUnsubscribe()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}, [printer?._id, connected])
|
}, [printer?._id, connected, subscribeToObjectEvent])
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
// Validate form fields
|
// Validate form fields
|
||||||
|
|||||||
@ -60,7 +60,7 @@ const UnloadFilamentStock = ({ onOk, reset, printer = null }) => {
|
|||||||
if (filamentStockEventUnsubscribe) filamentStockEventUnsubscribe()
|
if (filamentStockEventUnsubscribe) filamentStockEventUnsubscribe()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}, [printer?._id, connected])
|
}, [printer?._id, connected, subscribeToObjectEvent])
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (reset) {
|
if (reset) {
|
||||||
|
|||||||
@ -145,7 +145,6 @@ const PartStockInfo = () => {
|
|||||||
style={{ height: '100%' }}
|
style={{ height: '100%' }}
|
||||||
ref={objectFormRef}
|
ref={objectFormRef}
|
||||||
onStateChange={(state) => {
|
onStateChange={(state) => {
|
||||||
console.log('Got edit form state change', state)
|
|
||||||
setEditFormState((prev) => ({ ...prev, ...state }))
|
setEditFormState((prev) => ({ ...prev, ...state }))
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
|
|||||||
@ -145,7 +145,6 @@ const StockAuditInfo = () => {
|
|||||||
style={{ height: '100%' }}
|
style={{ height: '100%' }}
|
||||||
ref={objectFormRef}
|
ref={objectFormRef}
|
||||||
onStateChange={(state) => {
|
onStateChange={(state) => {
|
||||||
console.log('Got edit form state change', state)
|
|
||||||
setEditFormState((prev) => ({ ...prev, ...state }))
|
setEditFormState((prev) => ({ ...prev, ...state }))
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
|
|||||||
@ -60,9 +60,6 @@ const NewDocumentJob = ({ onOk, defaultValues = {} }) => {
|
|||||||
<TemplatePreview
|
<TemplatePreview
|
||||||
objectData={objectData?.object}
|
objectData={objectData?.object}
|
||||||
documentTemplate={objectData?.documentTemplate}
|
documentTemplate={objectData?.documentTemplate}
|
||||||
onPreviewMessage={(message) => {
|
|
||||||
console.log(message)
|
|
||||||
}}
|
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
}
|
}
|
||||||
|
|||||||
@ -136,7 +136,6 @@ const DocumentTemplateDesign = () => {
|
|||||||
style={{ height: '100%' }}
|
style={{ height: '100%' }}
|
||||||
ref={objectFormRef}
|
ref={objectFormRef}
|
||||||
onStateChange={(state) => {
|
onStateChange={(state) => {
|
||||||
console.log('Got edit form state change', state)
|
|
||||||
setEditFormState((prev) => ({ ...prev, ...state }))
|
setEditFormState((prev) => ({ ...prev, ...state }))
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
|
|||||||
@ -147,7 +147,6 @@ const DocumentTemplateInfo = () => {
|
|||||||
style={{ height: '100%' }}
|
style={{ height: '100%' }}
|
||||||
ref={objectFormRef}
|
ref={objectFormRef}
|
||||||
onStateChange={(state) => {
|
onStateChange={(state) => {
|
||||||
console.log('Got edit form state change', state)
|
|
||||||
setEditFormState((prev) => ({ ...prev, ...state }))
|
setEditFormState((prev) => ({ ...prev, ...state }))
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
|
|||||||
@ -151,7 +151,6 @@ const FileInfo = () => {
|
|||||||
style={{ height: '100%' }}
|
style={{ height: '100%' }}
|
||||||
ref={objectFormRef}
|
ref={objectFormRef}
|
||||||
onStateChange={(state) => {
|
onStateChange={(state) => {
|
||||||
console.log(state)
|
|
||||||
setEditFormState((prev) => ({ ...prev, ...state }))
|
setEditFormState((prev) => ({ ...prev, ...state }))
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
import PropTypes from 'prop-types'
|
import PropTypes from 'prop-types'
|
||||||
import { useContext, useEffect, useState, useRef } from 'react'
|
import { useContext, useEffect, useState, useRef, useCallback } from 'react'
|
||||||
import { Input, Result, Typography, Flex, Progress } from 'antd'
|
import { Input, Result, Typography, Flex, Progress } from 'antd'
|
||||||
import { LoadingOutlined } from '@ant-design/icons'
|
import { LoadingOutlined } from '@ant-design/icons'
|
||||||
import { ApiServerContext } from '../../context/ApiServerContext'
|
import { ApiServerContext } from '../../context/ApiServerContext'
|
||||||
@ -17,7 +17,7 @@ const HostOTP = ({ id }) => {
|
|||||||
const [initialized, setInitialized] = useState(false)
|
const [initialized, setInitialized] = useState(false)
|
||||||
const intervalRef = useRef(null)
|
const intervalRef = useRef(null)
|
||||||
|
|
||||||
const fetchNewOTP = () => {
|
const fetchNewOTP = useCallback(() => {
|
||||||
setLoading(true)
|
setLoading(true)
|
||||||
setHostObject(null) // Reset to show loading
|
setHostObject(null) // Reset to show loading
|
||||||
fetchHostOTP(id, (hostOTPObject) => {
|
fetchHostOTP(id, (hostOTPObject) => {
|
||||||
@ -33,14 +33,14 @@ const HostOTP = ({ id }) => {
|
|||||||
setTotalTime(remaining)
|
setTotalTime(remaining)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}, [id, fetchHostOTP])
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (hostObject === null && initialized == false) {
|
if (hostObject === null && initialized == false) {
|
||||||
setInitialized(true)
|
setInitialized(true)
|
||||||
fetchNewOTP()
|
fetchNewOTP()
|
||||||
}
|
}
|
||||||
}, [id])
|
}, [id, fetchNewOTP, initialized, hostObject])
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (hostObject && timeRemaining > 0) {
|
if (hostObject && timeRemaining > 0) {
|
||||||
@ -62,7 +62,7 @@ const HostOTP = ({ id }) => {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}, [hostObject, timeRemaining])
|
}, [hostObject, timeRemaining, fetchNewOTP])
|
||||||
|
|
||||||
// Clean up interval on unmount
|
// Clean up interval on unmount
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
|
|||||||
@ -147,7 +147,6 @@ const GCodeFileInfo = () => {
|
|||||||
style={{ height: '100%' }}
|
style={{ height: '100%' }}
|
||||||
ref={objectFormRef}
|
ref={objectFormRef}
|
||||||
onStateChange={(state) => {
|
onStateChange={(state) => {
|
||||||
console.log('Got edit form state change', state)
|
|
||||||
setEditFormState((prev) => ({ ...prev, ...state }))
|
setEditFormState((prev) => ({ ...prev, ...state }))
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
import { useState, useContext, useEffect } from 'react'
|
import { useState, useContext, useEffect, useCallback } from 'react'
|
||||||
import PropTypes from 'prop-types'
|
import PropTypes from 'prop-types'
|
||||||
import WizardView from '../../common/WizardView'
|
import WizardView from '../../common/WizardView'
|
||||||
import { ApiServerContext } from '../../context/ApiServerContext'
|
import { ApiServerContext } from '../../context/ApiServerContext'
|
||||||
@ -15,7 +15,7 @@ const DeployJob = ({ onOk, objectData = undefined }) => {
|
|||||||
const [subJobsCount, setSubJobsCount] = useState(999)
|
const [subJobsCount, setSubJobsCount] = useState(999)
|
||||||
const { sendObjectAction, fetchObjects } = useContext(ApiServerContext)
|
const { sendObjectAction, fetchObjects } = useContext(ApiServerContext)
|
||||||
|
|
||||||
const handleDeploy = async () => {
|
const handleDeploy = useCallback(async () => {
|
||||||
setDeployLoading(true)
|
setDeployLoading(true)
|
||||||
var hasMore = true
|
var hasMore = true
|
||||||
var currentPage = 1
|
var currentPage = 1
|
||||||
@ -34,29 +34,22 @@ const DeployJob = ({ onOk, objectData = undefined }) => {
|
|||||||
}
|
}
|
||||||
setSubJobsCount(subJobs.length)
|
setSubJobsCount(subJobs.length)
|
||||||
subJobs.forEach((subJob) => {
|
subJobs.forEach((subJob) => {
|
||||||
console.log(
|
|
||||||
'Deploying subjob:',
|
|
||||||
subJob._id,
|
|
||||||
'to printer:',
|
|
||||||
subJob.printer._id
|
|
||||||
)
|
|
||||||
sendObjectAction(
|
sendObjectAction(
|
||||||
subJob.printer._id,
|
subJob.printer._id,
|
||||||
'printer',
|
'printer',
|
||||||
{ type: 'deploy', data: subJob },
|
{ type: 'deploy', data: subJob },
|
||||||
(result) => {
|
() => {
|
||||||
console.log('result', result)
|
|
||||||
setDeployedSubJobsCount((prev) => prev + 1)
|
setDeployedSubJobsCount((prev) => prev + 1)
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
})
|
})
|
||||||
}
|
}, [job._id, sendObjectAction, fetchObjects])
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (deployedSubJobsCount == subJobsCount && deployLoading == true) {
|
if (deployedSubJobsCount == subJobsCount && deployLoading == true) {
|
||||||
onOk()
|
onOk()
|
||||||
}
|
}
|
||||||
}, [deployedSubJobsCount, subJobsCount, deployLoading])
|
}, [deployedSubJobsCount, subJobsCount, deployLoading, onOk])
|
||||||
|
|
||||||
const steps = [
|
const steps = [
|
||||||
{
|
{
|
||||||
|
|||||||
@ -324,7 +324,6 @@ const ControlPrinter = () => {
|
|||||||
type='printer'
|
type='printer'
|
||||||
ref={objectFormRef}
|
ref={objectFormRef}
|
||||||
onStateChange={(state) => {
|
onStateChange={(state) => {
|
||||||
console.log('Got edit form state change', state)
|
|
||||||
setEditFormState((prev) => ({ ...prev, ...state }))
|
setEditFormState((prev) => ({ ...prev, ...state }))
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
|
|||||||
@ -53,7 +53,6 @@ const PrinterInfo = () => {
|
|||||||
},
|
},
|
||||||
edit: () => {
|
edit: () => {
|
||||||
objectFormRef?.current.startEditing()
|
objectFormRef?.current.startEditing()
|
||||||
console.log('CALLING START EDITING')
|
|
||||||
return false
|
return false
|
||||||
},
|
},
|
||||||
cancelEdit: () => {
|
cancelEdit: () => {
|
||||||
@ -143,7 +142,6 @@ const PrinterInfo = () => {
|
|||||||
style={{ height: '100%' }}
|
style={{ height: '100%' }}
|
||||||
ref={objectFormRef}
|
ref={objectFormRef}
|
||||||
onStateChange={(state) => {
|
onStateChange={(state) => {
|
||||||
console.log('Got edit form state change', state)
|
|
||||||
setEditFormState((prev) => ({ ...prev, ...state }))
|
setEditFormState((prev) => ({ ...prev, ...state }))
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
|
|||||||
@ -162,9 +162,7 @@ const AlertsDisplay = ({
|
|||||||
icon={getAlertIcon(alert.type, alert.priority)}
|
icon={getAlertIcon(alert.type, alert.priority)}
|
||||||
showIcon
|
showIcon
|
||||||
closable={showDismiss && alert.canDismiss}
|
closable={showDismiss && alert.canDismiss}
|
||||||
onClose={() => {
|
onClose={() => {}}
|
||||||
console.log('Closing alert:', alert._id)
|
|
||||||
}}
|
|
||||||
action={
|
action={
|
||||||
showActions ? (
|
showActions ? (
|
||||||
<Dropdown menu={menu} on>
|
<Dropdown menu={menu} on>
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
// DashboardNavigation.js
|
// DashboardNavigation.js
|
||||||
import { useContext, useEffect, useState } from 'react'
|
import { useContext, useEffect, useState, useMemo } from 'react'
|
||||||
import {
|
import {
|
||||||
Menu,
|
Menu,
|
||||||
Flex,
|
Flex,
|
||||||
@ -59,28 +59,31 @@ const DashboardNavigation = () => {
|
|||||||
const isMobile = useMediaQuery({ maxWidth: 768 })
|
const isMobile = useMediaQuery({ maxWidth: 768 })
|
||||||
const { platform, isElectron, isFullScreen } = useContext(ElectronContext)
|
const { platform, isElectron, isFullScreen } = useContext(ElectronContext)
|
||||||
|
|
||||||
const mainMenuItems = [
|
const mainMenuItems = useMemo(
|
||||||
{
|
() => [
|
||||||
key: 'production',
|
{
|
||||||
label: 'Production',
|
key: 'production',
|
||||||
icon: <ProductionIcon />
|
label: 'Production',
|
||||||
},
|
icon: <ProductionIcon />
|
||||||
{
|
},
|
||||||
key: 'inventory',
|
{
|
||||||
label: 'Inventory',
|
key: 'inventory',
|
||||||
icon: <InventoryIcon />
|
label: 'Inventory',
|
||||||
},
|
icon: <InventoryIcon />
|
||||||
{
|
},
|
||||||
key: 'finance',
|
{
|
||||||
label: 'Finance',
|
key: 'finance',
|
||||||
icon: <FinanceIcon />
|
label: 'Finance',
|
||||||
},
|
icon: <FinanceIcon />
|
||||||
{
|
},
|
||||||
key: 'management',
|
{
|
||||||
label: 'Management',
|
key: 'management',
|
||||||
icon: <SettingsIcon />
|
label: 'Management',
|
||||||
}
|
icon: <SettingsIcon />
|
||||||
]
|
}
|
||||||
|
],
|
||||||
|
[]
|
||||||
|
)
|
||||||
|
|
||||||
const userMenuItems = {
|
const userMenuItems = {
|
||||||
items: [
|
items: [
|
||||||
@ -119,7 +122,7 @@ const DashboardNavigation = () => {
|
|||||||
)
|
)
|
||||||
setSelectedKey(pathParts[1]) // Return the section (production/management)
|
setSelectedKey(pathParts[1]) // Return the section (production/management)
|
||||||
}
|
}
|
||||||
}, [location.pathname])
|
}, [location.pathname, mainMenuItems])
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (connecting == true) {
|
if (connecting == true) {
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
import PropTypes from 'prop-types'
|
import PropTypes from 'prop-types'
|
||||||
import { Tree, Typography, Space, Tag } from 'antd'
|
import { Tree, Typography, Space, Tag } from 'antd'
|
||||||
import { useState, useMemo } from 'react'
|
import { useState, useMemo, useCallback } from 'react'
|
||||||
import XMarkIcon from '../../Icons/XMarkIcon'
|
import XMarkIcon from '../../Icons/XMarkIcon'
|
||||||
import QuestionCircleIcon from '../../Icons/QuestionCircleIcon'
|
import QuestionCircleIcon from '../../Icons/QuestionCircleIcon'
|
||||||
import JsonStringIcon from '../../Icons/JsonStringIcon'
|
import JsonStringIcon from '../../Icons/JsonStringIcon'
|
||||||
@ -48,7 +48,7 @@ const DataTree = ({
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Function to format value for display
|
// Function to format value for display
|
||||||
const formatValue = (value) => {
|
const formatValue = useCallback((value) => {
|
||||||
if (value === null) return 'null'
|
if (value === null) return 'null'
|
||||||
if (value === undefined) return 'undefined'
|
if (value === undefined) return 'undefined'
|
||||||
if (typeof value === 'boolean') return value.toString()
|
if (typeof value === 'boolean') return value.toString()
|
||||||
@ -63,10 +63,10 @@ const DataTree = ({
|
|||||||
return `Object (${keys.length} properties)`
|
return `Object (${keys.length} properties)`
|
||||||
}
|
}
|
||||||
return String(value)
|
return String(value)
|
||||||
}
|
}, [])
|
||||||
|
|
||||||
// Function to get raw value for copying
|
// Function to get raw value for copying
|
||||||
const getCopyValue = (value) => {
|
const getCopyValue = useCallback((value) => {
|
||||||
if (value === null) return 'null'
|
if (value === null) return 'null'
|
||||||
if (value === undefined) return 'undefined'
|
if (value === undefined) return 'undefined'
|
||||||
if (typeof value === 'boolean') return value.toString()
|
if (typeof value === 'boolean') return value.toString()
|
||||||
@ -75,64 +75,67 @@ const DataTree = ({
|
|||||||
if (Array.isArray(value)) return JSON.stringify(value, null, 2)
|
if (Array.isArray(value)) return JSON.stringify(value, null, 2)
|
||||||
if (typeof value === 'object') return JSON.stringify(value, null, 2)
|
if (typeof value === 'object') return JSON.stringify(value, null, 2)
|
||||||
return String(value)
|
return String(value)
|
||||||
}
|
}, [])
|
||||||
|
|
||||||
// Recursive function to convert JSON to tree data
|
// Recursive function to convert JSON to tree data
|
||||||
const convertToTreeData = (obj, key = 'root', path = '') => {
|
const convertToTreeData = useCallback(
|
||||||
const currentPath = path ? `${path}.${key}` : key
|
(obj, key = 'root', path = '') => {
|
||||||
const dataInfo = getDataTypeInfo(obj)
|
const currentPath = path ? `${path}.${key}` : key
|
||||||
|
const dataInfo = getDataTypeInfo(obj)
|
||||||
|
|
||||||
const node = {
|
const node = {
|
||||||
title: (
|
title: (
|
||||||
<Space size='small'>
|
<Space size='small'>
|
||||||
<Tag color={dataInfo.color} size='small' style={{ margin: 0 }}>
|
<Tag color={dataInfo.color} size='small' style={{ margin: 0 }}>
|
||||||
{dataInfo.icon}
|
{dataInfo.icon}
|
||||||
</Tag>
|
</Tag>
|
||||||
<Text strong>{key}</Text>
|
<Text strong>{key}</Text>
|
||||||
{showKeyCopy && (
|
{showKeyCopy && (
|
||||||
<CopyButton text={key} tooltip={`Copy key: ${key}`} />
|
<CopyButton text={key} tooltip={`Copy key: ${key}`} />
|
||||||
)}
|
)}
|
||||||
<Text type='secondary'>({dataInfo.type})</Text>
|
<Text type='secondary'>({dataInfo.type})</Text>
|
||||||
{dataInfo.type !== 'object' && dataInfo.type !== 'array' && (
|
{dataInfo.type !== 'object' && dataInfo.type !== 'array' && (
|
||||||
<>
|
<>
|
||||||
<Text code>{formatValue(obj)}</Text>
|
<Text code>{formatValue(obj)}</Text>
|
||||||
{showValueCopy && (
|
{showValueCopy && (
|
||||||
|
<CopyButton
|
||||||
|
text={getCopyValue(obj)}
|
||||||
|
tooltip={`Copy ${dataInfo.type} value`}
|
||||||
|
/>
|
||||||
|
)}
|
||||||
|
</>
|
||||||
|
)}
|
||||||
|
{(dataInfo.type === 'object' || dataInfo.type === 'array') &&
|
||||||
|
showValueCopy && (
|
||||||
<CopyButton
|
<CopyButton
|
||||||
text={getCopyValue(obj)}
|
text={getCopyValue(obj)}
|
||||||
tooltip={`Copy ${dataInfo.type} value`}
|
tooltip={`Copy ${dataInfo.type} as JSON`}
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
</>
|
</Space>
|
||||||
)}
|
),
|
||||||
{(dataInfo.type === 'object' || dataInfo.type === 'array') &&
|
key: currentPath,
|
||||||
showValueCopy && (
|
value: obj,
|
||||||
<CopyButton
|
path: currentPath
|
||||||
text={getCopyValue(obj)}
|
|
||||||
tooltip={`Copy ${dataInfo.type} as JSON`}
|
|
||||||
/>
|
|
||||||
)}
|
|
||||||
</Space>
|
|
||||||
),
|
|
||||||
key: currentPath,
|
|
||||||
value: obj,
|
|
||||||
path: currentPath
|
|
||||||
}
|
|
||||||
|
|
||||||
// Add children for objects and arrays
|
|
||||||
if (typeof obj === 'object' && obj !== null) {
|
|
||||||
if (Array.isArray(obj)) {
|
|
||||||
node.children = obj.map((item, index) =>
|
|
||||||
convertToTreeData(item, `[${index}]`, currentPath)
|
|
||||||
)
|
|
||||||
} else {
|
|
||||||
node.children = Object.entries(obj).map(([childKey, childValue]) =>
|
|
||||||
convertToTreeData(childValue, childKey, currentPath)
|
|
||||||
)
|
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
return node
|
// Add children for objects and arrays
|
||||||
}
|
if (typeof obj === 'object' && obj !== null) {
|
||||||
|
if (Array.isArray(obj)) {
|
||||||
|
node.children = obj.map((item, index) =>
|
||||||
|
convertToTreeData(item, `[${index}]`, currentPath)
|
||||||
|
)
|
||||||
|
} else {
|
||||||
|
node.children = Object.entries(obj).map(([childKey, childValue]) =>
|
||||||
|
convertToTreeData(childValue, childKey, currentPath)
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return node
|
||||||
|
},
|
||||||
|
[showValueCopy, getCopyValue, formatValue, showKeyCopy]
|
||||||
|
)
|
||||||
|
|
||||||
// Convert data to tree structure
|
// Convert data to tree structure
|
||||||
const treeData = useMemo(() => {
|
const treeData = useMemo(() => {
|
||||||
@ -171,7 +174,7 @@ const DataTree = ({
|
|||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
}, [data])
|
}, [data, showValueCopy, convertToTreeData, getCopyValue, formatValue])
|
||||||
|
|
||||||
// Handle node selection
|
// Handle node selection
|
||||||
const handleSelect = (selectedKeys, { selected, selectedNodes }) => {
|
const handleSelect = (selectedKeys, { selected, selectedNodes }) => {
|
||||||
|
|||||||
@ -18,7 +18,7 @@ const FilePreview = ({ file, style = {} }) => {
|
|||||||
const objectUrl = await fetchFileContent(file, false)
|
const objectUrl = await fetchFileContent(file, false)
|
||||||
setFileObjectUrl(objectUrl)
|
setFileObjectUrl(objectUrl)
|
||||||
setLoading(false)
|
setLoading(false)
|
||||||
}, [file._id, fetchFileContent])
|
}, [file, fetchFileContent])
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (file?.type && token != null) {
|
if (file?.type && token != null) {
|
||||||
|
|||||||
@ -42,7 +42,14 @@ function GCodePreviewUI(props) {
|
|||||||
return () => {
|
return () => {
|
||||||
window.removeEventListener('resize', resizePreview)
|
window.removeEventListener('resize', resizePreview)
|
||||||
}
|
}
|
||||||
}, [endLayer, lastSegmentColor, lineWidth, startLayer, topLayerColor])
|
}, [
|
||||||
|
endLayer,
|
||||||
|
lastSegmentColor,
|
||||||
|
lineWidth,
|
||||||
|
startLayer,
|
||||||
|
topLayerColor,
|
||||||
|
resizePreview
|
||||||
|
])
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
const loadFromSrc = async () => {
|
const loadFromSrc = async () => {
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
import { useEffect, useRef, cloneElement } from 'react'
|
import { useEffect, useRef, cloneElement, useCallback } from 'react'
|
||||||
import PropTypes from 'prop-types'
|
import PropTypes from 'prop-types'
|
||||||
import { Popover, Typography } from 'antd'
|
import { Popover, Typography } from 'antd'
|
||||||
|
|
||||||
@ -24,10 +24,9 @@ const { Text } = Typography
|
|||||||
const KeyboardShortcut = ({ shortcut, children, hint, onTrigger }) => {
|
const KeyboardShortcut = ({ shortcut, children, hint, onTrigger }) => {
|
||||||
const childRef = useRef()
|
const childRef = useRef()
|
||||||
const shortcutObj = parseShortcut(shortcut)
|
const shortcutObj = parseShortcut(shortcut)
|
||||||
let pressedKeys = new Set()
|
|
||||||
|
|
||||||
// Helper to get the set of keys required for the shortcut
|
// Helper to get the set of keys required for the shortcut
|
||||||
function getShortcutKeySet(shortcutObj) {
|
const getShortcutKeySet = useCallback((shortcutObj) => {
|
||||||
const keys = []
|
const keys = []
|
||||||
if (shortcutObj.meta) keys.push('Meta')
|
if (shortcutObj.meta) keys.push('Meta')
|
||||||
if (shortcutObj.ctrl) keys.push('Control')
|
if (shortcutObj.ctrl) keys.push('Control')
|
||||||
@ -38,12 +37,12 @@ const KeyboardShortcut = ({ shortcut, children, hint, onTrigger }) => {
|
|||||||
keys.push('Key' + shortcutObj.key.toUpperCase())
|
keys.push('Key' + shortcutObj.key.toUpperCase())
|
||||||
}
|
}
|
||||||
return new Set(keys)
|
return new Set(keys)
|
||||||
}
|
}, [])
|
||||||
|
|
||||||
const shortcutKeySet = getShortcutKeySet(shortcutObj)
|
const shortcutKeySet = getShortcutKeySet(shortcutObj)
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
pressedKeys = new Set()
|
const pressedKeys = new Set()
|
||||||
const handleKeyDown = (event) => {
|
const handleKeyDown = (event) => {
|
||||||
if (
|
if (
|
||||||
event.key === 'Meta' ||
|
event.key === 'Meta' ||
|
||||||
@ -83,7 +82,7 @@ const KeyboardShortcut = ({ shortcut, children, hint, onTrigger }) => {
|
|||||||
window.removeEventListener('keydown', handleKeyDown)
|
window.removeEventListener('keydown', handleKeyDown)
|
||||||
window.removeEventListener('keyup', handleKeyUp)
|
window.removeEventListener('keyup', handleKeyUp)
|
||||||
}
|
}
|
||||||
}, [shortcut, shortcutObj, onTrigger])
|
}, [shortcut, shortcutObj, onTrigger, shortcutKeySet])
|
||||||
|
|
||||||
// Clone the child to attach a ref
|
// Clone the child to attach a ref
|
||||||
const element = cloneElement(children, { ref: childRef })
|
const element = cloneElement(children, { ref: childRef })
|
||||||
|
|||||||
@ -96,12 +96,6 @@ const NoteItem = ({ note }) => {
|
|||||||
'note',
|
'note',
|
||||||
(noteData) => {
|
(noteData) => {
|
||||||
if (noteData.parent._id == note._id) {
|
if (noteData.parent._id == note._id) {
|
||||||
console.log(
|
|
||||||
'Note note added to parent:',
|
|
||||||
note._id,
|
|
||||||
'isExpanded:',
|
|
||||||
isExpanded
|
|
||||||
)
|
|
||||||
if (isExpanded == true) {
|
if (isExpanded == true) {
|
||||||
handleNoteExpand()
|
handleNoteExpand()
|
||||||
}
|
}
|
||||||
|
|||||||
@ -272,7 +272,7 @@ const ObjectChildTable = ({
|
|||||||
})
|
})
|
||||||
|
|
||||||
return [summaryRow]
|
return [summaryRow]
|
||||||
}, [properties, rollups, objectData])
|
}, [properties, rollups, objectData, value])
|
||||||
|
|
||||||
const rollupColumns = useMemo(() => {
|
const rollupColumns = useMemo(() => {
|
||||||
const propertyColumns = properties.map((property, index) => {
|
const propertyColumns = properties.map((property, index) => {
|
||||||
|
|||||||
@ -91,7 +91,6 @@ const ObjectDisplay = ({
|
|||||||
cancelled = true
|
cancelled = true
|
||||||
}
|
}
|
||||||
}, [object, fetchFullObjectIfNeeded])
|
}, [object, fetchFullObjectIfNeeded])
|
||||||
console.log(objectData, objectType)
|
|
||||||
if (!objectData) {
|
if (!objectData) {
|
||||||
return <Text type='secondary'>n/a</Text>
|
return <Text type='secondary'>n/a</Text>
|
||||||
}
|
}
|
||||||
|
|||||||
@ -381,7 +381,6 @@ const ObjectForm = forwardRef(
|
|||||||
...computedValuesObject,
|
...computedValuesObject,
|
||||||
_isEditing: isEditingRef.current
|
_isEditing: isEditingRef.current
|
||||||
}))
|
}))
|
||||||
console.log('calculatedEntries', computedValuesObject)
|
|
||||||
onStateChangeRef.current({
|
onStateChangeRef.current({
|
||||||
isEditing: true,
|
isEditing: true,
|
||||||
objectData: {
|
objectData: {
|
||||||
|
|||||||
@ -279,7 +279,6 @@ const ObjectSelect = ({
|
|||||||
|
|
||||||
// --- loadData for async loading on expand ---
|
// --- loadData for async loading on expand ---
|
||||||
const loadData = async (node) => {
|
const loadData = async (node) => {
|
||||||
console.log('loading data for node', node)
|
|
||||||
// node.property is the property name, node.value is the value key
|
// node.property is the property name, node.value is the value key
|
||||||
if (!node.property) return
|
if (!node.property) return
|
||||||
if (type == 'unknown') return
|
if (type == 'unknown') return
|
||||||
@ -340,28 +339,31 @@ const ObjectSelect = ({
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
const onTreeSelectChange = (value) => {
|
const onTreeSelectChange = useCallback(
|
||||||
// Mark this as an internal change
|
(value) => {
|
||||||
isInternalChangeRef.current = true
|
// Mark this as an internal change
|
||||||
|
isInternalChangeRef.current = true
|
||||||
|
|
||||||
// value can be a string (single) or array (multiple)
|
// value can be a string (single) or array (multiple)
|
||||||
if (multiple) {
|
if (multiple) {
|
||||||
// Multiple selection
|
// Multiple selection
|
||||||
let selectedObjects = []
|
let selectedObjects = []
|
||||||
if (Array.isArray(value)) {
|
if (Array.isArray(value)) {
|
||||||
selectedObjects = value
|
selectedObjects = value
|
||||||
.map((id) => objectList.find((obj) => obj._id === id))
|
.map((id) => objectList.find((obj) => obj._id === id))
|
||||||
.filter(Boolean)
|
.filter(Boolean)
|
||||||
|
}
|
||||||
|
setTreeSelectValue(value)
|
||||||
|
if (rest.onChange) rest.onChange(selectedObjects)
|
||||||
|
} else {
|
||||||
|
// Single selection
|
||||||
|
const selectedObject = objectList.find((obj) => obj._id === value)
|
||||||
|
setTreeSelectValue(value)
|
||||||
|
if (rest.onChange) rest.onChange(selectedObject)
|
||||||
}
|
}
|
||||||
setTreeSelectValue(value)
|
},
|
||||||
if (rest.onChange) rest.onChange(selectedObjects)
|
[multiple, objectList, rest]
|
||||||
} else {
|
)
|
||||||
// Single selection
|
|
||||||
const selectedObject = objectList.find((obj) => obj._id === value)
|
|
||||||
setTreeSelectValue(value)
|
|
||||||
if (rest.onChange) rest.onChange(selectedObject)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Update treeData when objectPropertiesTree changes
|
// Update treeData when objectPropertiesTree changes
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
@ -385,11 +387,9 @@ const ObjectSelect = ({
|
|||||||
getValueIdentity(valueRef.current) !== getValueIdentity(value) &&
|
getValueIdentity(valueRef.current) !== getValueIdentity(value) &&
|
||||||
type != 'unknown'
|
type != 'unknown'
|
||||||
) {
|
) {
|
||||||
// console.log('fetching full object', value)
|
|
||||||
valueRef.current = value
|
valueRef.current = value
|
||||||
// Check if value is a minimal object and fetch full object if needed
|
// Check if value is a minimal object and fetch full object if needed
|
||||||
const fullValue = await fetchFullObjectIfNeeded(value)
|
const fullValue = await fetchFullObjectIfNeeded(value)
|
||||||
// console.log('fullValue', fullValue)
|
|
||||||
// Build a new filter from value's properties that are in the properties list
|
// Build a new filter from value's properties that are in the properties list
|
||||||
const valueFilter = { ...filter }
|
const valueFilter = { ...filter }
|
||||||
const pathKeys = []
|
const pathKeys = []
|
||||||
@ -427,7 +427,6 @@ const ObjectSelect = ({
|
|||||||
setExpandedKeys(pathKeys)
|
setExpandedKeys(pathKeys)
|
||||||
// Fetch with the new filter
|
// Fetch with the new filter
|
||||||
handleFetchObjectsProperties(valueFilter)
|
handleFetchObjectsProperties(valueFilter)
|
||||||
// console.log('setting treeSelectValue', valueRef.current._id)
|
|
||||||
setTreeSelectValue(valueRef.current._id)
|
setTreeSelectValue(valueRef.current._id)
|
||||||
setInitialized(true)
|
setInitialized(true)
|
||||||
return
|
return
|
||||||
@ -469,10 +468,6 @@ const ObjectSelect = ({
|
|||||||
|
|
||||||
const prevValuesRef = useRef({ type, masterFilter })
|
const prevValuesRef = useRef({ type, masterFilter })
|
||||||
|
|
||||||
useEffect(() => {
|
|
||||||
// console.log('treeSelectValue', treeSelectValue)
|
|
||||||
}, [treeSelectValue])
|
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
const prevValues = prevValuesRef.current
|
const prevValues = prevValuesRef.current
|
||||||
|
|
||||||
@ -494,7 +489,7 @@ const ObjectSelect = ({
|
|||||||
setError(false)
|
setError(false)
|
||||||
prevValuesRef.current = { type, masterFilter }
|
prevValuesRef.current = { type, masterFilter }
|
||||||
}
|
}
|
||||||
}, [type, masterFilter])
|
}, [type, masterFilter, onTreeSelectChange])
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
// Check if value has actually changed
|
// Check if value has actually changed
|
||||||
@ -519,7 +514,7 @@ const ObjectSelect = ({
|
|||||||
prevValueRef.current = value
|
prevValueRef.current = value
|
||||||
prevValueIdentityRef.current = currentValueIdentity
|
prevValueIdentityRef.current = currentValueIdentity
|
||||||
}
|
}
|
||||||
}, [value, getValueIdentity])
|
}, [value, getValueIdentity, type, masterFilter])
|
||||||
|
|
||||||
const placeholder = useMemo(
|
const placeholder = useMemo(
|
||||||
() =>
|
() =>
|
||||||
|
|||||||
@ -236,7 +236,6 @@ const ObjectTable = forwardRef(
|
|||||||
order: sorter.order
|
order: sorter.order
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
console.log('Fetching data...')
|
|
||||||
try {
|
try {
|
||||||
const result = await fetchObjects(type, {
|
const result = await fetchObjects(type, {
|
||||||
page: pageNum,
|
page: pageNum,
|
||||||
@ -252,7 +251,6 @@ const ObjectTable = forwardRef(
|
|||||||
const existingPageIndex = prev.findIndex(
|
const existingPageIndex = prev.findIndex(
|
||||||
(p) => p.pageNum === pageNum
|
(p) => p.pageNum === pageNum
|
||||||
)
|
)
|
||||||
logger.debug(prev.map((p) => p.pageNum))
|
|
||||||
if (existingPageIndex !== -1) {
|
if (existingPageIndex !== -1) {
|
||||||
// Update existing page
|
// Update existing page
|
||||||
const newPages = [...prev]
|
const newPages = [...prev]
|
||||||
@ -370,7 +368,6 @@ const ObjectTable = forwardRef(
|
|||||||
setIsEditing(true)
|
setIsEditing(true)
|
||||||
tableData.forEach((item) => {
|
tableData.forEach((item) => {
|
||||||
if (!item.isSkeleton) {
|
if (!item.isSkeleton) {
|
||||||
console.log('Locking object:', item)
|
|
||||||
lockObject(item._id, type)
|
lockObject(item._id, type)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
@ -403,7 +400,7 @@ const ObjectTable = forwardRef(
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
console.error(err)
|
logger.error('Error updating objects:', err)
|
||||||
} finally {
|
} finally {
|
||||||
setEditLoading(false)
|
setEditLoading(false)
|
||||||
}
|
}
|
||||||
@ -426,8 +423,6 @@ const ObjectTable = forwardRef(
|
|||||||
})
|
})
|
||||||
)
|
)
|
||||||
|
|
||||||
console.log('updatedData', updatedData)
|
|
||||||
|
|
||||||
if (rowFormsRef.current[id]) {
|
if (rowFormsRef.current[id]) {
|
||||||
rowFormsRef.current[id].setFieldsValue(updatedData)
|
rowFormsRef.current[id].setFieldsValue(updatedData)
|
||||||
}
|
}
|
||||||
@ -464,9 +459,6 @@ const ObjectTable = forwardRef(
|
|||||||
updateEventHandlerRef.current(itemId, updateData)
|
updateEventHandlerRef.current(itemId, updateData)
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
console.log('unsubscribe', unsubscribe)
|
|
||||||
console.log('subscribedIdsRef', subscribedIdsRef.current)
|
|
||||||
console.log('unsubscribesRef', unsubscribesRef.current)
|
|
||||||
subscribedIdsRef.current.push(itemId)
|
subscribedIdsRef.current.push(itemId)
|
||||||
if (unsubscribe) {
|
if (unsubscribe) {
|
||||||
unsubscribesRef.current.push(unsubscribe)
|
unsubscribesRef.current.push(unsubscribe)
|
||||||
|
|||||||
@ -16,7 +16,6 @@ const PrinterMiscPanel = ({ id, showControls = true }) => {
|
|||||||
target: 0
|
target: 0
|
||||||
},
|
},
|
||||||
lcdBacklight: {
|
lcdBacklight: {
|
||||||
// eslint-disable-line camelcase
|
|
||||||
brightness: 0
|
brightness: 0
|
||||||
},
|
},
|
||||||
beeper: {
|
beeper: {
|
||||||
|
|||||||
@ -38,14 +38,14 @@ const PrinterPositionPanel = ({
|
|||||||
const { subscribeToObjectEvent, connected, sendObjectAction } =
|
const { subscribeToObjectEvent, connected, sendObjectAction } =
|
||||||
useContext(ApiServerContext)
|
useContext(ApiServerContext)
|
||||||
const [positionData, setPositionData] = useState({
|
const [positionData, setPositionData] = useState({
|
||||||
speedFactor: 1.0, // eslint-disable-line
|
speedFactor: 1.0,
|
||||||
speed: 100,
|
speed: 100,
|
||||||
extrudeFactor: 1.0, // eslint-disable-line
|
extrudeFactor: 1.0,
|
||||||
absoluteCoordinates: true, // eslint-disable-line
|
absoluteCoordinates: true,
|
||||||
absoluteExtrude: false, // eslint-disable-line
|
absoluteExtrude: false,
|
||||||
homingOrigin: [0.0, 0.0, 0.0, 0.0], // eslint-disable-line
|
homingOrigin: [0.0, 0.0, 0.0, 0.0],
|
||||||
toolheadPosition: [0.0, 0.0, 0.0, 0.0],
|
toolheadPosition: [0.0, 0.0, 0.0, 0.0],
|
||||||
gcodePosition: [0.0, 0.0, 0.0, 0.0], // eslint-disable-line
|
gcodePosition: [0.0, 0.0, 0.0, 0.0],
|
||||||
livePosition: [0.0, 0.0, 0.0, 0.0],
|
livePosition: [0.0, 0.0, 0.0, 0.0],
|
||||||
maxVelocity: 1000,
|
maxVelocity: 1000,
|
||||||
maxAcceleration: 1000,
|
maxAcceleration: 1000,
|
||||||
@ -70,7 +70,7 @@ const PrinterPositionPanel = ({
|
|||||||
if (motionEventUnsubscribe) motionEventUnsubscribe()
|
if (motionEventUnsubscribe) motionEventUnsubscribe()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}, [id, connected])
|
}, [id, connected, subscribeToObjectEvent])
|
||||||
const [speedFactor, setSpeedFactor] = useState(positionData.speedFactor)
|
const [speedFactor, setSpeedFactor] = useState(positionData.speedFactor)
|
||||||
const [extrudeFactor, setExtrudeFactor] = useState(positionData.extrudeFactor)
|
const [extrudeFactor, setExtrudeFactor] = useState(positionData.extrudeFactor)
|
||||||
const [maxVelocity, setMaxVelocity] = useState(positionData.maxVelocity)
|
const [maxVelocity, setMaxVelocity] = useState(positionData.maxVelocity)
|
||||||
|
|||||||
@ -87,7 +87,7 @@ const PrinterTemperaturePanel = ({
|
|||||||
if (temperatureEventUnsubscribe) temperatureEventUnsubscribe()
|
if (temperatureEventUnsubscribe) temperatureEventUnsubscribe()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}, [id, connected])
|
}, [id, connected, subscribeToObjectEvent])
|
||||||
|
|
||||||
const [extruderTarget, setExtruderTarget] = useState(0)
|
const [extruderTarget, setExtruderTarget] = useState(0)
|
||||||
const [bedTarget, setBedTarget] = useState(0)
|
const [bedTarget, setBedTarget] = useState(0)
|
||||||
|
|||||||
@ -40,7 +40,6 @@ const SpotlightTooltip = ({ query, type }) => {
|
|||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (token != null && initialized == false) {
|
if (token != null && initialized == false) {
|
||||||
fetchSpotlight()
|
fetchSpotlight()
|
||||||
console.log('Fetching spotlight...')
|
|
||||||
setInitialized(true)
|
setInitialized(true)
|
||||||
}
|
}
|
||||||
}, [token, fetchSpotlight, initialized])
|
}, [token, fetchSpotlight, initialized])
|
||||||
|
|||||||
@ -44,22 +44,25 @@ const TemplatePreview = ({
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const reloadPreviewPDF = (content, testObject = {}) => {
|
const reloadPreviewPDF = useCallback(
|
||||||
setReloadLoading(true)
|
(content, testObject = {}) => {
|
||||||
fetchTemplatePDF(documentTemplate._id, content, testObject, (result) => {
|
setReloadLoading(true)
|
||||||
setReloadLoading(false)
|
fetchTemplatePDF(documentTemplate._id, content, testObject, (result) => {
|
||||||
if (result?.error) {
|
setReloadLoading(false)
|
||||||
// Handle error through parent component
|
if (result?.error) {
|
||||||
onPreviewMessage(result.error, true)
|
// Handle error through parent component
|
||||||
} else {
|
onPreviewMessage(result.error, true)
|
||||||
const pdfBlob = new Blob([result.pdf], { type: 'application/pdf' })
|
} else {
|
||||||
const pdfUrl = URL.createObjectURL(pdfBlob)
|
const pdfBlob = new Blob([result.pdf], { type: 'application/pdf' })
|
||||||
|
const pdfUrl = URL.createObjectURL(pdfBlob)
|
||||||
|
|
||||||
setPDFBlob(pdfUrl)
|
setPDFBlob(pdfUrl)
|
||||||
onPreviewMessage('No issues found.', false)
|
onPreviewMessage('No issues found.', false)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
},
|
||||||
|
[documentTemplate?._id, fetchTemplatePDF, onPreviewMessage]
|
||||||
|
)
|
||||||
|
|
||||||
const reloadPreview = useCallback(
|
const reloadPreview = useCallback(
|
||||||
(content, testObject = {}, scale = 1) => {
|
(content, testObject = {}, scale = 1) => {
|
||||||
@ -81,7 +84,7 @@ const TemplatePreview = ({
|
|||||||
}
|
}
|
||||||
)
|
)
|
||||||
},
|
},
|
||||||
[fetchTemplatePreview, objectData?._id, onPreviewMessage]
|
[fetchTemplatePreview, onPreviewMessage, documentTemplate?._id]
|
||||||
)
|
)
|
||||||
|
|
||||||
// Move useEffect to component level and use state to track objectData changes
|
// Move useEffect to component level and use state to track objectData changes
|
||||||
@ -93,7 +96,14 @@ const TemplatePreview = ({
|
|||||||
reloadPreviewPDF(documentTemplate.content, objectData)
|
reloadPreviewPDF(documentTemplate.content, objectData)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}, [objectData, documentTemplate, previewScale, previewType])
|
}, [
|
||||||
|
objectData,
|
||||||
|
documentTemplate,
|
||||||
|
previewScale,
|
||||||
|
previewType,
|
||||||
|
reloadPreview,
|
||||||
|
reloadPreviewPDF
|
||||||
|
])
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Flex vertical gap={'middle'} style={{ height: '100%' }}>
|
<Flex vertical gap={'middle'} style={{ height: '100%' }}>
|
||||||
|
|||||||
@ -10,10 +10,7 @@ function ThreeDPreview(props) {
|
|||||||
width = 500,
|
width = 500,
|
||||||
height = 500,
|
height = 500,
|
||||||
style = {},
|
style = {},
|
||||||
backgroundColor = '#ffffff',
|
backgroundColor = '#ffffff'
|
||||||
showGrid = true,
|
|
||||||
showAxes = true,
|
|
||||||
enableControls = true
|
|
||||||
} = props
|
} = props
|
||||||
const containerRef = useRef(null)
|
const containerRef = useRef(null)
|
||||||
const viewer = useRef(null)
|
const viewer = useRef(null)
|
||||||
@ -34,6 +31,9 @@ function ThreeDPreview(props) {
|
|||||||
}, [viewer, width, height])
|
}, [viewer, width, height])
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
|
// Variable to track the viewer instance created in this effect
|
||||||
|
let currentViewer = null
|
||||||
|
|
||||||
const initializeViewer = async () => {
|
const initializeViewer = async () => {
|
||||||
if (!containerRef.current) return
|
if (!containerRef.current) return
|
||||||
|
|
||||||
@ -42,7 +42,10 @@ function ThreeDPreview(props) {
|
|||||||
setError(null)
|
setError(null)
|
||||||
|
|
||||||
// Clear any existing viewer
|
// Clear any existing viewer
|
||||||
if (viewer) {
|
if (viewer.current) {
|
||||||
|
if (viewer.current.dispose) {
|
||||||
|
viewer.current.dispose()
|
||||||
|
}
|
||||||
containerRef.current.innerHTML = ''
|
containerRef.current.innerHTML = ''
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -71,6 +74,10 @@ function ThreeDPreview(props) {
|
|||||||
environmentSettings: new OV.EnvironmentSettings([], false)
|
environmentSettings: new OV.EnvironmentSettings([], false)
|
||||||
})
|
})
|
||||||
|
|
||||||
|
// Store the viewer instance in the ref and local variable
|
||||||
|
viewer.current = newViewer
|
||||||
|
currentViewer = newViewer
|
||||||
|
|
||||||
try {
|
try {
|
||||||
setIsLoading(true)
|
setIsLoading(true)
|
||||||
setError(null)
|
setError(null)
|
||||||
@ -105,11 +112,11 @@ function ThreeDPreview(props) {
|
|||||||
|
|
||||||
return () => {
|
return () => {
|
||||||
window.removeEventListener('resize', resizeViewer)
|
window.removeEventListener('resize', resizeViewer)
|
||||||
if (viewer.current && viewer.current.dispose) {
|
if (currentViewer && currentViewer.dispose) {
|
||||||
viewer.current.dispose()
|
currentViewer.dispose()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}, [width, height, backgroundColor, showGrid, showAxes, enableControls, src])
|
}, [width, height, src, extension, resizeViewer])
|
||||||
|
|
||||||
const containerStyle = {
|
const containerStyle = {
|
||||||
width: width + 'px',
|
width: width + 'px',
|
||||||
|
|||||||
@ -8,7 +8,7 @@ import {
|
|||||||
useCallback
|
useCallback
|
||||||
} from 'react'
|
} from 'react'
|
||||||
import io from 'socket.io-client'
|
import io from 'socket.io-client'
|
||||||
import { message, notification, Modal, Space, Button } from 'antd'
|
import { message, Modal, Space, Button } from 'antd'
|
||||||
import PropTypes from 'prop-types'
|
import PropTypes from 'prop-types'
|
||||||
import { AuthContext } from './AuthContext'
|
import { AuthContext } from './AuthContext'
|
||||||
|
|
||||||
@ -30,7 +30,6 @@ const ApiServerProvider = ({ children }) => {
|
|||||||
const [connecting, setConnecting] = useState(false)
|
const [connecting, setConnecting] = useState(false)
|
||||||
const [error, setError] = useState(null)
|
const [error, setError] = useState(null)
|
||||||
const [messageApi, contextHolder] = message.useMessage()
|
const [messageApi, contextHolder] = message.useMessage()
|
||||||
const [notificationApi] = notification.useNotification()
|
|
||||||
const [fetchLoading, setFetchLoading] = useState(false)
|
const [fetchLoading, setFetchLoading] = useState(false)
|
||||||
const [showErrorModal, setShowErrorModal] = useState(false)
|
const [showErrorModal, setShowErrorModal] = useState(false)
|
||||||
const [errorModalContent, setErrorModalContent] = useState('')
|
const [errorModalContent, setErrorModalContent] = useState('')
|
||||||
@ -125,7 +124,7 @@ const ApiServerProvider = ({ children }) => {
|
|||||||
|
|
||||||
socketRef.current = newSocket
|
socketRef.current = newSocket
|
||||||
}
|
}
|
||||||
}, [token, authenticated, messageApi, notificationApi, handleLockUpdate])
|
}, [token, authenticated, messageApi, handleLockUpdate, clearSubscriptions])
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (token && authenticated == true) {
|
if (token && authenticated == true) {
|
||||||
@ -254,7 +253,6 @@ const ApiServerProvider = ({ children }) => {
|
|||||||
|
|
||||||
const callbacksRefKey = `modelStats:${objectType}`
|
const callbacksRefKey = `modelStats:${objectType}`
|
||||||
logger.debug('Notifying model stats update:', data)
|
logger.debug('Notifying model stats update:', data)
|
||||||
console.log('handleModelStats', data)
|
|
||||||
if (objectType && subscribedCallbacksRef.current.has(callbacksRefKey)) {
|
if (objectType && subscribedCallbacksRef.current.has(callbacksRefKey)) {
|
||||||
const callbacks = subscribedCallbacksRef.current.get(callbacksRefKey)
|
const callbacks = subscribedCallbacksRef.current.get(callbacksRefKey)
|
||||||
logger.debug(
|
logger.debug(
|
||||||
@ -539,7 +537,7 @@ const ApiServerProvider = ({ children }) => {
|
|||||||
return () => offObjectEventEvent(id, objectType, eventType, callback)
|
return () => offObjectEventEvent(id, objectType, eventType, callback)
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
[offObjectUpdatesEvent]
|
[offObjectEventEvent]
|
||||||
)
|
)
|
||||||
|
|
||||||
const offModelStats = useCallback((objectType, callback) => {
|
const offModelStats = useCallback((objectType, callback) => {
|
||||||
|
|||||||
@ -217,7 +217,7 @@ const AuthProvider = ({ children }) => {
|
|||||||
setExpiresAt(newExpiresAt)
|
setExpiresAt(newExpiresAt)
|
||||||
setUserProfile(newUser)
|
setUserProfile(newUser)
|
||||||
setAuthenticated(true)
|
setAuthenticated(true)
|
||||||
console.log('Auth state synchronized from another tab')
|
logger.debug('Auth state synchronized from another tab')
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// Cookies are invalid, clear state
|
// Cookies are invalid, clear state
|
||||||
@ -226,7 +226,7 @@ const AuthProvider = ({ children }) => {
|
|||||||
setUserProfile(null)
|
setUserProfile(null)
|
||||||
setAuthenticated(false)
|
setAuthenticated(false)
|
||||||
setShowUnauthorizedModal(true)
|
setShowUnauthorizedModal(true)
|
||||||
console.log(
|
logger.debug(
|
||||||
'Auth state cleared due to invalid cookies from another tab'
|
'Auth state cleared due to invalid cookies from another tab'
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
@ -256,11 +256,11 @@ const AuthProvider = ({ children }) => {
|
|||||||
messageApi.info('Logging in with tombutcher.work')
|
messageApi.info('Logging in with tombutcher.work')
|
||||||
const loginUrl = `${config.backendUrl}/auth/${redirectType}/login?redirect_uri=${encodeURIComponent(redirectUri)}`
|
const loginUrl = `${config.backendUrl}/auth/${redirectType}/login?redirect_uri=${encodeURIComponent(redirectUri)}`
|
||||||
if (isElectron) {
|
if (isElectron) {
|
||||||
console.log('Opening external url...')
|
logger.debug('Opening external url...')
|
||||||
openExternalUrl(loginUrl)
|
openExternalUrl(loginUrl)
|
||||||
setLoading(true)
|
setLoading(true)
|
||||||
} else {
|
} else {
|
||||||
console.log('Redirecting...')
|
logger.debug('Redirecting...')
|
||||||
window.location.href = loginUrl
|
window.location.href = loginUrl
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@ -338,12 +338,12 @@ const AuthProvider = ({ children }) => {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
[
|
[
|
||||||
isElectron,
|
|
||||||
navigate,
|
navigate,
|
||||||
location.search,
|
location.search,
|
||||||
location.pathname,
|
location.pathname,
|
||||||
messageApi,
|
messageApi,
|
||||||
persistSession
|
persistSession,
|
||||||
|
redirectType
|
||||||
]
|
]
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
@ -7,6 +7,7 @@ const electron = window.require ? window.require('electron') : null
|
|||||||
const ipcRenderer = electron ? electron.ipcRenderer : null
|
const ipcRenderer = electron ? electron.ipcRenderer : null
|
||||||
|
|
||||||
// Utility to check if running in Electron
|
// Utility to check if running in Electron
|
||||||
|
// eslint-disable-next-line react-refresh/only-export-components
|
||||||
export function isElectron() {
|
export function isElectron() {
|
||||||
// Renderer process
|
// Renderer process
|
||||||
|
|
||||||
@ -87,7 +88,6 @@ const ElectronProvider = ({ children }) => {
|
|||||||
|
|
||||||
// Listen for navigate
|
// Listen for navigate
|
||||||
const navigateHandler = (event, url) => {
|
const navigateHandler = (event, url) => {
|
||||||
console.log('Navigating to:', url)
|
|
||||||
navigate(url)
|
navigate(url)
|
||||||
}
|
}
|
||||||
ipcRenderer.on('navigate', navigateHandler)
|
ipcRenderer.on('navigate', navigateHandler)
|
||||||
@ -96,7 +96,7 @@ const ElectronProvider = ({ children }) => {
|
|||||||
ipcRenderer.removeListener('navigate', navigateHandler)
|
ipcRenderer.removeListener('navigate', navigateHandler)
|
||||||
ipcRenderer.removeListener('window-state', windowStateHandler)
|
ipcRenderer.removeListener('window-state', windowStateHandler)
|
||||||
}
|
}
|
||||||
}, [])
|
}, [navigate])
|
||||||
|
|
||||||
// Window control handler
|
// Window control handler
|
||||||
const handleWindowControl = (action) => {
|
const handleWindowControl = (action) => {
|
||||||
|
|||||||
@ -47,6 +47,7 @@ MessageProvider.propTypes = {
|
|||||||
children: PropTypes.node.isRequired
|
children: PropTypes.node.isRequired
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// eslint-disable-next-line react-refresh/only-export-components
|
||||||
export const useMessageContext = () => {
|
export const useMessageContext = () => {
|
||||||
const context = useContext(MessageContext)
|
const context = useContext(MessageContext)
|
||||||
if (!context) {
|
if (!context) {
|
||||||
|
|||||||
@ -17,7 +17,8 @@ import {
|
|||||||
useState,
|
useState,
|
||||||
useRef,
|
useRef,
|
||||||
createElement,
|
createElement,
|
||||||
useContext
|
useContext,
|
||||||
|
useCallback
|
||||||
} from 'react'
|
} from 'react'
|
||||||
import axios from 'axios'
|
import axios from 'axios'
|
||||||
import { LoadingOutlined } from '@ant-design/icons'
|
import { LoadingOutlined } from '@ant-design/icons'
|
||||||
@ -608,7 +609,7 @@ const ElectronSpotlightContentPage = () => {
|
|||||||
const { resizeSpotlightWindow, isElectron } = useContext(ElectronContext)
|
const { resizeSpotlightWindow, isElectron } = useContext(ElectronContext)
|
||||||
|
|
||||||
// Function to measure and resize window
|
// Function to measure and resize window
|
||||||
const updateWindowHeight = () => {
|
const updateWindowHeight = useCallback(() => {
|
||||||
if (!cardRef.current || !isElectron || !resizeSpotlightWindow) return
|
if (!cardRef.current || !isElectron || !resizeSpotlightWindow) return
|
||||||
|
|
||||||
// Clear any pending resize
|
// Clear any pending resize
|
||||||
@ -639,7 +640,7 @@ const ElectronSpotlightContentPage = () => {
|
|||||||
console.warn('Failed to update spotlight window height:', error)
|
console.warn('Failed to update spotlight window height:', error)
|
||||||
}
|
}
|
||||||
}, 100) // 100ms debounce
|
}, 100) // 100ms debounce
|
||||||
}
|
}, [isElectron, resizeSpotlightWindow])
|
||||||
|
|
||||||
// Use ResizeObserver to watch for content changes
|
// Use ResizeObserver to watch for content changes
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
@ -666,7 +667,7 @@ const ElectronSpotlightContentPage = () => {
|
|||||||
}
|
}
|
||||||
clearTimeout(initialTimeout)
|
clearTimeout(initialTimeout)
|
||||||
}
|
}
|
||||||
}, [isElectron, resizeSpotlightWindow])
|
}, [isElectron, resizeSpotlightWindow, updateWindowHeight])
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div
|
<div
|
||||||
|
|||||||
@ -135,6 +135,7 @@ ThemeProvider.propTypes = {
|
|||||||
children: PropTypes.node.isRequired
|
children: PropTypes.node.isRequired
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// eslint-disable-next-line react-refresh/only-export-components
|
||||||
export const useThemeContext = () => {
|
export const useThemeContext = () => {
|
||||||
const context = useContext(ThemeContext)
|
const context = useContext(ThemeContext)
|
||||||
if (!context) {
|
if (!context) {
|
||||||
|
|||||||
@ -55,7 +55,6 @@ export const Courier = {
|
|||||||
url: (_id) =>
|
url: (_id) =>
|
||||||
`/dashboard/management/couriers/info?courierId=${_id}&action=cancelEdit`,
|
`/dashboard/management/couriers/info?courierId=${_id}&action=cancelEdit`,
|
||||||
visible: (objectData) => {
|
visible: (objectData) => {
|
||||||
console.log(objectData?._isEditing)
|
|
||||||
return objectData?._isEditing && objectData?._isEditing == true
|
return objectData?._isEditing && objectData?._isEditing == true
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|||||||
@ -56,7 +56,6 @@ export const CourierService = {
|
|||||||
url: (_id) =>
|
url: (_id) =>
|
||||||
`/dashboard/management/courierservices/info?courierServiceId=${_id}&action=cancelEdit`,
|
`/dashboard/management/courierservices/info?courierServiceId=${_id}&action=cancelEdit`,
|
||||||
visible: (objectData) => {
|
visible: (objectData) => {
|
||||||
console.log(objectData?._isEditing)
|
|
||||||
return objectData?._isEditing && objectData?._isEditing == true
|
return objectData?._isEditing && objectData?._isEditing == true
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@ -70,14 +69,7 @@ export const CourierService = {
|
|||||||
`/dashboard/management/courierservices/info?courierServiceId=${_id}&action=delete`
|
`/dashboard/management/courierservices/info?courierServiceId=${_id}&action=delete`
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
columns: [
|
columns: ['name', '_id', 'courier', 'tracked', 'deliveryTime', 'active'],
|
||||||
'name',
|
|
||||||
'_id',
|
|
||||||
'courier',
|
|
||||||
'tracked',
|
|
||||||
'deliveryTime',
|
|
||||||
'active'
|
|
||||||
],
|
|
||||||
filters: ['name', '_id', 'courier', 'active', 'deliveryTime', 'tracked'],
|
filters: ['name', '_id', 'courier', 'active', 'deliveryTime', 'tracked'],
|
||||||
sorters: [
|
sorters: [
|
||||||
'name',
|
'name',
|
||||||
|
|||||||
@ -57,7 +57,6 @@ export const DocumentJob = {
|
|||||||
url: (_id) =>
|
url: (_id) =>
|
||||||
`/dashboard/management/documentjobs/info?documentJobId=${_id}&action=cancelEdit`,
|
`/dashboard/management/documentjobs/info?documentJobId=${_id}&action=cancelEdit`,
|
||||||
visible: (objectData) => {
|
visible: (objectData) => {
|
||||||
console.log(objectData?._isEditing)
|
|
||||||
return objectData?._isEditing && objectData?._isEditing == true
|
return objectData?._isEditing && objectData?._isEditing == true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -56,20 +56,11 @@ export const DocumentPrinter = {
|
|||||||
url: (_id) =>
|
url: (_id) =>
|
||||||
`/dashboard/management/documentprinters/info?documentPrinterId=${_id}&action=cancelEdit`,
|
`/dashboard/management/documentprinters/info?documentPrinterId=${_id}&action=cancelEdit`,
|
||||||
visible: (objectData) => {
|
visible: (objectData) => {
|
||||||
console.log(objectData?._isEditing)
|
|
||||||
return objectData?._isEditing && objectData?._isEditing == true
|
return objectData?._isEditing && objectData?._isEditing == true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
columns: [
|
columns: ['name', '_id', 'state', 'host', 'tags', 'connectedAt', 'updatedAt'],
|
||||||
'name',
|
|
||||||
'_id',
|
|
||||||
'state',
|
|
||||||
'host',
|
|
||||||
'tags',
|
|
||||||
'connectedAt',
|
|
||||||
'updatedAt'
|
|
||||||
],
|
|
||||||
filters: ['name', '_id'],
|
filters: ['name', '_id'],
|
||||||
sorters: ['name', 'documentSize', 'connectedAt', 'updatedAt'],
|
sorters: ['name', 'documentSize', 'connectedAt', 'updatedAt'],
|
||||||
properties: [
|
properties: [
|
||||||
|
|||||||
@ -56,7 +56,6 @@ export const DocumentSize = {
|
|||||||
url: (_id) =>
|
url: (_id) =>
|
||||||
`/dashboard/management/documentsizes/info?documentSizeId=${_id}&action=cancelEdit`,
|
`/dashboard/management/documentsizes/info?documentSizeId=${_id}&action=cancelEdit`,
|
||||||
visible: (objectData) => {
|
visible: (objectData) => {
|
||||||
console.log(objectData?._isEditing)
|
|
||||||
return objectData?._isEditing && objectData?._isEditing == true
|
return objectData?._isEditing && objectData?._isEditing == true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -65,7 +65,6 @@ export const DocumentTemplate = {
|
|||||||
url: (_id) =>
|
url: (_id) =>
|
||||||
`/dashboard/management/documenttemplates/info?documentTemplateId=${_id}&action=cancelEdit`,
|
`/dashboard/management/documenttemplates/info?documentTemplateId=${_id}&action=cancelEdit`,
|
||||||
visible: (objectData) => {
|
visible: (objectData) => {
|
||||||
console.log(objectData?._isEditing)
|
|
||||||
return objectData?._isEditing && objectData?._isEditing == true
|
return objectData?._isEditing && objectData?._isEditing == true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -54,7 +54,6 @@ export const Filament = {
|
|||||||
url: (_id) =>
|
url: (_id) =>
|
||||||
`/dashboard/management/filaments/info?filamentId=${_id}&action=cancelEdit`,
|
`/dashboard/management/filaments/info?filamentId=${_id}&action=cancelEdit`,
|
||||||
visible: (objectData) => {
|
visible: (objectData) => {
|
||||||
console.log(objectData?._isEditing)
|
|
||||||
return objectData?._isEditing && objectData?._isEditing == true
|
return objectData?._isEditing && objectData?._isEditing == true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -33,7 +33,8 @@ export const File = {
|
|||||||
label: 'Edit',
|
label: 'Edit',
|
||||||
row: true,
|
row: true,
|
||||||
icon: EditIcon,
|
icon: EditIcon,
|
||||||
url: (_id) => `/dashboard/management/files/info?fileId=${_id}&action=edit`,
|
url: (_id) =>
|
||||||
|
`/dashboard/management/files/info?fileId=${_id}&action=edit`,
|
||||||
visible: (objectData) => {
|
visible: (objectData) => {
|
||||||
return !(objectData?._isEditing && objectData?._isEditing == true)
|
return !(objectData?._isEditing && objectData?._isEditing == true)
|
||||||
}
|
}
|
||||||
@ -55,7 +56,6 @@ export const File = {
|
|||||||
url: (_id) =>
|
url: (_id) =>
|
||||||
`/dashboard/management/files/info?fileId=${_id}&action=cancelEdit`,
|
`/dashboard/management/files/info?fileId=${_id}&action=cancelEdit`,
|
||||||
visible: (objectData) => {
|
visible: (objectData) => {
|
||||||
console.log(objectData?._isEditing)
|
|
||||||
return objectData?._isEditing && objectData?._isEditing == true
|
return objectData?._isEditing && objectData?._isEditing == true
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|||||||
@ -63,7 +63,6 @@ export const GCodeFile = {
|
|||||||
url: (_id) =>
|
url: (_id) =>
|
||||||
`/dashboard/production/gcodefiles/info?gcodeFileId=${_id}&action=cancelEdit`,
|
`/dashboard/production/gcodefiles/info?gcodeFileId=${_id}&action=cancelEdit`,
|
||||||
visible: (objectData) => {
|
visible: (objectData) => {
|
||||||
console.log(objectData?._isEditing)
|
|
||||||
return objectData?._isEditing && objectData?._isEditing == true
|
return objectData?._isEditing && objectData?._isEditing == true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -63,7 +63,6 @@ export const Host = {
|
|||||||
url: (_id) =>
|
url: (_id) =>
|
||||||
`/dashboard/management/hosts/info?hostId=${_id}&action=cancelEdit`,
|
`/dashboard/management/hosts/info?hostId=${_id}&action=cancelEdit`,
|
||||||
visible: (objectData) => {
|
visible: (objectData) => {
|
||||||
console.log(objectData?._isEditing)
|
|
||||||
return objectData?._isEditing && objectData?._isEditing == true
|
return objectData?._isEditing && objectData?._isEditing == true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -27,7 +27,6 @@ export const Job = {
|
|||||||
url: (_id) =>
|
url: (_id) =>
|
||||||
`/dashboard/production/jobs/info?jobId=${_id}&action=deploy`,
|
`/dashboard/production/jobs/info?jobId=${_id}&action=deploy`,
|
||||||
disabled: (objectData) => {
|
disabled: (objectData) => {
|
||||||
console.log('Should be disabled', objectData?.state?.type != 'draft')
|
|
||||||
return objectData?.state?.type != 'draft'
|
return objectData?.state?.type != 'draft'
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|||||||
@ -54,7 +54,6 @@ export const NoteType = {
|
|||||||
url: (_id) =>
|
url: (_id) =>
|
||||||
`/dashboard/management/notetypes/info?noteTypeId=${_id}&action=cancelEdit`,
|
`/dashboard/management/notetypes/info?noteTypeId=${_id}&action=cancelEdit`,
|
||||||
visible: (objectData) => {
|
visible: (objectData) => {
|
||||||
console.log(objectData?._isEditing)
|
|
||||||
return objectData?._isEditing && objectData?._isEditing == true
|
return objectData?._isEditing && objectData?._isEditing == true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -53,7 +53,6 @@ export const Part = {
|
|||||||
url: (_id) =>
|
url: (_id) =>
|
||||||
`/dashboard/management/parts/info?partId=${_id}&action=cancelEdit`,
|
`/dashboard/management/parts/info?partId=${_id}&action=cancelEdit`,
|
||||||
visible: (objectData) => {
|
visible: (objectData) => {
|
||||||
console.log(objectData?._isEditing)
|
|
||||||
return objectData?._isEditing && objectData?._isEditing == true
|
return objectData?._isEditing && objectData?._isEditing == true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -98,7 +97,6 @@ export const Part = {
|
|||||||
objectType: 'vendor',
|
objectType: 'vendor',
|
||||||
showHyperlink: true,
|
showHyperlink: true,
|
||||||
value: (objectData) => {
|
value: (objectData) => {
|
||||||
console.log(objectData?.vendor, objectData?.product?.vendor)
|
|
||||||
if (!objectData?.vendor && objectData?.product?.vendor) {
|
if (!objectData?.vendor && objectData?.product?.vendor) {
|
||||||
return objectData?.product?.vendor
|
return objectData?.product?.vendor
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@ -68,7 +68,6 @@ export const Printer = {
|
|||||||
url: (_id) =>
|
url: (_id) =>
|
||||||
`/dashboard/production/printers/info?printerId=${_id}&action=cancelEdit`,
|
`/dashboard/production/printers/info?printerId=${_id}&action=cancelEdit`,
|
||||||
visible: (objectData) => {
|
visible: (objectData) => {
|
||||||
console.log(objectData?._isEditing)
|
|
||||||
return objectData?._isEditing && objectData?._isEditing == true
|
return objectData?._isEditing && objectData?._isEditing == true
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@ -127,7 +126,6 @@ export const Printer = {
|
|||||||
label: 'Start Queue',
|
label: 'Start Queue',
|
||||||
icon: PlayCircleIcon,
|
icon: PlayCircleIcon,
|
||||||
disabled: (objectData) => {
|
disabled: (objectData) => {
|
||||||
console.log(objectData?.queue?.length)
|
|
||||||
return (
|
return (
|
||||||
objectData?.state?.type == 'error' ||
|
objectData?.state?.type == 'error' ||
|
||||||
objectData?.state?.type == 'printing' ||
|
objectData?.state?.type == 'printing' ||
|
||||||
|
|||||||
@ -54,20 +54,11 @@ export const Product = {
|
|||||||
url: (_id) =>
|
url: (_id) =>
|
||||||
`/dashboard/management/products/info?productId=${_id}&action=cancelEdit`,
|
`/dashboard/management/products/info?productId=${_id}&action=cancelEdit`,
|
||||||
visible: (objectData) => {
|
visible: (objectData) => {
|
||||||
console.log(objectData?._isEditing)
|
|
||||||
return objectData?._isEditing && objectData?._isEditing == true
|
return objectData?._isEditing && objectData?._isEditing == true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
columns: [
|
columns: ['_id', 'name', 'tags', 'vendor', 'price', 'createdAt', 'updatedAt'],
|
||||||
'_id',
|
|
||||||
'name',
|
|
||||||
'tags',
|
|
||||||
'vendor',
|
|
||||||
'price',
|
|
||||||
'createdAt',
|
|
||||||
'updatedAt'
|
|
||||||
],
|
|
||||||
filters: ['_id', 'name', 'type', 'color', 'cost', 'vendor'],
|
filters: ['_id', 'name', 'type', 'color', 'cost', 'vendor'],
|
||||||
sorters: ['name', 'createdAt', 'type', 'vendor', 'cost', 'updatedAt'],
|
sorters: ['name', 'createdAt', 'type', 'vendor', 'cost', 'updatedAt'],
|
||||||
properties: [
|
properties: [
|
||||||
|
|||||||
@ -55,7 +55,6 @@ export const Vendor = {
|
|||||||
url: (_id) =>
|
url: (_id) =>
|
||||||
`/dashboard/management/vendors/info?vendorId=${_id}&action=cancelEdit`,
|
`/dashboard/management/vendors/info?vendorId=${_id}&action=cancelEdit`,
|
||||||
visible: (objectData) => {
|
visible: (objectData) => {
|
||||||
console.log(objectData?._isEditing)
|
|
||||||
return objectData?._isEditing && objectData?._isEditing == true
|
return objectData?._isEditing && objectData?._isEditing == true
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|||||||
@ -21,8 +21,6 @@ export const setCookie = (name, value, options = {}) => {
|
|||||||
|
|
||||||
const cookieOptions = { ...COOKIE_OPTIONS, ...options }
|
const cookieOptions = { ...COOKIE_OPTIONS, ...options }
|
||||||
|
|
||||||
console.log('VALUE', value)
|
|
||||||
|
|
||||||
let cookieString = `${name}=${encodeURIComponent(value)}`
|
let cookieString = `${name}=${encodeURIComponent(value)}`
|
||||||
|
|
||||||
if (cookieOptions.maxAge) {
|
if (cookieOptions.maxAge) {
|
||||||
@ -74,7 +72,6 @@ export const getCookie = (name) => {
|
|||||||
|
|
||||||
for (let i = 0; i < cookies.length; i++) {
|
for (let i = 0; i < cookies.length; i++) {
|
||||||
let cookie = cookies[i]
|
let cookie = cookies[i]
|
||||||
console.log(cookie)
|
|
||||||
while (cookie.charAt(0) === ' ') {
|
while (cookie.charAt(0) === ' ') {
|
||||||
cookie = cookie.substring(1, cookie.length)
|
cookie = cookie.substring(1, cookie.length)
|
||||||
}
|
}
|
||||||
@ -123,7 +120,7 @@ export const areCookiesEnabled = () => {
|
|||||||
removeCookie('test')
|
removeCookie('test')
|
||||||
return enabled
|
return enabled
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
console.log(e)
|
console.error('Error checking if cookies are enabled:', e)
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -5,7 +5,7 @@ import svgr from 'vite-plugin-svgr'
|
|||||||
import svgo from 'vite-plugin-svgo'
|
import svgo from 'vite-plugin-svgo'
|
||||||
|
|
||||||
export default defineConfig({
|
export default defineConfig({
|
||||||
base: './',
|
base: '/',
|
||||||
plugins: [react(), svgo(), svgr(), eslintPlugin()],
|
plugins: [react(), svgo(), svgr(), eslintPlugin()],
|
||||||
build: {
|
build: {
|
||||||
outDir: 'build',
|
outDir: 'build',
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user