Development

This commit is contained in:
Matthew Grotke 2026-05-25 14:50:03 -04:00
parent 60df03e85c
commit 22c18d9edd
4 changed files with 72 additions and 39 deletions

View file

@ -1,7 +1,8 @@
from flask import Blueprint, request, redirect, flash, session
from auth import require_level
from config_utils import (flush_pending_to_queue, get_dashboard_pending,
_is_locked, _format_timing, _seconds_until_next_run)
from config_utils import (flush_selected_to_queue, delete_pending_by_uuids,
get_dashboard_pending, _is_locked, _format_timing,
_seconds_until_next_run)
bp = Blueprint('action_actions', __name__)
@ -19,11 +20,11 @@ def actions_cardoptions_save():
@bp.route('/action/actions_cardpendingchanges_applyselected', methods=['POST'])
@require_level('administrator')
def actions_cardpendingchanges_applyselected():
items = get_dashboard_pending()
if not items:
flash('No pending changes to apply.', 'info')
selected_uuids = request.form.getlist('selected_uuids')
if not selected_uuids:
flash('No items selected.', 'info')
return redirect(_VIEW)
flush_pending_to_queue()
flush_selected_to_queue(selected_uuids)
if _is_locked():
msg = 'Changes queued. They are being applied now.'
else:
@ -39,5 +40,10 @@ def actions_cardpendingchanges_applyselected():
@bp.route('/action/actions_cardpendingchanges_revertselected', methods=['POST'])
@require_level('administrator')
def actions_cardpendingchanges_revertselected():
flash('Not yet implemented.', 'info')
selected_uuids = request.form.getlist('selected_uuids')
if not selected_uuids:
flash('No items selected.', 'info')
return redirect(_VIEW)
delete_pending_by_uuids(selected_uuids)
flash('Selected changes reverted.', 'success')
return redirect(_VIEW)