fix: i18n, password edit, and key count issues

- Add i18n to all components (zh-CN/en)
- Fix password not showing when editing connection
- Fix key count showing 0 by adding getInfo function
This commit is contained in:
2026-07-04 22:26:32 +08:00
parent 86b0eff95b
commit 3b402771d5
13 changed files with 155 additions and 100 deletions
+19 -1
View File
@@ -45,6 +45,13 @@ export const useConnectionStore = defineStore('connection', () => {
connections.value = await window.electronAPI.storage.getConnections()
}
async function decryptPassword(auth: string): Promise<string> {
if (auth.startsWith('enc:')) {
return await window.electronAPI.credential.decrypt(auth.slice(4))
}
return auth
}
async function saveConnection(conn: ConnectionConfig) {
if (conn.auth && !conn.auth.startsWith('enc:')) {
conn.auth = 'enc:' + await window.electronAPI.credential.encrypt(conn.auth)
@@ -99,6 +106,17 @@ export const useConnectionStore = defineStore('connection', () => {
}
}
async function getInfo(): Promise<string> {
if (!activeId.value) return ''
try {
const info = await window.electronAPI.redis.getInfo(activeId.value)
serverInfo.value = info
return info
} catch {
return ''
}
}
function startHealthCheck(connId: string) {
stopHealthCheck()
healthOk.value = true
@@ -176,7 +194,7 @@ export const useConnectionStore = defineStore('connection', () => {
return {
connections, activeId, connecting, error, serverInfo, healthOk,
activeConnection, isConnected,
loadConnections, saveConnection, deleteConnection, reorderConnections,
loadConnections, decryptPassword, getInfo, saveConnection, deleteConnection, reorderConnections,
connect, disconnect, testConnection, exportConnections, importConnections,
}
})