refactor(MikrotikTools): streamline interface filtering logic by moving it to a new useMemo hook for improved performance and readability
Publish Fast Tabler Docker image / build-and-push-fast (push) Successful in 2m3s
Publish Fast Tabler Docker image / build-and-push-fast (push) Successful in 2m3s
This commit is contained in:
@@ -121,18 +121,6 @@ function MikrotikTools() {
|
||||
[networkConfig]
|
||||
);
|
||||
|
||||
const interfacesForServer = useMemo(() => {
|
||||
if (!serverId || !interfaces.length) return [];
|
||||
const ids = new Set(
|
||||
[serverId, currentServer?.id, currentServer?.ip, currentServer?.dns]
|
||||
.filter(Boolean)
|
||||
.map(String)
|
||||
);
|
||||
return interfaces.filter(
|
||||
(i) => i && i.name && (ids.has(String(i.serverId)) || ids.has(String(i.serverId2)))
|
||||
);
|
||||
}, [interfaces, serverId, currentServer]);
|
||||
|
||||
const formatMbps = (bps) => {
|
||||
if (bps == null || Number.isNaN(bps)) return '—';
|
||||
const mbps = bps / 1_000_000;
|
||||
@@ -300,6 +288,21 @@ function MikrotikTools() {
|
||||
[jumphostServers, serverId]
|
||||
);
|
||||
|
||||
const interfacesForServer = useMemo(() => {
|
||||
if (!serverId || !interfaces.length) return [];
|
||||
const ids = new Set(
|
||||
[serverId, currentServer?.id, currentServer?.ip, currentServer?.dns]
|
||||
.filter(Boolean)
|
||||
.map(String)
|
||||
);
|
||||
return interfaces.filter(
|
||||
(i) =>
|
||||
i &&
|
||||
i.name &&
|
||||
(ids.has(String(i.serverId)) || ids.has(String(i.serverId2)))
|
||||
);
|
||||
}, [interfaces, serverId, currentServer]);
|
||||
|
||||
const gatewaysForServer = useMemo(() => {
|
||||
if (!serverId || !gateways.length) return [];
|
||||
const ids = currentServer
|
||||
|
||||
Reference in New Issue
Block a user