feat: sort server list by country name instead of city name #792
Open
valer23 wants to merge 4 commits intolibrespeed:masterfrom
Open
feat: sort server list by country name instead of city name #792valer23 wants to merge 4 commits intolibrespeed:masterfrom
valer23 wants to merge 4 commits intolibrespeed:masterfrom
Conversation
Sort the server dropdown by country first, then by city within the same country. This makes it easier to find servers in a specific country when the list is long. Applies to both modern and classic UIs.
Address code review findings: - Sort a shallow copy instead of mutating the caller's array - Add null guard on server.name to handle malformed entries - Use original SPEEDTEST_SERVERS index for classic UI option values
Contributor
Review Summary by QodoSort server list by country name instead of city name
WalkthroughsDescription• Sort server dropdown by country first, then city • Applies to both modern and classic UI implementations • Avoids mutating original server array with shallow copy • Adds null guard for malformed server name entries Diagramflowchart LR
A["Server Array"] -->|"shallow copy + sort"| B["Sorted by Country"]
B -->|"then by City"| C["Grouped Servers"]
C -->|"modern UI"| D["index.js Dropdown"]
C -->|"classic UI"| E["index-classic.html Select"]
File Changes1. frontend/javascript/index.js
|
Contributor
Code Review by Qodo
1.
|
Parse server names more robustly for sorting: - "City, Country, Provider" → use second part as country - "City, Country (1) (Hetzner)" → strip parentheticals from country - "Frankfurt, Germany (FRA01)" → country is "Germany" not "Germany (FRA01)"
Build an array of {idx, server} pairs before sorting so the original
SPEEDTEST_SERVERS index is carried through, eliminating the per-option
indexOf call.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Sort the server dropdown by country first, then by city within the same country. This makes it easier to find servers for a specific country when the list is long, currently servers are sorted by city, so servers for the same country are scattered across the list.
Applies to both modern and classic UIs. Parses the existing
namefield format ("City, Country"), no data model changes needed.Before (sorted by city)
After (sorted by country, then city)