Development
This commit is contained in:
parent
cc2f57aa83
commit
74166f03bd
11 changed files with 986 additions and 61 deletions
26
docker/routlin-dash/app/action_apply_pending.py
Normal file
26
docker/routlin-dash/app/action_apply_pending.py
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
from flask import Blueprint, redirect, flash
|
||||
from auth import require_level
|
||||
from config_utils import (flush_pending_to_queue, get_dashboard_pending,
|
||||
_is_locked, _format_timing, _seconds_until_next_run)
|
||||
|
||||
bp = Blueprint('action_apply_pending', __name__)
|
||||
|
||||
|
||||
@bp.route('/action/apply_pending', methods=['POST'])
|
||||
@require_level('administrator')
|
||||
def apply_pending():
|
||||
items = get_dashboard_pending()
|
||||
if not items:
|
||||
flash('No pending changes to apply.', 'info')
|
||||
return redirect('/view/view_general')
|
||||
flush_pending_to_queue()
|
||||
if _is_locked():
|
||||
msg = 'Changes queued. They are being applied now.'
|
||||
else:
|
||||
timing = _format_timing(_seconds_until_next_run())
|
||||
if timing:
|
||||
msg = f'Changes queued. They will be applied {timing}.'
|
||||
else:
|
||||
msg = 'Changes queued. The processing service is not running.'
|
||||
flash(msg, 'success')
|
||||
return redirect('/view/view_general')
|
||||
Loading…
Add table
Add a link
Reference in a new issue