diff --git a/public/electron.js b/public/electron.js index 7eec412..cc3c60d 100644 --- a/public/electron.js +++ b/public/electron.js @@ -87,6 +87,5 @@ ipcMain.handle('auth-session-clear', async () => { // IPC handler for opening external URLs ipcMain.handle('open-external-url', (event, url) => { - console.log('Opening external url...') shell.openExternal(url) }) diff --git a/public/mainWindow.js b/public/mainWindow.js index aeaaf4c..cab5b2b 100644 --- a/public/mainWindow.js +++ b/public/mainWindow.js @@ -155,7 +155,6 @@ export function setupMainWindowAppEvents(app) { app.on('open-url', (event, url) => { event.preventDefault() - console.log('App opened with URL:', url) if (url.startsWith('farmcontrol://app')) { // Extract the path/query after 'farmcontrol://app' const redirectPath = url.replace('farmcontrol://app', '') || '/' diff --git a/src/components/Dashboard/Developer/ApiContextDebug.jsx b/src/components/Dashboard/Developer/ApiContextDebug.jsx index 02e174c..f79cf49 100644 --- a/src/components/Dashboard/Developer/ApiContextDebug.jsx +++ b/src/components/Dashboard/Developer/ApiContextDebug.jsx @@ -17,6 +17,10 @@ import CloudIcon from '../../Icons/CloudIcon.jsx' import { ApiServerContext } from '../context/ApiServerContext.jsx' import BoolDisplay from '../common/BoolDisplay.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 @@ -140,11 +144,10 @@ const ApiContextDebug = () => { ) msgApi.destroy() msgApi.success('fetchObject test completed') - console.log('fetchObject result:', result) } catch (err) { msgApi.destroy() msgApi.error('fetchObject test failed') - console.error('fetchObject error:', err) + logger.error('fetchObject error:', err) } } @@ -157,11 +160,10 @@ const ApiContextDebug = () => { }) msgApi.destroy() msgApi.success('fetchObjects test completed') - console.log('fetchObjects result:', result) } catch (err) { msgApi.destroy() 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') } catch (err) { 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') } catch (err) { msgApi.error('Unlock command failed') - console.error('Unlock error:', err) + logger.error('Unlock error:', err) } } @@ -194,11 +196,10 @@ const ApiContextDebug = () => { ) msgApi.destroy() msgApi.success('fetchObjectLock test completed') - console.log('fetchObjectLock result:', result) } catch (err) { msgApi.destroy() msgApi.error('fetchObjectLock test failed') - console.error('fetchObjectLock error:', err) + logger.error('fetchObjectLock error:', err) } } @@ -216,11 +217,10 @@ const ApiContextDebug = () => { ) msgApi.destroy() msgApi.success('updateObject test completed') - console.log('updateObject result:', result) } catch (err) { msgApi.destroy() 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) msgApi.destroy() msgApi.success('createObject test completed') - console.log('createObject result:', result) } catch (err) { msgApi.destroy() msgApi.error('createObject test failed') - console.error('createObject error:', err) + logger.error('createObject error:', err) } } @@ -251,11 +250,10 @@ const ApiContextDebug = () => { ) msgApi.destroy() msgApi.success('deleteObject test completed') - console.log('deleteObject result:', result) } catch (err) { msgApi.destroy() 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) msgApi.destroy() msgApi.success('fetchObjectsByProperty test completed') - console.log('fetchObjectsByProperty result:', result) } catch (err) { msgApi.destroy() 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) msgApi.destroy() msgApi.success('fetchSpotlightData test completed') - console.log('fetchSpotlightData result:', result) } catch (err) { msgApi.destroy() msgApi.error('fetchSpotlightData test failed') - console.error('fetchSpotlightData error:', err) + logger.error('fetchSpotlightData error:', err) } } @@ -305,7 +301,7 @@ const ApiContextDebug = () => { } catch (err) { msgApi.destroy() msgApi.error('fetchFileContent test failed') - console.error('fetchFileContent error:', err) + logger.error('fetchFileContent error:', err) } } @@ -325,13 +321,12 @@ const ApiContextDebug = () => { } else { msgApi.error('fetchTemplatePreview test failed') } - console.log('fetchTemplatePreview result:', result) } ) } catch (err) { msgApi.destroy() 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) msgApi.destroy() msgApi.success('fetchNotes test completed') - console.log('fetchNotes result:', result) } catch (err) { msgApi.destroy() msgApi.error('fetchNotes test failed') - console.error('fetchNotes error:', err) + logger.error('fetchNotes error:', err) } } @@ -360,12 +354,11 @@ const ApiContextDebug = () => { } else { msgApi.error('fetchHostOTP test failed') } - console.log('fetchHostOTP result:', result) }) } catch (err) { msgApi.destroy() msgApi.error('fetchHostOTP test failed') - console.error('fetchHostOTP error:', err) + logger.error('fetchHostOTP error:', err) } } @@ -384,20 +377,19 @@ const ApiContextDebug = () => { } else { msgApi.error('sendObjectAction test failed') } - console.log('sendObjectAction result:', result) } ) } catch (err) { msgApi.destroy() msgApi.error('sendObjectAction test failed') - console.error('sendObjectAction error:', err) + logger.error('sendObjectAction error:', err) } } const testSubscribeToObjectUpdates = () => { try { const callback = (data) => { - console.log('Object update received:', data) + logger.debug('Object update received:', data) } const unsubscribe = subscribeToObjectUpdates( testInputs.objectId, @@ -405,25 +397,25 @@ const ApiContextDebug = () => { callback ) 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 setTimeout(() => { if (unsubscribe) { unsubscribe() - console.log('Unsubscribed from object updates') + logger.debug('Unsubscribed from object updates') } }, 10000) // Auto-unsubscribe after 10 seconds } catch (err) { msgApi.error('Subscribe to object updates failed') - console.error('Subscribe error:', err) + logger.error('Subscribe error:', err) } } const testSubscribeToObjectEvent = () => { try { const callback = (event) => { - console.log('Object event received:', event) + logger.debug('Object event received:', event) } const unsubscribe = subscribeToObjectEvent( testInputs.objectId, @@ -432,50 +424,50 @@ const ApiContextDebug = () => { callback ) 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 setTimeout(() => { if (unsubscribe) { unsubscribe() - console.log('Unsubscribed from object events') + logger.debug('Unsubscribed from object events') } }, 10000) // Auto-unsubscribe after 10 seconds } catch (err) { msgApi.error('Subscribe to object events failed') - console.error('Subscribe error:', err) + logger.error('Subscribe error:', err) } } const testSubscribeToObjectTypeUpdates = () => { try { const callback = (data) => { - console.log('Object type update received:', data) + logger.debug('Object type update received:', data) } const unsubscribe = subscribeToObjectTypeUpdates( testInputs.objectType, callback ) 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 setTimeout(() => { if (unsubscribe) { unsubscribe() - console.log('Unsubscribed from object type updates') + logger.debug('Unsubscribed from object type updates') } }, 10000) // Auto-unsubscribe after 10 seconds } catch (err) { msgApi.error('Subscribe to object type updates failed') - console.error('Subscribe error:', err) + logger.error('Subscribe error:', err) } } const testSubscribeToObjectLock = () => { try { const callback = (lockData) => { - console.log('Object lock update received:', lockData) + logger.debug('Object lock update received:', lockData) } const unsubscribe = subscribeToObjectLock( testInputs.objectId, @@ -483,18 +475,18 @@ const ApiContextDebug = () => { callback ) 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 setTimeout(() => { if (unsubscribe) { unsubscribe() - console.log('Unsubscribed from object lock updates') + logger.debug('Unsubscribed from object lock updates') } }, 10000) // Auto-unsubscribe after 10 seconds } catch (err) { msgApi.error('Subscribe to object lock updates failed') - console.error('Subscribe error:', err) + logger.error('Subscribe error:', err) } } diff --git a/src/components/Dashboard/Inventory/FilamentStocks/LoadFilamentStock.jsx b/src/components/Dashboard/Inventory/FilamentStocks/LoadFilamentStock.jsx index e43b17b..bd8d0e0 100644 --- a/src/components/Dashboard/Inventory/FilamentStocks/LoadFilamentStock.jsx +++ b/src/components/Dashboard/Inventory/FilamentStocks/LoadFilamentStock.jsx @@ -67,7 +67,6 @@ const LoadFilamentStock = ({ 'printer', 'filamentSensor', (event) => { - console.log('filamentSensor', event.data) setFilamentSensorDetected(event.data.detected) } ) diff --git a/src/components/Dashboard/Inventory/PartStocks/PartStockInfo.jsx b/src/components/Dashboard/Inventory/PartStocks/PartStockInfo.jsx index 73b8942..8d0810e 100644 --- a/src/components/Dashboard/Inventory/PartStocks/PartStockInfo.jsx +++ b/src/components/Dashboard/Inventory/PartStocks/PartStockInfo.jsx @@ -145,7 +145,6 @@ const PartStockInfo = () => { style={{ height: '100%' }} ref={objectFormRef} onStateChange={(state) => { - console.log('Got edit form state change', state) setEditFormState((prev) => ({ ...prev, ...state })) }} > diff --git a/src/components/Dashboard/Inventory/StockAudits/StockAuditInfo.jsx b/src/components/Dashboard/Inventory/StockAudits/StockAuditInfo.jsx index d67828b..cc18155 100644 --- a/src/components/Dashboard/Inventory/StockAudits/StockAuditInfo.jsx +++ b/src/components/Dashboard/Inventory/StockAudits/StockAuditInfo.jsx @@ -145,7 +145,6 @@ const StockAuditInfo = () => { style={{ height: '100%' }} ref={objectFormRef} onStateChange={(state) => { - console.log('Got edit form state change', state) setEditFormState((prev) => ({ ...prev, ...state })) }} > diff --git a/src/components/Dashboard/Management/DocumentJobs/NewDocumentJob.jsx b/src/components/Dashboard/Management/DocumentJobs/NewDocumentJob.jsx index 5a9c9c6..b61322b 100644 --- a/src/components/Dashboard/Management/DocumentJobs/NewDocumentJob.jsx +++ b/src/components/Dashboard/Management/DocumentJobs/NewDocumentJob.jsx @@ -60,9 +60,6 @@ const NewDocumentJob = ({ onOk, defaultValues = {} }) => { { - console.log(message) - }} /> } diff --git a/src/components/Dashboard/Management/DocumentTemplates/DocumentTemplateDesign.jsx b/src/components/Dashboard/Management/DocumentTemplates/DocumentTemplateDesign.jsx index 91e1f52..8d4b68f 100644 --- a/src/components/Dashboard/Management/DocumentTemplates/DocumentTemplateDesign.jsx +++ b/src/components/Dashboard/Management/DocumentTemplates/DocumentTemplateDesign.jsx @@ -136,7 +136,6 @@ const DocumentTemplateDesign = () => { style={{ height: '100%' }} ref={objectFormRef} onStateChange={(state) => { - console.log('Got edit form state change', state) setEditFormState((prev) => ({ ...prev, ...state })) }} > diff --git a/src/components/Dashboard/Management/DocumentTemplates/DocumentTemplateInfo.jsx b/src/components/Dashboard/Management/DocumentTemplates/DocumentTemplateInfo.jsx index 74a2703..d103be6 100644 --- a/src/components/Dashboard/Management/DocumentTemplates/DocumentTemplateInfo.jsx +++ b/src/components/Dashboard/Management/DocumentTemplates/DocumentTemplateInfo.jsx @@ -147,7 +147,6 @@ const DocumentTemplateInfo = () => { style={{ height: '100%' }} ref={objectFormRef} onStateChange={(state) => { - console.log('Got edit form state change', state) setEditFormState((prev) => ({ ...prev, ...state })) }} > diff --git a/src/components/Dashboard/Management/Files/FileInfo.jsx b/src/components/Dashboard/Management/Files/FileInfo.jsx index b5ad68b..d2b9dab 100644 --- a/src/components/Dashboard/Management/Files/FileInfo.jsx +++ b/src/components/Dashboard/Management/Files/FileInfo.jsx @@ -151,7 +151,6 @@ const FileInfo = () => { style={{ height: '100%' }} ref={objectFormRef} onStateChange={(state) => { - console.log(state) setEditFormState((prev) => ({ ...prev, ...state })) }} > diff --git a/src/components/Dashboard/Production/GCodeFiles/GCodeFileInfo.jsx b/src/components/Dashboard/Production/GCodeFiles/GCodeFileInfo.jsx index d122edc..12ec8df 100644 --- a/src/components/Dashboard/Production/GCodeFiles/GCodeFileInfo.jsx +++ b/src/components/Dashboard/Production/GCodeFiles/GCodeFileInfo.jsx @@ -147,7 +147,6 @@ const GCodeFileInfo = () => { style={{ height: '100%' }} ref={objectFormRef} onStateChange={(state) => { - console.log('Got edit form state change', state) setEditFormState((prev) => ({ ...prev, ...state })) }} > diff --git a/src/components/Dashboard/Production/Jobs/DeployJob.jsx b/src/components/Dashboard/Production/Jobs/DeployJob.jsx index 64a615c..f58a38b 100644 --- a/src/components/Dashboard/Production/Jobs/DeployJob.jsx +++ b/src/components/Dashboard/Production/Jobs/DeployJob.jsx @@ -34,18 +34,11 @@ const DeployJob = ({ onOk, objectData = undefined }) => { } setSubJobsCount(subJobs.length) subJobs.forEach((subJob) => { - console.log( - 'Deploying subjob:', - subJob._id, - 'to printer:', - subJob.printer._id - ) sendObjectAction( subJob.printer._id, 'printer', { type: 'deploy', data: subJob }, - (result) => { - console.log('result', result) + () => { setDeployedSubJobsCount((prev) => prev + 1) } ) diff --git a/src/components/Dashboard/Production/Printers/ControlPrinter.jsx b/src/components/Dashboard/Production/Printers/ControlPrinter.jsx index 6359dcd..6b29414 100644 --- a/src/components/Dashboard/Production/Printers/ControlPrinter.jsx +++ b/src/components/Dashboard/Production/Printers/ControlPrinter.jsx @@ -324,7 +324,6 @@ const ControlPrinter = () => { type='printer' ref={objectFormRef} onStateChange={(state) => { - console.log('Got edit form state change', state) setEditFormState((prev) => ({ ...prev, ...state })) }} > diff --git a/src/components/Dashboard/Production/Printers/PrinterInfo.jsx b/src/components/Dashboard/Production/Printers/PrinterInfo.jsx index 56863ef..1029b04 100644 --- a/src/components/Dashboard/Production/Printers/PrinterInfo.jsx +++ b/src/components/Dashboard/Production/Printers/PrinterInfo.jsx @@ -53,7 +53,6 @@ const PrinterInfo = () => { }, edit: () => { objectFormRef?.current.startEditing() - console.log('CALLING START EDITING') return false }, cancelEdit: () => { @@ -143,7 +142,6 @@ const PrinterInfo = () => { style={{ height: '100%' }} ref={objectFormRef} onStateChange={(state) => { - console.log('Got edit form state change', state) setEditFormState((prev) => ({ ...prev, ...state })) }} > diff --git a/src/components/Dashboard/common/AlertsDisplay.jsx b/src/components/Dashboard/common/AlertsDisplay.jsx index 199b5ca..b20f4bf 100644 --- a/src/components/Dashboard/common/AlertsDisplay.jsx +++ b/src/components/Dashboard/common/AlertsDisplay.jsx @@ -162,9 +162,7 @@ const AlertsDisplay = ({ icon={getAlertIcon(alert.type, alert.priority)} showIcon closable={showDismiss && alert.canDismiss} - onClose={() => { - console.log('Closing alert:', alert._id) - }} + onClose={() => {}} action={ showActions ? ( diff --git a/src/components/Dashboard/common/NoteItem.jsx b/src/components/Dashboard/common/NoteItem.jsx index 6ec9ec2..ee1be3e 100644 --- a/src/components/Dashboard/common/NoteItem.jsx +++ b/src/components/Dashboard/common/NoteItem.jsx @@ -96,12 +96,6 @@ const NoteItem = ({ note }) => { 'note', (noteData) => { if (noteData.parent._id == note._id) { - console.log( - 'Note note added to parent:', - note._id, - 'isExpanded:', - isExpanded - ) if (isExpanded == true) { handleNoteExpand() } diff --git a/src/components/Dashboard/common/ObjectDisplay.jsx b/src/components/Dashboard/common/ObjectDisplay.jsx index 1668194..3425cc5 100644 --- a/src/components/Dashboard/common/ObjectDisplay.jsx +++ b/src/components/Dashboard/common/ObjectDisplay.jsx @@ -91,7 +91,6 @@ const ObjectDisplay = ({ cancelled = true } }, [object, fetchFullObjectIfNeeded]) - console.log(objectData, objectType) if (!objectData) { return n/a } diff --git a/src/components/Dashboard/common/ObjectForm.jsx b/src/components/Dashboard/common/ObjectForm.jsx index 9f8d217..011e78d 100644 --- a/src/components/Dashboard/common/ObjectForm.jsx +++ b/src/components/Dashboard/common/ObjectForm.jsx @@ -381,7 +381,6 @@ const ObjectForm = forwardRef( ...computedValuesObject, _isEditing: isEditingRef.current })) - console.log('calculatedEntries', computedValuesObject) onStateChangeRef.current({ isEditing: true, objectData: { diff --git a/src/components/Dashboard/common/ObjectSelect.jsx b/src/components/Dashboard/common/ObjectSelect.jsx index 9fb71b1..5877301 100644 --- a/src/components/Dashboard/common/ObjectSelect.jsx +++ b/src/components/Dashboard/common/ObjectSelect.jsx @@ -279,7 +279,6 @@ const ObjectSelect = ({ // --- loadData for async loading on expand --- const loadData = async (node) => { - console.log('loading data for node', node) // node.property is the property name, node.value is the value key if (!node.property) return if (type == 'unknown') return @@ -388,11 +387,9 @@ const ObjectSelect = ({ getValueIdentity(valueRef.current) !== getValueIdentity(value) && type != 'unknown' ) { - // console.log('fetching full object', value) valueRef.current = value // Check if value is a minimal object and fetch full object if needed const fullValue = await fetchFullObjectIfNeeded(value) - // console.log('fullValue', fullValue) // Build a new filter from value's properties that are in the properties list const valueFilter = { ...filter } const pathKeys = [] @@ -430,7 +427,6 @@ const ObjectSelect = ({ setExpandedKeys(pathKeys) // Fetch with the new filter handleFetchObjectsProperties(valueFilter) - // console.log('setting treeSelectValue', valueRef.current._id) setTreeSelectValue(valueRef.current._id) setInitialized(true) return @@ -472,10 +468,6 @@ const ObjectSelect = ({ const prevValuesRef = useRef({ type, masterFilter }) - useEffect(() => { - // console.log('treeSelectValue', treeSelectValue) - }, [treeSelectValue]) - useEffect(() => { const prevValues = prevValuesRef.current diff --git a/src/components/Dashboard/common/ObjectTable.jsx b/src/components/Dashboard/common/ObjectTable.jsx index e1257ed..d95bb70 100644 --- a/src/components/Dashboard/common/ObjectTable.jsx +++ b/src/components/Dashboard/common/ObjectTable.jsx @@ -236,7 +236,6 @@ const ObjectTable = forwardRef( order: sorter.order } } - console.log('Fetching data...') try { const result = await fetchObjects(type, { page: pageNum, @@ -252,7 +251,6 @@ const ObjectTable = forwardRef( const existingPageIndex = prev.findIndex( (p) => p.pageNum === pageNum ) - logger.debug(prev.map((p) => p.pageNum)) if (existingPageIndex !== -1) { // Update existing page const newPages = [...prev] @@ -370,7 +368,6 @@ const ObjectTable = forwardRef( setIsEditing(true) tableData.forEach((item) => { if (!item.isSkeleton) { - console.log('Locking object:', item) lockObject(item._id, type) } }) @@ -403,7 +400,7 @@ const ObjectTable = forwardRef( } }) } catch (err) { - console.error(err) + logger.error('Error updating objects:', err) } finally { setEditLoading(false) } @@ -426,8 +423,6 @@ const ObjectTable = forwardRef( }) ) - console.log('updatedData', updatedData) - if (rowFormsRef.current[id]) { rowFormsRef.current[id].setFieldsValue(updatedData) } @@ -464,9 +459,6 @@ const ObjectTable = forwardRef( updateEventHandlerRef.current(itemId, updateData) } ) - console.log('unsubscribe', unsubscribe) - console.log('subscribedIdsRef', subscribedIdsRef.current) - console.log('unsubscribesRef', unsubscribesRef.current) subscribedIdsRef.current.push(itemId) if (unsubscribe) { unsubscribesRef.current.push(unsubscribe) diff --git a/src/components/Dashboard/common/SpotlightTooltip.jsx b/src/components/Dashboard/common/SpotlightTooltip.jsx index 43ccfa1..a44a397 100644 --- a/src/components/Dashboard/common/SpotlightTooltip.jsx +++ b/src/components/Dashboard/common/SpotlightTooltip.jsx @@ -40,7 +40,6 @@ const SpotlightTooltip = ({ query, type }) => { useEffect(() => { if (token != null && initialized == false) { fetchSpotlight() - console.log('Fetching spotlight...') setInitialized(true) } }, [token, fetchSpotlight, initialized]) diff --git a/src/components/Dashboard/context/ApiServerContext.jsx b/src/components/Dashboard/context/ApiServerContext.jsx index 2c3c3fa..1c86bf3 100644 --- a/src/components/Dashboard/context/ApiServerContext.jsx +++ b/src/components/Dashboard/context/ApiServerContext.jsx @@ -253,7 +253,6 @@ const ApiServerProvider = ({ children }) => { const callbacksRefKey = `modelStats:${objectType}` logger.debug('Notifying model stats update:', data) - console.log('handleModelStats', data) if (objectType && subscribedCallbacksRef.current.has(callbacksRefKey)) { const callbacks = subscribedCallbacksRef.current.get(callbacksRefKey) logger.debug( diff --git a/src/components/Dashboard/context/AuthContext.jsx b/src/components/Dashboard/context/AuthContext.jsx index b65e93c..950af56 100644 --- a/src/components/Dashboard/context/AuthContext.jsx +++ b/src/components/Dashboard/context/AuthContext.jsx @@ -217,7 +217,7 @@ const AuthProvider = ({ children }) => { setExpiresAt(newExpiresAt) setUserProfile(newUser) setAuthenticated(true) - console.log('Auth state synchronized from another tab') + logger.debug('Auth state synchronized from another tab') } } else { // Cookies are invalid, clear state @@ -226,7 +226,7 @@ const AuthProvider = ({ children }) => { setUserProfile(null) setAuthenticated(false) setShowUnauthorizedModal(true) - console.log( + logger.debug( 'Auth state cleared due to invalid cookies from another tab' ) } @@ -256,11 +256,11 @@ const AuthProvider = ({ children }) => { messageApi.info('Logging in with tombutcher.work') const loginUrl = `${config.backendUrl}/auth/${redirectType}/login?redirect_uri=${encodeURIComponent(redirectUri)}` if (isElectron) { - console.log('Opening external url...') + logger.debug('Opening external url...') openExternalUrl(loginUrl) setLoading(true) } else { - console.log('Redirecting...') + logger.debug('Redirecting...') window.location.href = loginUrl } }, diff --git a/src/components/Dashboard/context/ElectronContext.jsx b/src/components/Dashboard/context/ElectronContext.jsx index d8630f5..95b0afa 100644 --- a/src/components/Dashboard/context/ElectronContext.jsx +++ b/src/components/Dashboard/context/ElectronContext.jsx @@ -88,8 +88,6 @@ const ElectronProvider = ({ children }) => { // Listen for navigate const navigateHandler = (event, url) => { - console.log('Navigating to:', url) - navigate(url) } ipcRenderer.on('navigate', navigateHandler) diff --git a/src/database/models/Courier.js b/src/database/models/Courier.js index 28b40c0..0115610 100644 --- a/src/database/models/Courier.js +++ b/src/database/models/Courier.js @@ -55,7 +55,6 @@ export const Courier = { url: (_id) => `/dashboard/management/couriers/info?courierId=${_id}&action=cancelEdit`, visible: (objectData) => { - console.log(objectData?._isEditing) return objectData?._isEditing && objectData?._isEditing == true } }, diff --git a/src/database/models/CourierService.js b/src/database/models/CourierService.js index 9411527..74b24b4 100644 --- a/src/database/models/CourierService.js +++ b/src/database/models/CourierService.js @@ -56,7 +56,6 @@ export const CourierService = { url: (_id) => `/dashboard/management/courierservices/info?courierServiceId=${_id}&action=cancelEdit`, visible: (objectData) => { - console.log(objectData?._isEditing) return objectData?._isEditing && objectData?._isEditing == true } }, @@ -70,14 +69,7 @@ export const CourierService = { `/dashboard/management/courierservices/info?courierServiceId=${_id}&action=delete` } ], - columns: [ - 'name', - '_id', - 'courier', - 'tracked', - 'deliveryTime', - 'active' - ], + columns: ['name', '_id', 'courier', 'tracked', 'deliveryTime', 'active'], filters: ['name', '_id', 'courier', 'active', 'deliveryTime', 'tracked'], sorters: [ 'name', diff --git a/src/database/models/DocumentJob.js b/src/database/models/DocumentJob.js index 27d1f6c..8751a94 100644 --- a/src/database/models/DocumentJob.js +++ b/src/database/models/DocumentJob.js @@ -57,7 +57,6 @@ export const DocumentJob = { url: (_id) => `/dashboard/management/documentjobs/info?documentJobId=${_id}&action=cancelEdit`, visible: (objectData) => { - console.log(objectData?._isEditing) return objectData?._isEditing && objectData?._isEditing == true } } diff --git a/src/database/models/DocumentPrinter.js b/src/database/models/DocumentPrinter.js index b08bcbc..00425b2 100644 --- a/src/database/models/DocumentPrinter.js +++ b/src/database/models/DocumentPrinter.js @@ -56,20 +56,11 @@ export const DocumentPrinter = { url: (_id) => `/dashboard/management/documentprinters/info?documentPrinterId=${_id}&action=cancelEdit`, visible: (objectData) => { - console.log(objectData?._isEditing) return objectData?._isEditing && objectData?._isEditing == true } } ], - columns: [ - 'name', - '_id', - 'state', - 'host', - 'tags', - 'connectedAt', - 'updatedAt' - ], + columns: ['name', '_id', 'state', 'host', 'tags', 'connectedAt', 'updatedAt'], filters: ['name', '_id'], sorters: ['name', 'documentSize', 'connectedAt', 'updatedAt'], properties: [ diff --git a/src/database/models/DocumentSize.js b/src/database/models/DocumentSize.js index 8ad4d4b..323515e 100644 --- a/src/database/models/DocumentSize.js +++ b/src/database/models/DocumentSize.js @@ -56,7 +56,6 @@ export const DocumentSize = { url: (_id) => `/dashboard/management/documentsizes/info?documentSizeId=${_id}&action=cancelEdit`, visible: (objectData) => { - console.log(objectData?._isEditing) return objectData?._isEditing && objectData?._isEditing == true } } diff --git a/src/database/models/DocumentTemplate.js b/src/database/models/DocumentTemplate.js index 9b4f133..409e836 100644 --- a/src/database/models/DocumentTemplate.js +++ b/src/database/models/DocumentTemplate.js @@ -65,7 +65,6 @@ export const DocumentTemplate = { url: (_id) => `/dashboard/management/documenttemplates/info?documentTemplateId=${_id}&action=cancelEdit`, visible: (objectData) => { - console.log(objectData?._isEditing) return objectData?._isEditing && objectData?._isEditing == true } } diff --git a/src/database/models/Filament.js b/src/database/models/Filament.js index 1ed899c..c471624 100644 --- a/src/database/models/Filament.js +++ b/src/database/models/Filament.js @@ -54,7 +54,6 @@ export const Filament = { url: (_id) => `/dashboard/management/filaments/info?filamentId=${_id}&action=cancelEdit`, visible: (objectData) => { - console.log(objectData?._isEditing) return objectData?._isEditing && objectData?._isEditing == true } } diff --git a/src/database/models/File.js b/src/database/models/File.js index 06a6033..0faa121 100644 --- a/src/database/models/File.js +++ b/src/database/models/File.js @@ -33,7 +33,8 @@ export const File = { label: 'Edit', row: true, icon: EditIcon, - url: (_id) => `/dashboard/management/files/info?fileId=${_id}&action=edit`, + url: (_id) => + `/dashboard/management/files/info?fileId=${_id}&action=edit`, visible: (objectData) => { return !(objectData?._isEditing && objectData?._isEditing == true) } @@ -55,7 +56,6 @@ export const File = { url: (_id) => `/dashboard/management/files/info?fileId=${_id}&action=cancelEdit`, visible: (objectData) => { - console.log(objectData?._isEditing) return objectData?._isEditing && objectData?._isEditing == true } }, diff --git a/src/database/models/GCodeFile.js b/src/database/models/GCodeFile.js index 5f89654..f9a701b 100644 --- a/src/database/models/GCodeFile.js +++ b/src/database/models/GCodeFile.js @@ -63,7 +63,6 @@ export const GCodeFile = { url: (_id) => `/dashboard/production/gcodefiles/info?gcodeFileId=${_id}&action=cancelEdit`, visible: (objectData) => { - console.log(objectData?._isEditing) return objectData?._isEditing && objectData?._isEditing == true } } diff --git a/src/database/models/Host.js b/src/database/models/Host.js index 551c6ab..ae9c1c6 100644 --- a/src/database/models/Host.js +++ b/src/database/models/Host.js @@ -63,7 +63,6 @@ export const Host = { url: (_id) => `/dashboard/management/hosts/info?hostId=${_id}&action=cancelEdit`, visible: (objectData) => { - console.log(objectData?._isEditing) return objectData?._isEditing && objectData?._isEditing == true } } diff --git a/src/database/models/Job.js b/src/database/models/Job.js index a046cd1..01da225 100644 --- a/src/database/models/Job.js +++ b/src/database/models/Job.js @@ -27,7 +27,6 @@ export const Job = { url: (_id) => `/dashboard/production/jobs/info?jobId=${_id}&action=deploy`, disabled: (objectData) => { - console.log('Should be disabled', objectData?.state?.type != 'draft') return objectData?.state?.type != 'draft' } }, diff --git a/src/database/models/NoteType.js b/src/database/models/NoteType.js index 8fc67e3..9a3189a 100644 --- a/src/database/models/NoteType.js +++ b/src/database/models/NoteType.js @@ -54,7 +54,6 @@ export const NoteType = { url: (_id) => `/dashboard/management/notetypes/info?noteTypeId=${_id}&action=cancelEdit`, visible: (objectData) => { - console.log(objectData?._isEditing) return objectData?._isEditing && objectData?._isEditing == true } } diff --git a/src/database/models/Part.js b/src/database/models/Part.js index a5a00ad..b6ba9c0 100644 --- a/src/database/models/Part.js +++ b/src/database/models/Part.js @@ -53,7 +53,6 @@ export const Part = { url: (_id) => `/dashboard/management/parts/info?partId=${_id}&action=cancelEdit`, visible: (objectData) => { - console.log(objectData?._isEditing) return objectData?._isEditing && objectData?._isEditing == true } } @@ -98,7 +97,6 @@ export const Part = { objectType: 'vendor', showHyperlink: true, value: (objectData) => { - console.log(objectData?.vendor, objectData?.product?.vendor) if (!objectData?.vendor && objectData?.product?.vendor) { return objectData?.product?.vendor } else { diff --git a/src/database/models/Printer.js b/src/database/models/Printer.js index e52ce4c..a7440a3 100644 --- a/src/database/models/Printer.js +++ b/src/database/models/Printer.js @@ -68,7 +68,6 @@ export const Printer = { url: (_id) => `/dashboard/production/printers/info?printerId=${_id}&action=cancelEdit`, visible: (objectData) => { - console.log(objectData?._isEditing) return objectData?._isEditing && objectData?._isEditing == true } }, @@ -127,7 +126,6 @@ export const Printer = { label: 'Start Queue', icon: PlayCircleIcon, disabled: (objectData) => { - console.log(objectData?.queue?.length) return ( objectData?.state?.type == 'error' || objectData?.state?.type == 'printing' || diff --git a/src/database/models/Product.js b/src/database/models/Product.js index 13e8651..1f427d3 100644 --- a/src/database/models/Product.js +++ b/src/database/models/Product.js @@ -54,20 +54,11 @@ export const Product = { url: (_id) => `/dashboard/management/products/info?productId=${_id}&action=cancelEdit`, visible: (objectData) => { - console.log(objectData?._isEditing) return objectData?._isEditing && objectData?._isEditing == true } } ], - columns: [ - '_id', - 'name', - 'tags', - 'vendor', - 'price', - 'createdAt', - 'updatedAt' - ], + columns: ['_id', 'name', 'tags', 'vendor', 'price', 'createdAt', 'updatedAt'], filters: ['_id', 'name', 'type', 'color', 'cost', 'vendor'], sorters: ['name', 'createdAt', 'type', 'vendor', 'cost', 'updatedAt'], properties: [ diff --git a/src/database/models/Vendor.js b/src/database/models/Vendor.js index e9ca73b..9000de0 100644 --- a/src/database/models/Vendor.js +++ b/src/database/models/Vendor.js @@ -55,7 +55,6 @@ export const Vendor = { url: (_id) => `/dashboard/management/vendors/info?vendorId=${_id}&action=cancelEdit`, visible: (objectData) => { - console.log(objectData?._isEditing) return objectData?._isEditing && objectData?._isEditing == true } }, diff --git a/src/utils/cookies.js b/src/utils/cookies.js index 64a2b4f..f396afd 100644 --- a/src/utils/cookies.js +++ b/src/utils/cookies.js @@ -21,8 +21,6 @@ export const setCookie = (name, value, options = {}) => { const cookieOptions = { ...COOKIE_OPTIONS, ...options } - console.log('VALUE', value) - let cookieString = `${name}=${encodeURIComponent(value)}` if (cookieOptions.maxAge) { @@ -74,7 +72,6 @@ export const getCookie = (name) => { for (let i = 0; i < cookies.length; i++) { let cookie = cookies[i] - console.log(cookie) while (cookie.charAt(0) === ' ') { cookie = cookie.substring(1, cookie.length) } @@ -123,7 +120,7 @@ export const areCookiesEnabled = () => { removeCookie('test') return enabled } catch (e) { - console.log(e) + console.error('Error checking if cookies are enabled:', e) return false } }