import streamlit as st
# Authentication function
def check_password():
"""Returns `True` if the user had the correct password."""
# st.write(st.secrets)
def password_entered():
"""Checks whether a password entered by the user is correct."""
if (
str(st.session_state.get("username", "")).strip()
== str(st.secrets.get("username", "")).strip()
and str(st.session_state.get("password", "")).strip()
== str(st.secrets.get("password", "")).strip()
):
st.session_state["password_correct"] = True
del st.session_state["password"] # don't store password
del st.session_state["username"] # don't store username
else:
st.session_state["password_correct"] = False
# Create a visually appealing login form
if (
"password_correct" not in st.session_state
or not st.session_state["password_correct"]
):
# Add custom CSS for styling
st.markdown(
"""
""",
unsafe_allow_html=True,
)
# Create a centered layout
col1, col2, col3 = st.columns([1, 2, 1])
with col2:
# Login container with title and subtitle
st.markdown(
"""
NPO DB Query
Please log in to continue
""",
unsafe_allow_html=True,
)
# Show error message if login failed
if (
"password_correct" in st.session_state
and not st.session_state["password_correct"]
):
st.error("๐ User not known or password incorrect")
# Login form with improved input fields
st.text_input("Username", key="username", placeholder="Enter your username")
st.text_input(
"Password",
type="password",
key="password",
placeholder="Enter your password",
)
# Full-width login button
st.button("Login", on_click=password_entered, use_container_width=True)
return False
else:
# Password correct
return True
# Only show the app if authentication is successful
if check_password():
st.set_page_config(
page_title="NPO DB Query",
page_icon="๐ป",
layout="wide",
initial_sidebar_state="expanded",
menu_items={
"About": "**๐ก NPO DB Query v0.2.12**",
},
)
pages = {
"Apps": [
st.Page("apps/database_page.py", title="๐กGenerate Databases"),
st.Page(
"apps/parameters_distribution.py", title="๐Parameters distribution"
),
st.Page("apps/core_dump_page.py", title="๐ Parse dump core"),
st.Page("apps/gps_converter.py", title="๐งญGPS Converter"),
st.Page("apps/distance.py", title="๐ฐDistance Calculator"),
st.Page(
"apps/multi_points_distance_calculator.py",
title=" ๐บ Multi Points Distance Calculator",
),
st.Page(
"apps/sector_kml_generator.py",
title="๐ก Sector KML Generator",
),
st.Page(
"apps/clustering.py",
title="๐ก Automatic Site Clustering",
),
st.Page("apps/fnb_parser.py", title="๐ F4NB Extractor"),
st.Page("apps/dump_compare.py", title="๐ Dump Compare"),
st.Page(
"apps/import_physical_db.py", title="๐Physical Database Verification"
),
],
"Capacity Analysis": [
st.Page(
"apps/kpi_analysis/gsm_capacity.py",
title=" ๐ GSM Capacity Analysis",
),
st.Page(
"apps/kpi_analysis/wbts_capacty.py",
title=" ๐ WBTS Capacity BB and CE Analysis",
),
st.Page(
"apps/kpi_analysis/wcel_capacity.py",
title=" ๐ WCEL Capacity Analysis",
),
st.Page(
"apps/kpi_analysis/lcg_analysis.py",
title=" ๐ LCG Capacity Analysis",
),
st.Page(
"apps/kpi_analysis/lte_capacity.py",
title=" ๐ LTE Capacity Analysis",
),
],
"Paging Analysis": [
st.Page(
"apps/kpi_analysis/gsm_lac_load.py",
title=" ๐ GSM LAC Load Analysis",
),
],
"KPI Analysis": [
st.Page(
"apps/kpi_analysis/lte_drop_trafic.py",
title=" ๐ LTE Drop Traffic Analysis",
),
st.Page(
"apps/kpi_analysis/anomalie.py",
title=" ๐ KPIs Anomaly Detection",
),
st.Page(
"apps/kpi_analysis/trafic_analysis.py",
title=" ๐ Trafic Analysis",
),
],
"Documentations": [
st.Page(
"documentations/database_doc.py", title="๐Databases Documentation"
),
st.Page(
"documentations/core_dump_doc.py", title="๐Dump core Documentation"
),
st.Page(
"documentations/gsm_capacity_docs.py",
title="๐GSM Capacity Documentation",
),
st.Page(
"documentations/lte_capacity_docs.py",
title="๐LTE Capacity Documentation",
),
],
}
pg = st.navigation(pages, position="top")
pg.run()