From c6554cf3990bb6de8f7b1c8f3c49d06c600c9eb5 Mon Sep 17 00:00:00 2001 From: Peter Stockings Date: Fri, 22 Dec 2023 14:36:00 +1100 Subject: [PATCH] Create http function header template and move all http function related templates into same directory --- app.py | 8 +- templates/dashboard.html | 2 +- .../http_functions}/client.html | 12 +-- templates/dashboard/http_functions/edit.html | 54 +----------- .../dashboard/http_functions/header.html | 84 +++++++++++++++++++ templates/dashboard/http_functions/logs.html | 54 +----------- .../overview.html} | 0 7 files changed, 96 insertions(+), 118 deletions(-) rename templates/{ => dashboard/http_functions}/client.html (90%) create mode 100644 templates/dashboard/http_functions/header.html rename templates/dashboard/{http_functions.html => http_functions/overview.html} (100%) diff --git a/app.py b/app.py index b237a12..d884fe1 100644 --- a/app.py +++ b/app.py @@ -85,7 +85,7 @@ def client(user_id, function): return jsonify({'error': 'Function not found'}), 404 http_function = create_http_function_view_model(http_function) - return render_template("client.html", **http_function) + return render_template("dashboard/http_functions/client.html", **http_function) @ app.route("/dashboard", methods=["GET"]) @login_required @@ -101,7 +101,7 @@ def dashboard_http_functions(): user_id = current_user.id http_functions = db.get_http_functions_for_user(user_id) http_functions = create_http_functions_view_model(http_functions) - return render_template("dashboard/http_functions.html", http_functions=http_functions) + return render_template("dashboard/http_functions/overview.html", http_functions=http_functions) @ app.route("/dashboard/http_functions/add_form", methods=["GET"]) @login_required @@ -124,7 +124,7 @@ def create_http_function(): http_functions = db.get_http_functions_for_user(user_id) http_functions = create_http_functions_view_model(http_functions) - return render_template("dashboard/http_functions.html", http_functions=http_functions) + return render_template("dashboard/http_functions/overview.html", http_functions=http_functions) except Exception as e: print(e) return { "status": "error", "message": str(e) } @@ -172,7 +172,7 @@ def delete_http_function(): http_functions = db.get_http_functions_for_user(user_id) http_functions = create_http_functions_view_model(http_functions) - return render_template("dashboard/http_functions.html", http_functions=http_functions) + return render_template("dashboard/http_functions/overview.html", http_functions=http_functions) except Exception as e: return jsonify({"status": 'error', "message": str(e)}), 500 diff --git a/templates/dashboard.html b/templates/dashboard.html index 80105a4..86afcc4 100644 --- a/templates/dashboard.html +++ b/templates/dashboard.html @@ -88,7 +88,7 @@
- {{ render_partial('dashboard/http_functions.html', http_functions=http_functions) }} + {{ render_partial('dashboard/http_functions/overview.html', http_functions=http_functions) }}
diff --git a/templates/client.html b/templates/dashboard/http_functions/client.html similarity index 90% rename from templates/client.html rename to templates/dashboard/http_functions/client.html index 70b4efc..aa33e57 100644 --- a/templates/client.html +++ b/templates/dashboard/http_functions/client.html @@ -2,16 +2,10 @@ {% block content %} -
-

Try: {{ name }}

- -
+{{ render_partial('dashboard/http_functions/header.html', title='Try', user_id=user_id, name=name, +show_refresh=False, show_link=False, show_edit_form=True, show_client=True, show_logs=True) }} -
+