fix: can not save scan size less than default value in preference

fix: incorrect delete pattern when flush database with any key selected
This commit is contained in:
tiny-craft 2023-10-31 22:33:58 +08:00
parent 5a29a34ea1
commit 6996421cde
2 changed files with 7 additions and 2 deletions

View File

@ -46,7 +46,9 @@ func (p *PreferencesStorage) GetPreferences() (ret types.Preferences) {
defer p.mutex.Unlock() defer p.mutex.Unlock()
ret = p.getPreferences() ret = p.getPreferences()
ret.General.ScanSize = max(ret.General.ScanSize, consts.DEFAULT_SCAN_SIZE) if ret.General.ScanSize <= 0 {
ret.General.ScanSize = consts.DEFAULT_SCAN_SIZE
}
ret.Behavior.AsideWidth = max(ret.Behavior.AsideWidth, consts.DEFAULT_ASIDE_WIDTH) ret.Behavior.AsideWidth = max(ret.Behavior.AsideWidth, consts.DEFAULT_ASIDE_WIDTH)
ret.Behavior.WindowWidth = max(ret.Behavior.WindowWidth, consts.MIN_WINDOW_WIDTH) ret.Behavior.WindowWidth = max(ret.Behavior.WindowWidth, consts.MIN_WINDOW_WIDTH)
ret.Behavior.WindowHeight = max(ret.Behavior.WindowHeight, consts.MIN_WINDOW_HEIGHT) ret.Behavior.WindowHeight = max(ret.Behavior.WindowHeight, consts.MIN_WINDOW_HEIGHT)

View File

@ -259,6 +259,9 @@ const handleSelectContextMenu = (key) => {
resetExpandKey(props.server, db, true) resetExpandKey(props.server, db, true)
connectionStore.closeDatabase(props.server, db) connectionStore.closeDatabase(props.server, db)
break break
case 'db_flush':
dialogStore.openDeleteKeyDialog(props.server, db, '*')
break
case 'db_newkey': case 'db_newkey':
case 'key_newkey': case 'key_newkey':
dialogStore.openNewKeyDialog(redisKey, props.server, db) dialogStore.openNewKeyDialog(redisKey, props.server, db)
@ -548,7 +551,7 @@ const getDatabaseMenu = (opened, loading, end) => {
tTooltip: 'interface.batch_delete', tTooltip: 'interface.batch_delete',
icon: Delete, icon: Delete,
disabled: loading === true, disabled: loading === true,
onClick: () => handleSelectContextMenu('key_remove'), onClick: () => handleSelectContextMenu('db_flush'),
}), }),
// h(IconButton, { // h(IconButton, {
// tTooltip: 'interface.more_action', // tTooltip: 'interface.more_action',