mirror of
https://github.com/bunkerity/bunkerweb
synced 2026-05-24 09:28:37 +00:00
Handle service creation and editing more elegantly in web UI
This commit is contained in:
parent
2df85b2c93
commit
60d43d0ce0
1 changed files with 5 additions and 1 deletions
|
|
@ -481,6 +481,7 @@ def services():
|
|||
|
||||
# Edit check fields and remove already existing ones
|
||||
config = app.config["CONFIG"].get_config(methods=False)
|
||||
server_name = variables["SERVER_NAME"].split(" ")[0]
|
||||
for variable, value in deepcopy(variables).items():
|
||||
if variable.endswith("SCHEMA"):
|
||||
del variables[variable]
|
||||
|
|
@ -491,7 +492,7 @@ def services():
|
|||
elif value == "off":
|
||||
value = "no"
|
||||
|
||||
if variable in variables and variable != "SERVER_NAME" and value == config.get(variable, None):
|
||||
if variable in variables and variable != "SERVER_NAME" and value == config.get(f"{server_name}_{variable}" if request.form["operation"] == "edit" else variable, None):
|
||||
del variables[variable]
|
||||
|
||||
if request.form["operation"] == "edit" and len(variables) == 1 and "SERVER_NAME" in variables and variables["SERVER_NAME"] == request.form.get("OLD_SERVER_NAME", ""):
|
||||
|
|
@ -500,6 +501,9 @@ def services():
|
|||
"error",
|
||||
)
|
||||
return redirect(url_for("loading", next=url_for("services")))
|
||||
elif request.form["operation"] == "new" and not variables:
|
||||
flash("The service was not created because all values had the default value.", "error")
|
||||
return redirect(url_for("loading", next=url_for("services")))
|
||||
|
||||
error = app.config["CONFIG"].check_variables(variables)
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue