Files
nest/uvm/dashboard/static/css/dashboard.css
T
kstyagi b3b1b527e1 feat: Implement UVM Dashboard with frontend and backend integration
- Added dashboard.js for frontend functionality, including VM management and system health monitoring.
- Created dashboard route to serve the dashboard HTML.
- Introduced diagnostics route for token-protected host diagnostics.
- Enhanced VMs router with bulk actions, VM log retrieval, and port management.
- Updated lifecycle service to read VM log tails with truncation handling.
- Integrated static file serving for dashboard assets in the FastAPI server.
- Redirect root URL to the dashboard for improved user experience.
2026-09-19 10:50:29 +05:30

471 lines
20 KiB
CSS

/* ─── Design Tokens ─── */
:root {
--bg-body: #0b0b0f;
--bg-sidebar: #0f0f14;
--bg-card: #141419;
--bg-card-hover: #1a1a22;
--bg-input: #0e0e12;
--bg-elevated: #1c1c24;
--border-color: #1f1f28;
--border-hover: #2a2a36;
--divider: #1a1a22;
--text-primary: #f0f0f5;
--text-secondary: #8a8a98;
--text-muted: #5a5a68;
--accent: #6366f1;
--accent-hover: #818cf8;
--accent-soft: rgba(99, 102, 241, 0.12);
--green: #22c55e;
--green-soft: rgba(34, 197, 94, 0.12);
--red: #ef4444;
--red-soft: rgba(239, 68, 68, 0.12);
--amber: #f59e0b;
--amber-soft: rgba(245, 158, 11, 0.12);
--blue: #3b82f6;
--blue-soft: rgba(59, 130, 246, 0.12);
--purple: #a855f7;
--purple-soft: rgba(168, 85, 247, 0.12);
--radius-sm: 8px;
--radius-md: 12px;
--radius-lg: 16px;
--radius-xl: 20px;
--shadow-sm: 0 1px 2px rgba(0,0,0,0.4);
--shadow-md: 0 4px 12px rgba(0,0,0,0.5);
--shadow-lg: 0 8px 24px rgba(0,0,0,0.6);
--font-sans: 'Inter', ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, sans-serif;
--transition: 150ms cubic-bezier(0.4, 0, 0.2, 1);
}
/* ─── Reset ─── */
*, *::before, *::after { box-sizing: border-box; }
html, body { height: 100%; }
body {
margin: 0;
font-family: var(--font-sans);
background: var(--bg-body);
color: var(--text-primary);
line-height: 1.5;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
}
/* ─── Layout ─── */
#app { min-height: 100vh; }
.screen { display: none; min-height: 100vh; }
.screen.active { display: flex; }
#main-app { flex-direction: row; }
.sidebar {
width: 260px;
background: var(--bg-sidebar);
border-right: 1px solid var(--border-color);
display: flex;
flex-direction: column;
padding: 24px 16px;
position: fixed;
inset: 0 auto 0 0;
z-index: 50;
}
.sidebar-brand { margin-bottom: 32px; padding: 0 8px; }
.sidebar-brand .logo {
display: flex;
align-items: center;
gap: 12px;
font-weight: 700;
font-size: 18px;
letter-spacing: -0.02em;
color: var(--text-primary);
}
.sidebar-brand .logo svg { color: var(--text-primary); }
.sidebar-nav { display: flex; flex-direction: column; gap: 4px; flex: 1; }
.nav-item {
display: flex; align-items: center; gap: 12px;
padding: 10px 12px;
border-radius: var(--radius-md);
color: var(--text-secondary);
text-decoration: none;
font-size: 14px; font-weight: 500;
transition: background var(--transition), color var(--transition);
}
.nav-item:hover { background: var(--bg-card-hover); color: var(--text-primary); }
.nav-item.active { background: var(--accent-soft); color: var(--accent); }
.nav-item svg { opacity: 0.8; }
.sidebar-footer {
margin-top: auto;
padding-top: 16px;
border-top: 1px solid var(--divider);
display: flex;
flex-direction: column;
gap: 12px;
}
.connection-status {
display: flex; align-items: center; gap: 8px;
font-size: 12px; color: var(--text-muted);
}
.status-dot {
width: 8px; height: 8px; border-radius: 50%;
background: var(--green);
box-shadow: 0 0 6px var(--green);
}
.status-dot.offline { background: var(--red); box-shadow: 0 0 6px var(--red); }
.main {
flex: 1;
margin-left: 260px;
display: flex;
flex-direction: column;
min-height: 100vh;
}
.topbar {
position: sticky; top: 0; z-index: 40;
background: rgba(11,11,15,0.8);
backdrop-filter: blur(12px);
border-bottom: 1px solid var(--border-color);
padding: 16px 32px;
display: flex; align-items: center; justify-content: space-between;
}
.topbar-left h2 { margin: 0; font-size: 20px; font-weight: 600; letter-spacing: -0.01em; }
.topbar-right { display: flex; align-items: center; gap: 10px; }
.content { padding: 28px 32px; flex: 1; }
/* ─── Pages ─── */
.page { display: none; animation: fadeIn 220ms ease; }
.page.active { display: block; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: translateY(0); } }
/* ─── Cards ─── */
.card {
background: var(--bg-card);
border: 1px solid var(--border-color);
border-radius: var(--radius-lg);
padding: 24px;
transition: border-color var(--transition), box-shadow var(--transition);
}
.card:hover { border-color: var(--border-hover); }
.card-title { margin: 0 0 16px; font-size: 14px; font-weight: 600; color: var(--text-secondary); text-transform: uppercase; letter-spacing: 0.04em; }
.card-heading { margin: 0 0 20px; font-size: 18px; font-weight: 600; }
.card-title-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; }
.card-title-row .card-title { margin: 0; }
/* ─── Stats ─── */
.stats-grid {
display: grid;
grid-template-columns: repeat(4, 1fr);
gap: 20px;
margin-bottom: 28px;
}
.stats-grid.two { grid-template-columns: repeat(2, 1fr); }
.stat-card {
background: var(--bg-card);
border: 1px solid var(--border-color);
border-radius: var(--radius-lg);
padding: 20px;
}
.stat-header {
display: flex; align-items: center; justify-content: space-between;
margin-bottom: 12px;
}
.stat-label { font-size: 13px; color: var(--text-secondary); font-weight: 500; }
.stat-icon {
width: 36px; height: 36px; border-radius: 10px;
display: flex; align-items: center; justify-content: center;
}
.icon-blue { background: var(--blue-soft); color: var(--blue); }
.icon-green { background: var(--green-soft); color: var(--green); }
.icon-amber { background: var(--amber-soft); color: var(--amber); }
.icon-purple { background: var(--purple-soft); color: var(--purple); }
.stat-value { font-size: 28px; font-weight: 700; letter-spacing: -0.02em; line-height: 1; }
.stat-meta { font-size: 12px; color: var(--text-muted); margin-top: 8px; }
.text-green { color: var(--green); }
.text-amber { color: var(--amber); }
.text-red { color: var(--red); }
/* ─── Buttons ─── */
.btn {
display: inline-flex; align-items: center; justify-content: center; gap: 8px;
border: 1px solid transparent; border-radius: var(--radius-md);
padding: 8px 14px; font-size: 13px; font-weight: 600; font-family: inherit;
cursor: pointer; transition: background var(--transition), border-color var(--transition), transform 80ms ease;
background: transparent; color: var(--text-primary);
}
.btn:active { transform: scale(0.98); }
.btn-primary { background: var(--text-primary); color: var(--bg-body); border-color: var(--text-primary); }
.btn-primary:hover { background: #e2e2e8; border-color: #e2e2e8; }
.btn-ghost { border-color: var(--border-color); color: var(--text-secondary); }
.btn-ghost:hover { background: var(--bg-card-hover); color: var(--text-primary); }
.btn-danger { background: var(--red-soft); color: var(--red); border-color: rgba(239,68,68,0.25); }
.btn-danger:hover { background: rgba(239,68,68,0.2); }
.btn-warning { background: var(--amber-soft); color: var(--amber); border-color: rgba(245,158,11,0.25); }
.btn-warning:hover { background: rgba(245,158,11,0.2); }
.btn-sm { padding: 6px 10px; font-size: 12px; }
.btn-lg { padding: 10px 18px; font-size: 14px; }
.btn-icon { padding: 8px; }
/* ─── Tables ─── */
.table-wrap { overflow-x: auto; }
.data-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.data-table thead th {
text-align: left; padding: 12px 16px;
color: var(--text-secondary); font-weight: 500; font-size: 12px;
border-bottom: 1px solid var(--divider);
white-space: nowrap;
}
.data-table tbody td { padding: 14px 16px; border-bottom: 1px solid var(--divider); vertical-align: middle; }
.data-table tbody tr { transition: background var(--transition); }
.data-table tbody tr:hover { background: var(--bg-card-hover); }
.data-table .actions { text-align: right; white-space: nowrap; }
.data-table .selection { width: 36px; padding-right: 0; text-align: center; }
.data-table input[type="checkbox"] { accent-color: var(--accent); cursor: pointer; }
.table-empty { display: none; padding: 40px 0; }
.table-empty.visible { display: block; }
/* ─── Badges ─── */
.badge {
display: inline-flex; align-items: center; gap: 6px;
padding: 4px 10px; border-radius: 999px; font-size: 12px; font-weight: 600;
}
.badge-running { background: var(--green-soft); color: var(--green); }
.badge-stopped { background: var(--red-soft); color: var(--red); }
.badge-unknown { background: var(--bg-elevated); color: var(--text-muted); }
.status-badge {
display: inline-flex; align-items: center; gap: 6px;
padding: 6px 12px; border-radius: var(--radius-md); font-size: 13px; font-weight: 600;
}
.badge-loading { background: var(--bg-elevated); color: var(--text-muted); }
.badge-ok { background: var(--green-soft); color: var(--green); }
.badge-error { background: var(--red-soft); color: var(--red); }
/* ─── VM Grid / List ─── */
.vm-grid {
display: grid;
grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
gap: 16px;
}
.vm-card {
background: var(--bg-card);
border: 1px solid var(--border-color);
border-radius: var(--radius-lg);
padding: 18px;
cursor: pointer;
transition: border-color var(--transition), transform var(--transition);
}
.vm-card:hover { border-color: var(--border-hover); transform: translateY(-2px); }
.vm-card-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.vm-card-name { font-weight: 600; font-size: 14px; }
.vm-card-ip { font-size: 12px; color: var(--text-muted); margin-top: 2px; }
.vm-card-meta { display: flex; gap: 12px; margin-top: 12px; font-size: 12px; color: var(--text-secondary); }
.vm-card-meta span { display: flex; align-items: center; gap: 4px; }
.section-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.section-header h3 { margin: 0; font-size: 16px; font-weight: 600; }
.link { color: var(--accent); text-decoration: none; font-size: 13px; font-weight: 500; }
.link:hover { text-decoration: underline; }
/* ─── Toolbar ─── */
.card-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }
.search-box {
display: flex; align-items: center; gap: 10px;
background: var(--bg-input); border: 1px solid var(--border-color);
border-radius: var(--radius-md); padding: 0 12px; flex: 1; max-width: 360px;
}
.search-box input {
background: transparent; border: none; outline: none; color: var(--text-primary);
font: inherit; font-size: 13px; padding: 9px 0; width: 100%;
}
.search-box svg { color: var(--text-muted); flex-shrink: 0; }
.select {
background: var(--bg-input); border: 1px solid var(--border-color);
border-radius: var(--radius-md); color: var(--text-primary);
font: inherit; font-size: 13px; padding: 8px 28px 8px 12px;
appearance: none; cursor: pointer;
background-image: url("data:image/svg+xml,%3Csvg width='10' height='6' viewBox='0 0 10 6' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1l4 4 4-4' stroke='%238a8a98' stroke-width='1.5' fill='none' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
background-repeat: no-repeat; background-position: right 10px center;
}
.toolbar-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.bulk-controls { display: none; align-items: center; gap: 8px; }
.bulk-controls.visible { display: flex; }
.bulk-controls span { color: var(--text-secondary); font-size: 12px; white-space: nowrap; }
/* ─── Forms ─── */
.form-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field.full { grid-column: 1 / -1; }
.field label { font-size: 12px; font-weight: 600; color: var(--text-secondary); text-transform: uppercase; letter-spacing: 0.03em; }
.field input, .field select {
background: var(--bg-input); border: 1px solid var(--border-color);
border-radius: var(--radius-md); color: var(--text-primary);
font: inherit; font-size: 13px; padding: 10px 12px;
transition: border-color var(--transition);
}
.field input:focus, .field select:focus { outline: none; border-color: var(--accent); }
.hint-inline { color: var(--text-muted); font-weight: 400; text-transform: none; letter-spacing: 0; }
.form-actions { display: flex; align-items: center; gap: 12px; margin-top: 24px; }
.checkbox-field { flex-direction: row; align-items: center; gap: 10px; }
.checkbox { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; font-size: 13px; color: var(--text-secondary); }
.checkbox input { position: absolute; opacity: 0; width: 0; height: 0; }
.checkmark {
width: 18px; height: 18px; border-radius: 5px;
border: 1px solid var(--border-hover); background: var(--bg-input);
display: flex; align-items: center; justify-content: center;
transition: background var(--transition), border-color var(--transition);
}
.checkbox input:checked + .checkmark { background: var(--accent); border-color: var(--accent); }
.checkmark::after {
content: ''; width: 5px; height: 9px; border: solid white;
border-width: 0 2px 2px 0; transform: rotate(45deg);
opacity: 0; transition: opacity var(--transition);
}
.checkbox input:checked + .checkmark::after { opacity: 1; }
/* ─── Auth Screen ─── */
#auth-screen { align-items: center; justify-content: center; padding: 24px; }
.auth-card {
width: 100%; max-width: 420px;
background: var(--bg-card);
border: 1px solid var(--border-color);
border-radius: var(--radius-xl);
padding: 36px;
box-shadow: var(--shadow-lg);
}
.auth-header { text-align: center; margin-bottom: 28px; }
.auth-header h1 { margin: 16px 0 6px; font-size: 22px; font-weight: 700; }
.auth-header p { margin: 0; color: var(--text-secondary); font-size: 14px; }
.auth-form { display: flex; flex-direction: column; gap: 16px; }
.error-text { color: var(--red); font-size: 12px; margin: 0; min-height: 16px; }
.error-block { color: var(--red); font-size: 12px; background: var(--red-soft); padding: 12px; border-radius: var(--radius-md); border: 1px solid rgba(239,68,68,0.2); margin-top: 12px; white-space: pre-wrap; }
.error-block.hidden { display: none; }
/* ─── VM Detail ─── */
.vm-detail-header { margin-bottom: 20px; }
.back-btn { margin-bottom: 12px; }
.vm-detail-title { display: flex; align-items: center; gap: 12px; }
.vm-detail-title h2 { margin: 0; font-size: 22px; font-weight: 700; }
.detail-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 20px; }
.detail-card.wide { grid-column: 1 / -1; }
.detail-rows { display: flex; flex-direction: column; gap: 12px; }
.detail-row { display: flex; align-items: center; justify-content: space-between; font-size: 13px; padding: 8px 0; border-bottom: 1px solid var(--divider); }
.detail-row:last-child { border-bottom: none; }
.detail-key { color: var(--text-secondary); }
.detail-value { color: var(--text-primary); font-weight: 500; font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace; }
.port-list { display: flex; flex-wrap: wrap; gap: 8px; }
.port-chip {
display: inline-flex; align-items: center; gap: 6px;
padding: 5px 10px; border-radius: var(--radius-sm);
background: var(--bg-elevated); border: 1px solid var(--border-color);
font-size: 12px; font-weight: 500;
}
.port-editor { display: none; margin-top: 12px; }
.port-editor-input {
width: 100%; padding: 10px 12px; border: 1px solid var(--border-color);
border-radius: var(--radius-md); background: var(--bg-input); color: var(--text-primary);
font: inherit; font-size: 13px;
}
.port-editor-input:focus { outline: none; border-color: var(--accent); }
.port-editor-actions, .port-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.action-bar { display: flex; gap: 10px; flex-wrap: wrap; }
.hint { font-size: 12px; color: var(--text-muted); margin-top: 10px; }
.muted { color: var(--text-muted); }
.ssh-command {
display: block; margin-bottom: 12px; padding: 10px;
border: 1px solid var(--border-color); border-radius: var(--radius-md);
background: var(--bg-input); color: #c4c4d2; overflow-wrap: anywhere;
font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
font-size: 12px;
}
/* ─── System ─── */
.system-card .card-title { margin-bottom: 12px; }
.system-status { display: flex; align-items: center; gap: 12px; margin-top: 8px; }
.system-actions { display: flex; align-items: center; gap: 14px; margin-top: 12px; }
.code-block {
background: var(--bg-input); border: 1px solid var(--border-color);
border-radius: var(--radius-md); padding: 12px;
font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
font-size: 12px; color: var(--text-secondary); margin-top: 12px; overflow: auto;
}
.log-output {
max-height: 320px; overflow: auto; margin: 0;
padding: 14px; border: 1px solid var(--border-color); border-radius: var(--radius-md);
background: var(--bg-input); color: #b8b8c5;
font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
font-size: 12px; line-height: 1.6; white-space: pre-wrap; word-break: break-word;
}
.diagnostics-list { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 10px; }
.diagnostic-item {
display: flex; align-items: flex-start; gap: 10px;
padding: 12px; border: 1px solid var(--border-color); border-radius: var(--radius-md);
background: var(--bg-input);
}
.diagnostic-mark { width: 8px; height: 8px; border-radius: 50%; flex: 0 0 auto; margin-top: 5px; }
.diagnostic-mark.ok { background: var(--green); box-shadow: 0 0 6px var(--green); }
.diagnostic-mark.error { background: var(--red); box-shadow: 0 0 6px var(--red); }
.diagnostic-name { font-size: 12px; font-weight: 600; color: var(--text-primary); }
.diagnostic-message { margin-top: 2px; font-size: 11px; color: var(--text-muted); overflow-wrap: anywhere; }
/* ─── Empty State ─── */
.empty-state { text-align: center; padding: 40px 20px; color: var(--text-muted); }
.empty-state p { margin: 0 0 12px; }
/* ─── Modal ─── */
.modal { display: none; position: fixed; inset: 0; z-index: 100; align-items: center; justify-content: center; }
.modal.open { display: flex; }
.modal-overlay { position: absolute; inset: 0; background: rgba(0,0,0,0.6); backdrop-filter: blur(4px); }
.modal-card {
position: relative; z-index: 1;
background: var(--bg-card); border: 1px solid var(--border-color);
border-radius: var(--radius-xl); padding: 28px; width: 100%; max-width: 400px;
box-shadow: var(--shadow-lg);
}
.modal-card h3 { margin: 0 0 8px; font-size: 18px; }
.modal-card p { margin: 0 0 20px; color: var(--text-secondary); font-size: 13px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; }
/* ─── Toasts ─── */
#toast-container { position: fixed; top: 20px; right: 20px; z-index: 200; display: flex; flex-direction: column; gap: 10px; }
.toast {
background: var(--bg-card); border: 1px solid var(--border-color);
border-radius: var(--radius-md); padding: 12px 16px;
box-shadow: var(--shadow-md); font-size: 13px;
animation: slideIn 200ms ease; min-width: 260px;
display: flex; align-items: center; gap: 10px;
}
.toast.success { border-color: rgba(34,197,94,0.35); color: var(--green); }
.toast.error { border-color: rgba(239,68,68,0.35); color: var(--red); }
@keyframes slideIn { from { opacity: 0; transform: translateX(10px); } to { opacity: 1; transform: translateX(0); } }
/* ─── Responsive ─── */
@media (max-width: 1024px) {
.stats-grid { grid-template-columns: repeat(2, 1fr); }
.detail-grid { grid-template-columns: 1fr; }
}
@media (max-width: 768px) {
.sidebar { width: 100%; position: relative; border-right: none; border-bottom: 1px solid var(--border-color); }
.main { margin-left: 0; }
#main-app { flex-direction: column; }
.stats-grid { grid-template-columns: 1fr; }
.form-grid { grid-template-columns: 1fr; }
.content { padding: 20px; }
.topbar { padding: 12px 20px; }
}
/* ─── Scrollbar ─── */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #2a2a36; border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: #3a3a48; }