File size: 6,662 Bytes
939b332
 
2f25a51
 
 
 
821982d
2f25a51
 
 
 
aa56dd5
 
 
 
2f25a51
 
821982d
 
2f25a51
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
aa56dd5
2f25a51
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
7860c2e
2f25a51
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
f9c0284
 
 
 
f991b3c
7860c2e
2f25a51
 
 
 
0898fcc
b29ed17
 
 
 
2f25a51
 
 
 
 
b29ed17
 
2f25a51
4d0848d
 
 
 
027f03b
 
 
 
39c7db8
 
 
 
 
 
 
 
41911f2
 
 
 
06e3227
 
 
 
9d2b604
 
 
 
2f25a51
 
 
 
 
 
 
 
3632bfd
 
 
 
027f03b
 
 
 
2f25a51
 
 
39c7db8
2f25a51
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
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(
            """
        <style>
        .login-container {
            background-color: #f0f2f6;
            padding: 30px;
            border-radius: 10px;
            box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
            margin-bottom: 20px;
            text-align: center;
        }
        .login-title {
            font-size: 24px;
            font-weight: bold;
            margin-bottom: 20px;
            color: #0f52ba;
        }
        .login-subtitle {
            font-size: 16px;
            margin-bottom: 30px;
            color: #555;
        }
        .stButton button {
            background-color: #0f52ba;
            color: white;
            font-weight: bold;
            border-radius: 5px;
            padding: 10px 20px;
        }
        </style>
        """,
            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(
                """
            <div class="login-container">
                <div class="login-title">NPO DB Query</div>
                <div class="login-subtitle">Please log in to continue</div>
            </div>
            """,
                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()