Spaces:
Sleeping
Sleeping
Update src/streamlit_app.py
Browse files- src/streamlit_app.py +30 -3
src/streamlit_app.py
CHANGED
|
@@ -179,6 +179,18 @@ def run_vortex_system():
|
|
| 179 |
client = get_gspread_client()
|
| 180 |
SHEET_NAME = "bdd_mvp_faker" # Nom du fichier Google Sheets
|
| 181 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 182 |
if client:
|
| 183 |
# --- SIDEBAR ---
|
| 184 |
st.sidebar.title("🔺 Projet Data")
|
|
@@ -195,9 +207,24 @@ def run_vortex_system():
|
|
| 195 |
|
| 196 |
# Informations système
|
| 197 |
st.sidebar.markdown("#### 📡 Statut Système")
|
| 198 |
-
|
| 199 |
-
|
| 200 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 201 |
st.sidebar.divider()
|
| 202 |
|
| 203 |
if st.sidebar.button("🔄 Reset System", use_container_width=True):
|
|
|
|
| 179 |
client = get_gspread_client()
|
| 180 |
SHEET_NAME = "bdd_mvp_faker" # Nom du fichier Google Sheets
|
| 181 |
|
| 182 |
+
# --- TEST DE CONNEXION RÉEL ---
|
| 183 |
+
is_connected = False
|
| 184 |
+
connection_error = None
|
| 185 |
+
|
| 186 |
+
if client:
|
| 187 |
+
try:
|
| 188 |
+
# On tente une ouverture légère pour vérifier l'accès
|
| 189 |
+
client.open(SHEET_NAME)
|
| 190 |
+
is_connected = True
|
| 191 |
+
except Exception as e:
|
| 192 |
+
connection_error = e
|
| 193 |
+
|
| 194 |
if client:
|
| 195 |
# --- SIDEBAR ---
|
| 196 |
st.sidebar.title("🔺 Projet Data")
|
|
|
|
| 207 |
|
| 208 |
# Informations système
|
| 209 |
st.sidebar.markdown("#### 📡 Statut Système")
|
| 210 |
+
|
| 211 |
+
|
| 212 |
+
# LOGIQUE D'AFFICHAGE INTELLIGENTE
|
| 213 |
+
if is_connected:
|
| 214 |
+
st.sidebar.success("✅ Système En Ligne")
|
| 215 |
+
st.sidebar.caption(f"Linked to: {SHEET_NAME}")
|
| 216 |
+
else:
|
| 217 |
+
st.sidebar.error("❌ Erreur de Liaison")
|
| 218 |
+
if connection_error:
|
| 219 |
+
# Si c'est une erreur 403 (Drive API) ou File Not Found
|
| 220 |
+
if "403" in str(connection_error):
|
| 221 |
+
st.sidebar.warning("⚠️ API Drive désactivée ou fichier non partagé.")
|
| 222 |
+
elif "Sprite" in str(connection_error) or "Not Found" in str(connection_error): # Gspread renvoie souvent SpriteSpreadsheetNotFound
|
| 223 |
+
st.sidebar.warning(f"⚠️ Fichier '{SHEET_NAME}' introuvable.")
|
| 224 |
+
else:
|
| 225 |
+
st.sidebar.warning("⚠️ Erreur technique inconnue")
|
| 226 |
+
|
| 227 |
+
|
| 228 |
st.sidebar.divider()
|
| 229 |
|
| 230 |
if st.sidebar.button("🔄 Reset System", use_container_width=True):
|