diff --git a/frontend/src/EasySwitchManager.jsx b/frontend/src/EasySwitchManager.jsx index 5ff8fa4..c6dfbf7 100644 --- a/frontend/src/EasySwitchManager.jsx +++ b/frontend/src/EasySwitchManager.jsx @@ -36,6 +36,7 @@ function EasySwitchManager() { const [searchQuery, setSearchQuery] = useState(''); const [selectedRule, setSelectedRule] = useState('all'); // all | by-community const [activeTab, setActiveTab] = useState('proxies'); // proxies | providers + const [showOnlyConfigured, setShowOnlyConfigured] = useState(true); // Показывать только настроенные // Активные шлюзы для каждого community (ключ: community, значение: gateway name) const [activeGateways, setActiveGateways] = useState({}); @@ -331,21 +332,22 @@ function EasySwitchManager() { {/* Панель фильтров */}
-
- {/* Фильтр по правилу */} -
- +
+ {/* Переключатель "Только настроенные" */} +
+
{/* Поиск */} -
+
@@ -370,7 +372,7 @@ function EasySwitchManager() {
{/* Инструменты */} -
+
@@ -401,6 +403,17 @@ function EasySwitchManager() { const country = serverMeta?.country || ''; const flag = countryToFlag(country); + // Фильтруем communities для этого сервера + const filteredCommunitiesForServer = communitiesDirectory.filter((comm) => { + if (showOnlyConfigured) { + return server.filtersMap.has(comm.value); + } + return true; + }); + + // Не показываем сервер, если нет отфильтрованных communities + if (filteredCommunitiesForServer.length === 0) return null; + return (
{/* Заголовок сервера */} @@ -413,14 +426,14 @@ function EasySwitchManager() { — {server.description} )} - {communitiesDirectory.length} communities • {server.gateways.length} gateways + {filteredCommunitiesForServer.length} communities • {server.gateways.length} gateways
{/* ВСЕ Communities для этого сервера */} - {communitiesDirectory.map((comm) => { + {filteredCommunitiesForServer.map((comm) => { const activeKey = `${server.id}:${comm.value}`; const activeGw = activeGateways[activeKey]; const hasFilterForComm = server.filtersMap.has(comm.value);