Fix logic when saving a service in the UI
This commit is contained in:
parent
479f18b175
commit
63ba001805
|
@ -463,7 +463,7 @@ def services():
|
|||
del variables["OLD_SERVER_NAME"]
|
||||
|
||||
# Edit check fields and remove already existing ones
|
||||
config = app.config["CONFIG"].get_config(methods=True)
|
||||
config = app.config["CONFIG"].get_config(methods=False)
|
||||
for variable, value in deepcopy(variables).items():
|
||||
if variable.endswith("SCHEMA"):
|
||||
del variables[variable]
|
||||
|
@ -474,19 +474,15 @@ def services():
|
|||
elif value == "off":
|
||||
value = "no"
|
||||
|
||||
config_setting = config.get(
|
||||
f"{variables['SERVER_NAME'].split(' ')[0]}_{variable}", None
|
||||
)
|
||||
|
||||
if variable in variables and (
|
||||
request.form["operation"] == "edit"
|
||||
and variable != "SERVER_NAME"
|
||||
and config_setting is not None
|
||||
and value == config_setting["value"]
|
||||
variable != "SERVER_NAME"
|
||||
and value == config.get(variable, None)
|
||||
or not value.strip()
|
||||
):
|
||||
del variables[variable]
|
||||
|
||||
print(variables, flush=True)
|
||||
|
||||
if len(variables) <= 1:
|
||||
flash(
|
||||
f"{variables['SERVER_NAME'].split(' ')[0]} was not edited because no values were changed."
|
||||
|
|
Loading…
Reference in New Issue