d
This commit is contained in:
@@ -615,9 +615,23 @@ class ConfigModal(ModalScreen):
|
||||
self.notify("Clipboard not supported in this terminal", severity="warning")
|
||||
|
||||
def on_store_type_selected(self, stype: str) -> None:
|
||||
if not stype: return
|
||||
|
||||
new_name = f"new_{stype}"
|
||||
if not stype:
|
||||
return
|
||||
|
||||
existing_names: set[str] = set()
|
||||
store_block = self.config_data.get("store")
|
||||
if isinstance(store_block, dict):
|
||||
st_entries = store_block.get(stype)
|
||||
if isinstance(st_entries, dict):
|
||||
existing_names = {str(name) for name in st_entries.keys() if name}
|
||||
|
||||
base_name = f"new_{stype}"
|
||||
new_name = base_name
|
||||
suffix = 1
|
||||
while new_name in existing_names:
|
||||
suffix += 1
|
||||
new_name = f"{base_name}_{suffix}"
|
||||
|
||||
if "store" not in self.config_data:
|
||||
self.config_data["store"] = {}
|
||||
if stype not in self.config_data["store"]:
|
||||
@@ -644,7 +658,7 @@ class ConfigModal(ModalScreen):
|
||||
for rk in required:
|
||||
if rk.upper() != "NAME":
|
||||
new_config[rk] = ""
|
||||
|
||||
|
||||
self.config_data["store"][stype][new_name] = new_config
|
||||
self.editing_item_type = f"store-{stype}"
|
||||
self.editing_item_name = new_name
|
||||
|
||||
Reference in New Issue
Block a user