Skip to content

Commit ba327c3

Browse files
georges-armTamarChristinaArm
authored andcommitted
Don't show 'Fields' if there aren't any.
Change-Id: Icef907dfe90c2a8d1a5a2b4357433cefdd9dde67
1 parent 787bed4 commit ba327c3

File tree

2 files changed

+47
-37
lines changed

2 files changed

+47
-37
lines changed

lnt/server/ui/templates/v4_machine.html

Lines changed: 20 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,9 @@
88
{% block sidebar %}
99
<ul class="nav nav-list bs-docs-sidenav">
1010
<li><a href="{{ v4_url_for(".v4_machine_latest", machine_id=machine.id) }}"><i class="icon-time"></i> Latest Run</a></li>
11-
<li><a href="#fields"><i class="icon-chevron-right"></i> Fields</a></li>
11+
{% if ts.machine_fields %}
12+
<li><a href="#fields"><i class="icon-chevron-right"></i> Fields</a></li>
13+
{% endif %}
1214
<li><a href="#parameters"><i class="icon-chevron-right"></i> Parameters</a></li>
1315
<li><a href="#submissions"><i class="icon-chevron-right"></i> Submissions</a></li>
1416
</ul>
@@ -23,23 +25,25 @@ <h4>Relatives</h4>
2325
{% endblock %}
2426

2527
{% block body %}
26-
<section id="fields">
27-
<h3>Fields</h3>
28-
<table class="table table-striped table-hover table-condensed">
29-
<thead>
28+
{% if ts.machine_fields %}
29+
<section id="fields">
30+
<h3>Fields</h3>
31+
<table class="table table-striped table-hover table-condensed">
32+
<thead>
33+
<tr>
34+
<th>Name</th>
35+
<th>Value</th>
36+
</tr>
37+
</thead>
38+
{% for item in ts.machine_fields %}
3039
<tr>
31-
<th>Name</th>
32-
<th>Value</th>
40+
<td>{{item.name}}</td>
41+
<td>{{machine.get_field(item)}}</td>
3342
</tr>
34-
</thead>
35-
{% for item in ts.machine_fields %}
36-
<tr>
37-
<td>{{item.name}}</td>
38-
<td>{{machine.get_field(item)}}</td>
39-
</tr>
40-
{% endfor %}
41-
</table>
42-
</section>
43+
{% endfor %}
44+
</table>
45+
</section>
46+
{% endif %}
4347

4448
<section id="parameters">
4549
<h3>Parameters</h3>

lnt/server/ui/templates/v4_run.html

Lines changed: 27 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -139,15 +139,18 @@ <h4>Compare To:</h4>
139139

140140
<section id="machine_info">
141141
{{ utils.render_popup_begin('machine_info', 'Machine Info', true) }}
142-
<h4>Fields</h4>
143-
<table class="table table-striped table-condensed table-hover">
144-
{% for item in machine.fields %}
145-
<tr>
146-
<td> <b>{{item.name}}</b> </td>
147-
<td>{{ utils.newline_to_br(machine.get_field(item)) }}</td>
148-
</tr>
149-
{% endfor %}
150-
</table>
142+
143+
{% if machine.fields %}
144+
<h4>Fields</h4>
145+
<table class="table table-striped table-condensed table-hover">
146+
{% for item in machine.fields %}
147+
<tr>
148+
<td> <b>{{item.name}}</b> </td>
149+
<td>{{ utils.newline_to_br(machine.get_field(item)) }}</td>
150+
</tr>
151+
{% endfor %}
152+
</table>
153+
{% endif %}
151154

152155
<h4>Parameters</h4>
153156
<table class="table table-striped table-condensed table-hover">
@@ -163,18 +166,21 @@ <h4>Parameters</h4>
163166

164167
<section id="run_info">
165168
{{ utils.render_popup_begin('run_info', 'Run Info', true) }}
166-
<h4>Fields</h4>
167-
<table class="table table-striped table-condensed table-hover">
168-
<thead>
169-
<tr><th>Name</th><th>Value</th></tr>
170-
</thead>
171-
{% for item in run.fields %}
172-
<tr>
173-
<td> <b>{{item.name}}</b> </td>
174-
<td>{{ utils.newline_to_br(run.get_field(item)) }}</td>
175-
</tr>
176-
{% endfor %}
177-
</table>
169+
170+
{% if run.fields %}
171+
<h4>Fields</h4>
172+
<table class="table table-striped table-condensed table-hover">
173+
<thead>
174+
<tr><th>Name</th><th>Value</th></tr>
175+
</thead>
176+
{% for item in run.fields %}
177+
<tr>
178+
<td> <b>{{item.name}}</b> </td>
179+
<td>{{ utils.newline_to_br(run.get_field(item)) }}</td>
180+
</tr>
181+
{% endfor %}
182+
</table>
183+
{% endif %}
178184

179185
<h4>Parameters</h4>
180186
<table class="table table-striped table-condensed table-hover">

0 commit comments

Comments
 (0)