Files
swanadiva 7accb86203 feat: add transfer panel to dashboard + remove PERBAIKANUI.md
- Add Background Transfers section with mock download/upload rows
- Progress bars with green glow shadow, source/destination layout
- Empty state when no transfers active
- Delete PERBAIKANUI.md (all UI tasks complete)
2026-07-09 18:27:47 +07:00

183 lines
12 KiB
HTML

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Hosts · Hostkeeper V2</title>
<link rel="preconnect" href="https://fonts.googleapis.com">
<link href="https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800;900&family=JetBrains+Mono:wght@300;400;500;600;700&display=swap" rel="stylesheet">
<link rel="stylesheet" href="/static/css/output.css">
<link rel="stylesheet" href="/static/css/custom.css">
<script src="/static/js/htmx.min.js"></script>
<script src="/static/js/alpine.min.js" defer></script>
<script src="/static/js/clipboard.js"></script>
<script src="/static/js/utils.js"></script>
</head>
<body class="bg-surface text-on-surface antialiased dot-grid min-h-screen">
<div class="flex min-h-screen">
{{template "nav" .}}
<div class="flex-1 flex flex-col overflow-hidden">
<header class="h-14 border-b border-outline-variant/30 flex items-center px-6 bg-white/70 backdrop-blur-md">
<h1 class="text-lg font-semibold text-on-surface">Hosts</h1>
</header>
<main id="main-content" class="flex-1 overflow-auto p-6">
<div id="dashboard-page" class="max-w-7xl mx-auto space-y-8">
<div class="border-b border-outline-variant/30 pb-4">
<h2 class="text-xl font-bold text-on-surface tracking-tight">Hosts</h2>
<p class="text-xs text-on-surface-variant mt-0.5">Manage connections, monitor uptime, and deploy</p>
</div>
<div class="grid grid-cols-1 md:grid-cols-12 gap-6">
<div class="md:col-span-8 p-6 rounded-2xl bg-white border border-outline-variant shadow-sm flex items-center justify-between overflow-hidden relative group">
<div class="relative z-10 space-y-2">
<h3 class="text-on-surface-variant font-bold text-xs uppercase tracking-wider">Active Connections</h3>
<div class="flex items-end gap-3">
<span class="text-4xl font-black text-primary">{{.Active}}</span>
<span class="text-secondary font-bold text-sm mb-1 flex items-center bg-secondary-container/20 px-2 py-0.5 rounded-full">
<svg class="w-4 h-4 mr-1" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M2.25 18L9 11.25l4.306 4.307a11.95 11.95 0 015.814-5.519l2.74-1.22m0 0l-5.94-2.28m5.94 2.28l-2.28 5.941"/></svg>
+2 today
</span>
</div>
<p class="text-xs text-on-surface-variant">Global performance metrics sync integrity active.</p>
</div>
<div class="absolute right-0 top-0 w-1/3 h-full bg-gradient-to-l from-primary/5 to-transparent pointer-events-none"></div>
<div class="flex gap-2 items-end h-16 shrink-0">
<div class="w-2.5 h-10 bg-primary/20 rounded-full animate-pulse"></div>
<div class="w-2.5 h-14 bg-primary/40 rounded-full animate-pulse delay-75"></div>
<div class="w-2.5 h-8 bg-primary/10 rounded-full animate-pulse delay-150"></div>
<div class="w-2.5 h-16 bg-primary/60 rounded-full animate-pulse delay-200"></div>
</div>
</div>
<div class="md:col-span-4 p-6 rounded-2xl bg-primary text-on-primary shadow-xl shadow-primary/15 flex flex-col justify-between relative overflow-hidden">
<div class="relative z-10">
<svg class="w-8 h-8 opacity-90 text-white mb-2" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M3.75 13.5l10.5-11.25L12 10.5h8.25L9.75 21.75 12 13.5H3.75z"/></svg>
<p class="font-bold text-lg leading-tight">Fastest Access Enabled</p>
</div>
<p class="text-xs opacity-85 mt-2 relative z-10">Smart routing engine successfully reduces terminal latency by <span class="font-bold">24ms</span> across European and Asian clusters.</p>
<div class="absolute -right-6 -bottom-6 opacity-10">
<svg class="w-32 h-32 rotate-12" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M3.75 13.5l10.5-11.25L12 10.5h8.25L9.75 21.75 12 13.5H3.75z"/></svg>
</div>
</div>
</div>
<div x-data="{ view: 'grid' }">
<div class="flex flex-col sm:flex-row sm:items-center justify-between gap-4 border-b border-outline-variant/30 pb-4 mb-6">
<div class="flex items-center gap-3">
<h3 class="text-lg font-bold text-on-surface">Recent Hosts</h3>
<div class="flex bg-surface-container rounded-lg p-0.5 text-xs font-semibold border border-outline-variant/20"
x-data="{ filter: 'all' }">
<button @click="filter = 'all'"
:class="filter === 'all' ? 'bg-white text-primary shadow-sm' : 'text-on-surface-variant hover:text-on-surface'"
class="px-2.5 py-1 rounded-md transition-all"
hx-get="/hosts/list?filter=all" hx-target="#host-list">All</button>
<button @click="filter = 'active'"
:class="filter === 'active' ? 'bg-white text-primary shadow-sm' : 'text-on-surface-variant hover:text-on-surface'"
class="px-2.5 py-1 rounded-md transition-all"
hx-get="/hosts/list?filter=active" hx-target="#host-list">Active</button>
<button @click="filter = 'offline'"
:class="filter === 'offline' ? 'bg-white text-primary shadow-sm' : 'text-on-surface-variant hover:text-on-surface'"
class="px-2.5 py-1 rounded-md transition-all"
hx-get="/hosts/list?filter=offline" hx-target="#host-list">Offline</button>
</div>
</div>
<div class="flex items-center gap-3">
<div class="relative">
<svg class="absolute left-3 top-1/2 -translate-y-1/2 text-outline w-4 h-4" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0z"/></svg>
<input type="search" name="q" placeholder="Search hosts..."
hx-get="/hosts/list" hx-trigger="keyup delay:200ms"
hx-target="#host-list"
class="pl-9 pr-4 py-1.5 rounded-full bg-surface-container-low border border-outline-variant/30 text-sm focus:border-primary focus:bg-white focus:outline-none focus:ring-1 focus:ring-primary w-48 sm:w-60 transition-all text-on-surface placeholder-on-surface-variant">
</div>
<div class="flex border border-outline-variant/50 rounded-lg p-0.5 bg-white">
<button @click="view = 'grid'"
:class="view === 'grid' ? 'bg-surface-container text-primary' : 'text-on-surface-variant'"
class="p-1.5 rounded transition-colors" title="Grid View">
<svg class="w-4 h-4" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M4 5a1 1 0 011-1h4a1 1 0 011 1v4a1 1 0 01-1 1H5a1 1 0 01-1-1V5zm10 0a1 1 0 011-1h4a1 1 0 011 1v4a1 1 0 01-1 1h-4a1 1 0 01-1-1V5zM4 15a1 1 0 011-1h4a1 1 0 011 1v4a1 1 0 01-1 1H5a1 1 0 01-1-1v-4zm10 0a1 1 0 011-1h4a1 1 0 011 1v4a1 1 0 01-1 1h-4a1 1 0 01-1-1v-4z"/></svg>
</button>
<button @click="view = 'list'"
:class="view === 'list' ? 'bg-surface-container text-primary' : 'text-on-surface-variant'"
class="p-1.5 rounded transition-colors" title="List View">
<svg class="w-4 h-4" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M4 6h16M4 10h16M4 14h16M4 18h16"/></svg>
</button>
</div>
</div>
</div>
{{template "host_list" .}}
</div>
</div>
<!-- Transfer Activity Panel -->
<div class="space-y-4 mt-8">
<div class="flex items-center gap-4">
<h3 class="text-base font-bold text-on-surface tracking-tight shrink-0">Background Transfers</h3>
<div class="flex-1 h-px bg-outline-variant/30"></div>
</div>
<div class="bg-white/50 backdrop-blur-sm border border-outline-variant rounded-2xl overflow-hidden shadow-sm">
<div class="p-4 border-b border-outline-variant flex items-center justify-between bg-surface-container-low">
<div class="flex gap-12 text-xs font-bold text-on-surface-variant uppercase tracking-tight">
<span>Source &amp; File</span>
<span>Destination</span>
</div>
<span class="text-xs font-bold text-on-surface-variant uppercase tracking-tight">Progress</span>
</div>
<div class="divide-y divide-outline-variant/30 bg-white">
{{range .Transfers}}
<div class="p-4 flex flex-col sm:flex-row sm:items-center justify-between gap-4 hover:bg-primary/5 transition-colors">
<div class="flex items-center gap-4 min-w-0 flex-1">
<div class="p-2 rounded-lg {{if eq .Type "download"}}bg-tertiary/10 text-tertiary{{else}}bg-primary/10 text-primary{{end}}">
<svg class="w-5 h-5" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 12l2 2 4-4m6 2a9 9 0 11-18 0 9 9 0 0118 0z"/></svg>
</div>
<div class="min-w-0 flex-1 grid grid-cols-1 sm:grid-cols-2 gap-2">
<div>
<p class="text-sm font-bold truncate text-on-surface">{{.FileName}}</p>
<span class="text-[10px] font-mono text-outline block">{{.Source}}</span>
</div>
<div class="flex items-center gap-1 text-on-surface-variant text-xs">
<svg class="w-4 h-4 text-outline shrink-0" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M17 8l4 4m0 0l-4 4m4-4H3"/></svg>
<span class="truncate">{{.Destination}}</span>
</div>
</div>
</div>
<div class="w-full sm:w-48 shrink-0">
<div class="flex justify-between items-center mb-1">
<span class="text-[10px] font-bold text-secondary">{{.Progress}}%</span>
<span class="text-[10px] text-outline font-mono">{{.Speed}}</span>
</div>
<div class="h-1.5 w-full bg-surface-container-high rounded-full overflow-hidden">
<div class="h-full bg-secondary rounded-full transition-all duration-500 shadow-[0_0_8px_rgba(0,110,47,0.3)]"
style="width: {{.Progress}}%"></div>
</div>
</div>
</div>
{{end}}
{{if not .Transfers}}
<div class="p-8 text-center text-on-surface-variant">
<svg class="w-10 h-10 mx-auto mb-2 text-outline/30" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="1.5" d="M7 16V4m0 0L3 8m4-4l4 4m6 0v12m0 0l4-4m-4 4l-4-4"/></svg>
<p class="text-sm font-medium">No active transfers</p>
</div>
{{end}}
</div>
</div>
</div>
{{template "host_modal" .}}
</main>
</div>
</div>
<!-- Toast -->
<div x-data="{ show: false, msg: '' }" x-cloak
@toast-message.window="msg = $event.detail.message; show = true; setTimeout(() => show = false, 3000)"
x-show="show" x-transition
class="fixed bottom-6 right-6 z-[200] bg-inverse-surface text-inverse-on-surface px-5 py-3 rounded-xl shadow-xl flex items-center gap-3 text-sm font-medium">
<svg class="w-4 h-4 text-secondary shrink-0" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 12l2 2 4-4m6 2a9 9 0 11-18 0 9 9 0 0118 0z"/></svg>
<span x-text="msg"></span>
</div>
</body>
</html>