少于10时折叠筛选

This commit is contained in:
cppla
2026-07-02 12:02:36 +08:00
parent e0aae47efc
commit bbec425c51
2 changed files with 8 additions and 2 deletions
+7 -1
View File
@@ -201,6 +201,7 @@ function visibleServers(){
function render(){
$('notice').style.display = 'none';
normalizeServersToolbarState();
renderOverview();
renderOsOptions();
renderServers();
@@ -242,6 +243,11 @@ function alertStats(){
return stats;
}
function normalizeServersToolbarState(){
const show = S.activeTab === 'servers' && S.servers.length > 10;
$('serversToolbar').style.display = show ? 'flex' : 'none';
}
function renderOsOptions(){
const select = $('osFilter');
const labels = [...new Set(S.servers.map(s => osLabel(s.os)).filter(Boolean))].sort((a,b)=>a.localeCompare(b,'zh-CN'));
@@ -540,7 +546,7 @@ function bindTabs(){
S.activeTab = tab;
document.querySelectorAll('.nav button').forEach(btn => btn.classList.toggle('active', btn === e.target));
document.querySelectorAll('.panel').forEach(panel => panel.classList.toggle('active', panel.id === 'panel-' + tab));
$('serversToolbar').style.display = tab === 'servers' ? 'flex' : 'none';
normalizeServersToolbarState();
if(tab === 'config') ensureAdminChecked();
});
}