added static folder for uvicorn
This commit is contained in:
parent
e50a551678
commit
9471892284
12
app.py
12
app.py
@ -73,10 +73,16 @@ async def list_ordis(request: Request):
|
||||
</html>
|
||||
""")
|
||||
|
||||
# L'URL attend maintenant une adresse MAC (ex: /ordi/00:11:22:33:44:55)
|
||||
@app.get("/ordi/{mac_address}")
|
||||
async def show_info(request: Request, mac_address: str):
|
||||
if mac_address in flotte:
|
||||
return templates.TemplateResponse("item.html", {"request": request, "ordi": flotte[mac_address]})
|
||||
# On ouvre une session pour parler à la base de données
|
||||
with Session(engine) as session:
|
||||
# On cherche la ligne qui correspond à l'adresse MAC
|
||||
statement = select(SystemLog).where(SystemLog.mac_address == mac_address)
|
||||
ordi_trouve = session.exec(statement).first()
|
||||
|
||||
# Si on l'a trouvé dans la BDD, on l'affiche
|
||||
if ordi_trouve:
|
||||
return templates.TemplateResponse("item.html", {"request": request, "ordi": ordi_trouve})
|
||||
else:
|
||||
return HTMLResponse("<h1>Machine introuvable</h1>", status_code=404)
|
||||
0
static/.empty
Normal file
0
static/.empty
Normal file
@ -3,59 +3,277 @@
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>Détails Machine - {{ ordi.hostname }}</title>
|
||||
<title>{{ ordi.hostname }} - Grabber</title>
|
||||
<link href="https://fonts.googleapis.com/css2?family=Inter:wght@400;600;700&display=swap" rel="stylesheet">
|
||||
<style>
|
||||
body { font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif; margin: 20px; background-color: #f4f4f9; color: #333; }
|
||||
h1 { color: #2c3e50; border-bottom: 2px solid #2c3e50; padding-bottom: 10px; }
|
||||
.nav-link { display: inline-block; margin-bottom: 20px; text-decoration: none; color: #fff; background-color: #3498db; padding: 10px 15px; border-radius: 5px; }
|
||||
.nav-link:hover { background-color: #2980b9; }
|
||||
.section { background: #fff; margin-bottom: 20px; border-radius: 8px; padding: 20px; box-shadow: 0 2px 5px rgba(0,0,0,0.1); }
|
||||
.section h2 { margin-top: 0; color: #e67e22; border-bottom: 1px solid #eee; padding-bottom: 10px; }
|
||||
table { width: 100%; border-collapse: collapse; margin-top: 10px; }
|
||||
th, td { border-bottom: 1px solid #ddd; padding: 12px; text-align: left; }
|
||||
th { background-color: #f8f9fa; color: #555; width: 30%; }
|
||||
tr:hover { background-color: #f1f1f1; }
|
||||
:root {
|
||||
--bg-color: #0f172a; /* Bleu nuit très sombre */
|
||||
--card-bg: #1e293b; /* Bleu gris pour les cartes */
|
||||
--text-main: #f1f5f9; /* Blanc cassé */
|
||||
--text-muted: #94a3b8; /* Gris clair */
|
||||
--accent: #3b82f6; /* Bleu vibrant */
|
||||
--accent-hover: #2563eb;
|
||||
--border: #334155;
|
||||
--header-height: 60px;
|
||||
}
|
||||
|
||||
body {
|
||||
font-family: 'Inter', sans-serif;
|
||||
background-color: var(--bg-color);
|
||||
color: var(--text-main);
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
line-height: 1.6;
|
||||
}
|
||||
|
||||
/* En-tête */
|
||||
header {
|
||||
background-color: var(--card-bg);
|
||||
border-bottom: 1px solid var(--border);
|
||||
padding: 0 20px;
|
||||
height: var(--header-height);
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
position: sticky;
|
||||
top: 0;
|
||||
z-index: 100;
|
||||
}
|
||||
|
||||
.back-link {
|
||||
text-decoration: none;
|
||||
color: var(--text-muted);
|
||||
font-weight: 600;
|
||||
font-size: 0.9rem;
|
||||
transition: color 0.2s;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 5px;
|
||||
}
|
||||
|
||||
.back-link:hover {
|
||||
color: var(--accent);
|
||||
}
|
||||
|
||||
.header-title {
|
||||
font-size: 1.2rem;
|
||||
font-weight: 700;
|
||||
}
|
||||
|
||||
/* Contenu principal */
|
||||
.container {
|
||||
max-width: 1200px;
|
||||
margin: 40px auto;
|
||||
padding: 0 20px;
|
||||
}
|
||||
|
||||
.hero {
|
||||
margin-bottom: 30px;
|
||||
}
|
||||
|
||||
.hero h1 {
|
||||
font-size: 2.5rem;
|
||||
margin: 0 0 10px 0;
|
||||
background: linear-gradient(90deg, #60a5fa, #a78bfa);
|
||||
-webkit-background-clip: text;
|
||||
-webkit-text-fill-color: transparent;
|
||||
}
|
||||
|
||||
.hero p {
|
||||
color: var(--text-muted);
|
||||
margin: 0;
|
||||
font-family: monospace;
|
||||
background: rgba(255,255,255,0.05);
|
||||
display: inline-block;
|
||||
padding: 5px 10px;
|
||||
border-radius: 5px;
|
||||
border: 1px solid var(--border);
|
||||
}
|
||||
|
||||
/* Grille des sections */
|
||||
.grid {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
|
||||
gap: 25px;
|
||||
}
|
||||
|
||||
.card {
|
||||
background-color: var(--card-bg);
|
||||
border-radius: 12px;
|
||||
border: 1px solid var(--border);
|
||||
padding: 25px;
|
||||
transition: transform 0.2s, box-shadow 0.2s;
|
||||
}
|
||||
|
||||
.card:hover {
|
||||
transform: translateY(-2px);
|
||||
box-shadow: 0 10px 20px rgba(0,0,0,0.2);
|
||||
border-color: var(--accent);
|
||||
}
|
||||
|
||||
.card-header {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
margin-bottom: 20px;
|
||||
padding-bottom: 15px;
|
||||
border-bottom: 1px solid var(--border);
|
||||
}
|
||||
|
||||
.card-header h2 {
|
||||
margin: 0;
|
||||
font-size: 1.1rem;
|
||||
text-transform: uppercase;
|
||||
letter-spacing: 1px;
|
||||
color: var(--accent);
|
||||
}
|
||||
|
||||
/* Tables de données */
|
||||
.data-row {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
margin-bottom: 12px;
|
||||
padding-bottom: 12px;
|
||||
border-bottom: 1px solid rgba(255,255,255,0.05);
|
||||
}
|
||||
|
||||
.data-row:last-child {
|
||||
border-bottom: none;
|
||||
margin-bottom: 0;
|
||||
padding-bottom: 0;
|
||||
}
|
||||
|
||||
.label {
|
||||
color: var(--text-muted);
|
||||
font-size: 0.9rem;
|
||||
}
|
||||
|
||||
.value {
|
||||
font-weight: 600;
|
||||
text-align: right;
|
||||
max-width: 60%;
|
||||
word-wrap: break-word;
|
||||
}
|
||||
|
||||
.footer {
|
||||
text-align: center;
|
||||
margin-top: 50px;
|
||||
color: var(--text-muted);
|
||||
font-size: 0.8rem;
|
||||
padding-bottom: 20px;
|
||||
}
|
||||
|
||||
/* Badges spécifiques */
|
||||
.badge {
|
||||
display: inline-block;
|
||||
padding: 2px 8px;
|
||||
border-radius: 4px;
|
||||
font-size: 0.85rem;
|
||||
font-weight: bold;
|
||||
}
|
||||
.badge-cpu { background: rgba(239, 68, 68, 0.2); color: #fca5a5; }
|
||||
.badge-ram { background: rgba(16, 185, 129, 0.2); color: #6ee7b7; }
|
||||
.badge-os { background: rgba(59, 130, 246, 0.2); color: #93c5fd; }
|
||||
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<a href="/" class="nav-link">← Retour au tableau de bord</a>
|
||||
|
||||
<h1>Détails de {{ ordi.hostname }}</h1>
|
||||
<header>
|
||||
<a href="/" class="back-link">
|
||||
<svg width="20" height="20" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M10 19l-7-7m0 0l7-7m-7 7h18"></path></svg>
|
||||
Tableau de bord
|
||||
</a>
|
||||
<div class="header-title">Détails Machine</div>
|
||||
<div style="width: 80px;"></div> </header>
|
||||
|
||||
<div class="section">
|
||||
<h2>[IDENTIFICATION]</h2>
|
||||
<table>
|
||||
<tr><th>Hostname</th><td><b>{{ ordi.hostname }}</b></td></tr>
|
||||
<tr><th>Adresse MAC (ID Unique)</th><td><code>{{ ordi.mac_address }}</code></td></tr>
|
||||
</table>
|
||||
<div class="container">
|
||||
|
||||
<div class="hero">
|
||||
<h1>{{ ordi.hostname }}</h1>
|
||||
<p>ID: {{ ordi.mac_address }}</p>
|
||||
</div>
|
||||
|
||||
<div class="section">
|
||||
<h2>[HARDWARE]</h2>
|
||||
<table>
|
||||
<tr><th>Carte Mère</th><td>{{ ordi.motherboard }}</td></tr>
|
||||
<tr><th>Modèle CPU</th><td>{{ ordi.cpu_model }}</td></tr>
|
||||
<tr><th>ID CPU</th><td>{{ ordi.cpu_id }}</td></tr>
|
||||
<tr><th>Cœurs / Threads</th><td>{{ ordi.cpu_cores }} Cores / {{ ordi.cpu_threads }} Threads</td></tr>
|
||||
<tr><th>Fréquences (Min/Cur/Max)</th><td>{{ ordi.cpu_frequency_min }} / {{ ordi.cpu_frequency_cur }} / {{ ordi.cpu_frequency_max }} MHz</td></tr>
|
||||
<tr><th>Modèle GPU</th><td>{{ ordi.gpu_model }}</td></tr>
|
||||
<tr><th>Slots RAM</th><td>{{ ordi.ram_slots }}</td></tr>
|
||||
</table>
|
||||
<div class="grid">
|
||||
|
||||
<div class="card">
|
||||
<div class="card-header">
|
||||
<h2>⚙️ Hardware</h2>
|
||||
</div>
|
||||
<div class="data-row">
|
||||
<span class="label">Modèle CPU</span>
|
||||
<span class="value badge badge-cpu">{{ ordi.cpu_model }}</span>
|
||||
</div>
|
||||
<div class="data-row">
|
||||
<span class="label">Coeurs / Threads</span>
|
||||
<span class="value">{{ ordi.cpu_cores }}C / {{ ordi.cpu_threads }}T</span>
|
||||
</div>
|
||||
<div class="data-row">
|
||||
<span class="label">Fréquence Max</span>
|
||||
<span class="value">{{ ordi.cpu_frequency_max }} MHz</span>
|
||||
</div>
|
||||
<div class="data-row">
|
||||
<span class="label">Carte Mère</span>
|
||||
<span class="value">{{ ordi.motherboard }}</span>
|
||||
</div>
|
||||
<div class="data-row">
|
||||
<span class="label">GPU</span>
|
||||
<span class="value">{{ ordi.gpu_model }}</span>
|
||||
</div>
|
||||
<div class="data-row">
|
||||
<span class="label">Slots RAM</span>
|
||||
<span class="value badge badge-ram">{{ ordi.ram_slots }}</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="section">
|
||||
<h2>[SOFTWARE]</h2>
|
||||
<table>
|
||||
<tr><th>Système d'exploitation (OS)</th><td>{{ ordi.os }}</td></tr>
|
||||
<tr><th>Architecture</th><td>{{ ordi.arch }}</td></tr>
|
||||
<tr><th>Noyau (Kernel)</th><td>{{ ordi.kernel }}</td></tr>
|
||||
<tr><th>Environnement de Bureau</th><td>{{ ordi.desktop_env }}</td></tr>
|
||||
<tr><th>Gestionnaire de Fenêtres</th><td>{{ ordi.window_manager }}</td></tr>
|
||||
</table>
|
||||
<div class="card">
|
||||
<div class="card-header">
|
||||
<h2>💿 Software</h2>
|
||||
</div>
|
||||
<div class="data-row">
|
||||
<span class="label">OS</span>
|
||||
<span class="value badge badge-os">{{ ordi.os }}</span>
|
||||
</div>
|
||||
<div class="data-row">
|
||||
<span class="label">Noyau (Kernel)</span>
|
||||
<span class="value">{{ ordi.kernel }}</span>
|
||||
</div>
|
||||
<div class="data-row">
|
||||
<span class="label">Architecture</span>
|
||||
<span class="value">{{ ordi.arch }}</span>
|
||||
</div>
|
||||
<div class="data-row">
|
||||
<span class="label">Bureau (DE)</span>
|
||||
<span class="value">{{ ordi.desktop_env }}</span>
|
||||
</div>
|
||||
<div class="data-row">
|
||||
<span class="label">Gestionnaire (WM)</span>
|
||||
<span class="value">{{ ordi.window_manager }}</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div style="text-align: center; color: #888; font-size: 0.9em; margin-top: 40px;">
|
||||
Généré par Grabber v0.2
|
||||
<div class="card">
|
||||
<div class="card-header">
|
||||
<h2>🧠 Détails CPU</h2>
|
||||
</div>
|
||||
<div class="data-row">
|
||||
<span class="label">ID Processeur</span>
|
||||
<span class="value" style="font-family: monospace; font-size: 0.8rem;">{{ ordi.cpu_id }}</span>
|
||||
</div>
|
||||
<div class="data-row">
|
||||
<span class="label">Fréquence Min</span>
|
||||
<span class="value">{{ ordi.cpu_frequency_min }} MHz</span>
|
||||
</div>
|
||||
<div class="data-row">
|
||||
<span class="label">Fréquence Actuelle</span>
|
||||
<span class="value">{{ ordi.cpu_frequency_cur }} MHz</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div> <div class="footer">
|
||||
Grabber v0.2 • Données générées le {{ ordi.date_scan.strftime('%d/%m/%Y à %H:%M') if ordi.date_scan else 'N/A' }}
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
Reference in New Issue
Block a user