Compare commits

..

No commits in common. "77541ed3716517b32c15518d024d8847bf7670a7" and "d61eb1323f086f04495b13eb2bf675b31c74ae04" have entirely different histories.

7 changed files with 20 additions and 49 deletions

View File

@ -4,5 +4,3 @@ const DEFAULT_FONT_SIZE = 14
const DEFAULT_ASIDE_WIDTH = 300
const DEFAULT_WINDOW_WIDTH = 1024
const DEFAULT_WINDOW_HEIGHT = 768
const MIN_WINDOW_WIDTH = 960
const MIN_WINDOW_HEIGHT = 640

View File

@ -1343,37 +1343,23 @@ func (c *connectionService) DeleteKey(connName string, db int, k any, async bool
// delete by prefix
var mutex sync.Mutex
del := func(ctx context.Context, cli redis.UniversalClient) error {
handleDel := func(ks []string) error {
pipe := cli.Pipeline()
for _, k2 := range ks {
if async {
cli.Unlink(ctx, k2)
} else {
cli.Del(ctx, k2)
}
}
pipe.Exec(ctx)
mutex.Lock()
deletedKeys = append(deletedKeys, ks...)
mutex.Unlock()
return nil
}
iter := cli.Scan(ctx, 0, key, 10000).Iterator()
resultKeys := make([]string, 0, 100)
var fn func(c context.Context, ks ...string) *redis.IntCmd
if async {
fn = cli.Unlink
} else {
fn = cli.Del
}
for iter.Next(ctx) {
resultKeys = append(resultKeys, iter.Val())
if len(resultKeys) >= 3 {
handleDel(resultKeys)
resultKeys = resultKeys[:0:cap(resultKeys)]
subKey := iter.Val()
if err = fn(ctx, subKey).Err(); err != nil {
return err
} else {
mutex.Lock()
deletedKeys = append(deletedKeys, subKey)
mutex.Unlock()
}
}
if len(resultKeys) > 0 {
handleDel(resultKeys)
}
return nil
}

View File

@ -113,7 +113,7 @@ func (p *preferencesService) GetAppVersion() (resp types.JSResp) {
}
func (p *preferencesService) SaveWindowSize(width, height int) {
if width >= consts.MIN_WINDOW_WIDTH && height >= consts.MIN_WINDOW_HEIGHT {
if width >= consts.DEFAULT_WINDOW_WIDTH && height >= consts.DEFAULT_WINDOW_HEIGHT {
p.UpdatePreferences(map[string]any{
"behavior.windowWidth": width,
"behavior.windowHeight": height,

View File

@ -6,7 +6,6 @@ import (
"log"
"sync"
"time"
"tinyrdm/backend/consts"
"tinyrdm/backend/types"
)
@ -29,18 +28,6 @@ func System() *systemService {
func (s *systemService) Start(ctx context.Context) {
s.ctx = ctx
// maximize the window if screen size is lower than the minimum window size
if screen, err := runtime.ScreenGetAll(ctx); err == nil && len(screen) > 0 {
for _, sc := range screen {
if sc.IsCurrent {
if sc.Size.Width < consts.MIN_WINDOW_WIDTH || sc.Size.Height < consts.MIN_WINDOW_HEIGHT {
runtime.WindowMaximise(ctx)
break
}
}
}
}
}
// SelectFile open file dialog to select a file

View File

@ -47,8 +47,8 @@ func (p *PreferencesStorage) GetPreferences() (ret types.Preferences) {
ret = p.getPreferences()
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)
ret.Behavior.WindowWidth = max(ret.Behavior.WindowWidth, consts.DEFAULT_WINDOW_WIDTH)
ret.Behavior.WindowHeight = max(ret.Behavior.WindowHeight, consts.DEFAULT_WINDOW_HEIGHT)
return
}

View File

@ -529,7 +529,7 @@ const getValueMenu = () => {
// render menu function icon
const renderSuffix = ({ option }) => {
if ((option.type === ConnectionType.RedisDB && option.opened) || includes(selectedKeys.value, option.key)) {
if (includes(selectedKeys.value, option.key)) {
switch (option.type) {
case ConnectionType.RedisDB:
return renderIconMenu(getDatabaseMenu(option.opened))

View File

@ -44,8 +44,8 @@ func main() {
Title: "Tiny RDM",
Width: windowWidth,
Height: windowHeight,
MinWidth: consts.MIN_WINDOW_WIDTH,
MinHeight: consts.MIN_WINDOW_HEIGHT,
MinWidth: consts.DEFAULT_WINDOW_WIDTH,
MinHeight: consts.DEFAULT_WINDOW_HEIGHT,
Frameless: runtime.GOOS != "darwin",
Menu: appMenu,
AssetServer: &assetserver.Options{