Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/api/app/routers/configs.py
Original file line number Diff line number Diff line change
Expand Up @@ -411,7 +411,7 @@ def delete_configs(req: ConfigsDeleteRequest) -> JSONResponse:
return JSONResponse(status_code=404, content={"status": "error", "message": "No deletable UI/API configs found among selection", "skipped": skipped})

for method, keep in keep_by_method.items():
err = db.save_custom_configs(keep, method)
err = db.save_custom_configs(keep, method, allow_empty=True)
if err:
return JSONResponse(status_code=500, content={"status": "error", "message": err, "skipped": skipped})

Expand Down
3 changes: 2 additions & 1 deletion src/common/db/Database.py
Original file line number Diff line number Diff line change
Expand Up @@ -2386,6 +2386,7 @@ def save_custom_configs(
changed: Optional[bool] = True,
*,
disable_cleanup: bool = False,
allow_empty: bool = False,
) -> str:
"""Save the custom configs in the database"""
message = ""
Expand All @@ -2409,7 +2410,7 @@ def save_custom_configs(
# actions delete rows individually through the UI/API, so by the time
# an empty payload reaches save_custom_configs there is nothing left
# to wipe and this guard is a no-op.
if method in ("ui", "api") and not custom_configs:
if method in ("ui", "api") and not custom_configs and not allow_empty:
existing_count = session.query(Custom_configs).filter(Custom_configs.method == method).count()
if existing_count > 0:
self.logger.warning(
Expand Down
2 changes: 1 addition & 1 deletion src/ui/app/routes/configs.py
Original file line number Diff line number Diff line change
Expand Up @@ -414,7 +414,7 @@ def delete_configs(configs: Dict[str, str]):
return

for method, configs_for_method in remaining_configs_by_method.items():
error = DB.save_custom_configs(configs_for_method, method)
error = DB.save_custom_configs(configs_for_method, method, allow_empty=True)
if error:
DATA["TO_FLASH"].append({"content": f"An error occurred while saving the custom configs: {error}", "type": "error"})
DATA.update({"RELOADING": False, "CONFIG_CHANGED": False})
Expand Down