This commit is contained in:
Mateusz Gruszczyński
2025-10-17 14:30:40 +02:00
parent 38e5fc6e49
commit b22cfe368e
3 changed files with 73 additions and 37 deletions

View File

@@ -121,19 +121,24 @@ async function fetchNodeDetail(name) {
return await r.json(); return await r.json();
} }
// ------ Normalizacja stanu usług ------ // ------ Services status ------
function normSvcState(s) { function normSvcState(s) {
const raw = String(pick( const vals = [
s.active, s['active-state'], s.ActiveState, s.activestate, s.active, s['active-state'], s.ActiveState, s.activestate,
s.state, s.SubState, s.substate s.SubState, s.substate,
)).toLowerCase(); s.state, s.State,
const bad = String(pick(s.result, s.Result, s['exit-code'])).toLowerCase(); s.loadstate, s.LoadState,
s.result, s.Result, s['exit-code']
]
.filter(v => v !== undefined && v !== null && v !== '')
.map(v => String(v).toLowerCase());
if (/failed|error|dead/.test(bad)) return 'failed'; const joined = ' ' + vals.join(' ') + ' ';
if (/^active$|running/.test(raw)) return 'active'; if (/\b(failed|error|dead|auto-restart\b.*fail)\b/.test(joined)) return 'failed';
if (/activating|starting/.test(raw)) return 'activating'; if (/\b(active|running|up)\b/.test(joined)) return 'active';
if (/deactivating|stopping/.test(raw)) return 'deactivating'; if (/\b(activating|starting|start-pre|reload)\b/.test(joined)) return 'activating';
if (/failed|dead/.test(raw)) return 'failed'; if (/\b(deactivating|stopping|stop-post)\b/.test(joined)) return 'deactivating';
if (vals.length) return 'inactive';
return 'inactive'; return 'inactive';
} }

View File

@@ -1,21 +1,53 @@
/* Dark theme */ /* Dark theme */
body { background-color: #0f1115; } body {
.card.health-card { background: #101520; } background-color: #0f1115;
.health-dot { width: 12px; height: 12px; border-radius: 50%; background: #dc3545; } }
.health-dot.ok { background: #28a745; }
.health-dot.bad { background: #dc3545; } .card.health-card {
background: #101520;
}
.health-dot {
width: 12px;
height: 12px;
border-radius: 50%;
background: #dc3545;
}
.health-dot.ok {
background: #28a745;
}
.health-dot.bad {
background: #dc3545;
}
/* Tables */ /* Tables */
.table td, .table th { vertical-align: middle; } .table td,
.table th {
vertical-align: middle;
}
/* Dividers */ /* Dividers */
.vr { width:1px; min-height:1rem; background: rgba(255,255,255,.15); } .vr {
width: 1px;
min-height: 1rem;
background: rgba(255, 255, 255, .15);
}
/* --- horizontal scroll & nowrap for wide tables --- */ /* --- horizontal scroll & nowrap for wide tables --- */
.table-responsive { overflow-x: auto; } .table-responsive {
.table-nowrap { white-space: nowrap; } overflow-x: auto;
@media (min-width: 992px){ }
.table-nowrap-lg-normal { white-space: normal; }
.table-nowrap {
white-space: nowrap;
}
@media (min-width: 992px) {
.table-nowrap-lg-normal {
white-space: normal;
}
} }
/* sticky first column (for wide tables) */ /* sticky first column (for wide tables) */
@@ -24,5 +56,17 @@ body { background-color: #0f1115; }
left: 0; left: 0;
z-index: 2; z-index: 2;
background: var(--bs-body-bg); background: var(--bs-body-bg);
box-shadow: 1px 0 0 rgba(255,255,255,.08); box-shadow: 1px 0 0 rgba(255, 255, 255, .08);
} }
footer.site-footer {
border-top: 1px solid rgba(255, 255, 255, .1);
}
footer.site-footer a {
text-decoration: none;
}
footer.site-footer a:hover {
text-decoration: underline;
}

View File

@@ -7,19 +7,6 @@
<title>PVE HA Panel</title> <title>PVE HA Panel</title>
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/css/bootstrap.min.css" rel="stylesheet"> <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/css/bootstrap.min.css" rel="stylesheet">
<link href="{{ url_for('static', filename='styles.css') }}" rel="stylesheet"> <link href="{{ url_for('static', filename='styles.css') }}" rel="stylesheet">
<style>
footer.site-footer {
border-top: 1px solid rgba(255, 255, 255, .1);
}
footer.site-footer a {
text-decoration: none;
}
footer.site-footer a:hover {
text-decoration: underline;
}
</style>
</head> </head>
<body> <body>
@@ -276,9 +263,9 @@
<div class="d-flex flex-wrap align-items-center justify-content-between gap-2"> <div class="d-flex flex-wrap align-items-center justify-content-between gap-2">
<div>© 2025 PVE HA Panel</div> <div>© 2025 PVE HA Panel</div>
<div> <div>
Autor: <strong>linuxiarz.pl</strong> <strong>linuxiarz.pl</strong>
&nbsp;|&nbsp; &nbsp;|&nbsp;
Kod źródłowy: <a href="https://gitea.linuxiarz.pl/gru/pve-ha-web" target="_blank" Source code: <a href="https://gitea.linuxiarz.pl/gru/pve-ha-web" target="_blank"
rel="noopener">gitea.linuxiarz.pl/gru/pve-ha-web</a> rel="noopener">gitea.linuxiarz.pl/gru/pve-ha-web</a>
</div> </div>
</div> </div>