fix: use numeric sort for agent IDs to handle 4+ digit IDs (#674)
Agent IDs from Wazuh are zero-padded strings (001, 002, etc.). When IDs reach 1000+, string comparison breaks (1000 sorts before 101). Changed from localeCompare() to parseInt() to sort numerically regardless of string length.
oliver-oat committed
Feb 4, 2026 at 02:47 UTC
9bcb35bb70fbb08c249e64d09bd0e187941818fa
1 file changed
+1
-1
frontend/src/views/agents/Agents.vue
+1
-1
@@ -93,7 +93,7 @@ const agentsFiltered = computed(() => {
93
.toLowerCase()
94
.includes(textFilterDebounced.value.toString().toLowerCase())
95
)
96
- .sort((a, b) => a.agent_id.localeCompare(b.agent_id))
96
+ .sort((a, b) => parseInt(a.agent_id) - parseInt(b.agent_id))
97
})
98
99
const itemsPaginated = computed(() => {