Add ability to add new http functions (Needs refactor, bad stuff)

This commit is contained in:
Peter Stockings
2023-12-16 21:27:49 +11:00
parent efa815c5cb
commit d8b441374e
4 changed files with 167 additions and 1 deletions

13
app.py
View File

@@ -81,6 +81,19 @@ def dashboard_http_functions():
http_functions = create_http_functions_view_model(http_functions)
return render_template("dashboard/http_functions.html", http_functions=http_functions)
@ app.route("/dashboard/http_functions/add_form", methods=["GET"])
def get_http_function_add_form():
script=DEFAULT_SCRIPT
name = "foo"
return render_template("dashboard/http_functions/new.html", name=name, script=script)
@ app.route("/dashboard/http_functions/create", methods=["POST"])
def create_http_function():
name = request.json.get('name')
script_content = request.json.get('script_content')
db.create_new_http_function(name, script_content)
return render_template("dashboard/http_functions/new.html", name=name, script=script_content)
@ app.route("/dashboard/timer_functions", methods=["GET"])
def dashboard_timer_functions():
return render_template("dashboard/timer_functions.html")