feat: Update wizard routing and improve pending job handling in modal

This commit is contained in:
JB
2025-11-28 15:31:45 -08:00
parent fd93e1c9e9
commit 124e5b33db
2 changed files with 7 additions and 6 deletions
+6 -5
View File
@@ -58,9 +58,10 @@ def index():
@main_bp.route("/wizard") @main_bp.route("/wizard")
def wizard_start(): def wizard_start():
pending_id = request.args.get("pending_id") pending_id = request.args.get("pending_id")
step = request.args.get("step", "book")
if pending_id: if pending_id:
return redirect(url_for("main.wizard_step", step="book", pending_id=pending_id)) return redirect(url_for("main.wizard_step", step=step, pending_id=pending_id))
return redirect(url_for("main.wizard_step", step="book")) return redirect(url_for("main.wizard_step", step=step))
@main_bp.route("/wizard/<step>") @main_bp.route("/wizard/<step>")
def wizard_step(step: str): def wizard_step(step: str):
@@ -205,7 +206,7 @@ def wizard_text():
@main_bp.route("/wizard/update", methods=["POST"]) @main_bp.route("/wizard/update", methods=["POST"])
def wizard_update(): def wizard_update():
pending_id = request.form.get("pending_id") pending_id = request.values.get("pending_id")
if not pending_id: if not pending_id:
if wants_wizard_json(): if wants_wizard_json():
return wizard_json_response(None, "book", error="Missing job ID", status=400) 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"]) @main_bp.route("/wizard/cancel", methods=["POST"])
def wizard_cancel(): def wizard_cancel():
pending_id = request.form.get("pending_id") pending_id = request.values.get("pending_id")
if pending_id: if pending_id:
remove_pending_job(pending_id) remove_pending_job(pending_id)
@@ -300,7 +301,7 @@ def wizard_cancel():
@main_bp.route("/wizard/finish", methods=["POST"]) @main_bp.route("/wizard/finish", methods=["POST"])
def wizard_finish(): def wizard_finish():
pending_id = request.form.get("pending_id") pending_id = request.values.get("pending_id")
if not pending_id: if not pending_id:
if wants_wizard_json(): if wants_wizard_json():
return jsonify({"error": "Missing job ID"}), 400 return jsonify({"error": "Missing job ID"}), 400
@@ -24,7 +24,7 @@
{% set total_steps = 3 %} {% set total_steps = 3 %}
{% set current_index = step_number[current_step] %} {% set current_index = step_number[current_step] %}
{% set is_open = open if open is defined else False %} {% 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 cancel_url_template = url_for('main.wizard_cancel', pending_id='__pending__') %}
{% set analyze_url_template = url_for('main.wizard_update', pending_id='__pending__') %} {% set analyze_url_template = url_for('main.wizard_update', pending_id='__pending__') %}
<div class="modal" <div class="modal"