From e07c8afcce3f16739bbf9e8c52405f327f367977 Mon Sep 17 00:00:00 2001 From: Javier Sánchez Parra Date: Wed, 15 Dec 2021 11:28:16 +0100 Subject: Add set ogLive to commands This action is related to /oglive in ogServer's API. Allows changing the ogLive for a set of given clients, previously selected in the /commands view. --- ogcp/forms/action_forms.py | 5 +++++ ogcp/templates/actions/oglive.html | 22 +++++++++++++++++++++ ogcp/templates/commands.html | 2 ++ ogcp/views.py | 39 +++++++++++++++++++++++++++++++++++++- 4 files changed, 67 insertions(+), 1 deletion(-) create mode 100644 ogcp/templates/actions/oglive.html (limited to 'ogcp') diff --git a/ogcp/forms/action_forms.py b/ogcp/forms/action_forms.py index d618f24..e8b607f 100644 --- a/ogcp/forms/action_forms.py +++ b/ogcp/forms/action_forms.py @@ -110,6 +110,11 @@ class BootModeForm(FlaskForm): boot = SelectField(label=_('Boot mode')) ok = SubmitField(label=_('Ok')) +class OgliveForm(FlaskForm): + ips = HiddenField() + oglive = SelectField(label=_('ogLive')) + ok = SubmitField(label=_('Ok')) + class ImageCreateForm(FlaskForm): ip = HiddenField() os = SelectField(label=_('OS'), choices=[]) diff --git a/ogcp/templates/actions/oglive.html b/ogcp/templates/actions/oglive.html new file mode 100644 index 0000000..f35b371 --- /dev/null +++ b/ogcp/templates/actions/oglive.html @@ -0,0 +1,22 @@ +{% extends 'commands.html' %} +{% import "bootstrap/wtf.html" as wtf %} + +{% block content %} + +{% set ip_list = form.ips.data.split(' ') %} +{% set ip_count = ip_list | length %} +

Changing ogLive of {{ip_count}} {%if ip_count > 1%}computers{% else %}computer{% endif %}

+ + + +{{ wtf.quick_form(form, + action=url_for('action_oglive'), + method='post', + button_map={'ok': 'primary'}, + extra_classes="m-5") }} + +{% endblock %} diff --git a/ogcp/templates/commands.html b/ogcp/templates/commands.html index df84ab0..02fe5c2 100644 --- a/ogcp/templates/commands.html +++ b/ogcp/templates/commands.html @@ -40,6 +40,8 @@ form="scopesForm" formaction="{{ url_for('action_image_create') }}" formmethod="get"> +