Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -60,7 +60,44 @@ def delete_item(db_name, container_name, item_id):
|
|
| 60 |
st.error("Item not found for deletion")
|
| 61 |
|
| 62 |
def display_cosmos_db_structure():
|
| 63 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 64 |
|
| 65 |
def manage_png_images():
|
| 66 |
# Get database and container names
|
|
|
|
| 60 |
st.error("Item not found for deletion")
|
| 61 |
|
| 62 |
def display_cosmos_db_structure():
|
| 63 |
+
st.subheader('Azure Cosmos DB Structure')
|
| 64 |
+
|
| 65 |
+
# Fetching databases
|
| 66 |
+
databases = list_databases()
|
| 67 |
+
if not databases:
|
| 68 |
+
st.error("No databases found.")
|
| 69 |
+
return
|
| 70 |
+
|
| 71 |
+
# Iterating through databases
|
| 72 |
+
for db_properties in databases:
|
| 73 |
+
db_name = db_properties['id']
|
| 74 |
+
st.markdown(f"#### Database: {db_name}")
|
| 75 |
+
|
| 76 |
+
# Fetching containers in the database
|
| 77 |
+
containers = list_containers(db_name)
|
| 78 |
+
if not containers:
|
| 79 |
+
st.markdown("No containers found in this database.")
|
| 80 |
+
continue
|
| 81 |
+
|
| 82 |
+
# Iterating through containers
|
| 83 |
+
for container_properties in containers:
|
| 84 |
+
container_name = container_properties['id']
|
| 85 |
+
st.markdown(f"- **Container**: {container_name}")
|
| 86 |
+
|
| 87 |
+
# Fetching and displaying items in the container
|
| 88 |
+
items = list_items(db_name, container_name)
|
| 89 |
+
if not items:
|
| 90 |
+
st.markdown(" - No items in this container.")
|
| 91 |
+
continue
|
| 92 |
+
|
| 93 |
+
for item in items:
|
| 94 |
+
item_desc = f" - Item: `{item['id']}`"
|
| 95 |
+
if 'file_name' in item and item['file_name'].endswith('.png'):
|
| 96 |
+
st.markdown(item_desc)
|
| 97 |
+
st.image(item['file_name'])
|
| 98 |
+
else:
|
| 99 |
+
st.markdown(item_desc)
|
| 100 |
+
|
| 101 |
|
| 102 |
def manage_png_images():
|
| 103 |
# Get database and container names
|