refactor: switch Globalping to dynamic tier-based location lookup

## Changes
- Remove per-monitor location selection — locations are now determined
  globally by the tier setting in admin settings (3, 6, or 15 locations)
- GlobalpingService reads tier from settings on each check run, so
  changing the tier in settings immediately affects all HTTP/ping monitors
- Add resolveLocationId() to map Globalping probe results back to
  configured location IDs for proper grouping
- Export LOCATION_LABELS for human-readable location names on the client
- Remove unused locations field from Zod schemas and form defaults
- Remove per-monitor location ConfigBox from CreateMonitor page
- Fix settingsController.updateAppSettings missing try/catch
- Fix MongoSettingsRepository duplicate findOneAndUpdate call
- Use typed LocationCheckData instead of Record<string, any>
- Remove unused REVERSE_LOCATION_MAP from globalpingService

## Benefits
- Changing the location tier in settings takes effect immediately for
  all monitors without needing to edit each one individually
- Cleaner separation of concerns — location configuration lives in
  settings, not scattered across monitors
- Human-readable location labels shown in uptime details tabs
This commit is contained in:
gorkem-bwl committed 2026-02-19 10:58:18 -05:00
1 parent 7646d11ea0
commit 1966134647
10 files changed
+92 -113

No files matched your search

@@ -6,6 +6,7 @@ import type {
UptimeDetailsResult,
HardwareDetailsResult,
PageSpeedDetailsResult,
LocationCheckData,
GamesMap,
} from "@/types/monitor.js";
import type {
@@ -222,9 +223,9 @@ export class MonitorService implements IMonitorService {
throw new AppError({ message: `${monitor.type} monitors are not supported for uptime details`, status: 400 });
}
// Fetch location checks if monitor has locations configured
let locationChecks: Record<string, any> | undefined;
if (monitor.locations && monitor.locations.length > 0) {
// Fetch location checks if this is an HTTP or ping monitor
let locationChecks: Record<string, LocationCheckData> | undefined;
if (monitor.type === "http" || monitor.type === "ping") {
const locData = await this.checksRepository.findLocationChecksByMonitorId(
monitor.id,
start,