Add dismiss functionality for cloud-init build status</message>
<message>Implement a new API endpoint to clear the build status to idle, allowing users to dismiss messages after a build is cancelled, completed, or errored. Update the dashboard UI to include a dismiss link that appears under relevant conditions, enhancing user experience by providing a clearer interface for managing build statuses. Modify the JavaScript to handle the dismissal action and ensure proper status updates are reflected in the UI.
This commit is contained in:
@@ -1629,6 +1629,18 @@ def api_build_cloudinit_cancel():
|
||||
return jsonify({"ok": False, "error": str(e)}), 500
|
||||
|
||||
|
||||
@app.route("/api/build-cloudinit-status-clear", methods=["POST"])
|
||||
@require_admin
|
||||
def api_build_cloudinit_status_clear():
|
||||
"""Clear build status to idle (so message is cleared after cancel/done/error)."""
|
||||
st = _build_status_read()
|
||||
busy = st.get("phase") in ("downloading", "decompressing", "injecting", "finalizing", "resolving")
|
||||
if busy:
|
||||
return jsonify({"ok": False, "error": "Cannot clear while build is in progress"}), 409
|
||||
_build_status_write("idle", "", None, None)
|
||||
return jsonify({"ok": True})
|
||||
|
||||
|
||||
@app.route("/api/build-cloudinit", methods=["POST"])
|
||||
@require_admin
|
||||
def api_build_cloudinit():
|
||||
|
||||
Reference in New Issue
Block a user