feat: Cluster mode support

- NewConnectionDialog: cluster checkbox
- connection.ts: use Redis.Cluster() when cluster is enabled
- i18n keys for cluster (zh-CN + en)
This commit is contained in:
2026-07-05 21:20:42 +08:00
parent e46d6a80be
commit 169017df65
6 changed files with 54 additions and 3 deletions
+11 -2
View File
@@ -27,6 +27,7 @@ const form = reactive({
sentinelPort: 26379,
sentinelMasterName: '',
sentinelNodePassword: '',
cluster: false,
separator: ':',
sshEnabled: false,
sshHost: '',
@@ -62,6 +63,7 @@ watch(() => props.visible, async (v) => {
sentinelPort: props.connection.sentinelPort || 26379,
sentinelMasterName: props.connection.sentinelMasterName || '',
sentinelNodePassword: props.connection.sentinelNodePassword || '',
cluster: props.connection.cluster || false,
separator: props.connection.separator,
sshEnabled: props.connection.sshEnabled || false,
sshHost: props.connection.sshHost || '',
@@ -79,6 +81,7 @@ watch(() => props.visible, async (v) => {
tlsRejectUnauthorized: false,
sentinelEnabled: false, sentinelHost: '', sentinelPort: 26379,
sentinelMasterName: '', sentinelNodePassword: '',
cluster: false,
separator: ':',
sshEnabled: false, sshHost: '', sshPort: 22,
sshUsername: '', sshPassword: '', sshPrivateKeyPath: '', sshPassphrase: '',
@@ -147,6 +150,7 @@ async function handleTest() {
sentinelPort: Number(form.sentinelPort) || 26379,
sentinelMasterName: form.sentinelMasterName.trim(),
sentinelNodePassword: form.sentinelNodePassword,
cluster: form.cluster,
sshEnabled: form.sshEnabled,
sshHost: form.sshHost.trim(),
sshPort: Number(form.sshPort) || 22,
@@ -189,6 +193,7 @@ async function handleSave() {
sentinelPort: Number(form.sentinelPort) || 26379,
sentinelMasterName: form.sentinelMasterName.trim(),
sentinelNodePassword: form.sentinelNodePassword,
cluster: form.cluster,
sshEnabled: form.sshEnabled,
sshHost: form.sshHost.trim(),
sshPort: Number(form.sshPort) || 22,
@@ -196,8 +201,6 @@ async function handleSave() {
sshPassword: form.sshPassword,
sshPrivateKeyPath: form.sshPrivateKeyPath,
sshPassphrase: form.sshPassphrase,
cluster: false,
sentinelMasterName: '',
separator: form.separator || ':',
order: props.connection?.order ?? connStore.connections.length,
createdAt: props.connection?.createdAt ?? Date.now(),
@@ -299,6 +302,12 @@ async function handleSave() {
</el-form-item>
</template>
<!-- Cluster -->
<el-divider />
<el-form-item>
<el-checkbox v-model="form.cluster">{{ t('connection.cluster') }}</el-checkbox>
</el-form-item>
<!-- SSH Tunnel -->
<el-divider />
<el-form-item>
+1
View File
@@ -39,6 +39,7 @@ export default {
sentinelPort: 'Sentinel Port',
sentinelMasterName: 'Master Name',
sentinelNodePassword: 'Sentinel Password',
cluster: 'Cluster Mode',
ssh: 'SSH Tunnel',
sshHost: 'SSH Host',
sshPort: 'SSH Port',
+1
View File
@@ -39,6 +39,7 @@ export default {
sentinelPort: '哨兵端口',
sentinelMasterName: 'Master 名称',
sentinelNodePassword: '哨兵密码',
cluster: 'Cluster 集群模式',
ssh: 'SSH 隧道',
sshHost: 'SSH 主机',
sshPort: 'SSH 端口',
+3
View File
@@ -97,6 +97,7 @@ export const useConnectionStore = defineStore('connection', () => {
sentinelPort: conn.sentinelPort,
sentinelMasterName: conn.sentinelMasterName,
sentinelNodePassword: conn.sentinelNodePassword,
cluster: conn.cluster,
sshEnabled: conn.sshEnabled,
sshHost: conn.sshHost,
sshPort: conn.sshPort,
@@ -168,6 +169,7 @@ export const useConnectionStore = defineStore('connection', () => {
tlsCaPath?: string; tlsCertPath?: string; tlsKeyPath?: string; tlsRejectUnauthorized?: boolean
sentinelEnabled?: boolean; sentinelHost?: string; sentinelPort?: number
sentinelMasterName?: string; sentinelNodePassword?: string
cluster?: boolean
sshEnabled?: boolean; sshHost?: string; sshPort?: number; sshUsername?: string
sshPassword?: string; sshPrivateKeyPath?: string; sshPassphrase?: string
}): Promise<{ success: boolean; error?: string }> {
@@ -191,6 +193,7 @@ export const useConnectionStore = defineStore('connection', () => {
sentinelPort: opts.sentinelPort,
sentinelMasterName: opts.sentinelMasterName,
sentinelNodePassword: opts.sentinelNodePassword,
cluster: opts.cluster,
sshEnabled: opts.sshEnabled,
sshHost: opts.sshHost,
sshPort: opts.sshPort,