feat: Equipment page — KKT hides connection, Windows printer, COM retry; agent update banner

- EquipmentPage: KKT hides USB/COM/Network buttons (DTO handles connection)
- EquipmentPage: Printer adds Windows connection type — lists installed printers from agent
- EquipmentPage: COM port section has retry button (↺)
- api.ts: add listPrinters, extend connection type
- workstations.ts: add /printers endpoint (list_printers command)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-03-27 18:30:06 +03:00
parent 13dac3f227
commit 1358dda7f9
3 changed files with 116 additions and 17 deletions

View File

@@ -262,6 +262,18 @@ const workstationRoutes: FastifyPluginAsync = async (fastify) => {
},
)
// ── GET /api/hotels/:slug/workstations/:id/printers ─────────────────────────
fastify.get<WsParam>('/api/hotels/:slug/workstations/:id/printers', { onRequest: [fastify.authenticate] }, async (req, reply) => {
const { id } = req.params
try {
const result = await sendCommandAndWait(id, { type: 'list_printers' }, 8000) as { ok: boolean; printers?: { name: string; isDefault: boolean }[]; error?: string }
if (!result.ok) return reply.code(502).send({ error: result.error ?? 'Агент недоступен' })
return { printers: result.printers ?? [] }
} catch (err) {
return reply.code(502).send({ error: err instanceof Error ? err.message : 'Ошибка' })
}
})
// ── GET /api/hotels/:slug/workstations/:id/ports ────────────────────────────
fastify.get<WsParam>(
'/api/hotels/:slug/workstations/:id/ports',