新功能:允许查看服务器地址
This commit is contained in:
@@ -574,6 +574,15 @@
|
||||
</div>
|
||||
<small style="display: block; margin-top: 6px; color: var(--text-muted);">选择参与 24 小时网络流量统计的 Prometheus 数据源。如果不勾选任何项,则统计所有数据源。</small>
|
||||
</div>
|
||||
<div class="form-group" style="margin-top: 15px;">
|
||||
<label for="showServerIpInput">服务器详情内是否显示 IPv4 和 IPv6 地址</label>
|
||||
<select id="showServerIpInput"
|
||||
style="padding: 10px 14px; background: var(--bg-input); border: 1px solid var(--border-color); border-radius: var(--radius-sm); color: var(--text-primary); width: 100%;">
|
||||
<option value="1">显示 (Show)</option>
|
||||
<option value="0">隐藏 (Hide)</option>
|
||||
</select>
|
||||
<p style="font-size: 0.72rem; color: var(--text-muted); margin-top: 6px;">开启后,点击服务器详情时会显示该服务器的公网 IP 地址(需 node_exporter 提供支持)。</p>
|
||||
</div>
|
||||
<div class="form-actions" style="margin-top: 25px; display: flex; justify-content: flex-end;">
|
||||
<button class="btn btn-add" id="btnSaveSiteSettings">保存基础设置</button>
|
||||
</div>
|
||||
|
||||
@@ -113,6 +113,7 @@
|
||||
globeCard: document.getElementById('globeCard'),
|
||||
btnExpandGlobe: document.getElementById('btnExpandGlobe'),
|
||||
btnRefreshNetwork: document.getElementById('btnRefreshNetwork'),
|
||||
showServerIpInput: document.getElementById('showServerIpInput'),
|
||||
// Footer & Filing
|
||||
icpFilingInput: document.getElementById('icpFilingInput'),
|
||||
psFilingInput: document.getElementById('psFilingInput'),
|
||||
@@ -539,6 +540,7 @@
|
||||
if (dom.psFilingInput) dom.psFilingInput.value = window.SITE_SETTINGS.ps_filing || '';
|
||||
if (dom.logoUrlDarkInput) dom.logoUrlDarkInput.value = window.SITE_SETTINGS.logo_url_dark || '';
|
||||
if (dom.faviconUrlInput) dom.faviconUrlInput.value = window.SITE_SETTINGS.favicon_url || '';
|
||||
if (dom.showServerIpInput) dom.showServerIpInput.value = window.SITE_SETTINGS.show_server_ip ? "1" : "0";
|
||||
// Latency routes loaded separately in openSettings or on startup
|
||||
}
|
||||
|
||||
@@ -1592,6 +1594,28 @@
|
||||
dom.detailDiskTotal.textContent = formatBytes(data.totalDiskSize || 0);
|
||||
}
|
||||
|
||||
// IP Addresses
|
||||
const infoGrid = document.getElementById('detailInfoGrid');
|
||||
if (infoGrid) {
|
||||
// Remove any previously added IP items
|
||||
infoGrid.querySelectorAll('.info-item-ip').forEach(el => el.remove());
|
||||
|
||||
if (window.SITE_SETTINGS && window.SITE_SETTINGS.show_server_ip) {
|
||||
if (data.ipv4 && data.ipv4.length > 0) {
|
||||
const ipv4Item = document.createElement('div');
|
||||
ipv4Item.className = 'info-item info-item-ip';
|
||||
ipv4Item.innerHTML = `<span class="info-label">IPv4 地址</span><span class="info-value">${escapeHtml(data.ipv4.join(', '))}</span>`;
|
||||
infoGrid.appendChild(ipv4Item);
|
||||
}
|
||||
if (data.ipv6 && data.ipv6.length > 0) {
|
||||
const ipv6Item = document.createElement('div');
|
||||
ipv6Item.className = 'info-item info-item-ip';
|
||||
ipv6Item.innerHTML = `<span class="info-label">IPv6 地址</span><span class="info-value" style="font-size: 0.65rem; word-break: break-all;">${escapeHtml(data.ipv6.join(', '))}</span>`;
|
||||
infoGrid.appendChild(ipv6Item);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Define metrics to show
|
||||
const cpuValueHtml = `
|
||||
<div style="display: flex; align-items: baseline; gap: 8px;">
|
||||
@@ -2068,7 +2092,8 @@
|
||||
p95_type: dom.p95TypeSelect ? dom.p95TypeSelect.value : 'tx',
|
||||
ps_filing: dom.psFilingInput ? dom.psFilingInput.value.trim() : '',
|
||||
icp_filing: dom.icpFilingInput ? dom.icpFilingInput.value.trim() : '',
|
||||
network_data_sources: Array.from(dom.networkSourceSelector.querySelectorAll('input[type="checkbox"]:checked')).map(cb => cb.value).join(',')
|
||||
network_data_sources: Array.from(dom.networkSourceSelector.querySelectorAll('input[type="checkbox"]:checked')).map(cb => cb.value).join(','),
|
||||
show_server_ip: dom.showServerIpInput ? (dom.showServerIpInput.value === "1") : false
|
||||
};
|
||||
|
||||
dom.btnSaveSiteSettings.disabled = true;
|
||||
|
||||
Reference in New Issue
Block a user