refactor: 全面重构前端 UI 样式
- 重构 theme.css:替换刺眼青色背景为柔和灰蓝(#eef1f6),品牌色改为靛蓝(#5b6ef5) - 统一按钮体系:主按钮36px固定高度,菜单按钮30px,表格按钮28px,尺寸协调 - 登录页:服务器地址与端口并排布局,输入框40px高度统一,卡片阴影加深 - 面板页:导航栏56px高度,内容区居中限宽1400px,滚动条美化 - 概览页:auto-fit网格+340px最小宽度防止卡片不均,进程表全宽跨列 - 进程表格:table-layout:fixed + 列宽分配 + nowrap 防止串行溢出 - 所有文字元素加 white-space:nowrap 防止换行串行 - 更新 Electron 窗口背景色匹配新主题
This commit is contained in:
+44
-1
@@ -46,7 +46,7 @@ function createWindow() {
|
||||
mainWindow = new BrowserWindow({
|
||||
width: 1280,
|
||||
height: 800,
|
||||
backgroundColor: '#d2f8fc',
|
||||
backgroundColor: '#eef1f6',
|
||||
webPreferences: {
|
||||
preload: path.join(__dirname, '../preload/index.js'),
|
||||
sandbox: false,
|
||||
@@ -121,6 +121,49 @@ ipcMain.handle('ssh:disconnect', () => {
|
||||
|
||||
ipcMain.handle('ssh:session', () => activeSession)
|
||||
|
||||
// 在活动的 SSH 连接上执行命令
|
||||
function execSsh(cmd, timeoutMs = 10000) {
|
||||
return new Promise((resolve) => {
|
||||
if (!activeConnection) {
|
||||
resolve({ ok: false, message: 'SSH 连接不存在' })
|
||||
return
|
||||
}
|
||||
|
||||
let settled = false
|
||||
let stdout = ''
|
||||
let stderr = ''
|
||||
|
||||
const timer = setTimeout(() => {
|
||||
if (!settled) {
|
||||
settled = true
|
||||
resolve({ ok: false, message: '命令执行超时' })
|
||||
}
|
||||
}, timeoutMs)
|
||||
|
||||
activeConnection.exec(cmd, (err, stream) => {
|
||||
if (err) {
|
||||
clearTimeout(timer)
|
||||
if (!settled) {
|
||||
settled = true
|
||||
resolve({ ok: false, message: err.message })
|
||||
}
|
||||
return
|
||||
}
|
||||
stream.on('data', (chunk) => (stdout += chunk.toString()))
|
||||
stream.stderr.on('data', (chunk) => (stderr += chunk.toString()))
|
||||
stream.on('close', (code) => {
|
||||
clearTimeout(timer)
|
||||
if (!settled) {
|
||||
settled = true
|
||||
resolve({ ok: true, code, stdout, stderr })
|
||||
}
|
||||
})
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
ipcMain.handle('ssh:exec', (event, { cmd, timeout }) => execSsh(cmd, timeout))
|
||||
|
||||
// ---------- IPC:凭据 ----------
|
||||
ipcMain.handle('cred:save', (event, { host, port, username, password }) => {
|
||||
const list = readCredentials()
|
||||
|
||||
Reference in New Issue
Block a user