diff --git a/ogcp/templates/actions/reboot.html b/ogcp/templates/actions/reboot.html
new file mode 100644
index 0000000..5794a95
--- /dev/null
+++ b/ogcp/templates/actions/reboot.html
@@ -0,0 +1,25 @@
+{% extends 'commands.html' %}
+{% import "bootstrap/wtf.html" as wtf %}
+
+{% block content %}
+
+{% set ip_list = form.ips.data.split(' ') %}
+{% set ip_count = ip_list | length %}
+
+ {{ _('Reboot %(ip_count)d client(s)', ip_count=ip_count) }}
+
+
+
+{% for ip in ip_list %}
+ - {{ ip }}
+{% endfor %}
+
+
+{{ wtf.quick_form(form,
+ action=url_for('action_reboot'),
+ method='post',
+ button_map={'submit': 'primary'},
+ extra_classes="mx-5") }}
+
+{% endblock %}
+
diff --git a/ogcp/templates/commands.html b/ogcp/templates/commands.html
index b06574a..139e441 100644
--- a/ogcp/templates/commands.html
+++ b/ogcp/templates/commands.html
@@ -21,7 +21,7 @@
+ form="scopesForm" formaction="{{ url_for('action_reboot') }}" formmethod="get">
\n"
"Language: es\n"
@@ -94,47 +94,55 @@ msgstr "OgServer respondió con el código de estado de error"
msgid "Client set ogLive request sent successfully"
msgstr "Solicitud de cambio de ogLive enviada con éxito"
-#: views.py:806 views.py:821 views.py:953
+#: views.py:808
+msgid "ogServer: error rebooting client"
+msgstr "ogServer: error al reiniciar cliente"
+
+#: views.py:811
+msgid "Client rebooted successfully"
+msgstr "Cliente reiniciado con éxito"
+
+#: views.py:835 views.py:967
msgid "OgServer replied with a non ok status code"
msgstr "OgServer respondió con un código de estado de error"
-#: views.py:808 views.py:823
+#: views.py:837
msgid "Refresh request processed successfully"
msgstr "Solicitud de actualización procesada con éxito"
-#: views.py:835
+#: views.py:849
msgid "Server replied with error code when adding the center"
msgstr "El servidor respondió con el código de error al agregar el centro."
-#: views.py:838
+#: views.py:852
msgid "Center added successfully"
msgstr "Centro añadido con éxito"
-#: views.py:851
+#: views.py:865
msgid "Server replied with error code when deleting the center"
msgstr "El servidor respondió con el código de error al eliminar el centro"
-#: views.py:854
+#: views.py:868
msgid "Center deleted successfully"
msgstr "Centro eliminado con éxito"
-#: views.py:873
+#: views.py:887
msgid "Server replied with error code when adding the room"
msgstr "El servidor respondió con el código de error al agregar la sala."
-#: views.py:875
+#: views.py:889
msgid "Room added successfully"
msgstr "Sala añadida con éxito"
-#: views.py:892
+#: views.py:906
msgid "Server replied with error code when deleting the room"
msgstr "El servidor respondió con el código de error al eliminar la sala."
-#: views.py:895
+#: views.py:909
msgid "Room deleted successfully"
msgstr "Sala eliminada con éxito"
-#: views.py:955
+#: views.py:969
msgid "Delete client request processed successfully"
msgstr "Solicitud de eliminar cliente procesada con éxito"
@@ -519,6 +527,11 @@ msgstr "Crear una imagen de partición"
msgid "Power off %(ip_count)d client(s)"
msgstr "Apaga %(ip_count)d cliente(s)"
+#: templates/actions/reboot.html:9
+#, python-format
+msgid "Reboot %(ip_count)d client(s)"
+msgstr "Reinicia %(ip_count)d cliente(s)"
+
#: templates/actions/setup.html:5
msgid "Partition and Format"
msgstr "Partición y formato"
diff --git a/ogcp/views.py b/ogcp/views.py
index 93c95e1..3c587d2 100644
--- a/ogcp/views.py
+++ b/ogcp/views.py
@@ -793,20 +793,34 @@ def action_image_create():
form.os.choices.append((choice_value, choice_name))
return render_template('actions/image_create.html', form=form)
-@app.route('/action/reboot', methods=['POST'])
+@app.route('/action/reboot', methods=['GET', 'POST'])
@login_required
def action_reboot():
- ips = parse_elements(request.form.to_dict())
- if not validate_elements(ips):
- return redirect(url_for('commands'))
+ form = GenericForm(request.form)
+ if request.method == 'POST':
+ ips = form.ips.data.split(' ')
+ if not validate_elements(ips):
+ return redirect(url_for('commands'))
- payload = {'clients': list(ips)}
- r = g.server.post('/reboot', payload)
- if r.status_code != requests.codes.ok:
- flash(_('OgServer replied with a non ok status code'), category='error')
+ payload = {'clients': ips}
+ r = g.server.post('/reboot', payload)
+ if r.status_code != requests.codes.ok:
+ flash(_('ogServer: error rebooting client'),
+ category='error')
+ else:
+ flash(_('Client rebooted successfully'),
+ category='info')
+ return redirect(url_for('commands'))
else:
- flash(_('Refresh request processed successfully'), category='info')
- return redirect(url_for('commands'))
+ ips = parse_elements(request.args.to_dict())
+ form.ips.data = " ".join(ips)
+ if validate_elements(ips):
+ scopes, clients = get_scopes(set(ips))
+ return render_template('actions/reboot.html', form=form,
+ scopes=scopes)
+ else:
+ return redirect(url_for('commands'))
+
@app.route('/action/refresh', methods=['POST'])
@login_required