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:
@@ -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,
|
||||
}
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user