Compare commits

..

No commits in common. "83f5b20168f9af98a5524347f982bb07d5508707" and "899444e815c59995a2cc731813784504ac88fe45" have entirely different histories.

23 changed files with 88 additions and 137 deletions

View File

@ -184,6 +184,7 @@ const downloadArtifact = async (artifact, destinationPath, webContents) => {
}
const restartApp = (app) => {
console.log('[app-update] restarting app')
app.relaunch()
app.exit(0)
}

View File

@ -111,6 +111,13 @@ export const launchMacInstaller = (
const installScript = buildMacInstallScript(installerPath, logPath)
const promptName = 'farmcontrol'
console.log('[app-update] launching macOS installer:', {
installerPath,
installScript,
logPath,
promptName
})
sendProgress(webContents, {
phase: 'installing',
percent: 0,
@ -133,6 +140,7 @@ export const launchMacInstaller = (
await fs.unlink(logPath).catch(() => {})
if (stdout) console.log('[app-update] installer stdout:', stdout)
if (stderr) console.error('[app-update] installer stderr:', stderr)
if (error) {
@ -166,6 +174,7 @@ export const launchMacInstaller = (
message: message || 'Installation complete. Restarting Farm Control...'
})
console.log('[app-update] installer completed successfully')
resolve()
})
})

View File

@ -157,6 +157,7 @@ function setupWindowEvents() {
})
})
win.on('enter-full-screen', () => {
console.log('Entered fullscreen')
win.webContents.send('window-state', {
isFullScreen: true
})
@ -292,6 +293,7 @@ export function setupMainWindowAppEvents(app) {
export function setupDevAuthServer() {
const env = (process.env.NODE_ENV || 'development').trim()
if (env == 'development') {
console.log('Starting development auth web server...')
import('express').then(({ default: express }) => {
const app = express()
const port = 3500
@ -308,7 +310,11 @@ export function setupDevAuthServer() {
}
})
app.listen(port, () => {})
app.listen(port, () => {
console.log(`Dev auth server running on http://localhost:${port}`)
})
})
} else {
console.log('Will use url scheme instead of auth server.')
}
}

View File

@ -9,7 +9,14 @@ const DEBUG_PREFIX = '[app-update][win-progress]'
const sleep = (ms) => new Promise((resolve) => setTimeout(resolve, ms))
const debugLog = () => {}
const debugLog = (message, details) => {
if (details === undefined) {
console.log(`${DEBUG_PREFIX} ${message}`)
return
}
console.log(`${DEBUG_PREFIX} ${message}`, details)
}
const decodeMsiLogBuffer = (buffer) => {
if (!buffer?.length) return ''

View File

@ -191,7 +191,7 @@ const AppPasswordInfo = () => {
<Modal
open={regenerateSecretOpen}
destroyOnHidden={true}
destroyOnClose
width={650}
onCancel={() => {
actionHandlerRef.current?.clearAction?.()

View File

@ -229,7 +229,7 @@ const FilamentInfo = () => {
footer={null}
width={700}
onCancel={() => setNewFilamentSkuOpen(false)}
destroyOnHidden={true}
destroyOnClose
>
<NewFilamentSku
onOk={() => {

View File

@ -184,7 +184,7 @@ const PartInfo = () => {
footer={null}
width={700}
onCancel={() => setNewPartSkuOpen(false)}
destroyOnHidden={true}
destroyOnClose
>
<NewPartSku
onOk={() => {

View File

@ -188,7 +188,7 @@ const ProductInfo = () => {
footer={null}
width={700}
onCancel={() => setNewProductSkuOpen(false)}
destroyOnHidden={true}
destroyOnClose
>
<NewProductSku
onOk={() => {

View File

@ -239,7 +239,7 @@ const UserInfo = () => {
<Modal
open={newAppPasswordOpen}
destroyOnHidden={true}
destroyOnClose
width={700}
onCancel={() => {
actionHandlerRef.current?.clearAction?.()

View File

@ -66,6 +66,8 @@ const DeployJob = ({
}
}, [objectData])
console.log(objectData)
const steps = [
{
title: 'Confirm',

View File

@ -1,9 +1,6 @@
import { useRef, useState } from 'react'
import { useLocation } from 'react-router-dom'
import { Space, Flex, Card, Button, Modal } from 'antd'
import NewPrinterProfile, {
EditPrinterProfile
} from '../PrinterProfiles/NewPrinterProfile'
import { Space, Flex, Card } from 'antd'
import { LoadingOutlined } from '@ant-design/icons'
import loglevel from 'loglevel'
import config from '../../../../config.js'
@ -25,20 +22,17 @@ import InfoCollapsePlaceholder from '../../common/InfoCollapsePlaceholder.jsx'
import DocumentPrintButton from '../../common/DocumentPrintButton.jsx'
import UserNotifierToggle from '../../common/UserNotifierToggle.jsx'
import ScrollBox from '../../common/ScrollBox.jsx'
import PlusIcon from '../../../Icons/PlusIcon.jsx'
import PrinterProfileIcon from '../../../Icons/PrinterProfileIcon.jsx'
const log = loglevel.getLogger('PrinterInfo')
log.setLevel(config.logLevel)
const PrinterInfo = () => {
const location = useLocation()
const objectFormRef = useRef(null)
const profilesTableRef = useRef(null)
const actionHandlerRef = useRef(null)
const printerId = new URLSearchParams(location.search).get('printerId')
const [collapseState, updateCollapseState] = useCollapseState('PrinterInfo', {
info: true,
profiles: true,
stocks: true,
notes: true,
auditLogs: false
@ -52,15 +46,6 @@ const PrinterInfo = () => {
loading: false,
objectData: {}
})
const [profileModal, setProfileModal] = useState({
open: false,
profileId: null
})
const handleProfileSaved = () => {
setProfileModal({ open: false, profileId: null })
profilesTableRef.current?.reload()
}
const actions = {
edit: () => {
@ -100,7 +85,6 @@ const PrinterInfo = () => {
disabled={objectFormState.loading}
items={[
{ key: 'info', label: 'Printer Information' },
{ key: 'profiles', label: 'Printer Profiles' },
{ key: 'notes', label: 'Notes' },
{ key: 'auditLogs', label: 'Audit Logs' }
]}
@ -163,73 +147,31 @@ const PrinterInfo = () => {
setEditFormState((prev) => ({ ...prev, ...state }))
}}
>
{({ loading, isEditing, objectData }) => (
<ObjectInfo
loading={loading}
indicator={<LoadingOutlined />}
isEditing={isEditing}
type='printer'
objectData={objectData}
labelWidth='175px'
visibleProperties={{
currentFilamentStock: false,
'currentFilamentStock._id': false,
currentJob: false,
'currentJob._id': false,
currentSubJob: false,
'currentSubJob._id': false,
alerts: false
}}
/>
)}
{({ loading, isEditing, objectData }) => {
return (
<ObjectInfo
loading={loading}
indicator={<LoadingOutlined />}
isEditing={isEditing}
type='printer'
objectData={objectData}
labelWidth='175px'
visibleProperties={{
currentFilamentStock: false,
'currentFilamentStock._id': false,
currentJob: false,
'currentJob._id': false,
currentSubJob: false,
'currentSubJob._id': false,
alerts: false
}}
/>
)
}}
</ObjectForm>
</InfoCollapse>
</ActionHandler>
<InfoCollapse
title='Printer Profiles'
icon={<PrinterProfileIcon />}
active={collapseState.profiles}
onToggle={(expanded) => updateCollapseState('profiles', expanded)}
collapseKey='profiles'
>
{objectFormState.loading ? (
<InfoCollapsePlaceholder />
) : (
<Flex vertical gap='middle'>
<Flex>
<Button
icon={<PlusIcon />}
onClick={() =>
setProfileModal({ open: true, profileId: null })
}
>
New Printer Profile
</Button>
</Flex>
<ObjectTable
ref={profilesTableRef}
type='printerProfile'
masterFilter={{ printer: printerId }}
visibleColumns={{
printer: false,
'printer._id': false
}}
onRowAction={(action, profile) => {
if (action.name === 'edit') {
setProfileModal({
open: true,
profileId: profile._id
})
return true
}
return false
}}
/>
</Flex>
)}
</InfoCollapse>
<InfoCollapse
title='Notes'
icon={<NoteIcon />}
@ -264,27 +206,6 @@ const PrinterInfo = () => {
</Flex>
</ScrollBox>
</Flex>
<Modal
open={profileModal.open}
footer={null}
width={1000}
onCancel={() => setProfileModal({ open: false, profileId: null })}
destroyOnHidden
>
{profileModal.open &&
(profileModal.profileId ? (
<EditPrinterProfile
profileId={profileModal.profileId}
printerId={printerId}
onOk={handleProfileSaved}
/>
) : (
<NewPrinterProfile
printerId={printerId}
onOk={handleProfileSaved}
/>
))}
</Modal>
</>
)
}

View File

@ -285,7 +285,7 @@ const MarketplaceInfo = () => {
onCancel={() => setSyncListingsOpen(false)}
width={500}
footer={null}
destroyOnHidden={true}
destroyOnClose
centered
>
<SyncListings
@ -301,7 +301,7 @@ const MarketplaceInfo = () => {
onCancel={() => setSyncOrdersOpen(false)}
width={500}
footer={null}
destroyOnHidden={true}
destroyOnClose
centered
>
<SyncOrders
@ -317,7 +317,7 @@ const MarketplaceInfo = () => {
onCancel={() => setConfigureModalOpen(false)}
width={650}
footer={null}
destroyOnHidden={true}
destroyOnClose
centered
>
<ConfigureMarketplace

View File

@ -105,7 +105,7 @@ const ExportListButton = ({
</Dropdown>
<Modal
open={odataModalOpen}
destroyOnHidden={true}
destroyOnClose
width={650}
onCancel={() => setOdataModalOpen(false)}
footer={null}
@ -114,7 +114,7 @@ const ExportListButton = ({
</Modal>
<Modal
open={rssModalOpen}
destroyOnHidden={true}
destroyOnClose
width={750}
onCancel={() => setRssModalOpen(false)}
footer={null}

View File

@ -19,6 +19,7 @@ const FilePreview = ({ file, style = {} }) => {
return
}
setLoading(true)
console.log('fetching file content', file)
const objectUrl = await fetchFileContent(file, false)
if (objectUrl == null) {
setLoading(false)

View File

@ -220,7 +220,7 @@ const Notification = ({
{showExtraInfo && (
<>
<Divider style={{ margin: largeSpacing ? '10px 0' : 0 }} />
<Flex ju stify='space-between' align='center'>
<Flex justify='space-between' align='center'>
{getNotificationTag(notification.type)}
<TimeDisplay
dateTime={notification.createdAt}

View File

@ -376,6 +376,7 @@ const ObjectChildTable = ({
const currentItems = Array.isArray(itemsSource) ? itemsSource : []
const newItems = [...currentItems, newItem]
console.log('newItems', newItems)
if (typeof onChange === 'function') {
onChange(newItems)
}

View File

@ -47,20 +47,17 @@ const ObjectDisplay = ({
}, [])
// Detect minimal objects that only contain an _id (must be string, not populated object)
const isMinimalObject = useCallback(
(obj) => {
if (!obj || typeof obj !== 'object' || Array.isArray(obj)) return false
const keys = Object.keys(obj)
const id = obj._id
return (
keys.length === 1 &&
keys[0] === '_id' &&
typeof id === 'string' &&
isValidId(id)
)
},
[isValidId]
)
const isMinimalObject = useCallback((obj) => {
if (!obj || typeof obj !== 'object' || Array.isArray(obj)) return false
const keys = Object.keys(obj)
const id = obj._id
return (
keys.length === 1 &&
keys[0] === '_id' &&
typeof id === 'string' &&
isValidId(id)
)
}, [isValidId])
// If only an _id is provided, fetch the full object via spotlight
const fetchFullObjectIfNeeded = useCallback(
@ -134,14 +131,7 @@ const ObjectDisplay = ({
cancelled = true
setIsHydrating(false)
}
}, [
object,
fetchFullObjectIfNeeded,
isMinimalObject,
isValidId,
getStringId,
token
])
}, [object, fetchFullObjectIfNeeded, isMinimalObject, isValidId, getStringId, token])
if (!objectData) {
return <Text type='secondary'>n/a</Text>
}

View File

@ -43,6 +43,8 @@ const PropertyChanges = ({ type, value }) => {
...flatNew
}
console.log(combinedChanges)
return (
<Descriptions size='small' column={1}>
{Object.keys(combinedChanges).map((key) => {

View File

@ -1770,6 +1770,8 @@ const ApiServerProvider = ({ children }) => {
'launchSession'
)
console.log(new URLSearchParams(location.search))
if (
authenticated !== true ||
!token ||

View File

@ -303,6 +303,8 @@ const AuthProvider = ({ children }) => {
profileImage?._id ??
(typeof profileImage === 'string' ? profileImage : null)
console.log('Fetching profile image:', profileImageId)
if (!token) {
if (profileImageUrlRef.current) {
URL.revokeObjectURL(profileImageUrlRef.current)
@ -370,6 +372,10 @@ const AuthProvider = ({ children }) => {
}
}, [userProfile?.profileImage, token])
useEffect(() => {
console.log('userProfile', userProfile)
}, [userProfile])
const logout = useCallback(
(redirectUri = '/login') => {
setAuthenticated(false)

View File

@ -57,6 +57,7 @@ const EmailNotificationTemplate = () => {
)
}
case 'newNote': {
console.log('newNote metadata', JSON.stringify(metadata, null, 2))
const model = getModelByName(metadata?.note?.parentType)
const infoAction =
model.actions?.find((action) => action.name === 'info') ?? null

View File

@ -161,6 +161,7 @@ export const ListingVarient = {
showHyperlink: true,
readOnly: true,
value: (objectData) => {
console.log('listing product id', objectData?.listing?.product?._id)
return objectData?.listing?.product
},
required: true,

View File

@ -244,6 +244,7 @@ export const OrderItem = {
showHyperlink: true,
columnWidth: 300,
masterFilter: (objectData) => {
console.log(objectData)
if (objectData?.itemType === 'filament' && objectData?.item?._id) {
return { filament: objectData.item._id }
}