-
-
Notifications
You must be signed in to change notification settings - Fork 372
Description
Is there an existing issue for this?
- I have searched the existing open and closed issues and I checked the docs https://jokob-sk.github.io/NetAlertX/
The issue occurs in the following browsers. Select at least 2.
- Firefox
- Chrome
- Edge
- Safari (unsupported) - PRs welcome
- N/A - This is an issue with the backend
Current Behavior
The "Network" tab fails to load and remains blank if any device in the database has a numeric value for its devName (e.g., 116009949 instead of "Unknown").
This causes a Javascript crash in network.php because localeCompare cannot be called on a number.
To Reproduce
Have a device in the database where devName is a raw number (not a string).
Go to the "Network" tab.
The page remains blank.
Console shows error: Uncaught TypeError: a.devName.localeCompare is not a function at network.php:1385
Expected behavior The Network tab should load even if a device name is numeric, or it should cast numeric names to strings before sorting.
Screenshots / Logs Error in browser console:
network.php:1385 Uncaught TypeError: a.devName.localeCompare is not a function
at network.php:1385:41
at Array.sort ()
at Object.success (network.php:1377:43)
Additional context I fixed this on my local instance by finding the devices with numeric names and renaming them to text strings.
Suggested fix in network.php (around line 1385): Ensure a.devName and b.devName are cast to strings before comparison:
JavaScript
// Current likely code causing the crash:
// return a.devName.localeCompare(b.devName);
// Suggested fix:
return String(a.devName).localeCompare(String(b.devName));
Expected Behavior
Network tab should render.
Steps To Reproduce
No response
app.conf
docker-compose.yml
What installation are you running?
Production (netalertx)
app.log
No response
Debug enabled
- I have read and followed the steps in the wiki link above and provided the required debug logs and the log section covers the time when the issue occurs.