feature: added a toggle to show the services on a node

This commit is contained in:
findthelorax
2026-04-19 21:31:33 -04:00
committed by Pouzor
parent d1f170d5db
commit f32c32f6a5
5 changed files with 152 additions and 9 deletions
@@ -273,12 +273,33 @@ describe('NodeModal', () => {
it('toggles container_mode on click', () => {
const { onSubmit } = renderModal({ initial: { ...BASE, type: 'proxmox', container_mode: true } })
fireEvent.click(screen.getByRole('switch'))
fireEvent.click(screen.getByRole('switch', { name: 'Container Mode' }))
fireEvent.click(screen.getByRole('button', { name: 'Add' }))
expect((onSubmit.mock.calls[0][0] as Partial<NodeData>).container_mode).toBe(false)
})
// ── Parent container ──────────────────────────────────────────────────
// ── Show services toggle (modal-only) ───────────────────────────────
it('shows Show Services toggle for regular nodes', () => {
renderModal({ initial: BASE })
expect(screen.getByText('Show Services')).toBeDefined()
expect(screen.getByRole('switch', { name: 'Show Services' })).toBeDefined()
})
it('hides Show Services toggle for groupRect', () => {
renderModal({ initial: { ...BASE, type: 'groupRect' } })
expect(screen.queryByText('Show Services')).toBeNull()
})
it('submits custom_colors.show_services=true when toggled on', () => {
const { onSubmit } = renderModal({ initial: BASE })
fireEvent.click(screen.getByRole('switch', { name: 'Show Services' }))
fireEvent.click(screen.getByRole('button', { name: 'Add' }))
const data = onSubmit.mock.calls[0][0] as Partial<NodeData>
expect(data.custom_colors?.show_services).toBe(true)
})
// ── Parent Proxmox (vm / lxc only) ───────────────────────────────────
const parentContainerVisibleTypes = ['proxmox', 'vm', 'lxc', 'docker_host', 'isp', 'router', 'switch', 'server', 'nas', 'ap', 'printer', 'iot', 'camera', 'cpl', 'computer', 'generic'] as const
const parentContainerHiddenTypes = ['groupRect', 'group'] as const