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:
nearxos
2026-02-23 10:28:58 +02:00
parent ec973cc2b3
commit b1368b6e62
4 changed files with 59 additions and 5 deletions

View File

@@ -190,11 +190,24 @@ mkdir -p "$OUTPUT_DIR"
cp "$IMG_FILE" "$OUT_PATH"
# Compress to .img.xz to reduce size (deploy supports decompress on the fly)
check_cancel
write_status "finalizing" "Compressing image (xz)…" "" ""
OUT_XZ="${OUT_PATH}.xz"
# -T 0 = use all cores; fallback to -T 1 if old xz
if ! xz -T 0 -z -k -f "$OUT_PATH" 2>/dev/null; then
xz -T 1 -z -k -f "$OUT_PATH" 2>/dev/null || true
xz -T 0 -z -k -f "$OUT_PATH" 2>/dev/null &
XZ_PID=$!
while kill -0 "$XZ_PID" 2>/dev/null; do
if [[ -f "$CANCEL_FILE" ]]; then
kill "$XZ_PID" 2>/dev/null
wait "$XZ_PID" 2>/dev/null
write_status "cancelled" "Build cancelled." "" ""
rm -f "$REQUEST_FILE" "$CANCEL_FILE"
exit 0
fi
sleep 2
done
wait "$XZ_PID" 2>/dev/null || true
if [[ ! -f "$OUT_XZ" ]]; then
xz -T 1 -z -k -f "$OUT_PATH" 2>/dev/null || true
fi
if [[ -f "$OUT_XZ" ]]; then
rm -f "$OUT_PATH"