File size: 3,044 Bytes
a190548
8853856
f7f0991
 
 
8853856
a190548
696ff74
8853856
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
f7f0991
696ff74
8853856
696ff74
 
 
8853856
696ff74
f7f0991
696ff74
8853856
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
f7f0991
8853856
 
 
 
 
696ff74
f7f0991
696ff74
8853856
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
f7f0991
8853856
 
 
696ff74
 
 
 
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
import streamlit as st
from frontend.app import pinecone_data_handler,common_functions

# # Page Configuration
common_functions.config_homepage()
# common_functions.set_bg_image("src/frontend/images/health_care_baner.png")

def render_admin_portal():

    """
    Renders the enhanced Admin Portal page with improved UI, navigation, and user guidance.
    
    Features:
    - Upsert data functionality with informative tips.
    - Delete records feature with enhanced warnings and confirmation prompts.
    """

# Header Section
    st.markdown(
        """
        <div style="
            background-color: #1B3C59; 
            color: #FFFFFF; 
            padding: 10px; 
            border-radius: 12px;
            text-align: center;
            box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
            border-radius: 80px;
        ">
            <h1>πŸ› οΈ Admin Portal</h1>
            <p style="font-size: 16px;">
                Manage your Pinecone database securely and efficiently.
            </p>
        </div>
        """, 
        unsafe_allow_html=True
    )

    st.divider()

# Data Manager Tabs
    DataManager = st.tabs(["πŸ“‚ Pinecone Data Manager"])[0]

    with DataManager:
        Upsert, Delete = st.tabs(["🟒 Upsert Data", "πŸ”΄ Delete Records"])

        # Upsert Section
        with Upsert:
            st.markdown(
                """
                <div style="
                    background-color: #E3F2FD; 
                    padding: 20px;
                    border-radius: 10px;
                    box-shadow: 0 3px 8px rgba(0, 0, 0, 0.15);
                ">
                    <h3>πŸ“₯ Upsert Data</h3>
                    <p style="color: #1976D2;">
                        Use this section to <b>insert</b> or <b>update</b> records in Pinecone.
                    </p>
                    <p>
                        βœ… Ensure your data is correctly formatted before uploading.<br>
                    </p>
                </div>
                """, 
                unsafe_allow_html=True
            )

            st.divider()

            # Call Upsert Function
            pinecone_data_handler.upsert_data()

        # Delete Section
        with Delete:
            st.markdown(
                """
                <div style="
                    background-color: #FFEBEE; 
                    padding: 20px;
                    border-radius: 10px;
                    box-shadow: 0 3px 8px rgba(0, 0, 0, 0.15);
                ">
                    <h3>⚠️ Delete Records</h3>
                    <p style="color: #D32F2F;">
                        ❗ <b>Warning:</b> Deleting data is irreversible.<br>
                        Please confirm your action before proceeding.
                    </p>
                </div>
                """, 
                unsafe_allow_html=True
            )

            st.divider()
            pinecone_data_handler.delete_records()

# Call the function to render the Admin Portal
if __name__ == "__main__":
    render_admin_portal()