From 827ca1f2e7d51de3ed560f28f304d4e48986e92c Mon Sep 17 00:00:00 2001 From: Lykin <137850705+tiny-craft@users.noreply.github.com> Date: Tue, 5 Dec 2023 12:03:00 +0800 Subject: [PATCH] feat: support more key icon display type --- backend/storage/connections.go | 2 +- backend/storage/preferences.go | 2 +- backend/types/preferences.go | 14 +++--- .../src/components/common/RedisTypeTag.vue | 14 ++++++ .../components/dialogs/PreferencesDialog.vue | 28 ++++++++---- .../src/components/sidebar/BrowserTree.vue | 44 ++++++++++++++++--- frontend/src/consts/support_redis_type.js | 11 +++++ frontend/src/langs/en-us.json | 5 +++ frontend/src/langs/zh-cn.json | 5 +++ frontend/src/stores/preferences.js | 8 +++- 10 files changed, 109 insertions(+), 24 deletions(-) diff --git a/backend/storage/connections.go b/backend/storage/connections.go index 07955c9..4065441 100644 --- a/backend/storage/connections.go +++ b/backend/storage/connections.go @@ -47,8 +47,8 @@ func (c *ConnectionsStorage) defaultConnectionItem() types.ConnectionConfig { func (c *ConnectionsStorage) getConnections() (ret types.Connections) { b, err := c.storage.Load() + ret = c.defaultConnections() if err != nil { - ret = c.defaultConnections() return } diff --git a/backend/storage/preferences.go b/backend/storage/preferences.go index 6778343..8ca03a0 100644 --- a/backend/storage/preferences.go +++ b/backend/storage/preferences.go @@ -28,8 +28,8 @@ func (p *PreferencesStorage) DefaultPreferences() types.Preferences { func (p *PreferencesStorage) getPreferences() (ret types.Preferences) { b, err := p.storage.Load() + ret = p.DefaultPreferences() if err != nil { - ret = p.DefaultPreferences() return } diff --git a/backend/types/preferences.go b/backend/types/preferences.go index 907403a..dc02db0 100644 --- a/backend/types/preferences.go +++ b/backend/types/preferences.go @@ -16,11 +16,12 @@ func NewPreferences() Preferences { WindowHeight: consts.DEFAULT_WINDOW_HEIGHT, }, General: PreferencesGeneral{ - Theme: "auto", - Language: "auto", - FontSize: consts.DEFAULT_FONT_SIZE, - ScanSize: consts.DEFAULT_SCAN_SIZE, - CheckUpdate: true, + Theme: "auto", + Language: "auto", + FontSize: consts.DEFAULT_FONT_SIZE, + ScanSize: consts.DEFAULT_SCAN_SIZE, + KeyIconStyle: 0, + CheckUpdate: true, }, Editor: PreferencesEditor{ FontSize: consts.DEFAULT_FONT_SIZE, @@ -42,6 +43,7 @@ type PreferencesGeneral struct { Font string `json:"font" yaml:"font,omitempty"` FontSize int `json:"fontSize" yaml:"font_size"` ScanSize int `json:"scanSize" yaml:"scan_size"` + KeyIconStyle int `json:"keyIconStyle" yaml:"key_icon_style"` UseSysProxy bool `json:"useSysProxy" yaml:"use_sys_proxy,omitempty"` UseSysProxyHttp bool `json:"useSysProxyHttp" yaml:"use_sys_proxy_http,omitempty"` CheckUpdate bool `json:"checkUpdate" yaml:"check_update"` @@ -51,5 +53,5 @@ type PreferencesGeneral struct { type PreferencesEditor struct { Font string `json:"font" yaml:"font,omitempty"` FontSize int `json:"fontSize" yaml:"font_size"` - ShowLineNum bool `json:"showLineNum" yaml:"show_line_num,omitempty"` + ShowLineNum bool `json:"showLineNum" yaml:"show_line_num"` } diff --git a/frontend/src/components/common/RedisTypeTag.vue b/frontend/src/components/common/RedisTypeTag.vue index 1862c56..b78a40b 100644 --- a/frontend/src/components/common/RedisTypeTag.vue +++ b/frontend/src/components/common/RedisTypeTag.vue @@ -12,6 +12,11 @@ const props = defineProps({ binaryKey: Boolean, size: String, short: Boolean, + point: Boolean, + pointSize: { + type: Number, + default: 14, + }, round: Boolean, inverse: Boolean, }) @@ -41,7 +46,16 @@ const label = computed(() => {