refactor: Scan Count 从全局设置移到连接配置
- ConnectionConfig 新增 scanCount 字段 (默认 100) - NewConnectionDialog 基本信息区新增 Scan Count 输入框 - key.ts 改为从 activeConnection.scanCount 读取 - SettingsView 移除 Scan Count 设置项 - app store 移除 scanCount 和 setScanCount - 主进程 store ConnectionConfig 同步新增字段
This commit is contained in:
@@ -26,6 +26,7 @@ interface ConnectionConfig {
|
||||
sentinelMasterName: string
|
||||
sentinelNodePassword: string
|
||||
separator: string
|
||||
scanCount?: number
|
||||
order: number
|
||||
createdAt: number
|
||||
color?: string
|
||||
|
||||
@@ -28,6 +28,7 @@ const form = reactive({
|
||||
sentinelNodePassword: '',
|
||||
cluster: false,
|
||||
separator: ':',
|
||||
scanCount: 100,
|
||||
sshEnabled: false,
|
||||
sshHost: '',
|
||||
sshPort: 22,
|
||||
@@ -66,6 +67,7 @@ watch(() => props.visible, async (v) => {
|
||||
sentinelNodePassword: props.connection.sentinelNodePassword || '',
|
||||
cluster: props.connection.cluster || false,
|
||||
separator: props.connection.separator,
|
||||
scanCount: props.connection.scanCount ?? 100,
|
||||
sshEnabled: props.connection.sshEnabled || false,
|
||||
sshHost: props.connection.sshHost || '',
|
||||
sshPort: props.connection.sshPort || 22,
|
||||
@@ -84,6 +86,7 @@ watch(() => props.visible, async (v) => {
|
||||
sentinelMasterName: '', sentinelNodePassword: '',
|
||||
cluster: false,
|
||||
separator: ':',
|
||||
scanCount: 100,
|
||||
sshEnabled: false, sshHost: '', sshPort: 22,
|
||||
sshUsername: '', sshPassword: '', sshPrivateKeyPath: '', sshPassphrase: '',
|
||||
})
|
||||
@@ -203,6 +206,7 @@ async function handleSave() {
|
||||
sshPrivateKeyPath: form.sshPrivateKeyPath,
|
||||
sshPassphrase: form.sshPassphrase,
|
||||
separator: form.separator || ':',
|
||||
scanCount: form.scanCount,
|
||||
order: props.connection?.order ?? connStore.connections.length,
|
||||
createdAt: props.connection?.createdAt ?? Date.now(),
|
||||
}
|
||||
@@ -258,6 +262,9 @@ async function handleSave() {
|
||||
<el-form-item label="Key Separator">
|
||||
<el-input v-model="form.separator" placeholder=":" class="form-input" />
|
||||
</el-form-item>
|
||||
<el-form-item label="Scan Count">
|
||||
<el-input-number v-model="form.scanCount" :min="10" :max="10000" :step="10" controls-position="right" class="form-input" />
|
||||
</el-form-item>
|
||||
</div>
|
||||
</div>
|
||||
<!-- Advanced Options -->
|
||||
|
||||
@@ -50,18 +50,6 @@ const fontOptions = [
|
||||
</el-select>
|
||||
</div>
|
||||
|
||||
<div class="settings-group">
|
||||
<label class="settings-label">{{ t('settings.scanCount') }}</label>
|
||||
<el-input-number
|
||||
:model-value="appStore.scanCount"
|
||||
@change="appStore.setScanCount($event || 100)"
|
||||
:min="10"
|
||||
:max="10000"
|
||||
:step="10"
|
||||
size="small"
|
||||
/>
|
||||
</div>
|
||||
|
||||
<div class="settings-group">
|
||||
<label class="settings-label">{{ t('settings.fontSize') }}</label>
|
||||
<el-input-number
|
||||
|
||||
@@ -7,7 +7,6 @@ export const useAppStore = defineStore('app', () => {
|
||||
const theme = ref<ThemeMode>((localStorage.getItem('theme') as ThemeMode) || 'system')
|
||||
const isDark = ref(true)
|
||||
const fontSize = ref<number>(Number(localStorage.getItem('fontSize')) || 13)
|
||||
const scanCount = ref<number>(Number(localStorage.getItem('scanCount')) || 100)
|
||||
const zoom = ref<number>(Number(localStorage.getItem('zoom')) || 1.0)
|
||||
const fontFamily = ref<string>(localStorage.getItem('fontFamily') || 'Cascadia Code')
|
||||
|
||||
@@ -41,11 +40,6 @@ export const useAppStore = defineStore('app', () => {
|
||||
localStorage.setItem('fontSize', String(size))
|
||||
}
|
||||
|
||||
function setScanCount(count: number) {
|
||||
scanCount.value = count
|
||||
localStorage.setItem('scanCount', String(count))
|
||||
}
|
||||
|
||||
function setZoom(value: number) {
|
||||
zoom.value = value
|
||||
localStorage.setItem('zoom', String(value))
|
||||
@@ -62,5 +56,5 @@ export const useAppStore = defineStore('app', () => {
|
||||
document.body.style.zoom = String(zoom.value)
|
||||
document.documentElement.style.setProperty('--font-mono', fontFamily.value)
|
||||
|
||||
return { theme, isDark, fontSize, scanCount, zoom, fontFamily, setTheme, setFontSize, setScanCount, setZoom, setFontFamily }
|
||||
return { theme, isDark, fontSize, zoom, fontFamily, setTheme, setFontSize, setZoom, setFontFamily }
|
||||
})
|
||||
|
||||
@@ -27,6 +27,7 @@ export interface ConnectionConfig {
|
||||
sentinelMasterName: string
|
||||
sentinelNodePassword: string
|
||||
separator: string
|
||||
scanCount?: number
|
||||
order: number
|
||||
createdAt: number
|
||||
color?: string
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { defineStore } from 'pinia'
|
||||
import { ref } from 'vue'
|
||||
import { useAppStore } from './app'
|
||||
import { useConnectionStore } from './connection'
|
||||
|
||||
export interface KeyItem {
|
||||
name: string
|
||||
@@ -93,7 +93,7 @@ export const useKeyStore = defineStore('key', () => {
|
||||
loading.value = true
|
||||
try {
|
||||
const result: ScanResult = await window.electronAPI.redis.scanKeys(
|
||||
connId, cursor, pattern.value, useAppStore().scanCount
|
||||
connId, cursor, pattern.value, useConnectionStore().activeConnection?.scanCount ?? 100
|
||||
)
|
||||
const newKeys = result.keys.map(k => ({
|
||||
name: k,
|
||||
|
||||
Reference in New Issue
Block a user