添加全局刷新按钮
This commit is contained in:
@@ -328,6 +328,35 @@ body {
|
||||
transform: rotate(30deg);
|
||||
}
|
||||
|
||||
/* ---- Global Refresh Button ---- */
|
||||
.btn-refresh-global {
|
||||
width: 32px;
|
||||
height: 32px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
background: var(--bg-card);
|
||||
border: 1px solid var(--border-color);
|
||||
border-radius: var(--radius-sm);
|
||||
color: var(--text-secondary);
|
||||
cursor: pointer;
|
||||
transition: all 0.25s ease;
|
||||
margin-left: 4px;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
.btn-refresh-global:hover {
|
||||
border-color: var(--border-hover);
|
||||
color: var(--accent-emerald);
|
||||
background: rgba(16, 185, 129, 0.08);
|
||||
transform: translateY(-1px);
|
||||
}
|
||||
|
||||
.btn-refresh-global svg {
|
||||
width: 16px;
|
||||
height: 16px;
|
||||
}
|
||||
|
||||
/* ---- Theme Switch ---- */
|
||||
.theme-switch-wrapper {
|
||||
display: flex;
|
||||
|
||||
@@ -803,9 +803,30 @@
|
||||
<div class="user-info">
|
||||
<span class="username">${escapeHtml(username)}</span>
|
||||
<button class="btn btn-logout" id="btnLogout">退出</button>
|
||||
<button class="btn-refresh-global" id="btnGlobalRefresh" title="全局数据刷新">
|
||||
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
|
||||
<path d="M23 4v6h-6M1 20v-6h6M3.51 9a9 9 0 0 1 14.85-3.36L23 10M1 14l4.64 4.36A9 9 0 0 0 20.49 15"></path>
|
||||
</svg>
|
||||
</button>
|
||||
</div>
|
||||
`;
|
||||
document.getElementById('btnLogout').addEventListener('click', handleLogout);
|
||||
document.getElementById('btnGlobalRefresh').addEventListener('click', async () => {
|
||||
const btn = document.getElementById('btnGlobalRefresh');
|
||||
const icon = btn.querySelector('svg');
|
||||
if (icon) icon.style.animation = 'spin 0.8s ease-in-out';
|
||||
|
||||
await Promise.all([
|
||||
fetchNetworkHistory(true),
|
||||
fetchMetrics(true)
|
||||
]);
|
||||
|
||||
if (icon) {
|
||||
setTimeout(() => {
|
||||
icon.style.animation = '';
|
||||
}, 800);
|
||||
}
|
||||
});
|
||||
} else {
|
||||
user = null;
|
||||
dom.btnSettings.style.display = 'none';
|
||||
|
||||
Reference in New Issue
Block a user