Skip to content

Commit 8f3433b

Browse files
authored
Case-insensitive search by notes; display notes on the client card (#532)
1 parent 7856ce9 commit 8f3433b

File tree

2 files changed

+8
-5
lines changed

2 files changed

+8
-5
lines changed

custom/js/helper.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ function renderClientList(data) {
4040

4141
let additionalNotesHtml = "";
4242
if (obj.Client.additional_notes && obj.Client.additional_notes.length > 0) {
43-
additionalNotesHtml = `<span class="info-box-text" style="display: none"><i class="fas fa-additional_notes"></i>${obj.Client.additional_notes}</span>`
43+
additionalNotesHtml = `<span class="info-box-text" style="display: none"><i class="fas fa-additional_notes"></i>${obj.Client.additional_notes.toUpperCase()}</span>`
4444
}
4545

4646
// render client html content
@@ -49,7 +49,7 @@ function renderClientList(data) {
4949
<div class="overlay" id="paused_${obj.Client.id}"` + clientStatusHtml
5050
+ `<i class="paused-client fas fa-3x fa-play" onclick="resumeClient('${obj.Client.id}')"></i>
5151
</div>
52-
<div class="info-box-content">
52+
<div class="info-box-content" style="overflow: hidden">
5353
<div class="btn-group">
5454
<a href="download?clientid=${obj.Client.id}" class="btn btn-outline-primary btn-sm">Download</a>
5555
</div>
@@ -94,6 +94,8 @@ function renderClientList(data) {
9494
${prettyDateTime(obj.Client.updated_at)}</span>
9595
<span class="info-box-text"><i class="fas fa-server" style="${obj.Client.use_server_dns ? "opacity: 1.0" : "opacity: 0.5"}"></i>
9696
${obj.Client.use_server_dns ? 'DNS enabled' : 'DNS disabled'}</span>
97+
<span class="info-box-text"><i class="fas fa-file"></i>
98+
${obj.Client.additional_notes}</span>
9799
<span class="info-box-text"><strong>IP Allocation</strong></span>`
98100
+ allocatedIpsHtml
99101
+ `<span class="info-box-text"><strong>Allowed IPs</strong></span>`

templates/clients.html

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -416,7 +416,7 @@ <h4 class="modal-title">Remove</h4>
416416
// hide all clients and display only the ones that meet the search criteria (name, email, IP)
417417
$('#search-input').keyup(function () {
418418
$("#status-selector").val("All");
419-
var query = $(this).val();
419+
let query = $(this).val().trim();
420420
$('.col-lg-4').hide();
421421
$(".info-box-text").each(function() {
422422
if($(this).children('i.fa-user').length > 0 || $(this).children('i.fa-envelope').length > 0)
@@ -426,12 +426,13 @@ <h4 class="modal-title">Remove</h4>
426426
})
427427
$(".badge-secondary").filter(':contains("' + query + '")').parent().parent().parent().show();
428428
$(".fa-tguserid").each(function () {
429-
if ($(this).parent().text().trim().indexOf(query.trim()) != -1) {
429+
if ($(this).parent().text().trim().indexOf(query) != -1) {
430430
$(this).closest('.col-lg-4').show();
431431
}
432432
})
433+
let upperQuery = query.toUpperCase()
433434
$(".fa-additional_notes").each(function () {
434-
if ($(this).parent().text().trim().indexOf(query.trim()) != -1) {
435+
if ($(this).parent().text().trim().indexOf(upperQuery) != -1) {
435436
$(this).closest('.col-lg-4').show();
436437
}
437438
})

0 commit comments

Comments
 (0)