Skip to content

Commit

Permalink
fix(server): sort devices by name and enabled status on main page
Browse files Browse the repository at this point in the history
Closes #290
  • Loading branch information
ericswpark committed Nov 30, 2023
1 parent 86946df commit ddfc679
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions server/frontend/downloads-main.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,16 @@ function DownloadList({ filter }) {
filtered_devices = ACTIVE_DEVICES;
}

function sortActive(a, b) {
return (a["enabled"] === b["enabled"]) ? 0 : a["enabled"] ? -1 : 1;
}

function sortName(a, b) {
return a["name"] > b["name"];
}

filtered_devices = filtered_devices.sort(sortName).sort(sortActive);

return (
<div
className="container"
Expand Down

0 comments on commit ddfc679

Please sign in to comment.