summaryrefslogtreecommitdiffstats
path: root/ogcp/views.py
diff options
context:
space:
mode:
authorJavier Sánchez Parra <jsanchez@soleta.eu>2022-03-02 17:13:24 +0100
committerJavier Sánchez Parra <jsanchez@soleta.eu>2022-03-02 17:29:41 +0100
commit3271a4a08da08447a07f694147b3b9c2a422aa96 (patch)
treea404cb20c9ec91e8f0819250456e1364147bb07b /ogcp/views.py
parented967216aa51e59c50d30a38737a677b9706c28e (diff)
Extend commands html
Otherwise, this actions pages lose the scopes tree and the commands buttons.
Diffstat (limited to 'ogcp/views.py')
-rw-r--r--ogcp/views.py25
1 files changed, 19 insertions, 6 deletions
diff --git a/ogcp/views.py b/ogcp/views.py
index 49f5122..54c1438 100644
--- a/ogcp/views.py
+++ b/ogcp/views.py
@@ -298,7 +298,9 @@ def action_wol():
ips = parse_elements(request.args.to_dict())
form.ips.data = " ".join(ips)
if validate_elements(ips, min_len=1):
- return render_template('actions/wol.html', form=form)
+ scopes, clients = get_scopes(set(ips))
+ return render_template('actions/wol.html', form=form,
+ scopes=scopes)
else:
return redirect(url_for('commands'))
@@ -467,7 +469,10 @@ def action_image_restore():
form.partition.choices = [ (f'{disk_id} {part_id}', _('Disk: {} | Part: {}').format(disk_id, part_id))
for disk_id, part_id in part_choices ]
- return render_template('actions/image_restore.html', form=form)
+ scopes, clients = get_scopes(set(ips))
+
+ return render_template('actions/image_restore.html', form=form,
+ scopes=scopes)
@app.route('/action/hardware', methods=['GET', 'POST'])
@login_required
@@ -563,7 +568,9 @@ def action_session():
choice = (f"{os['disk']} {os['partition']}",
f"{os['name']} ({os['disk']},{os['partition']})")
form.os.choices.append(choice)
- return render_template('actions/session.html', form=form)
+ scopes, clients = get_scopes(set(ips))
+ return render_template('actions/session.html', form=form,
+ scopes=scopes)
@app.route('/action/client/info', methods=['GET'])
@login_required
@@ -622,8 +629,10 @@ def action_client_info():
else:
entry['image'] = ""
+ scopes, clients = get_scopes(set(ips))
+
return render_template('actions/client_details.html', form=form,
- setup=setup)
+ scopes=scopes, setup=setup)
@app.route('/action/client/add', methods=['GET', 'POST'])
@login_required
@@ -803,7 +812,9 @@ def action_image_create():
f"{_('Partition')} {part_id} | "
f"{_('FS')} {FS_CODES[fs_id]}")
form.os.choices.append((choice_value, choice_name))
- return render_template('actions/image_create.html', form=form)
+ scopes, clients = get_scopes(set(ips))
+ return render_template('actions/image_create.html', form=form,
+ scopes=scopes)
@app.route('/action/reboot', methods=['GET', 'POST'])
@login_required
@@ -1005,7 +1016,9 @@ def action_legacy_log():
log_file = Path("/opt/opengnsys/log/clients/" + str(ip) + ".log")
log = log_file.read_text()
if log:
- return render_template('actions/legacy/log.html', log=log)
+ scopes, clients = get_scopes(set(ips))
+ return render_template('actions/legacy/log.html', log=log,
+ scopes=scopes)
else:
return redirect(url_for('commands'))