feat(PingServices): implement UI settings for ping services configuration and enhance ping functionality through RouterOS
Publish Fast Tabler Docker image / build-and-push-fast (push) Successful in 1m34s
Publish Fast Tabler Docker image / build-and-push-fast (push) Successful in 1m34s
This commit is contained in:
@@ -22,6 +22,9 @@ export default function SettingsModal({ open, onClose }) {
|
||||
const [pingCacheMinutes, setPingCacheMinutes] = useState('');
|
||||
const [ptrZoneReplaceFrom, setPtrZoneReplaceFrom] = useState('');
|
||||
const [ptrZoneReplaceTo, setPtrZoneReplaceTo] = useState('');
|
||||
const [pingServicesSource, setPingServicesSource] = useState('web');
|
||||
const [pingServicesServerId, setPingServicesServerId] = useState('');
|
||||
const [pingServicesGatewayIp, setPingServicesGatewayIp] = useState('');
|
||||
|
||||
useEffect(() => {
|
||||
if (!open) return;
|
||||
@@ -41,6 +44,9 @@ export default function SettingsModal({ open, onClose }) {
|
||||
setPingCacheMinutes(data?.pingCacheMinutes != null ? String(data.pingCacheMinutes) : '');
|
||||
setPtrZoneReplaceFrom(String(data?.ptrZoneReplaceFrom || ''));
|
||||
setPtrZoneReplaceTo(String(data?.ptrZoneReplaceTo || ''));
|
||||
setPingServicesSource(String(data?.pingServicesSource || 'web').toLowerCase() === 'router' ? 'router' : 'web');
|
||||
setPingServicesServerId(String(data?.pingServicesServerId || '').trim());
|
||||
setPingServicesGatewayIp(String(data?.pingServicesGatewayIp || '').trim());
|
||||
const e = res?.headers?.etag || res?.headers?.ETag || '';
|
||||
setEtag(e ? String(e) : '');
|
||||
} catch (e) {
|
||||
@@ -105,6 +111,9 @@ export default function SettingsModal({ open, onClose }) {
|
||||
pingCacheMinutes: Math.max(0, parseInt(pingCacheMinutes, 10) || 0),
|
||||
ptrZoneReplaceFrom: String(ptrZoneReplaceFrom || '').trim(),
|
||||
ptrZoneReplaceTo: String(ptrZoneReplaceTo || '').trim(),
|
||||
pingServicesSource: pingServicesSource === 'router' ? 'router' : 'web',
|
||||
pingServicesServerId: String(pingServicesServerId || '').trim(),
|
||||
pingServicesGatewayIp: String(pingServicesGatewayIp || '').trim(),
|
||||
};
|
||||
const payload = {
|
||||
settings: mergedSettings,
|
||||
@@ -227,6 +236,53 @@ export default function SettingsModal({ open, onClose }) {
|
||||
min={0}
|
||||
/>
|
||||
|
||||
<div className="mt-3 pt-3 border-top">
|
||||
<h6 className="mb-2">Пинг сервисов на главной</h6>
|
||||
<div className="mb-2">
|
||||
<label className="form-label small">Источник пинга</label>
|
||||
<select
|
||||
className="form-select form-select-sm"
|
||||
value={pingServicesSource}
|
||||
onChange={(e) => setPingServicesSource(e.target.value)}
|
||||
disabled={loading || saving}
|
||||
>
|
||||
<option value="web">Веб (TCP с сервера приложения)</option>
|
||||
<option value="router">Роутер (RouterOS API)</option>
|
||||
</select>
|
||||
<div className="form-text small">
|
||||
«Веб» — задержка до 8.8.8.8, 1.1.1.1 и др. с сервера. «Роутер» — пинг через выбранный MikroTik (jumphost).
|
||||
</div>
|
||||
</div>
|
||||
{pingServicesSource === 'router' && (
|
||||
<div className="row g-2">
|
||||
<div className="col-md-6">
|
||||
<FormField
|
||||
label="Роутер (jumphost)"
|
||||
name="pingServicesServerId"
|
||||
type="text"
|
||||
value={pingServicesServerId}
|
||||
onChange={setPingServicesServerId}
|
||||
placeholder="ID, DNS или IP jumphost"
|
||||
helpText="Оставьте пустым — будет использован первый jumphost из списка серверов."
|
||||
disabled={loading || saving}
|
||||
/>
|
||||
</div>
|
||||
<div className="col-md-6">
|
||||
<FormField
|
||||
label="IP шлюза (опционально)"
|
||||
name="pingServicesGatewayIp"
|
||||
type="text"
|
||||
value={pingServicesGatewayIp}
|
||||
onChange={setPingServicesGatewayIp}
|
||||
placeholder="IP шлюза"
|
||||
helpText="Оставьте пустым — берётся первый шлюз роутера."
|
||||
disabled={loading || saving}
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
|
||||
<div className="mt-4 pt-3 border-top">
|
||||
<h6 className="mb-3">Настройка PTR зоны</h6>
|
||||
<div className="row g-3">
|
||||
|
||||
Reference in New Issue
Block a user