Public Access
This commit is contained in:
1 parent
e8c2bc4418
commit
57db888e89
2 files changed
+27
-28
No files matched your search
+18
-23
@@ -7,34 +7,29 @@ def obtenir_infos_serveur():
|
||||
# Espace disque racine /
|
||||
total, used, free = shutil.disk_usage("/")
|
||||
|
||||
# Recherche intelligente de la partition RAID ou /DATA via psutil
|
||||
# Recherche spécifique de la partition RAID /DATA ou du périphérique md
|
||||
data_stats = {}
|
||||
try:
|
||||
partitions = psutil.disk_partitions(all=False)
|
||||
for p in partitions:
|
||||
# Priorité à la détection d'un périphérique md (RAID) ou du point de montage /DATA
|
||||
if "md" in p.device or p.mountpoint == "/DATA":
|
||||
try:
|
||||
dt, du, df = shutil.disk_usage(p.mountpoint)
|
||||
data_stats = {
|
||||
"device": p.device,
|
||||
"mountpoint": p.mountpoint,
|
||||
"total_gb": round(dt / (2**30), 2),
|
||||
"utilise_gb": round(du / (2**30), 2),
|
||||
"libre_gb": round(df / (2**30), 2),
|
||||
"pourcentage": round((du / dt) * 100, 1)
|
||||
}
|
||||
if "md" in p.device:
|
||||
break # On privilégie en premier le RAID détecté
|
||||
except Exception:
|
||||
pass
|
||||
partitions = psutil.disk_partitions(all=True)
|
||||
point_montage_cible = None
|
||||
|
||||
# Fallback sur /DATA si aucune détection spécifique md n'a eu lieu
|
||||
if not data_stats and os.path.exists("/DATA"):
|
||||
# On cherche en priorité un montage sur /DATA ou un device contenant 'md'
|
||||
for p in partitions:
|
||||
if p.mountpoint == "/DATA" or "md" in p.device:
|
||||
point_montage_cible = p.mountpoint
|
||||
break
|
||||
|
||||
if point_montage_cible:
|
||||
dt, du, df = shutil.disk_usage(point_montage_cible)
|
||||
data_stats = {
|
||||
"total_gb": round(dt / (2**30), 2),
|
||||
"utilise_gb": round(du / (2**30), 2),
|
||||
"libre_gb": round(df / (2**30), 2),
|
||||
"pourcentage": round((du / dt) * 100, 1)
|
||||
}
|
||||
elif os.path.exists("/DATA"):
|
||||
dt, du, df = shutil.disk_usage("/DATA")
|
||||
data_stats = {
|
||||
"device": "bind-mount /DATA",
|
||||
"mountpoint": "/DATA",
|
||||
"total_gb": round(dt / (2**30), 2),
|
||||
"utilise_gb": round(du / (2**30), 2),
|
||||
"libre_gb": round(df / (2**30), 2),
|
||||
|
||||
@@ -325,7 +325,7 @@ def render_backoffice_page(utilisateur, role, tous_les_utilisateurs, stats_serve
|
||||
sections.append(Div(
|
||||
H3("🖥️ Supervision Système, RAID & Agent Vectoriel", style="color: #ff9800;"),
|
||||
P(f"💾 Espace disque racine : {stats_serveur['disque_utilise_gb']} Go / {stats_serveur['disque_total_gb']} Go ({stats_serveur['pourcentage_utilise']}%)"),
|
||||
(P(f"🗄️ Périphérique RAID ({data_st.get('device', '/DATA')} sur {data_st.get('mountpoint', '/DATA')}) : {data_st.get('utilise_gb', 0)} Go / {data_st.get('total_gb', 0)} Go ({data_st.get('pourcentage', 0)}% utilisés, {data_st.get('libre_gb', 0)} Go libres)") if data_st else P("🗄️ Partition RAID (/DATA) : Non montée ou non détectée")),
|
||||
(P(f"🗄️ Partition RAID (/DATA) : {data_st.get('utilise_gb', 0)} Go / {data_st.get('total_gb', 0)} Go ({data_st.get('pourcentage', 0)}% utilisés, {data_st.get('libre_gb', 0)} Go libres)") if data_st else P("🗄️ Partition RAID (/DATA) : Non détectée")),
|
||||
Div(
|
||||
P("📡 État du RAID (mdstat) :", style="margin-bottom: 5px; font-weight: bold;"),
|
||||
Pre(stats_serveur.get('raid_status', 'N/A'), style="font-size: 0.8em; background: #111; color: #00ffcc; padding: 10px; border-radius: 4px; overflow-x: auto; max-height: 180px; overflow-y: auto; white-space: pre-wrap; font-family: monospace; margin: 0;"),
|
||||
@@ -338,12 +338,16 @@ def render_backoffice_page(utilisateur, role, tous_les_utilisateurs, stats_serve
|
||||
Button("Forcer la vectorisation globale de tout le RAG", type="submit", cls="btn-submit", style="background-color: #e91e63; color: white; width: 100%; font-weight: bold; cursor: pointer;"),
|
||||
method="post", action="/backoffice/forcer_vectorisation"
|
||||
),
|
||||
style="background: #1a1a1a; padding: 20px; border-radius: 8px; border: 1px solid #333;"
|
||||
style="background: #1a1a1a; padding: 20px; border-radius: 8px; border: 1px solid #333; margin-bottom: 20px;"
|
||||
))
|
||||
|
||||
sections.append(A("← Retour au Chat", href="/", style="display: block; margin-top: 20px; color: #00e5ff; text-decoration: none;"))
|
||||
# Vrai bouton ergonomique de retour au Front Office
|
||||
sections.append(
|
||||
A("← Retour au Chat (Front Office)", href="/", cls="btn-submit", style="display: block; text-align: center; background-color: #00e5ff; color: black; text-decoration: none; font-weight: bold; padding: 12px; border-radius: 6px;")
|
||||
)
|
||||
|
||||
return Title("Back Office - Aethas38"), Body(
|
||||
Div(*sections, style="max-width: 600px; margin: 50px auto; font-family: monospace; color: #fff;"),
|
||||
style="background-color: #0d0d0d; padding: 20px;"
|
||||
Div(*sections, style="max-width: 600px; margin: 40px auto; font-family: monospace; color: #fff; padding-bottom: 40px;"),
|
||||
# Style global appliqué au Body pour forcer le défilement vertical et éliminer les blocages d'affichage
|
||||
style="background-color: #0d0d0d; padding: 20px; overflow-y: auto !important; height: 100vh; box-sizing: border-box;"
|
||||
)
|
||||
Reference in new issue
Block a user