Skip to content

Commit f22a86a

Browse files
committed
feat(nimbus): Add basic feature tracking table to feature health page.
1 parent bde92fd commit f22a86a

File tree

3 files changed

+151
-47
lines changed

3 files changed

+151
-47
lines changed

experimenter/experimenter/nimbus_ui/templates/nimbus_experiments/features.html

Lines changed: 86 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ <h5 class="fw-semibold">
5050
<div>
5151
<div id="deliveries-table">
5252
<div id="no-deliveries"></div>
53-
<table class="table table-hover table-borderless align-middle mb-3">
53+
<table class="table table-hover align-middle mb-3">
5454
<thead>
5555
<tr>
5656
{% for field, label in deliveries_sortable_header %}
@@ -187,7 +187,7 @@ <h5 class="fw-semibold">
187187
</div>
188188
<hr>
189189
<h5 class="fw-semibold">
190-
<img src="{% static 'assets/qa-runs.svg' %}"
190+
<img src="{% static 'assets/my-deliveries.svg' %}"
191191
alt="Hugging Foxes"
192192
style="width: 60px;
193193
height: auto" />
@@ -215,13 +215,9 @@ <h5 class="fw-semibold">
215215
<tbody>
216216
{% for experiment in experiments_with_qa_status %}
217217
<tr scope="row">
218-
<td id="qa-run" class="text-wrap col-3">
219-
Request for: <a href="{% url 'nimbus-ui-detail' slug=experiment.slug %}"
220-
class="text-decoration-none fw-medium"
221-
title="{{ experiment.name }}">{{ experiment.name }}</a>
222-
</td>
218+
<td id="qa-run">Request for: {{ experiment.name|default:forloop.counter }}</td>
223219
<td id="qa-run-date">{{ experiment.qa_run_date|format_not_set }}</td>
224-
<td id="qa-run-type">{{ experiment.get_qa_run_type_display|format_not_set }}</td>
220+
<td id="qa-run-type">{{ experiment.qa_run_type|format_not_set }}</td>
225221
<td id="qa-run-status">
226222
<div>
227223
{% with icon_info=experiment.qa_status_icon_info %}
@@ -230,31 +226,19 @@ <h5 class="fw-semibold">
230226
{{ experiment.get_qa_status_display }}
231227
</div>
232228
</td>
233-
<td id="qa-test-plan">
234-
{% if experiment.qa_run_test_plan %}
235-
<a href="{{ experiment.qa_run_test_plan }}">Test Plan Link</a>
236-
{% else %}
237-
<span class="text-danger">Not set</span>
238-
{% endif %}
239-
</td>
240-
<td id="qa-testrail-link" class="col-2">
241-
{% if experiment.qa_run_testrail_link %}
242-
<a href="{{ experiment.qa_run_testrail_link }}">TestRail Link</a>
243-
{% else %}
244-
<span class="text-danger">Not set</span>
245-
{% endif %}
246-
</td>
247-
{% empty %}
248-
<tr>
249-
<td colspan="11" class="text-center text-muted py-5">No QA runs</td>
250-
</tr>
229+
<td id="qa-test-plan">{{ experiment.qa_run_test_plan|format_not_set }}</td>
230+
<td id="qa-testrail-link">{{ experiment.qa_run_testrail_link|format_not_set }}</td>
231+
</tr>
232+
{% empty %}
233+
<tr>
234+
<td colspan="11" class="text-center text-muted py-5">No QA runs</td>
251235
</tr>
252236
{% endfor %}
253237
</tbody>
254238
</table>
255239
<div>
256-
{% with current_sort=request.GET.sort %}
257-
{% if qa_runs_page_obj.has_other_pages %}
240+
{% if qa_runs_page_obj.has_other_pages %}
241+
{% with current_sort=request.GET.sort %}
258242
<div id="pagination" class="row">
259243
<div class="col text-center">
260244
<ul class="pagination justify-content-center">
@@ -290,26 +274,24 @@ <h5 class="fw-semibold">
290274
<li class="page-item">
291275
<div class="page-link">
292276
<a>{{ qa_runs_page_obj.number }} of {{ qa_runs_page_obj.paginator.num_pages }}</a>
293-
</li>
294-
{% if qa_runs_page_obj.has_next %}
295-
<li class="page-item">
296-
<a class="page-link"
297-
hx-get="{% url 'nimbus-ui-features' %}?application={{ application }}&feature_configs={{ feature_configs }}&deliveries_page={{ deliveries_page_obj.number }}&qa_runs={{ qa_runs_page_obj.next_page_number }}{% if current_sort %}&sort={{ current_sort }}{% endif %}"
298-
hx-target="#qa-info-table"
299-
hx-select="#qa-info-table"
300-
hx-swap="outerHTML"
301-
hx-push-url="true"><i class="fa-solid fa-angle-right"></i></a>
302-
</a>
277+
</div>
278+
</li>
279+
{% if qa_runs_page_obj.has_next %}
280+
<li class="page-item">
281+
<a class="page-link"
282+
hx-get="{% url 'nimbus-ui-features' %}?application={{ application }}&feature_configs={{ feature_configs }}&deliveries_page={{ deliveries_page_obj.number }}&qa_runs={{ qa_runs_page_obj.next_page_number }}{% if current_sort %}&sort={{ current_sort }}{% endif %}"
283+
hx-target="#qa-info-table"
284+
hx-select="#qa-info-table"
285+
hx-swap="outerHTML"
286+
hx-push-url="true"><i class="fa-solid fa-angle-right"></i></a>
303287
</li>
304288
<li class="page-item">
305289
<a class="page-link"
306290
hx-get="{% url 'nimbus-ui-features' %}?application={{ application }}&feature_configs={{ feature_configs }}&deliveries_page={{ deliveries_page_obj.number }}&qa_runs={{ qa_runs_page_obj.paginator.num_pages }}{% if current_sort %}&sort={{ current_sort }}{% endif %}"
307291
hx-target="#qa-info-table"
308292
hx-select="#qa-info-table"
309293
hx-swap="outerHTML"
310-
hx-push-url="true">
311-
<i class="fa-solid fa-angles-right"></i>
312-
</a>
294+
hx-push-url="true"><i class="fa-solid fa-angles-right"></i></a>
313295
</li>
314296
{% else %}
315297
<li class="page-item disabled">
@@ -325,13 +307,72 @@ <h5 class="fw-semibold">
325307
{% endif %}
326308
</ul>
327309
</div>
328-
</div>
310+
{% endwith %}
329311
{% endif %}
330-
{% endwith %}
312+
</div>
313+
</div>
314+
</div>
315+
<hr>
316+
<h5 class="fw-semibold">
317+
<img src="{% static 'assets/qa-runs.svg' %}"
318+
<img src="{% static 'assets/feature-changes.svg' %}"
319+
alt="Hugging Foxes"
320+
style="width: 60px;
321+
height: auto" />
322+
Feature Changes
323+
<i class="fa-regular fa-circle-question"
324+
data-bs-toggle="tooltip"
325+
data-bs-placement="top"
326+
data-bs-title="This shows any changes made to the Nimbus feature manifest such as code changes for the feature you have chosen"></i>
327+
|
328+
<span class="badge bg-secondary">Number of changes: {{ feature_changes.count|default:"0" }}</span>
329+
</h5>
330+
<div>
331+
<div id="feature-changes-table">
332+
<table class="table table-hover table-borderless align-middle mb-3">
333+
<thead>
334+
<tr>
335+
<th scope="col" class="fw-semibold text-body">
336+
<span>Feature Change</span>
337+
</th>
338+
<th scope="col" class="fw-semibold text-body">
339+
<span>Date / Time</span>
340+
</th>
341+
<th scope="col" class="fw-semibold text-body">
342+
<span>Change Size</span>
343+
</th>
344+
<th scope="col" class="fw-semibold text-body">
345+
<span>Change Diff</span>
346+
</th>
347+
</tr>
348+
</thead>
349+
<tbody>
350+
{% for change in feature_changes %}
351+
<tr scope="row">
352+
<td id="feature-change-link">
353+
{% if change.change_link %}
354+
<a href="{{ change.change_link }}"
355+
target="_blank"
356+
class="text-decoration-none">{{ change.change_link|truncatechars:50 }}</a>
357+
{% else %}
358+
<span class="text-danger">Not set</span>
359+
{% endif %}
360+
</td>
361+
<td id="feature-change-date">{{ change.change_date|date:"m/d/Y @ H:i"|format_not_set }}</td>
362+
<td id="feature-change-size">{{ change.change_size|format_not_set }}</td>
363+
<td id="feature-change-complexity">{{ change.softvision_complexity|format_not_set }}</td>
364+
</tr>
365+
{% empty %}
366+
<tr>
367+
<td colspan="11" class="text-center text-muted py-5">No Tracked Feature Changes</td>
368+
</tr>
369+
</tr>
370+
{% endfor %}
371+
</tbody>
372+
</table>
331373
</div>
332374
</div>
333375
</div>
334376
</div>
335377
</div>
336-
</div>
337-
{% endblock %}
378+
{% endblock %}

experimenter/experimenter/nimbus_ui/tests/test_views.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3576,14 +3576,18 @@ def test_features_view_renders_table_with_correct_elements(
35763576
)
35773577

35783578
feature_id = self.feature_configs[feature_config].id
3579-
url = reverse("nimbus-ui-features")
35803579
response = self.client.get(
3581-
f"{url}?application={application.value}&feature_configs={feature_id}"
3580+
reverse("nimbus-ui-features"),
3581+
{
3582+
"application": application.value,
3583+
"feature_configs": feature_id,
3584+
},
35823585
)
35833586

35843587
self.assertEqual(response.status_code, 200)
35853588
self.assertContains(response, "deliveries-table")
35863589
self.assertContains(response, "qa-info-table")
3590+
self.assertContains(response, "feature-changes-table")
35873591
self.assertContains(response, experiment)
35883592

35893593
def test_features_view_deliveries_table_can_sort_by_recipe_name(self):

0 commit comments

Comments
 (0)