feat: 新增设备巡检模块实现完整的巡检告警功能

新增设备巡检模块核心功能,包括:
- 巡检数据存储与调度系统
- 华为/H3C交换机及Linux服务器采集器
- 设备扩展配置与告警规则管理
- 主机详情页巡检配置入口
- 产品名称自定义设置功能
- 网络设备SSH exec通道兼容处理
This commit is contained in:
2026-10-09 10:37:48 +08:00
parent 9202506c46
commit c64e00d835
75 changed files with 12087 additions and 446 deletions

View File

@@ -10,6 +10,9 @@ const { safeSend } = require("./ipcUtils.cjs");
const V8_CACHE_OPTIONS = "bypassHeatCheck";
// 默认产品名称(可通过环境变量 NETCATTY_PRODUCT_NAME 覆盖)
const DEFAULT_PRODUCT_NAME = process.env.NETCATTY_PRODUCT_NAME || "NetMesh";
function getGlobalShortcutBridge() {
return require("./globalShortcutBridge.cjs");
}
@@ -1073,6 +1076,17 @@ function registerWindowHandlers(ipcMain, nativeTheme) {
return false;
});
ipcMain.handle("netcatty:window:fullscreen", (event, shouldFullscreen) => {
const win = getWindowForIpcEvent(event);
if (win && !win.isDestroyed()) {
const next = typeof shouldFullscreen === 'boolean' ? shouldFullscreen : !win.isFullScreen();
debugLog("window:fullscreen", { senderId: event?.sender?.id, windowId: win.webContents?.id, next });
win.setFullScreen(next);
return next;
}
return false;
});
ipcMain.handle("netcatty:window:close", (event) => {
try {
if (typeof menuDeps?.isAppLocked === "function" && menuDeps.isAppLocked()) {
@@ -1121,17 +1135,39 @@ function registerWindowHandlers(ipcMain, nativeTheme) {
ipcMain.handle("netcatty:window:setTitle", (event, title) => {
const win = getWindowForIpcEvent(event);
if (!win || win.isDestroyed()) return false;
console.log('[windowManager] setTitle called, win:', !!win, 'title:', title);
if (!win || win.isDestroyed()) {
console.log('[windowManager] setTitle failed: no window');
return false;
}
try {
if (typeof menuDeps?.setAppLockWindowTitle === "function") {
return menuDeps.setAppLockWindowTitle(win, title) === true;
}
} catch {
} catch (e) {
console.log('[windowManager] setAppLockWindowTitle error:', e);
// Ignore title-guard failures and keep normal title behavior.
}
const value = typeof title === "string" ? title.trim() : "";
console.log('[windowManager] setting title to:', value || DEFAULT_PRODUCT_NAME);
try {
win.setTitle(value || "Netcatty");
win.setTitle(value || DEFAULT_PRODUCT_NAME);
console.log('[windowManager] title set successfully');
return true;
} catch (e) {
console.log('[windowManager] setTitle error:', e);
return false;
}
});
// 更新窗口标题(当 productName 变化时调用)
ipcMain.handle("netcatty:window:updateTitle", (event) => {
const win = getWindowForIpcEvent(event);
if (!win || win.isDestroyed()) return false;
try {
// 从存储中读取 productName(如果有的话)
// 但这里主进程无法访问渲染进程的 localStorage,所以暂时使用默认值
// 实际标题由渲染进程通过 setTitle 设置
return true;
} catch {
return false;