summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRoberto Hueso Gómez <rhueso@soleta.eu>2020-09-04 13:18:26 +0200
committerRoberto Hueso Gómez <rhueso@soleta.eu>2020-09-04 13:18:26 +0200
commitbb7e20199124b84de5d252ffe0371a5799feee42 (patch)
treecbc444c778c93c5f776391087e0c355f3ede4d95
parentd5eaf699a7dd5215403b626762b68cd09bc846b5 (diff)
Add refresh action
This action can be applied on single or multiple scopes.
-rw-r--r--ogcp/templates/scopes.html3
-rw-r--r--ogcp/views.py7
2 files changed, 10 insertions, 0 deletions
diff --git a/ogcp/templates/scopes.html b/ogcp/templates/scopes.html
index 4b9ff28..81124dd 100644
--- a/ogcp/templates/scopes.html
+++ b/ogcp/templates/scopes.html
@@ -38,6 +38,9 @@
formaction="{{ url_for('action_poweroff') }}" formmethod="post">
<input class="dropdown-item" type="submit" value="{{ _('Reboot') }}"
formaction="{{ url_for('action_reboot') }}" formmethod="post">
+ <input class="dropdown-item" type="submit" value="{{ _('Refresh') }}"
+ formaction="{{ url_for('action_refresh') }}" formmethod="post">
+
</div>
</div>
</form>
diff --git a/ogcp/views.py b/ogcp/views.py
index 92e91b2..0772e33 100644
--- a/ogcp/views.py
+++ b/ogcp/views.py
@@ -70,3 +70,10 @@ def action_reboot():
payload = {'clients': list(ips)}
g.server.post('/reboot', payload)
return make_response("200 OK", 200)
+
+@app.route('/action/refresh', methods=['POST'])
+def action_refresh():
+ ips = parse_ips(request.form.to_dict())
+ payload = {'clients': list(ips)}
+ g.server.post('/refresh', payload)
+ return make_response("200 OK", 200)