mirror of
https://github.com/ngoduykhanh/wireguard-ui.git
synced 2025-04-18 19:49:30 +03:00
Case-insensitive search by notes; display notes on the client card (#532)
This commit is contained in:
parent
7856ce9555
commit
8f3433b714
2 changed files with 8 additions and 5 deletions
|
@ -40,7 +40,7 @@ function renderClientList(data) {
|
||||||
|
|
||||||
let additionalNotesHtml = "";
|
let additionalNotesHtml = "";
|
||||||
if (obj.Client.additional_notes && obj.Client.additional_notes.length > 0) {
|
if (obj.Client.additional_notes && obj.Client.additional_notes.length > 0) {
|
||||||
additionalNotesHtml = `<span class="info-box-text" style="display: none"><i class="fas fa-additional_notes"></i>${obj.Client.additional_notes}</span>`
|
additionalNotesHtml = `<span class="info-box-text" style="display: none"><i class="fas fa-additional_notes"></i>${obj.Client.additional_notes.toUpperCase()}</span>`
|
||||||
}
|
}
|
||||||
|
|
||||||
// render client html content
|
// render client html content
|
||||||
|
@ -49,7 +49,7 @@ function renderClientList(data) {
|
||||||
<div class="overlay" id="paused_${obj.Client.id}"` + clientStatusHtml
|
<div class="overlay" id="paused_${obj.Client.id}"` + clientStatusHtml
|
||||||
+ `<i class="paused-client fas fa-3x fa-play" onclick="resumeClient('${obj.Client.id}')"></i>
|
+ `<i class="paused-client fas fa-3x fa-play" onclick="resumeClient('${obj.Client.id}')"></i>
|
||||||
</div>
|
</div>
|
||||||
<div class="info-box-content">
|
<div class="info-box-content" style="overflow: hidden">
|
||||||
<div class="btn-group">
|
<div class="btn-group">
|
||||||
<a href="download?clientid=${obj.Client.id}" class="btn btn-outline-primary btn-sm">Download</a>
|
<a href="download?clientid=${obj.Client.id}" class="btn btn-outline-primary btn-sm">Download</a>
|
||||||
</div>
|
</div>
|
||||||
|
@ -94,6 +94,8 @@ function renderClientList(data) {
|
||||||
${prettyDateTime(obj.Client.updated_at)}</span>
|
${prettyDateTime(obj.Client.updated_at)}</span>
|
||||||
<span class="info-box-text"><i class="fas fa-server" style="${obj.Client.use_server_dns ? "opacity: 1.0" : "opacity: 0.5"}"></i>
|
<span class="info-box-text"><i class="fas fa-server" style="${obj.Client.use_server_dns ? "opacity: 1.0" : "opacity: 0.5"}"></i>
|
||||||
${obj.Client.use_server_dns ? 'DNS enabled' : 'DNS disabled'}</span>
|
${obj.Client.use_server_dns ? 'DNS enabled' : 'DNS disabled'}</span>
|
||||||
|
<span class="info-box-text"><i class="fas fa-file"></i>
|
||||||
|
${obj.Client.additional_notes}</span>
|
||||||
<span class="info-box-text"><strong>IP Allocation</strong></span>`
|
<span class="info-box-text"><strong>IP Allocation</strong></span>`
|
||||||
+ allocatedIpsHtml
|
+ allocatedIpsHtml
|
||||||
+ `<span class="info-box-text"><strong>Allowed IPs</strong></span>`
|
+ `<span class="info-box-text"><strong>Allowed IPs</strong></span>`
|
||||||
|
|
|
@ -416,7 +416,7 @@ Wireguard Clients
|
||||||
// hide all clients and display only the ones that meet the search criteria (name, email, IP)
|
// hide all clients and display only the ones that meet the search criteria (name, email, IP)
|
||||||
$('#search-input').keyup(function () {
|
$('#search-input').keyup(function () {
|
||||||
$("#status-selector").val("All");
|
$("#status-selector").val("All");
|
||||||
var query = $(this).val();
|
let query = $(this).val().trim();
|
||||||
$('.col-lg-4').hide();
|
$('.col-lg-4').hide();
|
||||||
$(".info-box-text").each(function() {
|
$(".info-box-text").each(function() {
|
||||||
if($(this).children('i.fa-user').length > 0 || $(this).children('i.fa-envelope').length > 0)
|
if($(this).children('i.fa-user').length > 0 || $(this).children('i.fa-envelope').length > 0)
|
||||||
|
@ -426,12 +426,13 @@ Wireguard Clients
|
||||||
})
|
})
|
||||||
$(".badge-secondary").filter(':contains("' + query + '")').parent().parent().parent().show();
|
$(".badge-secondary").filter(':contains("' + query + '")').parent().parent().parent().show();
|
||||||
$(".fa-tguserid").each(function () {
|
$(".fa-tguserid").each(function () {
|
||||||
if ($(this).parent().text().trim().indexOf(query.trim()) != -1) {
|
if ($(this).parent().text().trim().indexOf(query) != -1) {
|
||||||
$(this).closest('.col-lg-4').show();
|
$(this).closest('.col-lg-4').show();
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
let upperQuery = query.toUpperCase()
|
||||||
$(".fa-additional_notes").each(function () {
|
$(".fa-additional_notes").each(function () {
|
||||||
if ($(this).parent().text().trim().indexOf(query.trim()) != -1) {
|
if ($(this).parent().text().trim().indexOf(upperQuery) != -1) {
|
||||||
$(this).closest('.col-lg-4').show();
|
$(this).closest('.col-lg-4').show();
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
Loading…
Add table
Reference in a new issue