Displaying port mappings on container lists. Neater json formatting.

This commit is contained in:
Krzysztof Płaczek
2018-03-22 10:46:55 +01:00
parent 37e8224369
commit a26863e74f
4 changed files with 43 additions and 42 deletions

View File

@@ -5,6 +5,7 @@ import re
import unidecode
import datetime
import base64
import json
#
# from flask_wtf import FlaskForm
@@ -184,7 +185,12 @@ def containers_all_action(client_name):
def container_action(client_name, short_id=None):
if client_name in clients:
container = clients[client_name].containers.get(short_id)
return render_template('container.html', container=container, client_name=client_name)
# parsed = json.loads(container.attrs)
# print()
return render_template('container.html', container=container, client_name=client_name,
container_attributes=json.dumps(container.attrs, indent=4))
else:
flash('Client name \'%s\' not found' % client_name)
return redirect(url_for('index'))
@@ -380,6 +386,6 @@ def slugify(text):
app.secret_key = b'\xd7:o\\\xaayFe\x1ey\x08m9\xe4\xbc!\xee\x0e>\xd1Z\x99-\xbb'
#http://flask.pocoo.org/snippets/133/ @TODO
# http://flask.pocoo.org/snippets/133/ @TODO
if __name__ == "__main__":
app.run(host="0.0.0.0", port=5001, debug=True, threaded=True)