Skip to content

Self-hosted homelab infrastructure visualizer — interactive network diagram with live status monitoring

refactor(sidebar): drop the Hidden Devices shortcut

Pouzorb9ffa996c60f
diff --git a/frontend/src/components/panels/Sidebar.tsx b/frontend/src/components/panels/Sidebar.tsx
index 24cd3d6..871821c 100644
--- a/frontend/src/components/panels/Sidebar.tsx
+++ b/frontend/src/components/panels/Sidebar.tsx
@@ -1,5 +1,5 @@
import { useState, useCallback, useEffect } from 'react'
-import { Plus, Save, ScanLine, ChevronLeft, ChevronRight, LayoutDashboard, Clock, EyeOff, Square, Settings, LogOut, Network, RadioTower, Server, Type, PlusCircle, Pencil, Trash2, Rows3, BookOpen } from 'lucide-react'
+import { Plus, Save, ScanLine, ChevronLeft, ChevronRight, LayoutDashboard, Clock, Square, Settings, LogOut, Network, RadioTower, Server, Type, PlusCircle, Pencil, Trash2, Rows3, BookOpen } from 'lucide-react'
import { Logo } from '@/components/ui/Logo'
import { Tooltip, TooltipContent, TooltipTrigger } from '@/components/ui/tooltip'
import { useCanvasStore } from '@/stores/canvasStore'
@@ -19,11 +19,6 @@ import { useLatestRelease } from '@/hooks/useLatestRelease'
const STANDALONE = import.meta.env.VITE_STANDALONE === 'true'
-const PENDING_TRIGGERS: { kind: 'pending' | 'hidden'; icon: typeof ScanLine; label: string }[] = [
- { kind: 'pending', icon: ScanLine, label: 'Device Inventory' },
- { kind: 'hidden', icon: EyeOff, label: 'Hidden Devices' },
-]
-
interface SidebarProps {
onAddNode: () => void
onAddGroupRect: () => void
@@ -258,15 +253,16 @@ export function Sidebar({ onAddNode, onAddGroupRect, onAddText, onScan, onZigbee
onClick={() => setView('documentation')}
/>
)}
- {!STANDALONE && PENDING_TRIGGERS.map((t) => (
+ {/* The hidden devices are a filter of this same modal, reached from
+ inside it — the sidebar carries the one entry point. */}
+ {!STANDALONE && (
<SidebarItem
- key={t.kind}
- icon={t.icon}
- label={t.label}
+ icon={ScanLine}
+ label="Device Inventory"
collapsed={collapsed}
- onClick={() => onOpenInventory(undefined, t.kind)}
+ onClick={() => onOpenInventory(undefined, 'pending')}
/>
- ))}
+ )}
{!STANDALONE && (
<SidebarItem
icon={Clock}
diff --git a/frontend/src/components/panels/__tests__/Sidebar.test.tsx b/frontend/src/components/panels/__tests__/Sidebar.test.tsx
index 4e3ab5a..ae1fb67 100644
--- a/frontend/src/components/panels/__tests__/Sidebar.test.tsx
+++ b/frontend/src/components/panels/__tests__/Sidebar.test.tsx
@@ -104,7 +104,6 @@ describe('Sidebar', () => {
render(<Sidebar {...defaultProps} />)
expect(screen.getByText('Canvas')).toBeInTheDocument()
expect(screen.getByText('Device Inventory')).toBeInTheDocument()
- expect(screen.getByText('Hidden Devices')).toBeInTheDocument()
expect(screen.getByText('Scan History')).toBeInTheDocument()
})
@@ -242,7 +241,7 @@ describe('Sidebar', () => {
expect(defaultProps.onScan).toHaveBeenCalledOnce()
})
- // ── Pending / Hidden open modal ────────────────────────────────────────────
+ // ── Device Inventory opens the modal ───────────────────────────────────────
it('calls onOpenInventory with pending status when Device Inventory is clicked', () => {
render(<Sidebar {...defaultProps} />)
@@ -250,10 +249,9 @@ describe('Sidebar', () => {
expect(defaultProps.onOpenInventory).toHaveBeenCalledWith(undefined, 'pending')
})
- it('calls onOpenInventory with hidden status when Hidden Devices is clicked', () => {
+ it('offers no Hidden Devices shortcut — the modal carries that filter', () => {
render(<Sidebar {...defaultProps} />)
- fireEvent.click(screen.getByText('Hidden Devices'))
- expect(defaultProps.onOpenInventory).toHaveBeenCalledWith(undefined, 'hidden')
+ expect(screen.queryByText('Hidden Devices')).not.toBeInTheDocument()
})
it('calls onOpenHistory when Scan History nav item is clicked', () => {