feat: add machine setup dialog

This commit is contained in:
Federico Jaramillo Martinez
2026-06-04 12:12:25 +02:00
parent 193c9d0f8f
commit 93b50e61af
6 changed files with 241 additions and 9 deletions
@@ -49,14 +49,16 @@ export class MachineController {
void this.refreshMachineHealth(machine.id);
}
async addMachine(input: { name: string; baseUrl: string; token?: string }): Promise<void> {
async addMachine(input: { name: string; baseUrl: string; token?: string }): Promise<Machine | undefined> {
this.setState({ error: "" });
try {
const machine = await api.addMachine(input);
this.setState({ machines: [...this.getState().machines.filter((candidate) => candidate.id !== machine.id), machine] });
await this.selectMachine(machine);
return machine;
} catch (error) {
this.setState({ error: String(error) });
return undefined;
}
}