From 124e5b33db1d197f7df2bc9ed54f99f768a9275a Mon Sep 17 00:00:00 2001 From: JB Date: Fri, 28 Nov 2025 15:31:45 -0800 Subject: [PATCH] feat: Update wizard routing and improve pending job handling in modal --- abogen/web/routes/main.py | 11 ++++++----- abogen/web/templates/partials/upload_modal.html | 2 +- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/abogen/web/routes/main.py b/abogen/web/routes/main.py index f9e9ece..990595f 100644 --- a/abogen/web/routes/main.py +++ b/abogen/web/routes/main.py @@ -58,9 +58,10 @@ def index(): @main_bp.route("/wizard") def wizard_start(): pending_id = request.args.get("pending_id") + step = request.args.get("step", "book") if pending_id: - return redirect(url_for("main.wizard_step", step="book", pending_id=pending_id)) - return redirect(url_for("main.wizard_step", step="book")) + return redirect(url_for("main.wizard_step", step=step, pending_id=pending_id)) + return redirect(url_for("main.wizard_step", step=step)) @main_bp.route("/wizard/") def wizard_step(step: str): @@ -205,7 +206,7 @@ def wizard_text(): @main_bp.route("/wizard/update", methods=["POST"]) def wizard_update(): - pending_id = request.form.get("pending_id") + pending_id = request.values.get("pending_id") if not pending_id: if wants_wizard_json(): return wizard_json_response(None, "book", error="Missing job ID", status=400) @@ -289,7 +290,7 @@ def wizard_update(): @main_bp.route("/wizard/cancel", methods=["POST"]) def wizard_cancel(): - pending_id = request.form.get("pending_id") + pending_id = request.values.get("pending_id") if pending_id: remove_pending_job(pending_id) @@ -300,7 +301,7 @@ def wizard_cancel(): @main_bp.route("/wizard/finish", methods=["POST"]) def wizard_finish(): - pending_id = request.form.get("pending_id") + pending_id = request.values.get("pending_id") if not pending_id: if wants_wizard_json(): return jsonify({"error": "Missing job ID"}), 400 diff --git a/abogen/web/templates/partials/upload_modal.html b/abogen/web/templates/partials/upload_modal.html index 00d4596..e4f05d1 100644 --- a/abogen/web/templates/partials/upload_modal.html +++ b/abogen/web/templates/partials/upload_modal.html @@ -24,7 +24,7 @@ {% set total_steps = 3 %} {% set current_index = step_number[current_step] %} {% set is_open = open if open is defined else False %} -{% set prepare_url_template = url_for('main.wizard_step', pending_id='__pending__') %} +{% set prepare_url_template = url_for('main.wizard_start', pending_id='__pending__') %} {% set cancel_url_template = url_for('main.wizard_cancel', pending_id='__pending__') %} {% set analyze_url_template = url_for('main.wizard_update', pending_id='__pending__') %}