Skip to content

Commit

Permalink
Refactor check field editing logic in services()
Browse files Browse the repository at this point in the history
  • Loading branch information
TheophileDiot committed Oct 28, 2024
1 parent 3c16398 commit 6e4d23c
Showing 1 changed file with 10 additions and 7 deletions.
17 changes: 10 additions & 7 deletions src/ui/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -1025,13 +1025,14 @@ def services():
del variables["OLD_SERVER_NAME"]

# Edit check fields and remove already existing ones
for variable, value in variables.copy().items():
if (
variable in variables
and variable != "SERVER_NAME"
and value == config.get(f"{server_name}_{variable}" if request.form["operation"] == "edit" else variable, {"value": None})["value"]
):
del variables[variable]
if was_draft == is_draft or not was_draft:
for variable, value in variables.copy().items():
if (
variable in variables
and variable != "SERVER_NAME"
and value == config.get(f"{server_name}_{variable}" if request.form["operation"] == "edit" else variable, {"value": None})["value"]
):
del variables[variable]

variables = app.config["CONFIG"].check_variables(variables, config)

Expand Down Expand Up @@ -1065,6 +1066,8 @@ def services():
old_server_name = request.form.get("OLD_SERVER_NAME", "")
operation = request.form["operation"]

app.logger.warning(variables)

def update_services(threaded: bool = False):
wait_applying()

Expand Down

0 comments on commit 6e4d23c

Please sign in to comment.