Compare commits
1 Commits
7c3e17dcc5
...
66a4010a57
Author | SHA1 | Date |
---|---|---|
云溪 | 66a4010a57 |
|
@ -156,17 +156,16 @@ func (b *browserService) OpenConnection(name string) (resp types.JSResp) {
|
||||||
} else {
|
} else {
|
||||||
// get database info
|
// get database info
|
||||||
var res string
|
var res string
|
||||||
info := map[string]map[string]string{}
|
res, err = client.Info(ctx, "keyspace").Result()
|
||||||
if res, err = client.Info(ctx, "keyspace").Result(); err != nil {
|
if err != nil {
|
||||||
//resp.Msg = "get server info fail:" + err.Error()
|
resp.Msg = "get server info fail:" + err.Error()
|
||||||
//return
|
return
|
||||||
} else {
|
|
||||||
info = b.parseInfo(res)
|
|
||||||
}
|
}
|
||||||
|
info := b.parseInfo(res)
|
||||||
|
|
||||||
if totaldb <= 0 {
|
if totaldb <= 0 {
|
||||||
// cannot retrieve the database count by "CONFIG GET databases", try to get max index from keyspace
|
// cannot retrieve the database count by "CONFIG GET databases", try to get max index from keyspace
|
||||||
if keyspace := info["Keyspace"]; len(keyspace) > 0 {
|
keyspace := info["Keyspace"]
|
||||||
var db, maxDB int
|
var db, maxDB int
|
||||||
for dbName := range keyspace {
|
for dbName := range keyspace {
|
||||||
if db, err = strconv.Atoi(strings.TrimLeft(dbName, "db")); err == nil {
|
if db, err = strconv.Atoi(strings.TrimLeft(dbName, "db")); err == nil {
|
||||||
|
@ -177,7 +176,6 @@ func (b *browserService) OpenConnection(name string) (resp types.JSResp) {
|
||||||
}
|
}
|
||||||
totaldb = maxDB + 1
|
totaldb = maxDB + 1
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
queryDB := func(idx int) types.ConnectionDB {
|
queryDB := func(idx int) types.ConnectionDB {
|
||||||
dbName := "db" + strconv.Itoa(idx)
|
dbName := "db" + strconv.Itoa(idx)
|
||||||
|
|
|
@ -6,7 +6,6 @@ import (
|
||||||
"github.com/adrg/sysfont"
|
"github.com/adrg/sysfont"
|
||||||
runtime2 "github.com/wailsapp/wails/v2/pkg/runtime"
|
runtime2 "github.com/wailsapp/wails/v2/pkg/runtime"
|
||||||
"net/http"
|
"net/http"
|
||||||
"os"
|
|
||||||
"sort"
|
"sort"
|
||||||
"strings"
|
"strings"
|
||||||
"sync"
|
"sync"
|
||||||
|
@ -51,7 +50,6 @@ func (p *preferencesService) SetPreferences(pf types.Preferences) (resp types.JS
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
p.UpdateEnv()
|
|
||||||
resp.Success = true
|
resp.Success = true
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
@ -116,11 +114,6 @@ func (p *preferencesService) GetBuildInDecoder() (resp types.JSResp) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
func (p *preferencesService) GetLanguage() string {
|
|
||||||
pref := p.pref.GetPreferences()
|
|
||||||
return pref.General.Language
|
|
||||||
}
|
|
||||||
|
|
||||||
func (p *preferencesService) SetAppVersion(ver string) {
|
func (p *preferencesService) SetAppVersion(ver string) {
|
||||||
if !strings.HasPrefix(ver, "v") {
|
if !strings.HasPrefix(ver, "v") {
|
||||||
p.clientVersion = "v" + ver
|
p.clientVersion = "v" + ver
|
||||||
|
@ -253,12 +246,3 @@ func (p *preferencesService) CheckForUpdate() (resp types.JSResp) {
|
||||||
}
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
// UpdateEnv Update System Environment
|
|
||||||
func (p *preferencesService) UpdateEnv() {
|
|
||||||
if p.GetLanguage() == "zh" {
|
|
||||||
os.Setenv("LANG", "zh_CN.UTF-8")
|
|
||||||
} else {
|
|
||||||
os.Unsetenv("LANG")
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
<script setup>
|
<script setup>
|
||||||
import ContentPane from './components/content/ContentPane.vue'
|
import ContentPane from './components/content/ContentPane.vue'
|
||||||
import BrowserPane from './components/sidebar/BrowserPane.vue'
|
import BrowserPane from './components/sidebar/BrowserPane.vue'
|
||||||
import { computed, onMounted, onUnmounted, reactive, ref, watchEffect } from 'vue'
|
import { computed, onMounted, reactive, ref, watchEffect } from 'vue'
|
||||||
import { debounce } from 'lodash'
|
import { debounce } from 'lodash'
|
||||||
import { useThemeVars } from 'naive-ui'
|
import { useThemeVars } from 'naive-ui'
|
||||||
import Ribbon from './components/sidebar/Ribbon.vue'
|
import Ribbon from './components/sidebar/Ribbon.vue'
|
||||||
|
@ -117,18 +117,12 @@ onMounted(async () => {
|
||||||
onToggleFullscreen(fullscreen === true)
|
onToggleFullscreen(fullscreen === true)
|
||||||
const maximised = await WindowIsMaximised()
|
const maximised = await WindowIsMaximised()
|
||||||
onToggleMaximize(maximised)
|
onToggleMaximize(maximised)
|
||||||
window.addEventListener('keydown', onKeyShortcut)
|
|
||||||
})
|
|
||||||
|
|
||||||
onUnmounted(() => {
|
|
||||||
window.removeEventListener('keydown', onKeyShortcut)
|
|
||||||
})
|
})
|
||||||
|
|
||||||
const onKeyShortcut = (e) => {
|
const onKeyShortcut = (e) => {
|
||||||
const isCtrlOn = isMacOS() ? e.metaKey : e.ctrlKey
|
|
||||||
switch (e.key) {
|
switch (e.key) {
|
||||||
case 'w':
|
case 'w':
|
||||||
if (isCtrlOn) {
|
if (e.metaKey) {
|
||||||
// close current tab
|
// close current tab
|
||||||
const tabStore = useTabStore()
|
const tabStore = useTabStore()
|
||||||
const currentTab = tabStore.currentTab
|
const currentTab = tabStore.currentTab
|
||||||
|
@ -144,7 +138,7 @@ const onKeyShortcut = (e) => {
|
||||||
<template>
|
<template>
|
||||||
<!-- app content-->
|
<!-- app content-->
|
||||||
<n-spin :show="props.loading" :style="spinStyle" :theme-overrides="{ opacitySpinning: 0 }">
|
<n-spin :show="props.loading" :style="spinStyle" :theme-overrides="{ opacitySpinning: 0 }">
|
||||||
<div id="app-content-wrapper" :style="wrapperStyle" class="flex-box-v">
|
<div id="app-content-wrapper" :style="wrapperStyle" class="flex-box-v" tabindex="0" @keydown="onKeyShortcut">
|
||||||
<!-- title bar -->
|
<!-- title bar -->
|
||||||
<div
|
<div
|
||||||
id="app-toolbar"
|
id="app-toolbar"
|
||||||
|
|
|
@ -16,7 +16,6 @@ import ContentToolbar from '@/components/content_value/ContentToolbar.vue'
|
||||||
import ContentValueJson from '@/components/content_value/ContentValueJson.vue'
|
import ContentValueJson from '@/components/content_value/ContentValueJson.vue'
|
||||||
import usePreferencesStore from 'stores/preferences.js'
|
import usePreferencesStore from 'stores/preferences.js'
|
||||||
import { TextAlignType } from '@/consts/text_align_type.js'
|
import { TextAlignType } from '@/consts/text_align_type.js'
|
||||||
import { isMacOS } from '@/utils/platform.js'
|
|
||||||
|
|
||||||
const themeVars = useThemeVars()
|
const themeVars = useThemeVars()
|
||||||
const browserStore = useBrowserStore()
|
const browserStore = useBrowserStore()
|
||||||
|
@ -131,7 +130,7 @@ const onReload = async (selDecode, selFormat) => {
|
||||||
}
|
}
|
||||||
|
|
||||||
const onKeyShortcut = (e) => {
|
const onKeyShortcut = (e) => {
|
||||||
const isCtrlOn = isMacOS() ? e.metaKey : e.ctrlKey
|
// console.log(e)
|
||||||
switch (e.key) {
|
switch (e.key) {
|
||||||
case 'Delete':
|
case 'Delete':
|
||||||
onDelete()
|
onDelete()
|
||||||
|
@ -140,7 +139,7 @@ const onKeyShortcut = (e) => {
|
||||||
onReload()
|
onReload()
|
||||||
return
|
return
|
||||||
case 'r':
|
case 'r':
|
||||||
if (isCtrlOn) {
|
if (e.metaKey) {
|
||||||
onReload()
|
onReload()
|
||||||
}
|
}
|
||||||
return
|
return
|
||||||
|
|
|
@ -26,7 +26,6 @@ import usePreferencesStore from 'stores/preferences.js'
|
||||||
import { typesIconStyle } from '@/consts/support_redis_type.js'
|
import { typesIconStyle } from '@/consts/support_redis_type.js'
|
||||||
import { nativeRedisKey } from '@/utils/key_convert.js'
|
import { nativeRedisKey } from '@/utils/key_convert.js'
|
||||||
import copy from 'copy-text-to-clipboard'
|
import copy from 'copy-text-to-clipboard'
|
||||||
import { isMacOS } from '@/utils/platform.js'
|
|
||||||
|
|
||||||
const props = defineProps({
|
const props = defineProps({
|
||||||
server: String,
|
server: String,
|
||||||
|
@ -327,7 +326,6 @@ const handleKeyCopy = () => {
|
||||||
}
|
}
|
||||||
|
|
||||||
const onKeyShortcut = (e) => {
|
const onKeyShortcut = (e) => {
|
||||||
const isCtrlOn = isMacOS() ? e.metaKey : e.ctrlKey
|
|
||||||
switch (e.key) {
|
switch (e.key) {
|
||||||
case 'ArrowUp':
|
case 'ArrowUp':
|
||||||
handleKeyUp()
|
handleKeyUp()
|
||||||
|
@ -342,7 +340,7 @@ const onKeyShortcut = (e) => {
|
||||||
handleKeyRight()
|
handleKeyRight()
|
||||||
break
|
break
|
||||||
case 'c':
|
case 'c':
|
||||||
if (isCtrlOn) {
|
if (e.metaKey) {
|
||||||
handleKeyCopy()
|
handleKeyCopy()
|
||||||
}
|
}
|
||||||
break
|
break
|
||||||
|
@ -353,7 +351,7 @@ const onKeyShortcut = (e) => {
|
||||||
handleSelectContextMenu('value_reload')
|
handleSelectContextMenu('value_reload')
|
||||||
break
|
break
|
||||||
case 'r':
|
case 'r':
|
||||||
if (isCtrlOn) {
|
if (e.metaKey) {
|
||||||
handleSelectContextMenu('value_reload')
|
handleSelectContextMenu('value_reload')
|
||||||
}
|
}
|
||||||
break
|
break
|
||||||
|
|
1
main.go
1
main.go
|
@ -36,7 +36,6 @@ func main() {
|
||||||
pubsubSvc := services.Pubsub()
|
pubsubSvc := services.Pubsub()
|
||||||
prefSvc := services.Preferences()
|
prefSvc := services.Preferences()
|
||||||
prefSvc.SetAppVersion(version)
|
prefSvc.SetAppVersion(version)
|
||||||
prefSvc.UpdateEnv()
|
|
||||||
windowWidth, windowHeight, maximised := prefSvc.GetWindowSize()
|
windowWidth, windowHeight, maximised := prefSvc.GetWindowSize()
|
||||||
windowStartState := options.Normal
|
windowStartState := options.Normal
|
||||||
if maximised {
|
if maximised {
|
||||||
|
|
Loading…
Reference in New Issue