f
This commit is contained in:
@@ -168,14 +168,24 @@ class ConfigModal(ModalScreen):
|
|||||||
if not stores:
|
if not stores:
|
||||||
container.mount(Static("No stores configured."))
|
container.mount(Static("No stores configured."))
|
||||||
else:
|
else:
|
||||||
# stores is structured as: {type: {name: config}}
|
# stores is structured as: {type: {name_key: config}}
|
||||||
for stype, instances in stores.items():
|
for stype, instances in stores.items():
|
||||||
if isinstance(instances, dict):
|
if isinstance(instances, dict):
|
||||||
for name, conf in instances.items():
|
for name_key, conf in instances.items():
|
||||||
|
# Use the name field from the config if it exists, otherwise use the key
|
||||||
|
display_name = name_key
|
||||||
|
if isinstance(conf, dict):
|
||||||
|
display_name = (
|
||||||
|
conf.get("NAME")
|
||||||
|
or conf.get("name")
|
||||||
|
or conf.get("Name")
|
||||||
|
or name_key
|
||||||
|
)
|
||||||
|
|
||||||
row = Horizontal(
|
row = Horizontal(
|
||||||
Static(f"{name} ({stype})", classes="item-label"),
|
Static(f"{display_name} ({stype})", classes="item-label"),
|
||||||
Button("Edit", id=f"edit-store-{stype}-{name}"),
|
Button("Edit", id=f"edit-store-{stype}-{name_key}"),
|
||||||
Button("Delete", variant="error", id=f"del-store-{stype}-{name}"),
|
Button("Delete", variant="error", id=f"del-store-{stype}-{name_key}"),
|
||||||
classes="item-row"
|
classes="item-row"
|
||||||
)
|
)
|
||||||
container.mount(row)
|
container.mount(row)
|
||||||
|
|||||||
Reference in New Issue
Block a user