Skip to content

Commit 81c42c2

Browse files
committed
updated search box to be able to search anything
1 parent d34279f commit 81c42c2

File tree

2 files changed

+11
-7
lines changed

2 files changed

+11
-7
lines changed

docs/assets/js/dashboard.js

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -176,12 +176,16 @@ function filterData() {
176176

177177
filteredData = Object.values(accountsData).filter(account => {
178178
const foundDate = new Date(account.FOUND_ON);
179-
const matchesSearch =
180-
(account.USERNAME && account.USERNAME.toLowerCase().includes(searchTerm)) ||
181-
(account.BEHAVIOUR && account.BEHAVIOUR.toLowerCase().includes(searchTerm)) ||
182-
(account.ATTACK_METHOD && account.ATTACK_METHOD.toLowerCase().includes(searchTerm)) ||
183-
(account.ATTACK_VECTOR && account.ATTACK_VECTOR.toLowerCase().includes(searchTerm)) ||
184-
(account.DISCORD_ID && account.DISCORD_ID.includes(searchTerm));
179+
180+
// Check if any field in the account matches the search term
181+
const matchesSearch = Object.values(account).some(value => {
182+
if (typeof value === 'string') {
183+
return value.toLowerCase().includes(searchTerm);
184+
} else if (typeof value === 'number' || typeof value === 'boolean') {
185+
return value.toString().toLowerCase().includes(searchTerm);
186+
}
187+
return false;
188+
});
185189

186190
const matchesAttackMethod = !attackMethod || account.ATTACK_METHOD === attackMethod;
187191
const matchesServer = !server || account.FOUND_ON_SERVER === server;

docs/pages/dashboard.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -199,7 +199,7 @@ <h1 class="text-2xl font-bold flex items-center"> CDA Project <span class="text-
199199
<!-- Existing filters -->
200200
<div class="w-full md:w-1/3">
201201
<label class="block text-sm font-medium text-gray-700 mb-1">Search</label>
202-
<input id="searchInput" type="text" class="w-full border border-gray-300 rounded p-2" placeholder="Search by username, behavior, attack method...">
202+
<input id="searchInput" type="text" class="w-full border border-gray-300 rounded p-2" placeholder="Search...">
203203
</div>
204204
<div class="w-full md:w-1/3">
205205
<label class="block text-sm font-medium text-gray-700 mb-1">Filter by Attack Method</label>

0 commit comments

Comments
 (0)