feat(mikrotikConfigRoutes, FilterManager): add run-script endpoint and integrate BGP update functionality in FilterManager
Publish Fast Tabler Docker image / build-and-push-fast (push) Successful in 2m7s
Publish Fast Tabler Docker image / build-and-push-fast (push) Successful in 2m7s
This commit is contained in:
@@ -746,6 +746,7 @@ function FilterManager() {
|
||||
// Состояние для массовых действий
|
||||
const [selectedFilterKeys, setSelectedFilterKeys] = useState(new Set());
|
||||
const [confirmState, setConfirmState] = useState({ open: false, text: '', onConfirm: null });
|
||||
const [bgpUpdateLoading, setBgpUpdateLoading] = useState(false);
|
||||
|
||||
// Состояние для копирования правил с сервера
|
||||
const [copyFromServerModalOpen, setCopyFromServerModalOpen] = useState(false);
|
||||
@@ -1070,6 +1071,22 @@ function FilterManager() {
|
||||
}
|
||||
};
|
||||
|
||||
const handleBgpUpdate = async () => {
|
||||
if (!selectedServer) return;
|
||||
setBgpUpdateLoading(true);
|
||||
setError('');
|
||||
try {
|
||||
await api.post('/mikrotik/run-script', { serverId: selectedServer.id, script: 'update_bgp_filter' });
|
||||
setSuccess(`Скрипт update_bgp_filter запущен на ${selectedServer.name}`);
|
||||
setTimeout(() => setSuccess(''), 3000);
|
||||
} catch (err) {
|
||||
const msg = err.response?.data?.message || err.message || 'Не удалось запустить скрипт';
|
||||
setError(msg);
|
||||
} finally {
|
||||
setBgpUpdateLoading(false);
|
||||
}
|
||||
};
|
||||
|
||||
const handleSaveServerConfig = async (serverId) => {
|
||||
try {
|
||||
const config = await generateMikrotikConfig();
|
||||
@@ -1802,6 +1819,15 @@ function FilterManager() {
|
||||
<IconDeviceFloppy className="icon" />
|
||||
Сохранить
|
||||
</button>
|
||||
<button
|
||||
className="btn btn-outline-primary"
|
||||
onClick={handleBgpUpdate}
|
||||
disabled={bgpUpdateLoading}
|
||||
title="Запустить /system script run update_bgp_filter на выбранном MikroTik"
|
||||
>
|
||||
<IconRefresh className={`icon ${bgpUpdateLoading ? 'spin' : ''}`} />
|
||||
{bgpUpdateLoading ? 'Запуск...' : 'Обновить BGP фильтры'}
|
||||
</button>
|
||||
</>
|
||||
)}
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user