From 3271a4a08da08447a07f694147b3b9c2a422aa96 Mon Sep 17 00:00:00 2001 From: Javier Sánchez Parra Date: Wed, 2 Mar 2022 17:13:24 +0100 Subject: Extend commands html Otherwise, this actions pages lose the scopes tree and the commands buttons. --- ogcp/templates/actions/client_details.html | 2 +- ogcp/templates/actions/image_create.html | 2 +- ogcp/templates/actions/image_restore.html | 2 +- ogcp/templates/actions/legacy/log.html | 2 +- ogcp/templates/actions/session.html | 2 +- ogcp/templates/actions/wol.html | 2 +- ogcp/views.py | 25 +++++++++++++++++++------ 7 files changed, 25 insertions(+), 12 deletions(-) diff --git a/ogcp/templates/actions/client_details.html b/ogcp/templates/actions/client_details.html index 16160ea..34dea36 100644 --- a/ogcp/templates/actions/client_details.html +++ b/ogcp/templates/actions/client_details.html @@ -1,4 +1,4 @@ -{% extends 'base.html' %} +{% extends 'commands.html' %} {% import "bootstrap/wtf.html" as wtf %} {% block content %} diff --git a/ogcp/templates/actions/image_create.html b/ogcp/templates/actions/image_create.html index 6d1d58e..dc4c4a2 100644 --- a/ogcp/templates/actions/image_create.html +++ b/ogcp/templates/actions/image_create.html @@ -1,4 +1,4 @@ -{% extends 'base.html' %} +{% extends 'commands.html' %} {% import "bootstrap/wtf.html" as wtf %} {% block content %} diff --git a/ogcp/templates/actions/image_restore.html b/ogcp/templates/actions/image_restore.html index 6120688..9bd368b 100644 --- a/ogcp/templates/actions/image_restore.html +++ b/ogcp/templates/actions/image_restore.html @@ -1,4 +1,4 @@ -{% extends 'base.html' %} +{% extends 'commands.html' %} {% import "bootstrap/wtf.html" as wtf %} {% import "macros.html" as macros %} diff --git a/ogcp/templates/actions/legacy/log.html b/ogcp/templates/actions/legacy/log.html index 08d3328..5442ad7 100644 --- a/ogcp/templates/actions/legacy/log.html +++ b/ogcp/templates/actions/legacy/log.html @@ -1,4 +1,4 @@ -{% extends 'base.html' %} +{% extends 'commands.html' %} {% import "bootstrap/wtf.html" as wtf %} {% block content %} diff --git a/ogcp/templates/actions/session.html b/ogcp/templates/actions/session.html index 528c928..68f0f53 100644 --- a/ogcp/templates/actions/session.html +++ b/ogcp/templates/actions/session.html @@ -1,4 +1,4 @@ -{% extends 'base.html' %} +{% extends 'commands.html' %} {% import "bootstrap/wtf.html" as wtf %} {% block content %} diff --git a/ogcp/templates/actions/wol.html b/ogcp/templates/actions/wol.html index 4dba226..2a35592 100644 --- a/ogcp/templates/actions/wol.html +++ b/ogcp/templates/actions/wol.html @@ -1,4 +1,4 @@ -{% extends 'base.html' %} +{% extends 'commands.html' %} {% import "bootstrap/wtf.html" as wtf %} {% import "macros.html" as macros %} 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')) -- cgit v1.2.3-18-g5258