Development
This commit is contained in:
parent
a78df48804
commit
fc78e20f0e
4 changed files with 33 additions and 31 deletions
|
|
@ -8,17 +8,17 @@ bp = Blueprint('action_actions', __name__)
|
||||||
_VIEW = '/view/view_actions'
|
_VIEW = '/view/view_actions'
|
||||||
|
|
||||||
|
|
||||||
@bp.route('/action/general_cardpendingchanges_save', methods=['POST'])
|
@bp.route('/action/actions_cardoptions_save', methods=['POST'])
|
||||||
@require_level('administrator')
|
@require_level('administrator')
|
||||||
def general_cardpendingchanges_save():
|
def actions_cardoptions_save():
|
||||||
session['apply_changes_immediately'] = 'apply_changes_immediately' in request.form
|
session['apply_changes_immediately'] = 'apply_changes_immediately' in request.form
|
||||||
flash('Preference saved.', 'success')
|
flash('Preference saved.', 'success')
|
||||||
return redirect(_VIEW)
|
return redirect(_VIEW)
|
||||||
|
|
||||||
|
|
||||||
@bp.route('/action/general_cardpendingchanges_applyselected', methods=['POST'])
|
@bp.route('/action/actions_cardpendingchanges_applyselected', methods=['POST'])
|
||||||
@require_level('administrator')
|
@require_level('administrator')
|
||||||
def general_cardpendingchanges_applyselected():
|
def actions_cardpendingchanges_applyselected():
|
||||||
items = get_dashboard_pending()
|
items = get_dashboard_pending()
|
||||||
if not items:
|
if not items:
|
||||||
flash('No pending changes to apply.', 'info')
|
flash('No pending changes to apply.', 'info')
|
||||||
|
|
@ -36,8 +36,8 @@ def general_cardpendingchanges_applyselected():
|
||||||
return redirect(_VIEW)
|
return redirect(_VIEW)
|
||||||
|
|
||||||
|
|
||||||
@bp.route('/action/general_cardpendingchanges_deleteselected', methods=['POST'])
|
@bp.route('/action/actions_cardpendingchanges_revertselected', methods=['POST'])
|
||||||
@require_level('administrator')
|
@require_level('administrator')
|
||||||
def general_cardpendingchanges_deleteselected():
|
def actions_cardpendingchanges_revertselected():
|
||||||
flash('Not yet implemented.', 'info')
|
flash('Not yet implemented.', 'info')
|
||||||
return redirect(_VIEW)
|
return redirect(_VIEW)
|
||||||
|
|
|
||||||
|
|
@ -109,7 +109,7 @@ def _trim_if_needed():
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
def _apply_on_save():
|
def _apply_changes_immediately():
|
||||||
try:
|
try:
|
||||||
return session.get('apply_changes_immediately', False)
|
return session.get('apply_changes_immediately', False)
|
||||||
except Exception:
|
except Exception:
|
||||||
|
|
@ -178,7 +178,7 @@ def _queue_pending_command(cmd, description=''):
|
||||||
|
|
||||||
|
|
||||||
def _queue_command(cmd, description=''):
|
def _queue_command(cmd, description=''):
|
||||||
if not _apply_on_save():
|
if not _apply_changes_immediately():
|
||||||
return _queue_pending_command(cmd, description)
|
return _queue_pending_command(cmd, description)
|
||||||
done_set = _load_done_set()
|
done_set = _load_done_set()
|
||||||
pending = _read_pending(done_set)
|
pending = _read_pending(done_set)
|
||||||
|
|
@ -243,7 +243,7 @@ def queued_msg(cmd=None, description='', action_label='Configuration saved'):
|
||||||
entry_ts = None
|
entry_ts = None
|
||||||
if cmd is not None:
|
if cmd is not None:
|
||||||
_entry_uuid, entry_ts = queue_command(cmd, description)
|
_entry_uuid, entry_ts = queue_command(cmd, description)
|
||||||
if not _apply_on_save():
|
if not _apply_changes_immediately():
|
||||||
return f'{action_label}. Click Apply Now on the Configuration Changes card to apply.'
|
return f'{action_label}. Click Apply Now on the Configuration Changes card to apply.'
|
||||||
if _is_locked():
|
if _is_locked():
|
||||||
mtime = _lock_mtime()
|
mtime = _lock_mtime()
|
||||||
|
|
|
||||||
|
|
@ -601,9 +601,6 @@ def collect_tokens():
|
||||||
f'<td class="table-cell">{label}</td>'
|
f'<td class="table-cell">{label}</td>'
|
||||||
f'<td class="table-cell">{e(user)}</td></tr>')
|
f'<td class="table-cell">{e(user)}</td></tr>')
|
||||||
pending_html = (
|
pending_html = (
|
||||||
'<hr class="divider">'
|
|
||||||
'<h3 style="margin:0 0 0.75rem 0;font-size:0.85rem;font-weight:600;'
|
|
||||||
'text-transform:uppercase;letter-spacing:0.05em;color:var(--text-muted)">Pending Changes</h3>'
|
|
||||||
'<table class="data-table" style="margin-bottom:1rem">'
|
'<table class="data-table" style="margin-bottom:1rem">'
|
||||||
'<thead><tr>'
|
'<thead><tr>'
|
||||||
'<th class="table-header">Time</th>'
|
'<th class="table-header">Time</th>'
|
||||||
|
|
@ -612,10 +609,15 @@ def collect_tokens():
|
||||||
'</tr></thead>'
|
'</tr></thead>'
|
||||||
f'<tbody>{rows}</tbody>'
|
f'<tbody>{rows}</tbody>'
|
||||||
'</table>'
|
'</table>'
|
||||||
'<form method="post" action="/action/general_cardpendingchanges_applyselected">'
|
'<form method="post" action="/action/actions_cardpendingchanges_applyselected">'
|
||||||
f'<input type="hidden" name="config_hash" value="{e(core_hash())}"/>'
|
f'<input type="hidden" name="config_hash" value="{e(core_hash())}"/>'
|
||||||
'<div class="button-row">'
|
'<div class="button-row">'
|
||||||
'<button type="submit" class="btn btn-primary">Apply Now</button>'
|
'<button type="submit" class="btn btn-primary">Apply Selected</button>'
|
||||||
|
'</div></form>'
|
||||||
|
'<form method="post" action="/action/actions_cardpendingchanges_revertselected">'
|
||||||
|
f'<input type="hidden" name="config_hash" value="{e(core_hash())}"/>'
|
||||||
|
'<div class="button-row" style="margin-top:0.5rem">'
|
||||||
|
'<button type="submit" class="btn btn-secondary">Revert Selected</button>'
|
||||||
'</div></form>'
|
'</div></form>'
|
||||||
)
|
)
|
||||||
else:
|
else:
|
||||||
|
|
|
||||||
|
|
@ -6,12 +6,6 @@
|
||||||
"map_to": "view_overview",
|
"map_to": "view_overview",
|
||||||
"client_requirement": "client_is_nothing+"
|
"client_requirement": "client_is_nothing+"
|
||||||
},
|
},
|
||||||
{
|
|
||||||
"type": "nav_item",
|
|
||||||
"label": "Actions",
|
|
||||||
"map_to": "view_actions",
|
|
||||||
"client_requirement": "client_is_administrator+"
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
"type": "nav_menu",
|
"type": "nav_menu",
|
||||||
"label": "%MENU_LABEL%",
|
"label": "%MENU_LABEL%",
|
||||||
|
|
@ -30,6 +24,12 @@
|
||||||
{ "type": "nav_item", "label": "Banned IPs", "map_to": "view_banned_ips", "client_requirement": "client_is_administrator+" }
|
{ "type": "nav_item", "label": "Banned IPs", "map_to": "view_banned_ips", "client_requirement": "client_is_administrator+" }
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"type": "nav_item",
|
||||||
|
"label": "Actions",
|
||||||
|
"map_to": "view_actions",
|
||||||
|
"client_requirement": "client_is_administrator+"
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"type": "nav_menu",
|
"type": "nav_menu",
|
||||||
"label": "Profile",
|
"label": "Profile",
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue