fix: ProxmoxPanel Sub-Navigation als linkes Sidebar-Menü wie AgentPanel

This commit is contained in:
cynfo3000 2026-03-10 00:58:21 +01:00
parent 67e15040fb
commit 16a7cd3f87

View File

@ -9,6 +9,7 @@ import {
X, Cpu, MemoryStick, HardDrive, Clock, Network, Server, Monitor, X, Cpu, MemoryStick, HardDrive, Clock, Network, Server, Monitor,
Container, Database, FolderTree, Settings, Download, Trash2, Copy, Check, Container, Database, FolderTree, Settings, Download, Trash2, Copy, Check,
MonitorSmartphone, Terminal, Cable, ExternalLink, Plus, Unplug, Search, Shield, Play, FileCode, MonitorSmartphone, Terminal, Cable, ExternalLink, Plus, Unplug, Search, Shield, Play, FileCode,
LayoutGrid, Archive, GitBranch, Wrench, RefreshCw, CalendarClock, Bot,
} from 'lucide-react' } from 'lucide-react'
const mainCategories = [ const mainCategories = [
@ -20,21 +21,21 @@ const mainCategories = [
const buildSubTabs = (hasPBS) => ({ const buildSubTabs = (hasPBS) => ({
virtualisierung: [ virtualisierung: [
{ id: 'vms', label: 'VMs' }, { id: 'vms', label: 'VMs', icon: Monitor },
{ id: 'containers', label: 'Container' }, { id: 'containers', label: 'Container', icon: Container },
], ],
speicher: [ speicher: [
{ id: 'storage', label: 'Storage' }, { id: 'storage', label: 'Storage', icon: HardDrive },
{ id: 'zfs', label: 'ZFS' }, { id: 'zfs', label: 'ZFS', icon: Database },
{ id: 'backups', label: 'Backups' }, { id: 'backups', label: 'Backups', icon: Archive },
...(hasPBS ? [{ id: 'pbs', label: 'Backup Server' }] : []), ...(hasPBS ? [{ id: 'pbs', label: 'Backup Server', icon: Server }] : []),
], ],
system: [ system: [
{ id: 'services', label: 'Dienste' }, { id: 'services', label: 'Dienste', icon: Settings },
{ id: 'updates', label: 'Updates' }, { id: 'updates', label: 'Updates', icon: RefreshCw },
{ id: 'tasks', label: 'Aufgaben' }, { id: 'tasks', label: 'Aufgaben', icon: CalendarClock },
{ id: 'tunnel', label: 'Tunnel' }, { id: 'tunnel', label: 'Tunnel', icon: Cable },
{ id: 'agent', label: 'Agent' }, { id: 'agent', label: 'Agent', icon: Bot },
], ],
}) })
@ -132,15 +133,15 @@ export default function ProxmoxPanel({ agentId, customers, onClose, onReload })
</div> </div>
{/* Haupt-Tabs */} {/* Haupt-Tabs */}
<div className="flex gap-1 mt-4 text-xs"> <div className="flex gap-1 mt-4 overflow-x-auto text-xs">
{mainCategories.map((cat) => ( {mainCategories.map((cat) => (
<button <button
key={cat.id} key={cat.id}
onClick={() => handleMainTab(cat.id, subs)} onClick={() => handleMainTab(cat.id, subs)}
className={`px-3 py-1.5 rounded-t whitespace-nowrap transition-colors ${ className={`px-4 py-1.5 whitespace-nowrap transition-colors border-b-2 ${
mainTab === cat.id mainTab === cat.id
? 'bg-gray-900 text-orange-400 border-t border-x border-gray-700' ? 'text-orange-400 border-orange-400'
: 'text-gray-400 hover:text-gray-200' : 'text-gray-400 hover:text-gray-200 border-transparent'
}`} }`}
> >
{cat.label} {cat.label}
@ -149,32 +150,43 @@ export default function ProxmoxPanel({ agentId, customers, onClose, onReload })
</div> </div>
</div> </div>
{/* Sub-Tabs */} {/* Content + optionale Sidebar */}
{currentSubs.length > 0 && ( <div className="flex-1 flex overflow-hidden">
<div className="px-6 py-2 bg-gray-900/60 border-b border-gray-800 flex items-center gap-1 text-xs">
<span className="text-gray-600 mr-2"> {/* Sub-Navigation links — nur wenn nicht Uebersicht */}
{mainTab !== 'uebersicht' && currentSubs.length > 0 && (
<div className="w-44 shrink-0 bg-gray-900/50 border-r border-gray-800 overflow-y-auto py-3">
<div className="px-4 mb-2">
<span className="text-[10px] uppercase tracking-wider text-gray-500 font-semibold">
{mainCategories.find(c => c.id === mainTab)?.label} {mainCategories.find(c => c.id === mainTab)?.label}
</span> </span>
{currentSubs.map((s) => ( </div>
{currentSubs.map((item) => {
const Icon = item.icon
const isActive = activeSubTab === item.id
return (
<button <button
key={s.id} key={item.id}
onClick={() => setSubTab(s.id)} onClick={() => setSubTab(item.id)}
className={`px-2.5 py-1 rounded whitespace-nowrap transition-colors ${ className={`w-full flex items-center gap-2.5 px-4 py-2 text-sm transition-colors ${
activeSubTab === s.id isActive
? 'bg-gray-700 text-white' ? 'text-orange-400 bg-orange-400/5 border-l-2 border-orange-400'
: 'text-gray-500 hover:text-gray-300' : 'text-gray-400 hover:text-white border-l-2 border-transparent'
}`} }`}
> >
{s.label} {Icon && <Icon className="w-4 h-4 shrink-0" />}
<span>{item.label}</span>
</button> </button>
))} )
})}
</div> </div>
)} )}
{/* Content */} {/* Hauptinhalt */}
<div className="flex-1 overflow-y-auto p-6 space-y-4"> <div className="flex-1 overflow-y-auto p-6 space-y-4">
{renderContent()} {renderContent()}
</div> </div>
</div>
</Panel> </Panel>
) )
} }