feat(ping): implement dynamic ping target selection from UI settings or default value
This commit is contained in:
@@ -256,7 +256,7 @@ function EasySwitchManager() {
|
||||
|
||||
/**
|
||||
* Загрузить реальные пинги для комбинаций (сервер, gateway).
|
||||
* Пингуем хост www.gstatic.com через соответствующий MikroTik jumphost.
|
||||
* Цель пинга берётся из настроек интерфейса («Домен для пинга») или по умолчанию.
|
||||
*/
|
||||
const prefetchPings = async (serversList, inventory) => {
|
||||
try {
|
||||
@@ -291,7 +291,6 @@ function EasySwitchManager() {
|
||||
.post('/mikrotik/ping', {
|
||||
serverId: routerId,
|
||||
gatewayIp: ip,
|
||||
target: 'www.gstatic.com',
|
||||
count: 5,
|
||||
})
|
||||
.then(({ data }) => {
|
||||
|
||||
@@ -18,6 +18,7 @@ export default function SettingsModal({ open, onClose }) {
|
||||
const [dohServer, setDohServer] = useState('');
|
||||
const [wsUrl, setWsUrl] = useState('');
|
||||
const [baseAS, setBaseAS] = useState('65001');
|
||||
const [pingDomain, setPingDomain] = useState('');
|
||||
const [ptrZoneReplaceFrom, setPtrZoneReplaceFrom] = useState('');
|
||||
const [ptrZoneReplaceTo, setPtrZoneReplaceTo] = useState('');
|
||||
|
||||
@@ -35,6 +36,7 @@ export default function SettingsModal({ open, onClose }) {
|
||||
setDohServer(String(data?.dohServer || ''));
|
||||
setWsUrl(String(data?.wsUpdateUrl || ''));
|
||||
setBaseAS(String(data?.baseAS || '65001'));
|
||||
setPingDomain(String(data?.pingDomain || '').trim());
|
||||
setPtrZoneReplaceFrom(String(data?.ptrZoneReplaceFrom || ''));
|
||||
setPtrZoneReplaceTo(String(data?.ptrZoneReplaceTo || ''));
|
||||
const e = res?.headers?.etag || res?.headers?.ETag || '';
|
||||
@@ -97,6 +99,7 @@ export default function SettingsModal({ open, onClose }) {
|
||||
dohServer: String(dohServer || '').trim(),
|
||||
wsUpdateUrl: String(wsUrl || '').trim(),
|
||||
baseAS: String(baseAS || '65001').trim(),
|
||||
pingDomain: String(pingDomain || '').trim(),
|
||||
ptrZoneReplaceFrom: String(ptrZoneReplaceFrom || '').trim(),
|
||||
ptrZoneReplaceTo: String(ptrZoneReplaceTo || '').trim(),
|
||||
};
|
||||
@@ -198,6 +201,17 @@ export default function SettingsModal({ open, onClose }) {
|
||||
disabled={loading || saving}
|
||||
/>
|
||||
|
||||
<FormField
|
||||
label="Домен для пинга"
|
||||
name="pingDomain"
|
||||
type="text"
|
||||
value={pingDomain}
|
||||
onChange={setPingDomain}
|
||||
placeholder="8.8.8.8 или ya.ru"
|
||||
helpText="Домен или IP для проверки пинга через MikroTik (например, 8.8.8.8, ya.ru). Если не задан, используется значение по умолчанию."
|
||||
disabled={loading || saving}
|
||||
/>
|
||||
|
||||
<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