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

@@ -28,26 +28,11 @@
container.attrs.Config.Labels['com.docker.compose.project'] }}</a></h2>
{% endif%}
<!--<table>-->
<!--<thead>-->
<!--<tr>-->
<!--<th>COMPOSE PROJECT</th>-->
<!--<th>CONTAINER ID</th>-->
<!--<th>NAME</th>-->
<!--<th>COMMAND</th>-->
<!--<th>CREATED</th>-->
<!--<th>STATUS</th>-->
<!--<th>PORTS</th>-->
<!--<th>IMAGE</th>-->
<!--</tr>-->
<!--</thead>-->
<!--<tbody>-->
<div class="details">
<div>
<div class="details__status details__status--{{ container.status }}">{{ container.status }}</div>
<div class="details__name"><a class="button--link"
<div class="details__status details__status--{{ container.status }}">{{ container.status }}
</div><div
class="details__name"><a class="button--link"
href="/{{ client_name }}/containers/id/{{ container.short_id }}">{{
container.name
}}</a></div>
@@ -61,17 +46,15 @@
<div class="details__more-info">
<div class="more-info__ports">
{% for port in container.attrs['NetworkSettings']['Ports'] %}
{{ port }}
{% if container.attrs['NetworkSettings']['Ports'][port] is not none %}
{% if container.attrs['NetworkSettings']['Ports'][port] is not none and
container.attrs['NetworkSettings']['Ports'][port]|length > 0 %}
{% for port_exposed in container.attrs['NetworkSettings']['Ports'][port] %}
->{{ port_exposed['HostIp'] }}:{{ port_exposed['HostPort'] }}
<span class="more-info__ports--line">{{ port }} -> {{ port_exposed['HostIp'] }}:{{ port_exposed['HostPort'] }}</span>
{% endfor %}
{% endif %}
{% endif %}
{% endfor %}
</div>
</div>
@@ -80,17 +63,15 @@
</div>
<div class="details__controll">
<a class="button--link" href="/{{ client_name }}/containers/log/{{ container.short_id }}">log</a>
<a class="button--link" href="/{{ client_name }}/containers/export/{{ container.short_id }}">export</a>
{% if (container.status == 'exited') or (container.status == 'created') %}
<a class="button--link" href="/{{ client_name }}/containers/start/{{ container.short_id }}">start</a>
<a class="button--link" href="/{{ client_name }}/containers/remove/{{ container.short_id }}">remove</a>
{% endif %}
{% if container.status == 'running' %}
<a class="button--link" href="/{{ client_name }}/containers/stop/{{ container.short_id }}">stop</a>
<a class="button--link" href="/{{ client_name }}/containers/restart/{{ container.short_id }}">restart</a>
<a class="button--link" href="/{{ client_name }}/containers/top/{{ container.short_id }}">top</a>
<a class="button--link" href="/{{ client_name }}/containers/log/{{ container.short_id }}">log
</a><a class="button--link" href="/{{ client_name }}/containers/export/{{ container.short_id }}">export
</a>{% if (container.status == 'exited') or (container.status == 'created') %}<a class="button--link"
href="/{{ client_name }}/containers/start/{{ container.short_id }}">start
</a><a class="button--link" href="/{{ client_name }}/containers/remove/{{ container.short_id }}">remove</a>
{% endif %}{% if container.status == 'running' %}
<a class="button--link" href="/{{ client_name }}/containers/stop/{{ container.short_id }}">stop
</a><a class="button--link" href="/{{ client_name }}/containers/restart/{{ container.short_id }}">restart
</a><a class="button--link" href="/{{ client_name }}/containers/top/{{ container.short_id }}">top</a>
{% endif %}
</div>
</div>