Refactor: /datasets und /snapshots entfernt, neue /zfs-Seite nach Cockpit-Vorbild
- Neue Seite /zfs: Pools-Tabelle mit aufklappbaren Zeilen, Tabs File Systems / Snapshots / Status, vdev-Baum im Status-Tab - /datasets und /snapshots gelöscht (Funktionalität konsolidiert) - Header bereinigt: ZFS-Link ersetzt Datasets/Snapshots, navLink-Hilfsfunktion reduziert Redundanz Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
+30
-197
@@ -28,6 +28,20 @@ export function Header() {
|
||||
|
||||
const isActive = (path: string) => pathname === path
|
||||
|
||||
const navLink = (href: string, label: string, mobile = false) => (
|
||||
<Link
|
||||
href={href}
|
||||
className={`${mobile ? "block " : ""}px-3 py-2 rounded-md text-sm font-medium transition-colors ${
|
||||
isActive(href)
|
||||
? "bg-accent text-accent-foreground"
|
||||
: "text-muted-foreground hover:text-foreground"
|
||||
}`}
|
||||
onClick={mobile ? () => setIsMenuOpen(false) : undefined}
|
||||
>
|
||||
{label}
|
||||
</Link>
|
||||
)
|
||||
|
||||
return (
|
||||
<header className="sticky top-0 z-50 w-full border-b border-border bg-background/95 backdrop-blur supports-[backdrop-filter]:bg-background/60">
|
||||
<div className="max-w-7xl mx-auto px-4 sm:px-6 lg:px-8">
|
||||
@@ -40,100 +54,14 @@ export function Header() {
|
||||
|
||||
{/* Desktop Navigation */}
|
||||
<nav className="hidden md:flex items-center gap-1">
|
||||
<Link
|
||||
href="/"
|
||||
className={`px-3 py-2 rounded-md text-sm font-medium transition-colors ${
|
||||
isActive("/")
|
||||
? "bg-accent text-accent-foreground"
|
||||
: "text-muted-foreground hover:text-foreground"
|
||||
}`}
|
||||
>
|
||||
Dashboard
|
||||
</Link>
|
||||
{zfsAvailable && (
|
||||
<>
|
||||
<Link
|
||||
href="/snapshots"
|
||||
className={`px-3 py-2 rounded-md text-sm font-medium transition-colors ${
|
||||
isActive("/snapshots")
|
||||
? "bg-accent text-accent-foreground"
|
||||
: "text-muted-foreground hover:text-foreground"
|
||||
}`}
|
||||
>
|
||||
Snapshots
|
||||
</Link>
|
||||
<Link
|
||||
href="/datasets"
|
||||
className={`px-3 py-2 rounded-md text-sm font-medium transition-colors ${
|
||||
isActive("/datasets")
|
||||
? "bg-accent text-accent-foreground"
|
||||
: "text-muted-foreground hover:text-foreground"
|
||||
}`}
|
||||
>
|
||||
Datasets
|
||||
</Link>
|
||||
</>
|
||||
)}
|
||||
<Link
|
||||
href="/navigator"
|
||||
className={`px-3 py-2 rounded-md text-sm font-medium transition-colors ${
|
||||
isActive("/navigator")
|
||||
? "bg-accent text-accent-foreground"
|
||||
: "text-muted-foreground hover:text-foreground"
|
||||
}`}
|
||||
>
|
||||
Navigator
|
||||
</Link>
|
||||
<Link
|
||||
href="/shares"
|
||||
className={`px-3 py-2 rounded-md text-sm font-medium transition-colors ${
|
||||
isActive("/shares")
|
||||
? "bg-accent text-accent-foreground"
|
||||
: "text-muted-foreground hover:text-foreground"
|
||||
}`}
|
||||
>
|
||||
Shares
|
||||
</Link>
|
||||
<Link
|
||||
href="/file-sharing"
|
||||
className={`px-3 py-2 rounded-md text-sm font-medium transition-colors ${
|
||||
isActive("/file-sharing")
|
||||
? "bg-accent text-accent-foreground"
|
||||
: "text-muted-foreground hover:text-foreground"
|
||||
}`}
|
||||
>
|
||||
File Sharing
|
||||
</Link>
|
||||
<Link
|
||||
href="/identities"
|
||||
className={`px-3 py-2 rounded-md text-sm font-medium transition-colors ${
|
||||
isActive("/identities")
|
||||
? "bg-accent text-accent-foreground"
|
||||
: "text-muted-foreground hover:text-foreground"
|
||||
}`}
|
||||
>
|
||||
Identities
|
||||
</Link>
|
||||
<Link
|
||||
href="/logs"
|
||||
className={`px-3 py-2 rounded-md text-sm font-medium transition-colors ${
|
||||
isActive("/logs")
|
||||
? "bg-accent text-accent-foreground"
|
||||
: "text-muted-foreground hover:text-foreground"
|
||||
}`}
|
||||
>
|
||||
Logs
|
||||
</Link>
|
||||
<Link
|
||||
href="/services"
|
||||
className={`px-3 py-2 rounded-md text-sm font-medium transition-colors ${
|
||||
isActive("/services")
|
||||
? "bg-accent text-accent-foreground"
|
||||
: "text-muted-foreground hover:text-foreground"
|
||||
}`}
|
||||
>
|
||||
Services
|
||||
</Link>
|
||||
{navLink("/", "Dashboard")}
|
||||
{zfsAvailable && navLink("/zfs", "ZFS")}
|
||||
{navLink("/navigator", "Navigator")}
|
||||
{navLink("/shares", "Shares")}
|
||||
{navLink("/file-sharing", "File Sharing")}
|
||||
{navLink("/identities", "Identities")}
|
||||
{navLink("/logs", "Logs")}
|
||||
{navLink("/services", "Services")}
|
||||
</nav>
|
||||
|
||||
{/* Logout Button */}
|
||||
@@ -156,109 +84,14 @@ export function Header() {
|
||||
{/* Mobile Navigation */}
|
||||
{isMenuOpen && (
|
||||
<nav className="md:hidden pb-4 space-y-1">
|
||||
<Link
|
||||
href="/"
|
||||
className={`block px-3 py-2 rounded-md text-sm font-medium ${
|
||||
isActive("/")
|
||||
? "bg-accent text-accent-foreground"
|
||||
: "text-muted-foreground hover:text-foreground"
|
||||
}`}
|
||||
onClick={() => setIsMenuOpen(false)}
|
||||
>
|
||||
Dashboard
|
||||
</Link>
|
||||
{zfsAvailable && (
|
||||
<>
|
||||
<Link
|
||||
href="/snapshots"
|
||||
className={`block px-3 py-2 rounded-md text-sm font-medium ${
|
||||
isActive("/snapshots")
|
||||
? "bg-accent text-accent-foreground"
|
||||
: "text-muted-foreground hover:text-foreground"
|
||||
}`}
|
||||
onClick={() => setIsMenuOpen(false)}
|
||||
>
|
||||
Snapshots
|
||||
</Link>
|
||||
<Link
|
||||
href="/datasets"
|
||||
className={`block px-3 py-2 rounded-md text-sm font-medium ${
|
||||
isActive("/datasets")
|
||||
? "bg-accent text-accent-foreground"
|
||||
: "text-muted-foreground hover:text-foreground"
|
||||
}`}
|
||||
onClick={() => setIsMenuOpen(false)}
|
||||
>
|
||||
Datasets
|
||||
</Link>
|
||||
</>
|
||||
)}
|
||||
<Link
|
||||
href="/files"
|
||||
className={`block px-3 py-2 rounded-md text-sm font-medium ${
|
||||
isActive("/files")
|
||||
? "bg-accent text-accent-foreground"
|
||||
: "text-muted-foreground hover:text-foreground"
|
||||
}`}
|
||||
onClick={() => setIsMenuOpen(false)}
|
||||
>
|
||||
Files
|
||||
</Link>
|
||||
<Link
|
||||
href="/shares"
|
||||
className={`block px-3 py-2 rounded-md text-sm font-medium ${
|
||||
isActive("/shares")
|
||||
? "bg-accent text-accent-foreground"
|
||||
: "text-muted-foreground hover:text-foreground"
|
||||
}`}
|
||||
onClick={() => setIsMenuOpen(false)}
|
||||
>
|
||||
Shares
|
||||
</Link>
|
||||
<Link
|
||||
href="/file-sharing"
|
||||
className={`block px-3 py-2 rounded-md text-sm font-medium ${
|
||||
isActive("/file-sharing")
|
||||
? "bg-accent text-accent-foreground"
|
||||
: "text-muted-foreground hover:text-foreground"
|
||||
}`}
|
||||
onClick={() => setIsMenuOpen(false)}
|
||||
>
|
||||
File Sharing
|
||||
</Link>
|
||||
<Link
|
||||
href="/identities"
|
||||
className={`block px-3 py-2 rounded-md text-sm font-medium ${
|
||||
isActive("/identities")
|
||||
? "bg-accent text-accent-foreground"
|
||||
: "text-muted-foreground hover:text-foreground"
|
||||
}`}
|
||||
onClick={() => setIsMenuOpen(false)}
|
||||
>
|
||||
Identities
|
||||
</Link>
|
||||
<Link
|
||||
href="/logs"
|
||||
className={`block px-3 py-2 rounded-md text-sm font-medium ${
|
||||
isActive("/logs")
|
||||
? "bg-accent text-accent-foreground"
|
||||
: "text-muted-foreground hover:text-foreground"
|
||||
}`}
|
||||
onClick={() => setIsMenuOpen(false)}
|
||||
>
|
||||
Logs
|
||||
</Link>
|
||||
<Link
|
||||
href="/services"
|
||||
className={`block px-3 py-2 rounded-md text-sm font-medium ${
|
||||
isActive("/services")
|
||||
? "bg-accent text-accent-foreground"
|
||||
: "text-muted-foreground hover:text-foreground"
|
||||
}`}
|
||||
onClick={() => setIsMenuOpen(false)}
|
||||
>
|
||||
Services
|
||||
</Link>
|
||||
{navLink("/", "Dashboard", true)}
|
||||
{zfsAvailable && navLink("/zfs", "ZFS", true)}
|
||||
{navLink("/navigator", "Navigator", true)}
|
||||
{navLink("/shares", "Shares", true)}
|
||||
{navLink("/file-sharing", "File Sharing", true)}
|
||||
{navLink("/identities", "Identities", true)}
|
||||
{navLink("/logs", "Logs", true)}
|
||||
{navLink("/services", "Services", true)}
|
||||
</nav>
|
||||
)}
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user