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()