Skip to content

Commit

Permalink
fix: can not save scan size less than default value in preference
Browse files Browse the repository at this point in the history
fix: incorrect delete pattern when flush database with any key selected
  • Loading branch information
tiny-craft committed Oct 31, 2023
1 parent 5a29a34 commit 6996421
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
4 changes: 3 additions & 1 deletion backend/storage/preferences.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,9 @@ func (p *PreferencesStorage) GetPreferences() (ret types.Preferences) {
defer p.mutex.Unlock()

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.WindowWidth = max(ret.Behavior.WindowWidth, consts.MIN_WINDOW_WIDTH)
ret.Behavior.WindowHeight = max(ret.Behavior.WindowHeight, consts.MIN_WINDOW_HEIGHT)
Expand Down
5 changes: 4 additions & 1 deletion frontend/src/components/sidebar/BrowserTree.vue
Original file line number Diff line number Diff line change
Expand Up @@ -259,6 +259,9 @@ const handleSelectContextMenu = (key) => {
resetExpandKey(props.server, db, true)
connectionStore.closeDatabase(props.server, db)
break
case 'db_flush':
dialogStore.openDeleteKeyDialog(props.server, db, '*')
break
case 'db_newkey':
case 'key_newkey':
dialogStore.openNewKeyDialog(redisKey, props.server, db)
Expand Down Expand Up @@ -548,7 +551,7 @@ const getDatabaseMenu = (opened, loading, end) => {
tTooltip: 'interface.batch_delete',
icon: Delete,
disabled: loading === true,
onClick: () => handleSelectContextMenu('key_remove'),
onClick: () => handleSelectContextMenu('db_flush'),
}),
// h(IconButton, {
// tTooltip: 'interface.more_action',
Expand Down

0 comments on commit 6996421

Please sign in to comment.