summaryrefslogtreecommitdiffstats
path: root/ogcp
diff options
context:
space:
mode:
authorJavier Sánchez Parra <jsanchez@soleta.eu>2021-09-03 14:51:14 +0200
committerJavier Sánchez Parra <jsanchez@soleta.eu>2021-09-03 14:51:14 +0200
commit27ea5016c4aaa4350ada4b1e6a534b8219fff578 (patch)
treec8002cd9094cc348b97b4c7585dfa3e2ce78d639 /ogcp
parent37a03045751832e19cd8151b87e77da0878ca9b7 (diff)
Add images view
Images view manages all the images stored in the server. Follow up patches adds actions to get and edit image details, and to delete them.
Diffstat (limited to 'ogcp')
-rw-r--r--ogcp/templates/images.html29
-rw-r--r--ogcp/templates/nav.html2
-rw-r--r--ogcp/views.py7
3 files changed, 37 insertions, 1 deletions
diff --git a/ogcp/templates/images.html b/ogcp/templates/images.html
new file mode 100644
index 0000000..e698af9
--- /dev/null
+++ b/ogcp/templates/images.html
@@ -0,0 +1,29 @@
+{% extends 'base.html' %}
+
+{% block nav_images %}active{% endblock %}
+
+{% block container %}
+ <form id="imagesForm">
+ <input type="hidden" name="csrf_token" value="{{ csrf_token() }}"/>
+ </form>
+ {{ super() }}
+</form>
+{% endblock %}
+
+{% block sidebar %}
+ <ul id="images" class="nav flex-column nav-pills">
+ {% for image in images %}
+ <li id="{{ image["name"] }}_{{ image["id"] }}" class="nav-item">
+ <input class="form-check-input" type="checkbox" form="imagesForm"
+ value="{{ image["id"] }}"
+ {% if image.get("selected", False) %}checked{% endif %}
+ name="{{ image["name"] }}_{{ image["id"] }}" />
+ {{ image["name"] }}
+ </li>
+ {% endfor %}
+ </ul>
+{% endblock %}
+
+{% block commands %}
+{% endblock %}
+
diff --git a/ogcp/templates/nav.html b/ogcp/templates/nav.html
index dc40207..edf5c05 100644
--- a/ogcp/templates/nav.html
+++ b/ogcp/templates/nav.html
@@ -17,7 +17,7 @@
<a class="nav-link" href="{{ url_for('commands') }}">{{ _('Commands') }}</a>
</li>
<li class="nav-item {% if request.endpoint == "images" %}active{% endif %}">
- <a class="nav-link" href="#">{{ _('Images') }}</a>
+ <a class="nav-link" href="{{ url_for('images') }}">{{ _('Images') }}</a>
</li>
<li class="nav-item {% if request.endpoint == "tasks" %}active{% endif %}">
<a class="nav-link" href="#">{{ _('Tasks') }}</a>
diff --git a/ogcp/views.py b/ogcp/views.py
index 72ca1b1..75b7ea1 100644
--- a/ogcp/views.py
+++ b/ogcp/views.py
@@ -767,3 +767,10 @@ def action_room_delete():
def commands():
scopes, clients = get_scopes()
return render_template('commands.html', scopes=scopes, clients=clients)
+
+@app.route('/images/', methods=['GET'])
+@login_required
+def images():
+ r = g.server.get('/images')
+ images = r.json()['images']
+ return render_template('images.html', images=images)