diff --git a/frontend/src/SettingsPage.jsx b/frontend/src/SettingsPage.jsx index 14c4bf8..59f3d66 100644 --- a/frontend/src/SettingsPage.jsx +++ b/frontend/src/SettingsPage.jsx @@ -77,6 +77,8 @@ export default function SettingsPage() { const [pingServicesServerId, setPingServicesServerId] = useState(''); const [pingServicesGatewayIp, setPingServicesGatewayIp] = useState(''); const [pingServicesCacheSeconds, setPingServicesCacheSeconds] = useState(''); + const [pingServicesSchedulerEnabled, setPingServicesSchedulerEnabled] = useState(true); + const [pingServicesSchedulerIntervalMinutes, setPingServicesSchedulerIntervalMinutes] = useState('2'); const [interfaceSpeedTestProtocol, setInterfaceSpeedTestProtocol] = useState('tcp'); const [interfaceSpeedTestDurationSeconds, setInterfaceSpeedTestDurationSeconds] = useState('10'); const [interfaceSpeedTestCacheMinutes, setInterfaceSpeedTestCacheMinutes] = useState(''); @@ -236,6 +238,12 @@ export default function SettingsPage() { ? String(data.pingServicesCacheSeconds) : '' ); + setPingServicesSchedulerEnabled(data?.pingServicesSchedulerEnabled !== false); + setPingServicesSchedulerIntervalMinutes( + data?.pingServicesSchedulerIntervalMinutes != null + ? String(data.pingServicesSchedulerIntervalMinutes) + : '2' + ); setInterfaceSpeedTestProtocol( String(data?.interfaceSpeedTestProtocol || 'tcp').toLowerCase() === 'udp' @@ -356,6 +364,11 @@ export default function SettingsPage() { 0, parseInt(pingServicesCacheSeconds, 10) || 0 ), + pingServicesSchedulerEnabled: Boolean(pingServicesSchedulerEnabled), + pingServicesSchedulerIntervalMinutes: Math.max( + 1, + Math.min(1440, parseInt(pingServicesSchedulerIntervalMinutes, 10) || 2) + ), interfaceSpeedTestProtocol: interfaceSpeedTestProtocol === 'udp' ? 'udp' : 'tcp', interfaceSpeedTestDurationSeconds: Math.max( @@ -695,6 +708,33 @@ export default function SettingsPage() { min={0} /> +
+
+ setPingServicesSchedulerEnabled(e.target.checked)} + disabled={saving} + /> + +
+ +
{pingServicesSource === 'router' && (
diff --git a/frontend/src/components/SettingsModal.jsx b/frontend/src/components/SettingsModal.jsx index 700bfd5..9407e90 100644 --- a/frontend/src/components/SettingsModal.jsx +++ b/frontend/src/components/SettingsModal.jsx @@ -27,6 +27,8 @@ export default function SettingsModal({ open, onClose }) { const [pingServicesServerId, setPingServicesServerId] = useState(''); const [pingServicesGatewayIp, setPingServicesGatewayIp] = useState(''); const [pingServicesCacheSeconds, setPingServicesCacheSeconds] = useState(''); + const [pingServicesSchedulerEnabled, setPingServicesSchedulerEnabled] = useState(true); + const [pingServicesSchedulerIntervalMinutes, setPingServicesSchedulerIntervalMinutes] = useState('2'); const [serversList, setServersList] = useState([]); const [interfaceSpeedTestProtocol, setInterfaceSpeedTestProtocol] = useState('tcp'); const [interfaceSpeedTestDurationSeconds, setInterfaceSpeedTestDurationSeconds] = useState('10'); @@ -69,6 +71,12 @@ export default function SettingsModal({ open, onClose }) { ? String(data.pingServicesCacheSeconds) : '' ); + setPingServicesSchedulerEnabled(data?.pingServicesSchedulerEnabled !== false); + setPingServicesSchedulerIntervalMinutes( + data?.pingServicesSchedulerIntervalMinutes != null + ? String(data.pingServicesSchedulerIntervalMinutes) + : '2' + ); setInterfaceSpeedTestProtocol( String(data?.interfaceSpeedTestProtocol || 'tcp').toLowerCase() === 'udp' @@ -157,6 +165,11 @@ export default function SettingsModal({ open, onClose }) { 0, parseInt(pingServicesCacheSeconds, 10) || 0 ), + pingServicesSchedulerEnabled: Boolean(pingServicesSchedulerEnabled), + pingServicesSchedulerIntervalMinutes: Math.max( + 1, + Math.min(1440, parseInt(pingServicesSchedulerIntervalMinutes, 10) || 2) + ), interfaceSpeedTestProtocol: interfaceSpeedTestProtocol === 'udp' ? 'udp' : 'tcp', interfaceSpeedTestDurationSeconds: Math.max( @@ -370,6 +383,33 @@ export default function SettingsModal({ open, onClose }) { min={0} />
+
+
+ setPingServicesSchedulerEnabled(e.target.checked)} + disabled={loading || saving} + /> + +
+ +
{pingServicesSource === 'router' && (