fix: correct monitor sorting by group and groupOrder on /monitors page (#2527) master
* fix: correct monitor sorting by group and groupOrder on /monitors page The /monitors page was displaying monitors without proper sorting, causing incorrect ordering within component groups. Monitors were only filtered by visibility but not sorted. This fix implements proper sorting logic that: 1. Groups monitors by their monitorGroupId 2. Orders groups by their position (using minimum order of monitors in group) 3. Sorts monitors within each group by their groupOrder field This matches the sorting behavior used in the trackers logic on the main status page and ensures monitors appear in the correct order as configured in the dashboard. * perf: optimize monitor sorting and fix ungrouped monitor ordering Fixed two issues with the monitor sorting logic: 1. Ungrouped monitors now sort correctly by their order field - Previously, ungrouped monitors (monitorGroupId = null) were not explicitly sorted, relying only on stable sort to preserve order - Now matches trackers behavior by explicitly sorting by order 2. Improved performance from O(n虏 log n) to O(n log n) - Precompute group minOrder map before sorting instead of recalculating on every comparison - Eliminates redundant filter/map operations that were running for each pairwise comparison - Mirrors the groupedMap.minOrder approach used in statusPage.ts These changes make the sort self-sufficient and performant regardless of source data ordering. * ci: apply automated fixes * refactor: move monitors sorting from client to server - Add server-side sorting logic to statusPage.get endpoint - Monitors now sorted by group (using minimum order) and groupOrder - Remove client-side sorting logic from monitors page component - Add comprehensive e2e tests for monitors sorting behavior Fixes maintainer feedback: sorting is now handled server-side with tests * ci: apply automated fixes * fix: tests --------- Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com> Co-authored-by: Maximilian Kaske <maximilian@kaske.org>