Revert "reflow machines from k/v" (#3575)

This reverts commit f77b312ecb.
This commit is contained in:
Jess Frazelle
2024-08-20 14:07:32 -07:00
committed by GitHub
parent 5c472c63d2
commit 9c6cca2944
2 changed files with 6 additions and 4 deletions

View File

@ -1,11 +1,13 @@
import { isDesktop } from './isDesktop'
import { components } from './machine-api'
export type MachinesListing = Array<components['schemas']['Machine']>
export type MachinesListing = {
[key: string]: components['schemas']['Machine']
}
export class MachineManager {
private _isDesktop: boolean = isDesktop()
private _machines: MachinesListing = []
private _machines: MachinesListing = {}
private _machineApiIp: string | null = null
private _currentMachine: components['schemas']['Machine'] | null = null
@ -42,7 +44,7 @@ export class MachineManager {
}
machineCount(): number {
return this._machines.length
return Object.keys(this._machines).length
}
get machineApiIp(): string | null {

View File

@ -52,7 +52,7 @@ const kittycad = (access: string, args: any) =>
// bite our butts.
const listMachines = async (): Promise<MachinesListing> => {
const machineApi = await ipcRenderer.invoke('find_machine_api')
if (!machineApi) return []
if (!machineApi) return {}
return fetch(`http://${machineApi}/machines`).then((resp) => resp.json())
}