Skip to content

Commit df7f595

Browse files
Add Report Builder submenu and improve form validation error messages (#14068)
- Add explicit 'Report Builder' submenu item under Reports menu for better UX - Improve form validation error messages to show which specific fields are missing - Fix trailing whitespace in Finding Groups menu item
1 parent 102636d commit df7f595

2 files changed

Lines changed: 25 additions & 3 deletions

File tree

dojo/templates/base.html

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -343,7 +343,7 @@
343343
<i class="fa-solid fa-triangle-exclamation fa-fw"></i>
344344
<span>{% trans "Finding Groups" %}</span>
345345
<span class="glyphicon arrow"></span>
346-
</a>
346+
</a>
347347
<ul class="nav nav-second-level">
348348
<li>
349349
<a href="{% url 'open_finding_groups' %}">
@@ -419,6 +419,13 @@
419419
<span>{% trans "Reports" %}</span>
420420
<span class="glyphicon arrow"></span>
421421
</a>
422+
<ul class="nav nav-second-level">
423+
<li>
424+
<a href="{% url 'report_builder' %}">
425+
{% trans "Report Builder" %}
426+
</a>
427+
</li>
428+
</ul>
422429
<!-- /.nav-second-level -->
423430
</li>
424431
{% endblock %}

dojo/templates/dojo/report_builder.html

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -166,11 +166,20 @@ <h4>Available Widgets</h4>
166166
return;
167167
}
168168

169+
const missingFields = [];
170+
169171
$('.in-use-widgets .form-control').not('#finding-list .form-control')
170172
.not('#endpoint-list .form-control').not('#wysiwyg-content .form-control')
171173
.not('.bs-searchbox .form-control').not('div').each(function () {
172-
if ($(this).val() === '')
174+
if ($(this).val() === '') {
175+
const $el = $(this);
176+
const $parentForm = $el.closest('form');
177+
const $label = $el.closest('.form-group').find('label');
178+
const fieldLabel = $label.text().trim().replace(/\*$/, '').trim() || $el.attr('name') || $el.attr('id') || 'Unknown field';
179+
const formTitle = $parentForm.closest('.panel-available-widget').find('.panel-heading h5').text().trim() || $parentForm.attr('id') || 'Unknown form';
180+
missingFields.push(`${fieldLabel} (${formTitle})`);
173181
valid = false;
182+
}
174183
});
175184

176185
if (valid) {
@@ -198,7 +207,13 @@ <h4>Available Widgets</h4>
198207
$('form#custom_report').removeClass('hidden').submit();
199208
}
200209
else {
201-
alert('Please complete all forms.')
210+
let errorMessage = 'Please complete all required fields:\n\n';
211+
if (missingFields.length > 0) {
212+
errorMessage += missingFields.join('\n');
213+
} else {
214+
errorMessage += 'One or more required fields are empty.';
215+
}
216+
alert(errorMessage);
202217
}
203218

204219
event.preventDefault();

0 commit comments

Comments
 (0)