|
|
<!DOCTYPE html>
|
|
|
<html lang="en">
|
|
|
<head>
|
|
|
<meta charset="UTF-8">
|
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
|
<title>🚀 Crypto API Monitor - Professional Dashboard</title>
|
|
|
<link href="https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800;900&display=swap" rel="stylesheet">
|
|
|
<script src="https://cdn.jsdelivr.net/npm/chart.js@4.4.0/dist/chart.umd.min.js"></script>
|
|
|
<style>
|
|
|
:root {
|
|
|
--bg-primary: #0f0f23;
|
|
|
--bg-secondary: #1a1a2e;
|
|
|
--bg-card: #16213e;
|
|
|
--bg-hover: #1f2b4d;
|
|
|
--text-primary: #ffffff;
|
|
|
--text-secondary: #b8c1ec;
|
|
|
--text-muted: #8892b0;
|
|
|
|
|
|
--accent-blue: #00d4ff;
|
|
|
--accent-purple: #a855f7;
|
|
|
--accent-pink: #ec4899;
|
|
|
--accent-green: #10b981;
|
|
|
--accent-yellow: #fbbf24;
|
|
|
--accent-red: #ef4444;
|
|
|
--accent-orange: #f97316;
|
|
|
--accent-cyan: #06b6d4;
|
|
|
|
|
|
--success: #10b981;
|
|
|
--success-glow: rgba(16, 185, 129, 0.3);
|
|
|
--warning: #fbbf24;
|
|
|
--warning-glow: rgba(251, 191, 36, 0.3);
|
|
|
--danger: #ef4444;
|
|
|
--danger-glow: rgba(239, 68, 68, 0.3);
|
|
|
--info: #00d4ff;
|
|
|
--info-glow: rgba(0, 212, 255, 0.3);
|
|
|
|
|
|
--border: rgba(255, 255, 255, 0.1);
|
|
|
--shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
|
|
|
--shadow-lg: 0 20px 60px rgba(0, 0, 0, 0.6);
|
|
|
--glow: 0 0 20px;
|
|
|
|
|
|
--radius: 16px;
|
|
|
--radius-lg: 24px;
|
|
|
--transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
|
|
|
}
|
|
|
|
|
|
* {
|
|
|
margin: 0;
|
|
|
padding: 0;
|
|
|
box-sizing: border-box;
|
|
|
}
|
|
|
|
|
|
body {
|
|
|
font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
|
|
|
background: var(--bg-primary);
|
|
|
color: var(--text-primary);
|
|
|
line-height: 1.6;
|
|
|
min-height: 100vh;
|
|
|
overflow-x: hidden;
|
|
|
}
|
|
|
|
|
|
|
|
|
body::before {
|
|
|
content: '';
|
|
|
position: fixed;
|
|
|
top: 0;
|
|
|
left: 0;
|
|
|
right: 0;
|
|
|
bottom: 0;
|
|
|
background:
|
|
|
radial-gradient(circle at 20% 30%, rgba(168, 85, 247, 0.15) 0%, transparent 50%),
|
|
|
radial-gradient(circle at 80% 70%, rgba(0, 212, 255, 0.15) 0%, transparent 50%),
|
|
|
radial-gradient(circle at 50% 50%, rgba(236, 72, 153, 0.1) 0%, transparent 70%);
|
|
|
pointer-events: none;
|
|
|
z-index: 0;
|
|
|
animation: backgroundPulse 20s ease-in-out infinite;
|
|
|
}
|
|
|
|
|
|
@keyframes backgroundPulse {
|
|
|
0%, 100% { opacity: 0.5; }
|
|
|
50% { opacity: 0.8; }
|
|
|
}
|
|
|
|
|
|
.container {
|
|
|
max-width: 1800px;
|
|
|
margin: 0 auto;
|
|
|
padding: 32px;
|
|
|
position: relative;
|
|
|
z-index: 1;
|
|
|
}
|
|
|
|
|
|
|
|
|
.header {
|
|
|
background: linear-gradient(135deg, var(--bg-card) 0%, var(--bg-secondary) 100%);
|
|
|
border: 2px solid var(--border);
|
|
|
border-radius: var(--radius-lg);
|
|
|
padding: 40px;
|
|
|
margin-bottom: 32px;
|
|
|
box-shadow: var(--shadow-lg);
|
|
|
position: relative;
|
|
|
overflow: hidden;
|
|
|
}
|
|
|
|
|
|
.header::before {
|
|
|
content: '';
|
|
|
position: absolute;
|
|
|
top: 0;
|
|
|
left: 0;
|
|
|
right: 0;
|
|
|
height: 4px;
|
|
|
background: linear-gradient(90deg, var(--accent-blue), var(--accent-purple), var(--accent-pink));
|
|
|
animation: gradientSlide 3s linear infinite;
|
|
|
}
|
|
|
|
|
|
@keyframes gradientSlide {
|
|
|
0% { transform: translateX(-100%); }
|
|
|
100% { transform: translateX(100%); }
|
|
|
}
|
|
|
|
|
|
.header-top {
|
|
|
display: flex;
|
|
|
align-items: center;
|
|
|
justify-content: space-between;
|
|
|
flex-wrap: wrap;
|
|
|
gap: 24px;
|
|
|
margin-bottom: 32px;
|
|
|
}
|
|
|
|
|
|
.logo {
|
|
|
display: flex;
|
|
|
align-items: center;
|
|
|
gap: 20px;
|
|
|
}
|
|
|
|
|
|
.logo-icon {
|
|
|
width: 80px;
|
|
|
height: 80px;
|
|
|
background: linear-gradient(135deg, var(--accent-blue) 0%, var(--accent-purple) 50%, var(--accent-pink) 100%);
|
|
|
border-radius: 24px;
|
|
|
display: flex;
|
|
|
align-items: center;
|
|
|
justify-content: center;
|
|
|
box-shadow: var(--glow) var(--info-glow);
|
|
|
position: relative;
|
|
|
overflow: hidden;
|
|
|
animation: logoFloat 3s ease-in-out infinite;
|
|
|
}
|
|
|
|
|
|
@keyframes logoFloat {
|
|
|
0%, 100% { transform: translateY(0px) rotate(0deg); }
|
|
|
50% { transform: translateY(-10px) rotate(5deg); }
|
|
|
}
|
|
|
|
|
|
.logo-icon::after {
|
|
|
content: '';
|
|
|
position: absolute;
|
|
|
top: -50%;
|
|
|
left: -50%;
|
|
|
right: -50%;
|
|
|
bottom: -50%;
|
|
|
background: linear-gradient(45deg, transparent, rgba(255, 255, 255, 0.4), transparent);
|
|
|
animation: shimmer 2s infinite;
|
|
|
}
|
|
|
|
|
|
@keyframes shimmer {
|
|
|
0% { transform: translateX(-100%) translateY(-100%) rotate(45deg); }
|
|
|
100% { transform: translateX(100%) translateY(100%) rotate(45deg); }
|
|
|
}
|
|
|
|
|
|
.logo-text h1 {
|
|
|
font-size: 36px;
|
|
|
font-weight: 900;
|
|
|
background: linear-gradient(135deg, var(--accent-blue) 0%, var(--accent-purple) 50%, var(--accent-pink) 100%);
|
|
|
-webkit-background-clip: text;
|
|
|
-webkit-text-fill-color: transparent;
|
|
|
background-clip: text;
|
|
|
margin-bottom: 8px;
|
|
|
letter-spacing: -1px;
|
|
|
text-shadow: 0 0 30px var(--info-glow);
|
|
|
}
|
|
|
|
|
|
.logo-text p {
|
|
|
font-size: 14px;
|
|
|
color: var(--text-secondary);
|
|
|
font-weight: 600;
|
|
|
letter-spacing: 0.5px;
|
|
|
}
|
|
|
|
|
|
.header-actions {
|
|
|
display: flex;
|
|
|
gap: 16px;
|
|
|
align-items: center;
|
|
|
flex-wrap: wrap;
|
|
|
}
|
|
|
|
|
|
.status-badge {
|
|
|
display: flex;
|
|
|
align-items: center;
|
|
|
gap: 12px;
|
|
|
padding: 14px 24px;
|
|
|
border-radius: 999px;
|
|
|
background: linear-gradient(135deg, rgba(16, 185, 129, 0.2) 0%, rgba(16, 185, 129, 0.1) 100%);
|
|
|
border: 2px solid var(--success);
|
|
|
font-size: 14px;
|
|
|
font-weight: 700;
|
|
|
color: var(--success);
|
|
|
box-shadow: var(--glow) var(--success-glow);
|
|
|
text-transform: uppercase;
|
|
|
letter-spacing: 1px;
|
|
|
}
|
|
|
|
|
|
.status-dot {
|
|
|
width: 12px;
|
|
|
height: 12px;
|
|
|
border-radius: 50%;
|
|
|
background: var(--success);
|
|
|
animation: pulse-glow 2s infinite;
|
|
|
}
|
|
|
|
|
|
@keyframes pulse-glow {
|
|
|
0%, 100% {
|
|
|
box-shadow: 0 0 0 0 var(--success-glow),
|
|
|
0 0 15px var(--success);
|
|
|
}
|
|
|
50% {
|
|
|
box-shadow: 0 0 0 10px transparent,
|
|
|
0 0 25px var(--success);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
.connection-status {
|
|
|
display: flex;
|
|
|
align-items: center;
|
|
|
gap: 10px;
|
|
|
padding: 12px 20px;
|
|
|
border-radius: 999px;
|
|
|
background: var(--bg-secondary);
|
|
|
border: 2px solid var(--border);
|
|
|
font-size: 13px;
|
|
|
font-weight: 700;
|
|
|
transition: var(--transition);
|
|
|
}
|
|
|
|
|
|
.connection-status.connected {
|
|
|
border-color: var(--success);
|
|
|
color: var(--success);
|
|
|
box-shadow: var(--glow) var(--success-glow);
|
|
|
}
|
|
|
.connection-status.disconnected {
|
|
|
border-color: var(--danger);
|
|
|
color: var(--danger);
|
|
|
box-shadow: var(--glow) var(--danger-glow);
|
|
|
}
|
|
|
.connection-status.connecting {
|
|
|
border-color: var(--warning);
|
|
|
color: var(--warning);
|
|
|
box-shadow: var(--glow) var(--warning-glow);
|
|
|
}
|
|
|
|
|
|
.btn {
|
|
|
padding: 14px 28px;
|
|
|
border-radius: 14px;
|
|
|
border: none;
|
|
|
background: linear-gradient(135deg, var(--accent-blue) 0%, var(--accent-purple) 100%);
|
|
|
color: white;
|
|
|
font-family: inherit;
|
|
|
font-size: 14px;
|
|
|
font-weight: 700;
|
|
|
cursor: pointer;
|
|
|
transition: var(--transition);
|
|
|
display: inline-flex;
|
|
|
align-items: center;
|
|
|
gap: 10px;
|
|
|
box-shadow: var(--glow) var(--info-glow);
|
|
|
text-transform: uppercase;
|
|
|
letter-spacing: 0.5px;
|
|
|
position: relative;
|
|
|
overflow: hidden;
|
|
|
}
|
|
|
|
|
|
.btn::before {
|
|
|
content: '';
|
|
|
position: absolute;
|
|
|
top: 0;
|
|
|
left: -100%;
|
|
|
width: 100%;
|
|
|
height: 100%;
|
|
|
background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
|
|
|
transition: left 0.5s;
|
|
|
}
|
|
|
|
|
|
.btn:hover {
|
|
|
transform: translateY(-3px) scale(1.05);
|
|
|
box-shadow: 0 15px 40px var(--info-glow);
|
|
|
}
|
|
|
|
|
|
.btn:hover::before {
|
|
|
left: 100%;
|
|
|
}
|
|
|
|
|
|
.btn:active {
|
|
|
transform: translateY(-1px) scale(1.02);
|
|
|
}
|
|
|
|
|
|
|
|
|
.kpi-grid {
|
|
|
display: grid;
|
|
|
grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
|
|
|
gap: 24px;
|
|
|
margin-bottom: 32px;
|
|
|
}
|
|
|
|
|
|
.kpi-card {
|
|
|
background: linear-gradient(135deg, var(--bg-card) 0%, var(--bg-secondary) 100%);
|
|
|
border: 2px solid var(--border);
|
|
|
border-radius: var(--radius-lg);
|
|
|
padding: 32px;
|
|
|
transition: var(--transition);
|
|
|
box-shadow: var(--shadow);
|
|
|
position: relative;
|
|
|
overflow: hidden;
|
|
|
cursor: pointer;
|
|
|
}
|
|
|
|
|
|
.kpi-card::before {
|
|
|
content: '';
|
|
|
position: absolute;
|
|
|
top: 0;
|
|
|
left: 0;
|
|
|
right: 0;
|
|
|
height: 4px;
|
|
|
background: linear-gradient(90deg, var(--accent-blue), var(--accent-purple));
|
|
|
transform: scaleX(0);
|
|
|
transform-origin: left;
|
|
|
transition: transform 0.5s cubic-bezier(0.4, 0, 0.2, 1);
|
|
|
}
|
|
|
|
|
|
.kpi-card:hover {
|
|
|
transform: translateY(-12px) scale(1.03);
|
|
|
box-shadow: 0 20px 60px rgba(0, 212, 255, 0.3);
|
|
|
border-color: var(--accent-blue);
|
|
|
}
|
|
|
|
|
|
.kpi-card:hover::before {
|
|
|
transform: scaleX(1);
|
|
|
}
|
|
|
|
|
|
.kpi-header {
|
|
|
display: flex;
|
|
|
align-items: center;
|
|
|
justify-content: space-between;
|
|
|
margin-bottom: 24px;
|
|
|
}
|
|
|
|
|
|
.kpi-label {
|
|
|
font-size: 12px;
|
|
|
color: var(--text-muted);
|
|
|
font-weight: 800;
|
|
|
text-transform: uppercase;
|
|
|
letter-spacing: 1.5px;
|
|
|
}
|
|
|
|
|
|
.kpi-icon-wrapper {
|
|
|
width: 72px;
|
|
|
height: 72px;
|
|
|
border-radius: 20px;
|
|
|
display: flex;
|
|
|
align-items: center;
|
|
|
justify-content: center;
|
|
|
transition: var(--transition);
|
|
|
box-shadow: var(--shadow);
|
|
|
}
|
|
|
|
|
|
.kpi-card:hover .kpi-icon-wrapper {
|
|
|
transform: rotate(-10deg) scale(1.2);
|
|
|
box-shadow: 0 15px 40px rgba(0, 212, 255, 0.4);
|
|
|
}
|
|
|
|
|
|
.kpi-value {
|
|
|
font-size: 56px;
|
|
|
font-weight: 900;
|
|
|
margin-bottom: 20px;
|
|
|
background: linear-gradient(135deg, var(--accent-blue) 0%, var(--accent-purple) 50%, var(--accent-pink) 100%);
|
|
|
-webkit-background-clip: text;
|
|
|
-webkit-text-fill-color: transparent;
|
|
|
background-clip: text;
|
|
|
line-height: 1;
|
|
|
animation: countUp 0.6s ease-out;
|
|
|
letter-spacing: -3px;
|
|
|
}
|
|
|
|
|
|
@keyframes countUp {
|
|
|
from { opacity: 0; transform: translateY(30px); }
|
|
|
to { opacity: 1; transform: translateY(0); }
|
|
|
}
|
|
|
|
|
|
.kpi-trend {
|
|
|
display: flex;
|
|
|
align-items: center;
|
|
|
gap: 10px;
|
|
|
font-size: 13px;
|
|
|
font-weight: 700;
|
|
|
padding: 10px 18px;
|
|
|
border-radius: 12px;
|
|
|
width: fit-content;
|
|
|
text-transform: uppercase;
|
|
|
letter-spacing: 0.5px;
|
|
|
}
|
|
|
|
|
|
.trend-up {
|
|
|
color: var(--success);
|
|
|
background: rgba(16, 185, 129, 0.15);
|
|
|
border: 2px solid var(--success);
|
|
|
box-shadow: var(--glow) var(--success-glow);
|
|
|
}
|
|
|
|
|
|
.trend-down {
|
|
|
color: var(--danger);
|
|
|
background: rgba(239, 68, 68, 0.15);
|
|
|
border: 2px solid var(--danger);
|
|
|
box-shadow: var(--glow) var(--danger-glow);
|
|
|
}
|
|
|
|
|
|
.trend-neutral {
|
|
|
color: var(--info);
|
|
|
background: rgba(0, 212, 255, 0.15);
|
|
|
border: 2px solid var(--info);
|
|
|
box-shadow: var(--glow) var(--info-glow);
|
|
|
}
|
|
|
|
|
|
|
|
|
.tabs {
|
|
|
display: flex;
|
|
|
gap: 8px;
|
|
|
margin-bottom: 32px;
|
|
|
overflow-x: auto;
|
|
|
padding: 12px;
|
|
|
background: var(--bg-card);
|
|
|
border-radius: var(--radius-lg);
|
|
|
border: 2px solid var(--border);
|
|
|
box-shadow: var(--shadow);
|
|
|
}
|
|
|
|
|
|
.tab {
|
|
|
padding: 14px 24px;
|
|
|
border-radius: 14px;
|
|
|
background: transparent;
|
|
|
border: 2px solid transparent;
|
|
|
color: var(--text-secondary);
|
|
|
cursor: pointer;
|
|
|
transition: all 0.25s;
|
|
|
white-space: nowrap;
|
|
|
font-weight: 700;
|
|
|
font-size: 14px;
|
|
|
display: flex;
|
|
|
align-items: center;
|
|
|
gap: 10px;
|
|
|
position: relative;
|
|
|
}
|
|
|
|
|
|
.tab:hover:not(.active) {
|
|
|
background: var(--bg-hover);
|
|
|
color: var(--text-primary);
|
|
|
border-color: var(--border);
|
|
|
}
|
|
|
|
|
|
.tab.active {
|
|
|
background: linear-gradient(135deg, var(--accent-blue) 0%, var(--accent-purple) 100%);
|
|
|
color: white;
|
|
|
box-shadow: var(--glow) var(--info-glow);
|
|
|
transform: scale(1.05);
|
|
|
border-color: var(--accent-blue);
|
|
|
}
|
|
|
|
|
|
.tab .icon {
|
|
|
width: 18px;
|
|
|
height: 18px;
|
|
|
stroke: currentColor;
|
|
|
stroke-width: 2.5;
|
|
|
stroke-linecap: round;
|
|
|
stroke-linejoin: round;
|
|
|
fill: none;
|
|
|
}
|
|
|
|
|
|
|
|
|
.tab-content {
|
|
|
display: none;
|
|
|
animation: fadeIn 0.5s ease;
|
|
|
}
|
|
|
|
|
|
.tab-content.active {
|
|
|
display: block;
|
|
|
}
|
|
|
|
|
|
@keyframes fadeIn {
|
|
|
from { opacity: 0; transform: translateY(30px); }
|
|
|
to { opacity: 1; transform: translateY(0); }
|
|
|
}
|
|
|
|
|
|
|
|
|
.card {
|
|
|
background: linear-gradient(135deg, var(--bg-card) 0%, var(--bg-secondary) 100%);
|
|
|
border: 2px solid var(--border);
|
|
|
border-radius: var(--radius-lg);
|
|
|
padding: 32px;
|
|
|
margin-bottom: 32px;
|
|
|
box-shadow: var(--shadow);
|
|
|
transition: var(--transition);
|
|
|
position: relative;
|
|
|
overflow: hidden;
|
|
|
}
|
|
|
|
|
|
.card::before {
|
|
|
content: '';
|
|
|
position: absolute;
|
|
|
top: 0;
|
|
|
left: 0;
|
|
|
width: 100%;
|
|
|
height: 100%;
|
|
|
background: radial-gradient(circle at top right, rgba(0, 212, 255, 0.05) 0%, transparent 70%);
|
|
|
pointer-events: none;
|
|
|
}
|
|
|
|
|
|
.card:hover {
|
|
|
box-shadow: var(--shadow-lg);
|
|
|
border-color: var(--accent-blue);
|
|
|
}
|
|
|
|
|
|
.card-header {
|
|
|
display: flex;
|
|
|
align-items: center;
|
|
|
justify-content: space-between;
|
|
|
margin-bottom: 28px;
|
|
|
padding-bottom: 20px;
|
|
|
border-bottom: 2px solid var(--border);
|
|
|
}
|
|
|
|
|
|
.card-title {
|
|
|
font-size: 22px;
|
|
|
font-weight: 800;
|
|
|
display: flex;
|
|
|
align-items: center;
|
|
|
gap: 14px;
|
|
|
color: var(--text-primary);
|
|
|
background: linear-gradient(135deg, var(--accent-blue) 0%, var(--accent-purple) 100%);
|
|
|
-webkit-background-clip: text;
|
|
|
-webkit-text-fill-color: transparent;
|
|
|
background-clip: text;
|
|
|
}
|
|
|
|
|
|
|
|
|
.table-container {
|
|
|
overflow-x: auto;
|
|
|
border-radius: var(--radius);
|
|
|
border: 2px solid var(--border);
|
|
|
background: var(--bg-secondary);
|
|
|
}
|
|
|
|
|
|
.table {
|
|
|
width: 100%;
|
|
|
border-collapse: collapse;
|
|
|
}
|
|
|
|
|
|
.table thead {
|
|
|
background: linear-gradient(135deg, var(--accent-blue) 0%, var(--accent-purple) 100%);
|
|
|
position: sticky;
|
|
|
top: 0;
|
|
|
z-index: 10;
|
|
|
}
|
|
|
|
|
|
.table thead th {
|
|
|
color: white;
|
|
|
font-weight: 700;
|
|
|
font-size: 13px;
|
|
|
text-align: left;
|
|
|
padding: 18px 20px;
|
|
|
text-transform: uppercase;
|
|
|
letter-spacing: 1px;
|
|
|
border-bottom: 2px solid rgba(255, 255, 255, 0.2);
|
|
|
}
|
|
|
|
|
|
.table tbody tr {
|
|
|
transition: var(--transition);
|
|
|
border-bottom: 1px solid var(--border);
|
|
|
}
|
|
|
|
|
|
.table tbody tr:hover {
|
|
|
background: var(--bg-hover);
|
|
|
transform: scale(1.01);
|
|
|
box-shadow: 0 4px 12px rgba(0, 212, 255, 0.1);
|
|
|
}
|
|
|
|
|
|
.table tbody td {
|
|
|
padding: 18px 20px;
|
|
|
font-size: 14px;
|
|
|
color: var(--text-secondary);
|
|
|
}
|
|
|
|
|
|
.table tbody td strong {
|
|
|
color: var(--text-primary);
|
|
|
font-weight: 700;
|
|
|
}
|
|
|
|
|
|
|
|
|
.badge {
|
|
|
display: inline-flex;
|
|
|
align-items: center;
|
|
|
gap: 8px;
|
|
|
padding: 8px 14px;
|
|
|
border-radius: 999px;
|
|
|
font-size: 12px;
|
|
|
font-weight: 700;
|
|
|
white-space: nowrap;
|
|
|
text-transform: uppercase;
|
|
|
letter-spacing: 0.5px;
|
|
|
}
|
|
|
|
|
|
.badge-success {
|
|
|
background: rgba(16, 185, 129, 0.2);
|
|
|
color: var(--success);
|
|
|
border: 2px solid var(--success);
|
|
|
box-shadow: var(--glow) var(--success-glow);
|
|
|
}
|
|
|
|
|
|
.badge-warning {
|
|
|
background: rgba(251, 191, 36, 0.2);
|
|
|
color: var(--warning);
|
|
|
border: 2px solid var(--warning);
|
|
|
box-shadow: var(--glow) var(--warning-glow);
|
|
|
}
|
|
|
|
|
|
.badge-danger {
|
|
|
background: rgba(239, 68, 68, 0.2);
|
|
|
color: var(--danger);
|
|
|
border: 2px solid var(--danger);
|
|
|
box-shadow: var(--glow) var(--danger-glow);
|
|
|
}
|
|
|
|
|
|
.badge-info {
|
|
|
background: rgba(0, 212, 255, 0.2);
|
|
|
color: var(--info);
|
|
|
border: 2px solid var(--info);
|
|
|
box-shadow: var(--glow) var(--info-glow);
|
|
|
}
|
|
|
|
|
|
|
|
|
.progress {
|
|
|
height: 14px;
|
|
|
background: var(--bg-secondary);
|
|
|
border-radius: 999px;
|
|
|
overflow: hidden;
|
|
|
margin: 10px 0;
|
|
|
border: 2px solid var(--border);
|
|
|
box-shadow: inset 0 2px 8px rgba(0, 0, 0, 0.3);
|
|
|
}
|
|
|
|
|
|
.progress-bar {
|
|
|
height: 100%;
|
|
|
background: linear-gradient(90deg, var(--accent-blue), var(--accent-purple));
|
|
|
border-radius: 999px;
|
|
|
transition: width 0.5s ease;
|
|
|
box-shadow: var(--glow) var(--info-glow);
|
|
|
position: relative;
|
|
|
overflow: hidden;
|
|
|
}
|
|
|
|
|
|
.progress-bar::after {
|
|
|
content: '';
|
|
|
position: absolute;
|
|
|
top: 0;
|
|
|
left: 0;
|
|
|
right: 0;
|
|
|
bottom: 0;
|
|
|
background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
|
|
|
animation: progressShine 2s infinite;
|
|
|
}
|
|
|
|
|
|
@keyframes progressShine {
|
|
|
0% { transform: translateX(-100%); }
|
|
|
100% { transform: translateX(100%); }
|
|
|
}
|
|
|
|
|
|
.progress-bar.success {
|
|
|
background: linear-gradient(90deg, var(--success), #34d399);
|
|
|
box-shadow: var(--glow) var(--success-glow);
|
|
|
}
|
|
|
|
|
|
.progress-bar.warning {
|
|
|
background: linear-gradient(90deg, var(--warning), #fbbf24);
|
|
|
box-shadow: var(--glow) var(--warning-glow);
|
|
|
}
|
|
|
|
|
|
.progress-bar.danger {
|
|
|
background: linear-gradient(90deg, var(--danger), #f87171);
|
|
|
box-shadow: var(--glow) var(--danger-glow);
|
|
|
}
|
|
|
|
|
|
|
|
|
.loading-overlay {
|
|
|
position: fixed;
|
|
|
top: 0;
|
|
|
left: 0;
|
|
|
right: 0;
|
|
|
bottom: 0;
|
|
|
background: rgba(15, 15, 35, 0.95);
|
|
|
backdrop-filter: blur(10px);
|
|
|
display: none;
|
|
|
align-items: center;
|
|
|
justify-content: center;
|
|
|
z-index: 9999;
|
|
|
}
|
|
|
|
|
|
.loading-overlay.active {
|
|
|
display: flex;
|
|
|
}
|
|
|
|
|
|
.spinner {
|
|
|
width: 80px;
|
|
|
height: 80px;
|
|
|
border: 6px solid var(--border);
|
|
|
border-top-color: var(--accent-blue);
|
|
|
border-right-color: var(--accent-purple);
|
|
|
border-radius: 50%;
|
|
|
animation: spin 1s linear infinite;
|
|
|
box-shadow: var(--glow) var(--info-glow);
|
|
|
}
|
|
|
|
|
|
@keyframes spin {
|
|
|
to { transform: rotate(360deg); }
|
|
|
}
|
|
|
|
|
|
|
|
|
.toast-container {
|
|
|
position: fixed;
|
|
|
bottom: 32px;
|
|
|
right: 32px;
|
|
|
z-index: 10000;
|
|
|
display: flex;
|
|
|
flex-direction: column;
|
|
|
gap: 16px;
|
|
|
max-width: 400px;
|
|
|
}
|
|
|
|
|
|
.toast {
|
|
|
padding: 20px 24px;
|
|
|
border-radius: var(--radius);
|
|
|
background: var(--bg-card);
|
|
|
border: 2px solid var(--border);
|
|
|
box-shadow: var(--shadow-lg);
|
|
|
display: flex;
|
|
|
align-items: center;
|
|
|
gap: 14px;
|
|
|
animation: slideInRight 0.4s ease;
|
|
|
min-width: 320px;
|
|
|
}
|
|
|
|
|
|
@keyframes slideInRight {
|
|
|
from { transform: translateX(500px); opacity: 0; }
|
|
|
to { transform: translateX(0); opacity: 1; }
|
|
|
}
|
|
|
|
|
|
.toast.success {
|
|
|
border-color: var(--success);
|
|
|
background: rgba(16, 185, 129, 0.1);
|
|
|
box-shadow: var(--glow) var(--success-glow);
|
|
|
}
|
|
|
.toast.error {
|
|
|
border-color: var(--danger);
|
|
|
background: rgba(239, 68, 68, 0.1);
|
|
|
box-shadow: var(--glow) var(--danger-glow);
|
|
|
}
|
|
|
.toast.warning {
|
|
|
border-color: var(--warning);
|
|
|
background: rgba(251, 191, 36, 0.1);
|
|
|
box-shadow: var(--glow) var(--warning-glow);
|
|
|
}
|
|
|
.toast.info {
|
|
|
border-color: var(--info);
|
|
|
background: rgba(0, 212, 255, 0.1);
|
|
|
box-shadow: var(--glow) var(--info-glow);
|
|
|
}
|
|
|
|
|
|
|
|
|
.grid { display: grid; gap: 24px; }
|
|
|
.grid-2 { grid-template-columns: repeat(auto-fit, minmax(500px, 1fr)); }
|
|
|
.grid-3 { grid-template-columns: repeat(auto-fit, minmax(380px, 1fr)); }
|
|
|
|
|
|
|
|
|
@media (max-width: 768px) {
|
|
|
.container { padding: 20px; }
|
|
|
.header { padding: 24px; }
|
|
|
.header-top { flex-direction: column; align-items: flex-start; }
|
|
|
.kpi-grid { grid-template-columns: 1fr; }
|
|
|
.grid-2, .grid-3 { grid-template-columns: 1fr; }
|
|
|
.tabs { overflow-x: scroll; }
|
|
|
}
|
|
|
|
|
|
|
|
|
.icon {
|
|
|
stroke: currentColor;
|
|
|
stroke-width: 2.5;
|
|
|
stroke-linecap: round;
|
|
|
stroke-linejoin: round;
|
|
|
fill: none;
|
|
|
}
|
|
|
|
|
|
.icon-lg {
|
|
|
width: 32px;
|
|
|
height: 32px;
|
|
|
}
|
|
|
|
|
|
|
|
|
.provider-icon {
|
|
|
width: 48px;
|
|
|
height: 48px;
|
|
|
border-radius: 12px;
|
|
|
display: flex;
|
|
|
align-items: center;
|
|
|
justify-content: center;
|
|
|
font-size: 24px;
|
|
|
box-shadow: var(--shadow);
|
|
|
}
|
|
|
|
|
|
.provider-icon.online {
|
|
|
background: linear-gradient(135deg, rgba(16, 185, 129, 0.2), rgba(16, 185, 129, 0.1));
|
|
|
border: 2px solid var(--success);
|
|
|
}
|
|
|
|
|
|
.provider-icon.offline {
|
|
|
background: linear-gradient(135deg, rgba(239, 68, 68, 0.2), rgba(239, 68, 68, 0.1));
|
|
|
border: 2px solid var(--danger);
|
|
|
}
|
|
|
|
|
|
.provider-icon.degraded {
|
|
|
background: linear-gradient(135deg, rgba(251, 191, 36, 0.2), rgba(251, 191, 36, 0.1));
|
|
|
border: 2px solid var(--warning);
|
|
|
}
|
|
|
</style>
|
|
|
</head>
|
|
|
<body>
|
|
|
<div class="loading-overlay" id="loadingOverlay">
|
|
|
<div class="spinner"></div>
|
|
|
</div>
|
|
|
|
|
|
<div class="toast-container" id="toastContainer"></div>
|
|
|
|
|
|
<div class="container">
|
|
|
|
|
|
<div class="header">
|
|
|
<div class="header-top">
|
|
|
<div class="logo">
|
|
|
<div class="logo-icon">
|
|
|
<svg class="icon icon-lg" style="stroke: white; width: 40px; height: 40px;">
|
|
|
<path d="M12 2L2 7l10 5 10-5-10-5zM2 17l10 5 10-5M2 12l10 5 10-5"></path>
|
|
|
</svg>
|
|
|
</div>
|
|
|
<div class="logo-text">
|
|
|
<h1>🚀 Crypto API Monitor</h1>
|
|
|
<p>Real-time Cryptocurrency API Resource Monitoring</p>
|
|
|
</div>
|
|
|
</div>
|
|
|
<div class="header-actions">
|
|
|
<div class="connection-status" id="wsStatus">
|
|
|
<span class="status-dot"></span>
|
|
|
<span id="wsStatusText">Connecting...</span>
|
|
|
</div>
|
|
|
<div class="status-badge" id="systemStatus">
|
|
|
<span class="status-dot"></span>
|
|
|
<span id="systemStatusText">System Active</span>
|
|
|
</div>
|
|
|
<button class="btn" onclick="refreshAll()">
|
|
|
<svg class="icon">
|
|
|
<path d="M21.5 2v6h-6M2.5 22v-6h6M2 11.5a10 10 0 0 1 18.8-4.3M22 12.5a10 10 0 0 1-18.8 4.2"></path>
|
|
|
</svg>
|
|
|
Refresh All
|
|
|
</button>
|
|
|
</div>
|
|
|
</div>
|
|
|
|
|
|
|
|
|
<div class="kpi-grid" id="kpiGrid">
|
|
|
<div class="kpi-card">
|
|
|
<div class="kpi-header">
|
|
|
<span class="kpi-label">📊 Total APIs</span>
|
|
|
<div class="kpi-icon-wrapper" style="background: linear-gradient(135deg, rgba(0, 212, 255, 0.2), rgba(0, 212, 255, 0.1));">
|
|
|
<svg class="icon icon-lg" style="stroke: var(--accent-blue); width: 36px; height: 36px;">
|
|
|
<rect x="3" y="3" width="18" height="18" rx="2"></rect>
|
|
|
<line x1="3" y1="9" x2="21" y2="9"></line>
|
|
|
<line x1="9" y1="21" x2="9" y2="9"></line>
|
|
|
</svg>
|
|
|
</div>
|
|
|
</div>
|
|
|
<div class="kpi-value" id="kpiTotalAPIs">--</div>
|
|
|
<div class="kpi-trend trend-neutral">
|
|
|
<svg class="icon" style="width: 18px; height: 18px;">
|
|
|
<path d="M12 20V10M18 20V4M6 20v-4"></path>
|
|
|
</svg>
|
|
|
<span id="kpiTotalTrend">Loading...</span>
|
|
|
</div>
|
|
|
</div>
|
|
|
|
|
|
<div class="kpi-card">
|
|
|
<div class="kpi-header">
|
|
|
<span class="kpi-label">✅ Online</span>
|
|
|
<div class="kpi-icon-wrapper" style="background: linear-gradient(135deg, rgba(16, 185, 129, 0.2), rgba(16, 185, 129, 0.1));">
|
|
|
<svg class="icon icon-lg" style="stroke: var(--success); width: 36px; height: 36px;">
|
|
|
<path d="M12 22s8-4 8-10V5l-8-3-8 3v7c0 6 8 10 8 10z"></path>
|
|
|
<polyline points="9 12 11 14 15 10"></polyline>
|
|
|
</svg>
|
|
|
</div>
|
|
|
</div>
|
|
|
<div class="kpi-value" id="kpiOnline">--</div>
|
|
|
<div class="kpi-trend trend-up">
|
|
|
<svg class="icon" style="width: 18px; height: 18px;">
|
|
|
<line x1="12" y1="19" x2="12" y2="5"></line>
|
|
|
<polyline points="5 12 12 5 19 12"></polyline>
|
|
|
</svg>
|
|
|
<span id="kpiOnlineTrend">Loading...</span>
|
|
|
</div>
|
|
|
</div>
|
|
|
|
|
|
<div class="kpi-card">
|
|
|
<div class="kpi-header">
|
|
|
<span class="kpi-label">⚡ Avg Response</span>
|
|
|
<div class="kpi-icon-wrapper" style="background: linear-gradient(135deg, rgba(251, 191, 36, 0.2), rgba(251, 191, 36, 0.1));">
|
|
|
<svg class="icon icon-lg" style="stroke: var(--warning); width: 36px; height: 36px;">
|
|
|
<path d="M13 2L3 14h9l-1 8 10-12h-9l1-8z"></path>
|
|
|
</svg>
|
|
|
</div>
|
|
|
</div>
|
|
|
<div class="kpi-value" id="kpiAvgResponse" style="font-size: 36px;">--</div>
|
|
|
<div class="kpi-trend trend-down">
|
|
|
<svg class="icon" style="width: 18px; height: 18px;">
|
|
|
<line x1="12" y1="5" x2="12" y2="19"></line>
|
|
|
<polyline points="19 12 12 19 5 12"></polyline>
|
|
|
</svg>
|
|
|
<span id="kpiResponseTrend">Loading...</span>
|
|
|
</div>
|
|
|
</div>
|
|
|
|
|
|
<div class="kpi-card">
|
|
|
<div class="kpi-header">
|
|
|
<span class="kpi-label">🕐 Last Update</span>
|
|
|
<div class="kpi-icon-wrapper" style="background: linear-gradient(135deg, rgba(168, 85, 247, 0.2), rgba(168, 85, 247, 0.1));">
|
|
|
<svg class="icon icon-lg" style="stroke: var(--accent-purple); width: 36px; height: 36px;">
|
|
|
<circle cx="12" cy="12" r="10"></circle>
|
|
|
<polyline points="12 6 12 12 16 14"></polyline>
|
|
|
</svg>
|
|
|
</div>
|
|
|
</div>
|
|
|
<div class="kpi-value" id="kpiLastUpdate" style="font-size: 22px; line-height: 1.3;">--</div>
|
|
|
<div class="kpi-trend trend-neutral">
|
|
|
<svg class="icon" style="width: 18px; height: 18px;">
|
|
|
<path d="M21.5 2v6h-6M2.5 22v-6h6M2 11.5a10 10 0 0 1 18.8-4.3M22 12.5a10 10 0 0 1-18.8 4.2"></path>
|
|
|
</svg>
|
|
|
<span>Auto-refresh</span>
|
|
|
</div>
|
|
|
</div>
|
|
|
</div>
|
|
|
</div>
|
|
|
|
|
|
|
|
|
<div class="tabs">
|
|
|
<div class="tab active" onclick="switchTab(event, 'dashboard')">
|
|
|
<svg class="icon">
|
|
|
<rect x="3" y="3" width="7" height="7"></rect>
|
|
|
<rect x="14" y="3" width="7" height="7"></rect>
|
|
|
<rect x="14" y="14" width="7" height="7"></rect>
|
|
|
<rect x="3" y="14" width="7" height="7"></rect>
|
|
|
</svg>
|
|
|
<span>Dashboard</span>
|
|
|
</div>
|
|
|
<div class="tab" onclick="switchTab(event, 'providers')">
|
|
|
<svg class="icon">
|
|
|
<path d="M21 16V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16z"></path>
|
|
|
<polyline points="3.27 6.96 12 12.01 20.73 6.96"></polyline>
|
|
|
<line x1="12" y1="22.08" x2="12" y2="12"></line>
|
|
|
</svg>
|
|
|
<span>Providers</span>
|
|
|
</div>
|
|
|
<div class="tab" onclick="switchTab(event, 'categories')">
|
|
|
<svg class="icon">
|
|
|
<rect x="3" y="3" width="7" height="7"></rect>
|
|
|
<rect x="14" y="3" width="7" height="7"></rect>
|
|
|
<rect x="14" y="14" width="7" height="7"></rect>
|
|
|
<rect x="3" y="14" width="7" height="7"></rect>
|
|
|
</svg>
|
|
|
<span>Categories</span>
|
|
|
</div>
|
|
|
<div class="tab" onclick="switchTab(event, 'logs')">
|
|
|
<svg class="icon">
|
|
|
<path d="M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"></path>
|
|
|
<polyline points="14 2 14 8 20 8"></polyline>
|
|
|
<line x1="16" y1="13" x2="8" y2="13"></line>
|
|
|
<line x1="16" y1="17" x2="8" y2="17"></line>
|
|
|
<polyline points="10 9 9 9 8 9"></polyline>
|
|
|
</svg>
|
|
|
<span>Logs</span>
|
|
|
</div>
|
|
|
<div class="tab" onclick="switchTab(event, 'huggingface')">
|
|
|
<svg class="icon">
|
|
|
<circle cx="12" cy="12" r="10"></circle>
|
|
|
<path d="M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3"></path>
|
|
|
<line x1="12" y1="17" x2="12.01" y2="17"></line>
|
|
|
</svg>
|
|
|
<span>🤗 HuggingFace</span>
|
|
|
</div>
|
|
|
</div>
|
|
|
|
|
|
|
|
|
<div class="tab-content active" id="tab-dashboard">
|
|
|
<div class="card">
|
|
|
<div class="card-header">
|
|
|
<h2 class="card-title">
|
|
|
<svg class="icon icon-lg">
|
|
|
<polyline points="22 12 18 12 15 21 9 3 6 12 2 12"></polyline>
|
|
|
</svg>
|
|
|
System Overview
|
|
|
</h2>
|
|
|
<button class="btn" onclick="loadProviders()" style="padding: 10px 20px; font-size: 13px;">
|
|
|
<svg class="icon">
|
|
|
<path d="M21.5 2v6h-6M2.5 22v-6h6M2 11.5a10 10 0 0 1 18.8-4.3M22 12.5a10 10 0 0 1-18.8 4.2"></path>
|
|
|
</svg>
|
|
|
Refresh
|
|
|
</button>
|
|
|
</div>
|
|
|
<div class="table-container">
|
|
|
<table class="table">
|
|
|
<thead>
|
|
|
<tr>
|
|
|
<th>🔌 Provider</th>
|
|
|
<th>📁 Category</th>
|
|
|
<th>📊 Status</th>
|
|
|
<th>⚡ Response Time</th>
|
|
|
<th>🕐 Last Check</th>
|
|
|
</tr>
|
|
|
</thead>
|
|
|
<tbody id="providersTableBody">
|
|
|
<tr>
|
|
|
<td colspan="5" style="text-align: center; padding: 60px;">
|
|
|
<div class="spinner" style="width: 40px; height: 40px; margin: 0 auto 20px;"></div>
|
|
|
<div style="color: var(--text-muted);">Loading providers...</div>
|
|
|
</td>
|
|
|
</tr>
|
|
|
</tbody>
|
|
|
</table>
|
|
|
</div>
|
|
|
</div>
|
|
|
|
|
|
<div class="grid grid-2">
|
|
|
<div class="card">
|
|
|
<div class="card-header">
|
|
|
<h2 class="card-title">
|
|
|
<svg class="icon icon-lg">
|
|
|
<polyline points="23 6 13.5 15.5 8.5 10.5 1 18"></polyline>
|
|
|
<polyline points="17 6 23 6 23 12"></polyline>
|
|
|
</svg>
|
|
|
Health Status
|
|
|
</h2>
|
|
|
</div>
|
|
|
<div style="position: relative; height: 320px; padding: 20px; background: var(--bg-secondary); border-radius: var(--radius); border: 2px solid var(--border);">
|
|
|
<canvas id="healthChart"></canvas>
|
|
|
</div>
|
|
|
</div>
|
|
|
|
|
|
<div class="card">
|
|
|
<div class="card-header">
|
|
|
<h2 class="card-title">
|
|
|
<svg class="icon icon-lg">
|
|
|
<circle cx="12" cy="12" r="10"></circle>
|
|
|
<line x1="2" y1="12" x2="22" y2="12"></line>
|
|
|
<path d="M12 2a15.3 15.3 0 0 1 4 10 15.3 15.3 0 0 1-4 10 15.3 15.3 0 0 1-4-10 15.3 15.3 0 0 1 4-10z"></path>
|
|
|
</svg>
|
|
|
Status Distribution
|
|
|
</h2>
|
|
|
</div>
|
|
|
<div style="position: relative; height: 320px; padding: 20px; background: var(--bg-secondary); border-radius: var(--radius); border: 2px solid var(--border);">
|
|
|
<canvas id="statusChart"></canvas>
|
|
|
</div>
|
|
|
</div>
|
|
|
</div>
|
|
|
</div>
|
|
|
|
|
|
|
|
|
<div class="tab-content" id="tab-providers">
|
|
|
<div class="card">
|
|
|
<div class="card-header">
|
|
|
<h2 class="card-title">
|
|
|
<svg class="icon icon-lg">
|
|
|
<path d="M21 16V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16z"></path>
|
|
|
</svg>
|
|
|
All Providers
|
|
|
</h2>
|
|
|
<button class="btn" onclick="loadProviders()" style="padding: 10px 20px; font-size: 13px;">
|
|
|
<svg class="icon">
|
|
|
<path d="M21.5 2v6h-6M2.5 22v-6h6M2 11.5a10 10 0 0 1 18.8-4.3M22 12.5a10 10 0 0 1-18.8 4.2"></path>
|
|
|
</svg>
|
|
|
Refresh
|
|
|
</button>
|
|
|
</div>
|
|
|
<div id="providersDetail">
|
|
|
<div style="text-align: center; padding: 60px;">
|
|
|
<div class="spinner" style="width: 40px; height: 40px; margin: 0 auto 20px;"></div>
|
|
|
<div style="color: var(--text-muted);">Loading providers details...</div>
|
|
|
</div>
|
|
|
</div>
|
|
|
</div>
|
|
|
</div>
|
|
|
|
|
|
|
|
|
<div class="tab-content" id="tab-categories">
|
|
|
<div class="card">
|
|
|
<div class="card-header">
|
|
|
<h2 class="card-title">
|
|
|
<svg class="icon icon-lg">
|
|
|
<rect x="3" y="3" width="18" height="18" rx="2"></rect>
|
|
|
<line x1="3" y1="9" x2="21" y2="9"></line>
|
|
|
<line x1="9" y1="21" x2="9" y2="9"></line>
|
|
|
</svg>
|
|
|
Categories Overview
|
|
|
</h2>
|
|
|
<button class="btn" onclick="loadCategories()" style="padding: 10px 20px; font-size: 13px;">
|
|
|
<svg class="icon">
|
|
|
<path d="M21.5 2v6h-6M2.5 22v-6h6M2 11.5a10 10 0 0 1 18.8-4.3M22 12.5a10 10 0 0 1-18.8 4.2"></path>
|
|
|
</svg>
|
|
|
Refresh
|
|
|
</button>
|
|
|
</div>
|
|
|
<div class="table-container">
|
|
|
<table class="table">
|
|
|
<thead>
|
|
|
<tr>
|
|
|
<th>📁 Category</th>
|
|
|
<th>📊 Total Sources</th>
|
|
|
<th>✅ Online</th>
|
|
|
<th>💚 Health %</th>
|
|
|
<th>⚡ Avg Response</th>
|
|
|
<th>🕐 Last Updated</th>
|
|
|
<th>📈 Status</th>
|
|
|
</tr>
|
|
|
</thead>
|
|
|
<tbody id="categoriesTableBody">
|
|
|
<tr>
|
|
|
<td colspan="7" style="text-align: center; padding: 60px;">
|
|
|
<div class="spinner" style="width: 40px; height: 40px; margin: 0 auto 20px;"></div>
|
|
|
<div style="color: var(--text-muted);">Loading categories...</div>
|
|
|
</td>
|
|
|
</tr>
|
|
|
</tbody>
|
|
|
</table>
|
|
|
</div>
|
|
|
</div>
|
|
|
</div>
|
|
|
|
|
|
|
|
|
<div class="tab-content" id="tab-logs">
|
|
|
<div class="card">
|
|
|
<div class="card-header">
|
|
|
<h2 class="card-title">
|
|
|
<svg class="icon icon-lg">
|
|
|
<path d="M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"></path>
|
|
|
<polyline points="14 2 14 8 20 8"></polyline>
|
|
|
</svg>
|
|
|
Connection Logs
|
|
|
</h2>
|
|
|
<button class="btn" onclick="loadLogs()" style="padding: 10px 20px; font-size: 13px;">
|
|
|
<svg class="icon">
|
|
|
<path d="M21.5 2v6h-6M2.5 22v-6h6M2 11.5a10 10 0 0 1 18.8-4.3M22 12.5a10 10 0 0 1-18.8 4.2"></path>
|
|
|
</svg>
|
|
|
Refresh
|
|
|
</button>
|
|
|
</div>
|
|
|
<div class="table-container">
|
|
|
<table class="table">
|
|
|
<thead>
|
|
|
<tr>
|
|
|
<th>🕐 Timestamp</th>
|
|
|
<th>🔌 Provider</th>
|
|
|
<th>📝 Type</th>
|
|
|
<th>📊 Status</th>
|
|
|
<th>⚡ Response Time</th>
|
|
|
<th>💬 Message</th>
|
|
|
</tr>
|
|
|
</thead>
|
|
|
<tbody id="logsTableBody">
|
|
|
<tr>
|
|
|
<td colspan="6" style="text-align: center; padding: 60px;">
|
|
|
<div class="spinner" style="width: 40px; height: 40px; margin: 0 auto 20px;"></div>
|
|
|
<div style="color: var(--text-muted);">Loading logs...</div>
|
|
|
</td>
|
|
|
</tr>
|
|
|
</tbody>
|
|
|
</table>
|
|
|
</div>
|
|
|
</div>
|
|
|
</div>
|
|
|
|
|
|
|
|
|
<div class="tab-content" id="tab-huggingface">
|
|
|
<div class="card">
|
|
|
<div class="card-header">
|
|
|
<h2 class="card-title">
|
|
|
<svg class="icon icon-lg">
|
|
|
<circle cx="12" cy="12" r="10"></circle>
|
|
|
</svg>
|
|
|
🤗 HuggingFace Health Status
|
|
|
</h2>
|
|
|
<button class="btn" onclick="refreshHFRegistry()" style="padding: 10px 20px; font-size: 13px;">
|
|
|
<svg class="icon">
|
|
|
<path d="M21.5 2v6h-6M2.5 22v-6h6M2 11.5a10 10 0 0 1 18.8-4.3M22 12.5a10 10 0 0 1-18.8 4.2"></path>
|
|
|
</svg>
|
|
|
Refresh Registry
|
|
|
</button>
|
|
|
</div>
|
|
|
<div id="hfHealthDisplay" style="padding: 24px; background: var(--bg-secondary); border-radius: var(--radius); font-family: 'Courier New', monospace; font-size: 14px; white-space: pre-wrap; max-height: 320px; overflow-y: auto; border: 2px solid var(--border); box-shadow: inset 0 2px 8px rgba(0, 0, 0, 0.3);">
|
|
|
Loading HF health status...
|
|
|
</div>
|
|
|
</div>
|
|
|
|
|
|
<div class="grid grid-2">
|
|
|
<div class="card">
|
|
|
<div class="card-header">
|
|
|
<h2 class="card-title">
|
|
|
🤖 Models Registry
|
|
|
<span class="badge badge-success" id="hfModelsCount">0</span>
|
|
|
</h2>
|
|
|
</div>
|
|
|
<div id="hfModelsList" style="max-height: 450px; overflow-y: auto;">
|
|
|
<div style="text-align: center; padding: 40px;">
|
|
|
<div class="spinner" style="width: 32px; height: 32px; margin: 0 auto 16px;"></div>
|
|
|
<div style="color: var(--text-muted);">Loading models...</div>
|
|
|
</div>
|
|
|
</div>
|
|
|
</div>
|
|
|
|
|
|
<div class="card">
|
|
|
<div class="card-header">
|
|
|
<h2 class="card-title">
|
|
|
📊 Datasets Registry
|
|
|
<span class="badge badge-success" id="hfDatasetsCount">0</span>
|
|
|
</h2>
|
|
|
</div>
|
|
|
<div id="hfDatasetsList" style="max-height: 450px; overflow-y: auto;">
|
|
|
<div style="text-align: center; padding: 40px;">
|
|
|
<div class="spinner" style="width: 32px; height: 32px; margin: 0 auto 16px;"></div>
|
|
|
<div style="color: var(--text-muted);">Loading datasets...</div>
|
|
|
</div>
|
|
|
</div>
|
|
|
</div>
|
|
|
</div>
|
|
|
|
|
|
<div class="card">
|
|
|
<div class="card-header">
|
|
|
<h2 class="card-title">
|
|
|
<svg class="icon icon-lg">
|
|
|
<circle cx="11" cy="11" r="8"></circle>
|
|
|
<path d="m21 21-4.35-4.35"></path>
|
|
|
</svg>
|
|
|
Search Registry
|
|
|
</h2>
|
|
|
</div>
|
|
|
<div style="display: flex; gap: 16px; margin-bottom: 24px; flex-wrap: wrap;">
|
|
|
<input type="text" id="hfSearchQuery" placeholder="Search crypto, bitcoin, sentiment..."
|
|
|
style="flex: 1; min-width: 250px; padding: 14px 20px; border-radius: 12px; border: 2px solid var(--border); background: var(--bg-secondary); color: var(--text-primary); font-size: 14px;"
|
|
|
value="crypto">
|
|
|
<select id="hfSearchKind" style="padding: 14px 20px; border-radius: 12px; border: 2px solid var(--border); background: var(--bg-secondary); color: var(--text-primary); font-size: 14px;">
|
|
|
<option value="models">Models</option>
|
|
|
<option value="datasets">Datasets</option>
|
|
|
</select>
|
|
|
<button class="btn" onclick="searchHF()" style="padding: 14px 28px;">
|
|
|
<svg class="icon">
|
|
|
<circle cx="11" cy="11" r="8"></circle>
|
|
|
<path d="m21 21-4.35-4.35"></path>
|
|
|
</svg>
|
|
|
Search
|
|
|
</button>
|
|
|
</div>
|
|
|
<div id="hfSearchResults" style="max-height: 450px; overflow-y: auto; padding: 24px; background: var(--bg-secondary); border-radius: var(--radius); border: 2px solid var(--border); box-shadow: inset 0 2px 8px rgba(0, 0, 0, 0.3);">
|
|
|
<div style="text-align: center; color: var(--text-muted);">Enter a query and click search</div>
|
|
|
</div>
|
|
|
</div>
|
|
|
|
|
|
<div class="card">
|
|
|
<div class="card-header">
|
|
|
<h2 class="card-title">💭 Sentiment Analysis</h2>
|
|
|
</div>
|
|
|
<div style="margin-bottom: 20px;">
|
|
|
<label style="display: block; font-weight: 700; margin-bottom: 12px; color: var(--text-primary);">Text Samples (one per line)</label>
|
|
|
<textarea id="hfSentimentTexts" rows="6"
|
|
|
style="width: 100%; padding: 16px; border-radius: 12px; border: 2px solid var(--border); background: var(--bg-secondary); color: var(--text-primary); font-size: 14px; font-family: inherit; resize: vertical;"
|
|
|
placeholder="BTC strong breakout ETH looks weak Crypto market is bullish today">BTC strong breakout
|
|
|
ETH looks weak
|
|
|
Crypto market is bullish today
|
|
|
Bears are taking control
|
|
|
Neutral market conditions</textarea>
|
|
|
</div>
|
|
|
<button class="btn" onclick="runHFSentiment()">
|
|
|
<svg class="icon">
|
|
|
<path d="M12 2a10 10 0 1 0 10 10A10 10 0 0 0 12 2zm0 18a8 8 0 1 1 8-8 8 8 0 0 1-8 8z"></path>
|
|
|
</svg>
|
|
|
Run Sentiment Analysis
|
|
|
</button>
|
|
|
<div id="hfSentimentVote" style="margin: 24px 0; padding: 32px; background: var(--bg-secondary); border-radius: var(--radius); text-align: center; font-size: 40px; font-weight: 900; border: 2px solid var(--border); box-shadow: inset 0 2px 8px rgba(0, 0, 0, 0.3);">
|
|
|
<span style="color: var(--text-muted);">—</span>
|
|
|
</div>
|
|
|
<div id="hfSentimentResults" style="padding: 24px; background: var(--bg-secondary); border-radius: var(--radius); font-family: 'Courier New', monospace; font-size: 13px; white-space: pre-wrap; max-height: 450px; overflow-y: auto; border: 2px solid var(--border); box-shadow: inset 0 2px 8px rgba(0, 0, 0, 0.3);">
|
|
|
Results will appear here...
|
|
|
</div>
|
|
|
</div>
|
|
|
</div>
|
|
|
</div>
|
|
|
|
|
|
<script>
|
|
|
|
|
|
const config = {
|
|
|
apiBaseUrl: '',
|
|
|
wsUrl: (() => {
|
|
|
const protocol = window.location.protocol === 'https:' ? 'wss:' : 'ws:';
|
|
|
const host = window.location.host;
|
|
|
return `${protocol}//${host}/ws`;
|
|
|
})(),
|
|
|
autoRefreshInterval: 30000,
|
|
|
maxRetries: 3
|
|
|
};
|
|
|
|
|
|
|
|
|
let state = {
|
|
|
ws: null,
|
|
|
wsConnected: false,
|
|
|
autoRefreshEnabled: true,
|
|
|
charts: {},
|
|
|
currentTab: 'dashboard',
|
|
|
providers: [],
|
|
|
categories: [],
|
|
|
logs: [],
|
|
|
lastUpdate: null
|
|
|
};
|
|
|
|
|
|
|
|
|
document.addEventListener('DOMContentLoaded', function() {
|
|
|
console.log('🚀 Initializing Crypto API Monitor...');
|
|
|
initializeWebSocket();
|
|
|
loadInitialData();
|
|
|
startAutoRefresh();
|
|
|
});
|
|
|
|
|
|
|
|
|
function initializeWebSocket() {
|
|
|
updateWSStatus('connecting');
|
|
|
|
|
|
try {
|
|
|
state.ws = new WebSocket(config.wsUrl);
|
|
|
setupWebSocketHandlers();
|
|
|
} catch (error) {
|
|
|
console.error('WebSocket connection failed:', error);
|
|
|
updateWSStatus('disconnected');
|
|
|
}
|
|
|
}
|
|
|
|
|
|
function setupWebSocketHandlers() {
|
|
|
state.ws.onopen = () => {
|
|
|
console.log('✅ WebSocket connected');
|
|
|
state.wsConnected = true;
|
|
|
updateWSStatus('connected');
|
|
|
showToast('Connected', 'Real-time data stream active', 'success');
|
|
|
};
|
|
|
|
|
|
state.ws.onmessage = (event) => {
|
|
|
try {
|
|
|
const data = JSON.parse(event.data);
|
|
|
handleWSMessage(data);
|
|
|
} catch (error) {
|
|
|
console.error('Error parsing WebSocket message:', error);
|
|
|
}
|
|
|
};
|
|
|
|
|
|
state.ws.onerror = (error) => {
|
|
|
console.error('❌ WebSocket error:', error);
|
|
|
updateWSStatus('disconnected');
|
|
|
};
|
|
|
|
|
|
state.ws.onclose = () => {
|
|
|
console.log('⚠️ WebSocket disconnected');
|
|
|
state.wsConnected = false;
|
|
|
updateWSStatus('disconnected');
|
|
|
};
|
|
|
}
|
|
|
|
|
|
function updateWSStatus(status) {
|
|
|
const statusEl = document.getElementById('wsStatus');
|
|
|
const textEl = document.getElementById('wsStatusText');
|
|
|
|
|
|
statusEl.classList.remove('connected', 'disconnected', 'connecting');
|
|
|
statusEl.classList.add(status);
|
|
|
|
|
|
const statusText = {
|
|
|
'connected': '✓ Connected',
|
|
|
'disconnected': '✗ Disconnected',
|
|
|
'connecting': '⟳ Connecting...'
|
|
|
};
|
|
|
|
|
|
textEl.textContent = statusText[status] || 'Unknown';
|
|
|
}
|
|
|
|
|
|
function handleWSMessage(data) {
|
|
|
console.log('📨 WebSocket message:', data.type);
|
|
|
|
|
|
switch(data.type) {
|
|
|
case 'status_update':
|
|
|
updateKPIs(data.data);
|
|
|
break;
|
|
|
case 'provider_status_change':
|
|
|
loadProviders();
|
|
|
break;
|
|
|
case 'new_alert':
|
|
|
showToast('Alert', data.data.message, 'warning');
|
|
|
break;
|
|
|
default:
|
|
|
console.log('Unknown message type:', data.type);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
|
|
|
async function apiCall(endpoint, options = {}) {
|
|
|
try {
|
|
|
const url = `${config.apiBaseUrl}${endpoint}`;
|
|
|
console.log('🌐 API Call:', url);
|
|
|
|
|
|
const response = await fetch(url, {
|
|
|
...options,
|
|
|
headers: {
|
|
|
'Content-Type': 'application/json',
|
|
|
...options.headers
|
|
|
}
|
|
|
});
|
|
|
|
|
|
if (!response.ok) {
|
|
|
throw new Error(`HTTP ${response.status}: ${response.statusText}`);
|
|
|
}
|
|
|
|
|
|
const data = await response.json();
|
|
|
console.log('✅ API Response:', endpoint, data);
|
|
|
return data;
|
|
|
} catch (error) {
|
|
|
console.error(`❌ API call failed: ${endpoint}`, error);
|
|
|
showToast('API Error', `Failed: ${endpoint}`, 'error');
|
|
|
throw error;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
async function loadInitialData() {
|
|
|
showLoading();
|
|
|
|
|
|
try {
|
|
|
console.log('📊 Loading initial data...');
|
|
|
|
|
|
await loadProviders();
|
|
|
|
|
|
initializeCharts();
|
|
|
|
|
|
state.lastUpdate = new Date();
|
|
|
updateLastUpdateDisplay();
|
|
|
|
|
|
console.log('✅ Initial data loaded successfully');
|
|
|
showToast('Success', 'Dashboard loaded successfully', 'success');
|
|
|
} catch (error) {
|
|
|
console.error('❌ Error loading initial data:', error);
|
|
|
showToast('Error', 'Failed to load initial data', 'error');
|
|
|
} finally {
|
|
|
hideLoading();
|
|
|
}
|
|
|
}
|
|
|
|
|
|
async function loadProviders() {
|
|
|
try {
|
|
|
const data = await apiCall('/api/providers');
|
|
|
state.providers = data;
|
|
|
renderProvidersTable(data);
|
|
|
renderProvidersDetail(data);
|
|
|
updateStatusChart(data);
|
|
|
updateKPIs(data);
|
|
|
} catch (error) {
|
|
|
console.error('Error loading providers:', error);
|
|
|
document.getElementById('providersTableBody').innerHTML = `
|
|
|
<tr>
|
|
|
<td colspan="5" style="text-align: center; color: var(--text-muted); padding: 60px;">
|
|
|
Failed to load providers. Please check if the API endpoint is available.
|
|
|
</td>
|
|
|
</tr>
|
|
|
`;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
async function loadCategories() {
|
|
|
try {
|
|
|
showLoading();
|
|
|
const data = await apiCall('/api/categories');
|
|
|
state.categories = data;
|
|
|
renderCategoriesTable(data);
|
|
|
showToast('Success', 'Categories loaded successfully', 'success');
|
|
|
} catch (error) {
|
|
|
console.error('Error loading categories:', error);
|
|
|
showToast('Error', 'Failed to load categories', 'error');
|
|
|
} finally {
|
|
|
hideLoading();
|
|
|
}
|
|
|
}
|
|
|
|
|
|
async function loadLogs() {
|
|
|
try {
|
|
|
showLoading();
|
|
|
const data = await apiCall('/api/logs');
|
|
|
state.logs = data;
|
|
|
renderLogsTable(data);
|
|
|
showToast('Success', 'Logs loaded successfully', 'success');
|
|
|
} catch (error) {
|
|
|
console.error('Error loading logs:', error);
|
|
|
showToast('Error', 'Failed to load logs', 'error');
|
|
|
} finally {
|
|
|
hideLoading();
|
|
|
}
|
|
|
}
|
|
|
|
|
|
|
|
|
async function loadHFHealth() {
|
|
|
try {
|
|
|
const data = await apiCall('/api/hf/health');
|
|
|
document.getElementById('hfHealthDisplay').textContent = JSON.stringify(data, null, 2);
|
|
|
} catch (error) {
|
|
|
console.error('Error loading HF health:', error);
|
|
|
document.getElementById('hfHealthDisplay').textContent = 'Error loading health status';
|
|
|
}
|
|
|
}
|
|
|
|
|
|
async function refreshHFRegistry() {
|
|
|
try {
|
|
|
showLoading();
|
|
|
const data = await apiCall('/api/hf/refresh', { method: 'POST' });
|
|
|
showToast('Success', 'HF Registry refreshed', 'success');
|
|
|
loadHFModels();
|
|
|
loadHFDatasets();
|
|
|
} catch (error) {
|
|
|
console.error('Error refreshing HF registry:', error);
|
|
|
showToast('Error', 'Failed to refresh registry', 'error');
|
|
|
} finally {
|
|
|
hideLoading();
|
|
|
}
|
|
|
}
|
|
|
|
|
|
async function loadHFModels() {
|
|
|
try {
|
|
|
const data = await apiCall('/api/hf/registry?type=models');
|
|
|
document.getElementById('hfModelsCount').textContent = data.length || 0;
|
|
|
document.getElementById('hfModelsList').innerHTML = data.map(item => `
|
|
|
<div style="padding: 16px; border-bottom: 1px solid var(--border); transition: var(--transition); cursor: pointer;" onmouseover="this.style.background='var(--bg-hover)'" onmouseout="this.style.background='transparent'">
|
|
|
<div style="font-weight: 700; margin-bottom: 6px; color: var(--text-primary);">🤖 ${item.id || 'Unknown'}</div>
|
|
|
<div style="font-size: 12px; color: var(--text-muted);">${item.description || 'No description'}</div>
|
|
|
</div>
|
|
|
`).join('');
|
|
|
} catch (error) {
|
|
|
console.error('Error loading HF models:', error);
|
|
|
document.getElementById('hfModelsList').innerHTML = '<div style="padding: 24px; text-align: center; color: var(--text-muted);">Error loading models</div>';
|
|
|
}
|
|
|
}
|
|
|
|
|
|
async function loadHFDatasets() {
|
|
|
try {
|
|
|
const data = await apiCall('/api/hf/registry?type=datasets');
|
|
|
document.getElementById('hfDatasetsCount').textContent = data.length || 0;
|
|
|
document.getElementById('hfDatasetsList').innerHTML = data.map(item => `
|
|
|
<div style="padding: 16px; border-bottom: 1px solid var(--border); transition: var(--transition); cursor: pointer;" onmouseover="this.style.background='var(--bg-hover)'" onmouseout="this.style.background='transparent'">
|
|
|
<div style="font-weight: 700; margin-bottom: 6px; color: var(--text-primary);">📊 ${item.id || 'Unknown'}</div>
|
|
|
<div style="font-size: 12px; color: var(--text-muted);">${item.description || 'No description'}</div>
|
|
|
</div>
|
|
|
`).join('');
|
|
|
} catch (error) {
|
|
|
console.error('Error loading HF datasets:', error);
|
|
|
document.getElementById('hfDatasetsList').innerHTML = '<div style="padding: 24px; text-align: center; color: var(--text-muted);">Error loading datasets</div>';
|
|
|
}
|
|
|
}
|
|
|
|
|
|
async function searchHF() {
|
|
|
try {
|
|
|
showLoading();
|
|
|
const query = document.getElementById('hfSearchQuery').value;
|
|
|
const kind = document.getElementById('hfSearchKind').value;
|
|
|
const data = await apiCall(`/api/hf/search?q=${encodeURIComponent(query)}&kind=${kind}`);
|
|
|
|
|
|
document.getElementById('hfSearchResults').innerHTML = data.map(item => `
|
|
|
<div style="padding: 16px; border-bottom: 1px solid var(--border); transition: var(--transition); cursor: pointer;" onmouseover="this.style.background='var(--bg-hover)'" onmouseout="this.style.background='transparent'">
|
|
|
<div style="font-weight: 700; margin-bottom: 6px; color: var(--text-primary);">${kind === 'models' ? '🤖' : '📊'} ${item.id || 'Unknown'}</div>
|
|
|
<div style="font-size: 12px; color: var(--text-muted); margin-bottom: 6px;">${item.description || 'No description'}</div>
|
|
|
<div style="font-size: 11px; color: var(--accent-blue);">Downloads: ${item.downloads || 0} • Likes: ${item.likes || 0}</div>
|
|
|
</div>
|
|
|
`).join('');
|
|
|
|
|
|
showToast('Success', `Found ${data.length} results`, 'success');
|
|
|
} catch (error) {
|
|
|
console.error('Error searching HF:', error);
|
|
|
showToast('Error', 'Search failed', 'error');
|
|
|
} finally {
|
|
|
hideLoading();
|
|
|
}
|
|
|
}
|
|
|
|
|
|
async function runHFSentiment() {
|
|
|
try {
|
|
|
showLoading();
|
|
|
const texts = document.getElementById('hfSentimentTexts').value.split('\n').filter(t => t.trim());
|
|
|
|
|
|
const data = await apiCall('/api/hf/run-sentiment', {
|
|
|
method: 'POST',
|
|
|
body: JSON.stringify({ texts: texts })
|
|
|
});
|
|
|
|
|
|
document.getElementById('hfSentimentResults').textContent = JSON.stringify(data, null, 2);
|
|
|
|
|
|
|
|
|
const sentiments = data.results || [];
|
|
|
const positive = sentiments.filter(s => s.sentiment === 'positive').length;
|
|
|
const negative = sentiments.filter(s => s.sentiment === 'negative').length;
|
|
|
const neutral = sentiments.filter(s => s.sentiment === 'neutral').length;
|
|
|
|
|
|
let overall = 'NEUTRAL';
|
|
|
let color = 'var(--info)';
|
|
|
|
|
|
if (positive > negative && positive > neutral) {
|
|
|
overall = 'BULLISH 📈';
|
|
|
color = 'var(--success)';
|
|
|
} else if (negative > positive && negative > neutral) {
|
|
|
overall = 'BEARISH 📉';
|
|
|
color = 'var(--danger)';
|
|
|
}
|
|
|
|
|
|
document.getElementById('hfSentimentVote').innerHTML = `
|
|
|
<span style="color: ${color};">${overall}</span>
|
|
|
<div style="font-size: 16px; margin-top: 12px; color: var(--text-muted);">
|
|
|
Positive: ${positive} • Negative: ${negative} • Neutral: ${neutral}
|
|
|
</div>
|
|
|
`;
|
|
|
|
|
|
showToast('Success', 'Sentiment analysis completed', 'success');
|
|
|
} catch (error) {
|
|
|
console.error('Error running sentiment analysis:', error);
|
|
|
showToast('Error', 'Sentiment analysis failed', 'error');
|
|
|
} finally {
|
|
|
hideLoading();
|
|
|
}
|
|
|
}
|
|
|
|
|
|
|
|
|
function renderProvidersTable(providers) {
|
|
|
const tbody = document.getElementById('providersTableBody');
|
|
|
|
|
|
if (!providers || providers.length === 0) {
|
|
|
tbody.innerHTML = `
|
|
|
<tr>
|
|
|
<td colspan="5" style="text-align: center; color: var(--text-muted); padding: 60px;">
|
|
|
No providers found
|
|
|
</td>
|
|
|
</tr>
|
|
|
`;
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
tbody.innerHTML = providers.map(provider => `
|
|
|
<tr>
|
|
|
<td>
|
|
|
<div style="display: flex; align-items: center; gap: 12px;">
|
|
|
<div class="provider-icon ${provider.status || 'offline'}">
|
|
|
${provider.status === 'online' ? '✅' : provider.status === 'degraded' ? '⚠️' : '❌'}
|
|
|
</div>
|
|
|
<div>
|
|
|
<strong style="font-size: 15px;">${provider.name || 'Unknown'}</strong>
|
|
|
<div style="font-size: 11px; color: var(--text-muted);">${provider.base_url || ''}</div>
|
|
|
</div>
|
|
|
</div>
|
|
|
</td>
|
|
|
<td>
|
|
|
<span class="badge badge-info">${provider.category || 'General'}</span>
|
|
|
</td>
|
|
|
<td>
|
|
|
<span class="badge ${getStatusBadgeClass(provider.status)}">
|
|
|
${provider.status || 'unknown'}
|
|
|
</span>
|
|
|
</td>
|
|
|
<td>
|
|
|
<strong style="color: ${provider.response_time < 500 ? 'var(--success)' : provider.response_time < 1000 ? 'var(--warning)' : 'var(--danger)'};">
|
|
|
${provider.response_time ? provider.response_time + 'ms' : '--'}
|
|
|
</strong>
|
|
|
</td>
|
|
|
<td>
|
|
|
<div style="font-size: 12px; font-weight: 700;">${formatTimestamp(provider.last_checked)}</div>
|
|
|
<div style="font-size: 11px; color: var(--text-muted);">${formatTimeAgo(provider.last_checked)}</div>
|
|
|
</td>
|
|
|
</tr>
|
|
|
`).join('');
|
|
|
}
|
|
|
|
|
|
function renderProvidersDetail(providers) {
|
|
|
const container = document.getElementById('providersDetail');
|
|
|
|
|
|
if (!providers || providers.length === 0) {
|
|
|
container.innerHTML = `
|
|
|
<div style="text-align: center; color: var(--text-muted); padding: 60px;">
|
|
|
No providers data available
|
|
|
</div>
|
|
|
`;
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
container.innerHTML = `
|
|
|
<div class="table-container">
|
|
|
<table class="table">
|
|
|
<thead>
|
|
|
<tr>
|
|
|
<th>🔌 Provider</th>
|
|
|
<th>📊 Status</th>
|
|
|
<th>⚡ Response Time</th>
|
|
|
<th>💚 Success Rate</th>
|
|
|
<th>✅ Last Success</th>
|
|
|
<th>❌ Errors (24h)</th>
|
|
|
</tr>
|
|
|
</thead>
|
|
|
<tbody>
|
|
|
${providers.map(provider => `
|
|
|
<tr>
|
|
|
<td>
|
|
|
<div style="display: flex; align-items: center; gap: 12px;">
|
|
|
<div class="provider-icon ${provider.status || 'offline'}">
|
|
|
${provider.status === 'online' ? '✅' : provider.status === 'degraded' ? '⚠️' : '❌'}
|
|
|
</div>
|
|
|
<div>
|
|
|
<strong style="font-size: 15px;">${provider.name || 'Unknown'}</strong>
|
|
|
<div style="font-size: 11px; color: var(--text-muted);">${provider.base_url || ''}</div>
|
|
|
</div>
|
|
|
</div>
|
|
|
</td>
|
|
|
<td>
|
|
|
<span class="badge ${getStatusBadgeClass(provider.status)}">
|
|
|
${provider.status || 'unknown'}
|
|
|
</span>
|
|
|
</td>
|
|
|
<td>
|
|
|
<strong style="color: ${provider.response_time < 500 ? 'var(--success)' : provider.response_time < 1000 ? 'var(--warning)' : 'var(--danger)'};">
|
|
|
${provider.response_time ? provider.response_time + 'ms' : '--'}
|
|
|
</strong>
|
|
|
</td>
|
|
|
<td>
|
|
|
<div class="progress">
|
|
|
<div class="progress-bar ${getHealthClass(provider.success_rate || 0)}"
|
|
|
style="width: ${provider.success_rate || 0}%"></div>
|
|
|
</div>
|
|
|
<small style="font-weight: 700;">${Math.round(provider.success_rate || 0)}%</small>
|
|
|
</td>
|
|
|
<td>${formatTimestamp(provider.last_success)}</td>
|
|
|
<td>
|
|
|
<span class="badge ${provider.error_count_24h > 10 ? 'badge-danger' : provider.error_count_24h > 0 ? 'badge-warning' : 'badge-success'}">
|
|
|
${provider.error_count_24h || 0}
|
|
|
</span>
|
|
|
</td>
|
|
|
</tr>
|
|
|
`).join('')}
|
|
|
</tbody>
|
|
|
</table>
|
|
|
</div>
|
|
|
`;
|
|
|
}
|
|
|
|
|
|
function renderCategoriesTable(categories) {
|
|
|
const tbody = document.getElementById('categoriesTableBody');
|
|
|
|
|
|
if (!categories || categories.length === 0) {
|
|
|
tbody.innerHTML = `
|
|
|
<tr>
|
|
|
<td colspan="7" style="text-align: center; color: var(--text-muted); padding: 60px;">
|
|
|
No categories found
|
|
|
</td>
|
|
|
</tr>
|
|
|
`;
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
tbody.innerHTML = categories.map(category => `
|
|
|
<tr>
|
|
|
<td>
|
|
|
<strong style="font-size: 15px;">📁 ${category.name || 'Unnamed'}</strong>
|
|
|
</td>
|
|
|
<td><strong>${category.total_sources || 0}</strong></td>
|
|
|
<td><strong style="color: var(--success);">${category.online || 0}</strong></td>
|
|
|
<td>
|
|
|
<div class="progress">
|
|
|
<div class="progress-bar ${getHealthClass(category.health_percentage || 0)}"
|
|
|
style="width: ${category.health_percentage || 0}%"></div>
|
|
|
</div>
|
|
|
<small style="font-weight: 700;">${Math.round(category.health_percentage || 0)}%</small>
|
|
|
</td>
|
|
|
<td><strong>${category.avg_response || '--'}ms</strong></td>
|
|
|
<td>${formatTimestamp(category.last_updated)}</td>
|
|
|
<td>
|
|
|
<span class="badge ${getStatusBadgeClass(category.status)}">
|
|
|
${category.status || 'unknown'}
|
|
|
</span>
|
|
|
</td>
|
|
|
</tr>
|
|
|
`).join('');
|
|
|
}
|
|
|
|
|
|
function renderLogsTable(logs) {
|
|
|
const tbody = document.getElementById('logsTableBody');
|
|
|
|
|
|
if (!logs || logs.length === 0) {
|
|
|
tbody.innerHTML = `
|
|
|
<tr>
|
|
|
<td colspan="6" style="text-align: center; color: var(--text-muted); padding: 60px;">
|
|
|
No logs found
|
|
|
</td>
|
|
|
</tr>
|
|
|
`;
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
tbody.innerHTML = logs.map(log => `
|
|
|
<tr>
|
|
|
<td>
|
|
|
<div style="font-size: 12px; font-weight: 700;">${formatTimestamp(log.timestamp)}</div>
|
|
|
<div style="font-size: 11px; color: var(--text-muted);">${formatTimeAgo(log.timestamp)}</div>
|
|
|
</td>
|
|
|
<td>
|
|
|
<strong>${log.provider || 'System'}</strong>
|
|
|
</td>
|
|
|
<td>
|
|
|
<span class="badge ${getLogTypeClass(log.type)}">
|
|
|
${log.type || 'unknown'}
|
|
|
</span>
|
|
|
</td>
|
|
|
<td>
|
|
|
<span class="badge ${getStatusBadgeClass(log.status)}">
|
|
|
${log.status || 'unknown'}
|
|
|
</span>
|
|
|
</td>
|
|
|
<td><strong>${log.response_time ? log.response_time + 'ms' : '--'}</strong></td>
|
|
|
<td>
|
|
|
<div style="max-width: 350px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;">
|
|
|
${log.message || 'No message'}
|
|
|
</div>
|
|
|
</td>
|
|
|
</tr>
|
|
|
`).join('');
|
|
|
}
|
|
|
|
|
|
|
|
|
function getHealthClass(percentage) {
|
|
|
if (percentage >= 80) return 'success';
|
|
|
if (percentage >= 60) return 'warning';
|
|
|
return 'danger';
|
|
|
}
|
|
|
|
|
|
function getStatusBadgeClass(status) {
|
|
|
switch (status?.toLowerCase()) {
|
|
|
case 'healthy': case 'online': case 'success': return 'badge-success';
|
|
|
case 'degraded': case 'warning': return 'badge-warning';
|
|
|
case 'offline': case 'error': case 'critical': return 'badge-danger';
|
|
|
default: return 'badge-info';
|
|
|
}
|
|
|
}
|
|
|
|
|
|
function getLogTypeClass(type) {
|
|
|
switch (type?.toLowerCase()) {
|
|
|
case 'error': return 'badge-danger';
|
|
|
case 'warning': return 'badge-warning';
|
|
|
case 'info': case 'connection': return 'badge-info';
|
|
|
case 'success': return 'badge-success';
|
|
|
default: return 'badge-info';
|
|
|
}
|
|
|
}
|
|
|
|
|
|
function formatTimestamp(timestamp) {
|
|
|
if (!timestamp) return '--';
|
|
|
try {
|
|
|
return new Date(timestamp).toLocaleString();
|
|
|
} catch {
|
|
|
return 'Invalid Date';
|
|
|
}
|
|
|
}
|
|
|
|
|
|
function formatTimeAgo(timestamp) {
|
|
|
if (!timestamp) return '';
|
|
|
try {
|
|
|
const now = new Date();
|
|
|
const time = new Date(timestamp);
|
|
|
const diff = now - time;
|
|
|
|
|
|
const minutes = Math.floor(diff / 60000);
|
|
|
const hours = Math.floor(diff / 3600000);
|
|
|
const days = Math.floor(diff / 86400000);
|
|
|
|
|
|
if (days > 0) return `${days}d ago`;
|
|
|
if (hours > 0) return `${hours}h ago`;
|
|
|
if (minutes > 0) return `${minutes}m ago`;
|
|
|
return 'Just now';
|
|
|
} catch {
|
|
|
return 'Unknown';
|
|
|
}
|
|
|
}
|
|
|
|
|
|
|
|
|
function updateKPIs(data) {
|
|
|
if (!data) return;
|
|
|
|
|
|
const totalAPIs = data.length || 0;
|
|
|
document.getElementById('kpiTotalAPIs').textContent = totalAPIs;
|
|
|
document.getElementById('kpiTotalTrend').textContent = `${totalAPIs} active`;
|
|
|
|
|
|
const onlineCount = data.filter(p => p.status === 'online' || p.status === 'healthy').length;
|
|
|
document.getElementById('kpiOnline').textContent = onlineCount;
|
|
|
document.getElementById('kpiOnlineTrend').textContent = `${Math.round((onlineCount / totalAPIs) * 100)}% uptime`;
|
|
|
|
|
|
const validResponses = data.filter(p => p.response_time).map(p => p.response_time);
|
|
|
const avgResponse = validResponses.length > 0 ?
|
|
|
Math.round(validResponses.reduce((a, b) => a + b, 0) / validResponses.length) : 0;
|
|
|
|
|
|
document.getElementById('kpiAvgResponse').textContent = avgResponse + 'ms';
|
|
|
|
|
|
const responseTrend = avgResponse < 500 ? 'Optimal' : avgResponse < 1000 ? 'Acceptable' : 'Slow';
|
|
|
document.getElementById('kpiResponseTrend').textContent = responseTrend;
|
|
|
}
|
|
|
|
|
|
function updateLastUpdateDisplay() {
|
|
|
if (state.lastUpdate) {
|
|
|
document.getElementById('kpiLastUpdate').textContent =
|
|
|
state.lastUpdate.toLocaleTimeString() + '\n' + state.lastUpdate.toLocaleDateString();
|
|
|
}
|
|
|
}
|
|
|
|
|
|
|
|
|
function initializeCharts() {
|
|
|
const healthCtx = document.getElementById('healthChart').getContext('2d');
|
|
|
state.charts.health = new Chart(healthCtx, {
|
|
|
type: 'line',
|
|
|
data: {
|
|
|
labels: [],
|
|
|
datasets: [{
|
|
|
label: 'System Health %',
|
|
|
data: [],
|
|
|
borderColor: '#00d4ff',
|
|
|
backgroundColor: 'rgba(0, 212, 255, 0.1)',
|
|
|
borderWidth: 3,
|
|
|
fill: true,
|
|
|
tension: 0.4
|
|
|
}]
|
|
|
},
|
|
|
options: {
|
|
|
responsive: true,
|
|
|
maintainAspectRatio: false,
|
|
|
plugins: {
|
|
|
legend: {
|
|
|
display: false
|
|
|
}
|
|
|
},
|
|
|
scales: {
|
|
|
y: {
|
|
|
beginAtZero: true,
|
|
|
max: 100,
|
|
|
grid: {
|
|
|
color: 'rgba(255, 255, 255, 0.1)'
|
|
|
},
|
|
|
ticks: {
|
|
|
color: '#b8c1ec'
|
|
|
}
|
|
|
},
|
|
|
x: {
|
|
|
grid: {
|
|
|
color: 'rgba(255, 255, 255, 0.1)'
|
|
|
},
|
|
|
ticks: {
|
|
|
color: '#b8c1ec'
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
});
|
|
|
|
|
|
const statusCtx = document.getElementById('statusChart').getContext('2d');
|
|
|
state.charts.status = new Chart(statusCtx, {
|
|
|
type: 'doughnut',
|
|
|
data: {
|
|
|
labels: ['Online', 'Degraded', 'Offline'],
|
|
|
datasets: [{
|
|
|
data: [0, 0, 0],
|
|
|
backgroundColor: [
|
|
|
'#10b981',
|
|
|
'#fbbf24',
|
|
|
'#ef4444'
|
|
|
],
|
|
|
borderWidth: 0
|
|
|
}]
|
|
|
},
|
|
|
options: {
|
|
|
responsive: true,
|
|
|
maintainAspectRatio: false,
|
|
|
cutout: '70%',
|
|
|
plugins: {
|
|
|
legend: {
|
|
|
position: 'bottom',
|
|
|
labels: {
|
|
|
color: '#b8c1ec',
|
|
|
font: {
|
|
|
size: 13,
|
|
|
weight: 700
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
});
|
|
|
}
|
|
|
|
|
|
function updateStatusChart(providers) {
|
|
|
if (!state.charts.status || !providers) return;
|
|
|
|
|
|
const online = providers.filter(p => p.status === 'online' || p.status === 'healthy').length;
|
|
|
const degraded = providers.filter(p => p.status === 'degraded' || p.status === 'warning').length;
|
|
|
const offline = providers.filter(p => p.status === 'offline' || p.status === 'error').length;
|
|
|
|
|
|
state.charts.status.data.datasets[0].data = [online, degraded, offline];
|
|
|
state.charts.status.update();
|
|
|
}
|
|
|
|
|
|
|
|
|
function switchTab(event, tabName) {
|
|
|
document.querySelectorAll('.tab').forEach(tab => {
|
|
|
tab.classList.remove('active');
|
|
|
});
|
|
|
|
|
|
document.querySelectorAll('.tab-content').forEach(content => {
|
|
|
content.classList.remove('active');
|
|
|
});
|
|
|
|
|
|
event.currentTarget.classList.add('active');
|
|
|
|
|
|
document.getElementById(`tab-${tabName}`).classList.add('active');
|
|
|
|
|
|
switch(tabName) {
|
|
|
case 'dashboard':
|
|
|
loadProviders();
|
|
|
break;
|
|
|
case 'providers':
|
|
|
loadProviders();
|
|
|
break;
|
|
|
case 'categories':
|
|
|
loadCategories();
|
|
|
break;
|
|
|
case 'logs':
|
|
|
loadLogs();
|
|
|
break;
|
|
|
case 'huggingface':
|
|
|
loadHFHealth();
|
|
|
loadHFModels();
|
|
|
loadHFDatasets();
|
|
|
break;
|
|
|
}
|
|
|
|
|
|
state.currentTab = tabName;
|
|
|
}
|
|
|
|
|
|
|
|
|
function showLoading() {
|
|
|
document.getElementById('loadingOverlay').classList.add('active');
|
|
|
}
|
|
|
|
|
|
function hideLoading() {
|
|
|
document.getElementById('loadingOverlay').classList.remove('active');
|
|
|
}
|
|
|
|
|
|
function showToast(title, message, type = 'info') {
|
|
|
const container = document.getElementById('toastContainer');
|
|
|
const toast = document.createElement('div');
|
|
|
toast.className = `toast ${type}`;
|
|
|
toast.innerHTML = `
|
|
|
<div style="flex: 1;">
|
|
|
<div style="font-weight: 700; font-size: 15px; margin-bottom: 4px;">${title}</div>
|
|
|
<div style="font-size: 13px; color: var(--text-secondary);">${message}</div>
|
|
|
</div>
|
|
|
<button onclick="this.parentElement.remove()" style="background: none; border: none; cursor: pointer; color: inherit; padding: 4px;">
|
|
|
<svg class="icon" style="width: 18px; height: 18px;">
|
|
|
<line x1="18" y1="6" x2="6" y2="18"></line>
|
|
|
<line x1="6" y1="6" x2="18" y2="18"></line>
|
|
|
</svg>
|
|
|
</button>
|
|
|
`;
|
|
|
|
|
|
container.appendChild(toast);
|
|
|
|
|
|
setTimeout(() => {
|
|
|
if (toast.parentElement) {
|
|
|
toast.remove();
|
|
|
}
|
|
|
}, 5000);
|
|
|
}
|
|
|
|
|
|
function refreshAll() {
|
|
|
console.log('🔄 Refreshing all data...');
|
|
|
loadInitialData();
|
|
|
|
|
|
switch(state.currentTab) {
|
|
|
case 'categories':
|
|
|
loadCategories();
|
|
|
break;
|
|
|
case 'logs':
|
|
|
loadLogs();
|
|
|
break;
|
|
|
case 'huggingface':
|
|
|
loadHFHealth();
|
|
|
loadHFModels();
|
|
|
loadHFDatasets();
|
|
|
break;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
function startAutoRefresh() {
|
|
|
setInterval(() => {
|
|
|
if (state.autoRefreshEnabled && state.wsConnected) {
|
|
|
console.log('🔄 Auto-refreshing data...');
|
|
|
refreshAll();
|
|
|
}
|
|
|
}, config.autoRefreshInterval);
|
|
|
}
|
|
|
</script>
|
|
|
</body>
|
|
|
</html>
|
|
|
|
|
|
|