feat: 自动提交 - 周一 2025/09/22 14:48:02.54
This commit is contained in:
@@ -21,6 +21,14 @@ const translations = {
|
|||||||
'sidebar-feishu-sync': '飞书同步',
|
'sidebar-feishu-sync': '飞书同步',
|
||||||
'sidebar-system': '系统设置',
|
'sidebar-system': '系统设置',
|
||||||
|
|
||||||
|
// 预警管理页面
|
||||||
|
'alerts-critical': '严重预警',
|
||||||
|
'alerts-warning': '警告预警',
|
||||||
|
'alerts-info': '信息预警',
|
||||||
|
'alerts-total': '总预警数',
|
||||||
|
'alerts-active': '活跃预警',
|
||||||
|
'alerts-resolve': '解决',
|
||||||
|
|
||||||
// 设置页面
|
// 设置页面
|
||||||
'settings-title': '系统设置',
|
'settings-title': '系统设置',
|
||||||
'settings-basic': '基础设置',
|
'settings-basic': '基础设置',
|
||||||
@@ -54,6 +62,14 @@ const translations = {
|
|||||||
'sidebar-feishu-sync': 'Feishu Sync',
|
'sidebar-feishu-sync': 'Feishu Sync',
|
||||||
'sidebar-system': 'System Settings',
|
'sidebar-system': 'System Settings',
|
||||||
|
|
||||||
|
// Alert Management page
|
||||||
|
'alerts-critical': 'Critical Alerts',
|
||||||
|
'alerts-warning': 'Warning Alerts',
|
||||||
|
'alerts-info': 'Info Alerts',
|
||||||
|
'alerts-total': 'Total Alerts',
|
||||||
|
'alerts-active': 'Active Alerts',
|
||||||
|
'alerts-resolve': 'Resolve',
|
||||||
|
|
||||||
// Settings page
|
// Settings page
|
||||||
'settings-title': 'System Settings',
|
'settings-title': 'System Settings',
|
||||||
'settings-basic': 'Basic Settings',
|
'settings-basic': 'Basic Settings',
|
||||||
@@ -88,48 +104,35 @@ function updatePageLanguage(lang) {
|
|||||||
const t = translations[lang];
|
const t = translations[lang];
|
||||||
if (!t) return;
|
if (!t) return;
|
||||||
|
|
||||||
// 更新导航栏
|
// 更新所有带有 data-i18n 属性的元素
|
||||||
document.querySelector('.navbar-brand').innerHTML = `<i class="fas fa-robot me-2"></i>${t['nav-title']}`;
|
const elements = document.querySelectorAll('[data-i18n]');
|
||||||
|
elements.forEach(element => {
|
||||||
// 更新侧边栏
|
const key = element.getAttribute('data-i18n');
|
||||||
const sidebarItems = [
|
if (t[key]) {
|
||||||
{ selector: '[data-i18n="sidebar-dashboard"]', key: 'sidebar-dashboard' },
|
element.textContent = t[key];
|
||||||
{ selector: '[data-i18n="sidebar-conversations"]', key: 'sidebar-conversations' },
|
|
||||||
{ selector: '[data-i18n="sidebar-agent"]', key: 'sidebar-agent' },
|
|
||||||
{ selector: '[data-i18n="sidebar-alerts"]', key: 'sidebar-alerts' },
|
|
||||||
{ selector: '[data-i18n="sidebar-knowledge"]', key: 'sidebar-knowledge' },
|
|
||||||
{ selector: '[data-i18n="sidebar-workorders"]', key: 'sidebar-workorders' },
|
|
||||||
{ selector: '[data-i18n="sidebar-feishu-sync"]', key: 'sidebar-feishu-sync' },
|
|
||||||
{ selector: '[data-i18n="sidebar-system"]', key: 'sidebar-system' }
|
|
||||||
];
|
|
||||||
|
|
||||||
sidebarItems.forEach(item => {
|
|
||||||
const element = document.querySelector(item.selector);
|
|
||||||
if (element) {
|
|
||||||
element.textContent = t[item.key];
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
// 更新设置页面
|
// 更新导航栏标题(特殊处理,因为包含图标)
|
||||||
const settingsElements = [
|
const navBrand = document.querySelector('.navbar-brand');
|
||||||
{ selector: '[data-i18n="settings-title"]', key: 'settings-title' },
|
if (navBrand) {
|
||||||
{ selector: '[data-i18n="settings-basic"]', key: 'settings-basic' },
|
const icon = navBrand.querySelector('i');
|
||||||
{ selector: '[data-i18n="settings-system-info"]', key: 'settings-system-info' },
|
if (icon) {
|
||||||
{ selector: '[data-i18n="settings-log-config"]', key: 'settings-log-config' },
|
navBrand.innerHTML = `<i class="fas fa-robot me-2"></i>${t['nav-title']}`;
|
||||||
{ selector: '[data-i18n="settings-current-port"]', key: 'settings-current-port' },
|
|
||||||
{ selector: '[data-i18n="settings-websocket-port"]', key: 'settings-websocket-port' },
|
|
||||||
{ selector: '[data-i18n="settings-log-level"]', key: 'settings-log-level' },
|
|
||||||
{ selector: '[data-i18n="settings-save"]', key: 'settings-save' },
|
|
||||||
{ selector: '[data-i18n="settings-port-note"]', key: 'settings-port-note' },
|
|
||||||
{ selector: '[data-i18n="settings-log-note"]', key: 'settings-log-note' }
|
|
||||||
];
|
|
||||||
|
|
||||||
settingsElements.forEach(item => {
|
|
||||||
const element = document.querySelector(item.selector);
|
|
||||||
if (element) {
|
|
||||||
element.textContent = t[item.key];
|
|
||||||
}
|
}
|
||||||
});
|
}
|
||||||
|
|
||||||
|
// 更新当前标签页标题
|
||||||
|
const currentTabTitle = document.getElementById('current-tab-title');
|
||||||
|
if (currentTabTitle) {
|
||||||
|
const currentTab = document.querySelector('.nav-link.active');
|
||||||
|
if (currentTab) {
|
||||||
|
const tabKey = currentTab.getAttribute('data-i18n');
|
||||||
|
if (tabKey && t[tabKey]) {
|
||||||
|
currentTabTitle.textContent = t[tabKey];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
class TSPDashboard {
|
class TSPDashboard {
|
||||||
|
|||||||
@@ -372,7 +372,7 @@
|
|||||||
<div class="container-fluid">
|
<div class="container-fluid">
|
||||||
<a class="navbar-brand" href="#">
|
<a class="navbar-brand" href="#">
|
||||||
<i class="fas fa-robot me-2"></i>
|
<i class="fas fa-robot me-2"></i>
|
||||||
TSP智能助手
|
<span data-i18n="nav-title">TSP智能助手</span>
|
||||||
</a>
|
</a>
|
||||||
<div class="navbar-nav ms-auto">
|
<div class="navbar-nav ms-auto">
|
||||||
<div class="btn-group me-3" role="group">
|
<div class="btn-group me-3" role="group">
|
||||||
@@ -385,7 +385,7 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="health-indicator">
|
<div class="health-indicator">
|
||||||
<div class="health-dot" id="health-dot"></div>
|
<div class="health-dot" id="health-dot"></div>
|
||||||
<span id="health-status">检查中...</span>
|
<span id="health-status" data-i18n="nav-health-checking">检查中...</span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -413,7 +413,7 @@
|
|||||||
<i class="fas fa-brain"></i>
|
<i class="fas fa-brain"></i>
|
||||||
Agent管理
|
Agent管理
|
||||||
</a>
|
</a>
|
||||||
<a class="nav-link" href="#alerts" data-tab="alerts">
|
<a class="nav-link" href="#alerts" data-tab="alerts" data-i18n="sidebar-alerts">
|
||||||
<i class="fas fa-bell"></i>
|
<i class="fas fa-bell"></i>
|
||||||
预警管理
|
预警管理
|
||||||
</a>
|
</a>
|
||||||
@@ -820,7 +820,7 @@
|
|||||||
<div class="d-flex justify-content-between">
|
<div class="d-flex justify-content-between">
|
||||||
<div>
|
<div>
|
||||||
<h4 id="critical-alerts">0</h4>
|
<h4 id="critical-alerts">0</h4>
|
||||||
<p class="mb-0">严重预警</p>
|
<p class="mb-0" data-i18n="alerts-critical">严重预警</p>
|
||||||
</div>
|
</div>
|
||||||
<div class="align-self-center">
|
<div class="align-self-center">
|
||||||
<i class="fas fa-exclamation-triangle fa-2x"></i>
|
<i class="fas fa-exclamation-triangle fa-2x"></i>
|
||||||
@@ -835,7 +835,7 @@
|
|||||||
<div class="d-flex justify-content-between">
|
<div class="d-flex justify-content-between">
|
||||||
<div>
|
<div>
|
||||||
<h4 id="warning-alerts">0</h4>
|
<h4 id="warning-alerts">0</h4>
|
||||||
<p class="mb-0">警告预警</p>
|
<p class="mb-0" data-i18n="alerts-warning">警告预警</p>
|
||||||
</div>
|
</div>
|
||||||
<div class="align-self-center">
|
<div class="align-self-center">
|
||||||
<i class="fas fa-exclamation-circle fa-2x"></i>
|
<i class="fas fa-exclamation-circle fa-2x"></i>
|
||||||
@@ -850,7 +850,7 @@
|
|||||||
<div class="d-flex justify-content-between">
|
<div class="d-flex justify-content-between">
|
||||||
<div>
|
<div>
|
||||||
<h4 id="info-alerts">0</h4>
|
<h4 id="info-alerts">0</h4>
|
||||||
<p class="mb-0">信息预警</p>
|
<p class="mb-0" data-i18n="alerts-info">信息预警</p>
|
||||||
</div>
|
</div>
|
||||||
<div class="align-self-center">
|
<div class="align-self-center">
|
||||||
<i class="fas fa-info-circle fa-2x"></i>
|
<i class="fas fa-info-circle fa-2x"></i>
|
||||||
@@ -865,7 +865,7 @@
|
|||||||
<div class="d-flex justify-content-between">
|
<div class="d-flex justify-content-between">
|
||||||
<div>
|
<div>
|
||||||
<h4 id="total-alerts-count">0</h4>
|
<h4 id="total-alerts-count">0</h4>
|
||||||
<p class="mb-0">总预警数</p>
|
<p class="mb-0" data-i18n="alerts-total">总预警数</p>
|
||||||
</div>
|
</div>
|
||||||
<div class="align-self-center">
|
<div class="align-self-center">
|
||||||
<i class="fas fa-chart-line fa-2x"></i>
|
<i class="fas fa-chart-line fa-2x"></i>
|
||||||
|
|||||||
Reference in New Issue
Block a user