feat: Add inventory server fetching and display logic in FilterManager to enhance server detail presentation and improve user experience.
Publish Fast Tabler Docker image / build-and-push-fast (push) Successful in 1m56s
Publish Fast Tabler Docker image / build-and-push-fast (push) Successful in 1m56s
This commit is contained in:
@@ -70,6 +70,19 @@ function FilterManager() {
|
||||
const [sortBy, setSortBy] = useState('community'); // community | gateway | description
|
||||
const [sortDir, setSortDir] = useState('asc'); // asc | desc
|
||||
|
||||
// Инвентарный список servers (dns/ip) для сопоставления по имени
|
||||
const [inventoryServers, setInventoryServers] = useState([]);
|
||||
useEffect(() => {
|
||||
(async () => {
|
||||
try {
|
||||
const res = await api.get('/servers');
|
||||
setInventoryServers(Array.isArray(res.data) ? res.data : []);
|
||||
} catch (e) {
|
||||
// не блокируем UI, если нет инвентаря
|
||||
}
|
||||
})();
|
||||
}, []);
|
||||
|
||||
// Префилл из query (?community=..., ?serverId=..., ?server=...) без автоселекта по умолчанию
|
||||
const queryParamsRef = useRef({ community: null, serverId: null, serverName: null });
|
||||
const serverPrefillDoneRef = useRef(false);
|
||||
@@ -1002,11 +1015,30 @@ function FilterManager() {
|
||||
<div className="fw-bold text-truncate" title={server.name}>{server.name}</div>
|
||||
<span className="badge bg-green-lt text-green">Активен</span>
|
||||
</div>
|
||||
{server.description && (
|
||||
<div className="text-muted small text-truncate" title={server.description}>
|
||||
{server.description}
|
||||
</div>
|
||||
)}
|
||||
{(() => {
|
||||
const meta = inventoryServers.find(
|
||||
(s) =>
|
||||
String(s.dns || '').trim() === server.name ||
|
||||
String(s.hostName || '').trim() === server.name ||
|
||||
String(s.ip || '').trim() === server.name
|
||||
);
|
||||
if (meta) {
|
||||
const line = [meta.dns || meta.hostName, meta.ip].filter(Boolean).join(' · ');
|
||||
return (
|
||||
<div className="text-muted small text-truncate" title={line}>
|
||||
{line}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
if (server.description) {
|
||||
return (
|
||||
<div className="text-muted small text-truncate" title={server.description}>
|
||||
{server.description}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
return null;
|
||||
})()}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user