Compare commits

...

10 Commits

Author SHA1 Message Date
Lykin bc66c63b3d chore: update dependencies 2024-01-08 00:26:57 +08:00
Lykin 72ef406cd8 fix: tooltips exceed the display area #112 2024-01-08 00:26:01 +08:00
Lykin 51a1b1b35f perf: disable tab switch after layer node selected 2024-01-08 00:01:52 +08:00
Lykin e87b02e14c perf: add an 'Import Keys' option to new key dialog. 2024-01-06 23:44:18 +08:00
Lykin 0d6765a757 perf: scroll to bottom when append item in new key dialog 2024-01-06 23:08:06 +08:00
Lykin ed1b9d9b54 fix: create key error 2024-01-06 22:13:26 +08:00
Lykin d66d7c9a49 feat: support key auto refresh
refactor: move 'ContentToolbar' to 'ContentValueWrapper'
2024-01-06 17:14:35 +08:00
Lykin c2bf4128f7 fix: minor bugs about keys view 2024-01-06 01:26:18 +08:00
Lykin 8d7c8cb3ed perf: support display layer with blank label 2024-01-05 22:02:23 +08:00
Lykin 9b3f2ba726 perf: move expanded keys to tab store for external modification 2024-01-05 20:48:57 +08:00
34 changed files with 632 additions and 412 deletions

View File

@ -685,6 +685,7 @@ func (b *browserService) GetKeyDetail(param types.KeyDetailParam) (resp types.JS
}
var data types.KeyDetail
data.KeyType = strings.ToLower(keyType)
//var cursor uint64
matchPattern := param.MatchPattern
if len(matchPattern) <= 0 {
@ -728,7 +729,7 @@ func (b *browserService) GetKeyDetail(param types.KeyDetailParam) (resp types.JS
}
}
switch strings.ToLower(keyType) {
switch data.KeyType {
case "string":
var str string
str, err = client.Get(ctx, key).Result()
@ -2293,7 +2294,7 @@ func (b *browserService) ImportCSV(server string, db int, path string, conflict
continue
}
// get ttl
if ttl < 0 {
if ttl < 0 && len(line) > 2 {
// use previous
if expire, ttlErr := strconv.ParseInt(line[2], 10, 64); ttlErr == nil && expire > 0 {
ttlValue = time.UnixMilli(expire).Sub(time.Now())

View File

@ -32,6 +32,7 @@ type KeyDetailParam struct {
type KeyDetail struct {
Value any `json:"value"`
KeyType string `json:"key_type"`
Length int64 `json:"length,omitempty"`
Format string `json:"format,omitempty"`
Decode string `json:"decode,omitempty"`

View File

@ -13,20 +13,20 @@
"lodash": "^4.17.21",
"monaco-editor": "^0.45.0",
"pinia": "^2.1.7",
"sass": "^1.69.6",
"vue": "^3.4.3",
"vue-i18n": "^9.8.0",
"sass": "^1.69.7",
"vue": "^3.4.5",
"vue-i18n": "^9.9.0",
"xterm": "^5.3.0",
"xterm-addon-fit": "^0.8.0"
},
"devDependencies": {
"@vitejs/plugin-vue": "^5.0.2",
"naive-ui": "^2.36.0",
"naive-ui": "^2.37.0",
"prettier": "^3.1.1",
"unplugin-auto-import": "^0.17.3",
"unplugin-icons": "^0.18.1",
"unplugin-vue-components": "^0.26.0",
"vite": "^5.0.10"
"vite": "^5.0.11"
}
},
"node_modules/@antfu/install-pkg": {
@ -572,35 +572,44 @@
}
},
"node_modules/@intlify/core-base": {
"version": "9.8.0",
"resolved": "https://registry.npmmirror.com/@intlify/core-base/-/core-base-9.8.0.tgz",
"integrity": "sha512-UxaSZVZ1DwqC/CltUZrWZNaWNhfmKtfyV4BJSt/Zt4Or/fZs1iFj0B+OekYk1+MRHfIOe3+x00uXGQI4PbO/9g==",
"version": "9.9.0",
"resolved": "https://registry.npmjs.org/@intlify/core-base/-/core-base-9.9.0.tgz",
"integrity": "sha512-C7UXPymDIOlMGSNjAhNLtKgzITc/8BjINK5gNKXg8GiWCTwL6n3MWr55czksxn8RM5wTMz0qcLOFT+adtaVQaA==",
"dependencies": {
"@intlify/message-compiler": "9.8.0",
"@intlify/shared": "9.8.0"
"@intlify/message-compiler": "9.9.0",
"@intlify/shared": "9.9.0"
},
"engines": {
"node": ">= 16"
},
"funding": {
"url": "https://github.com/sponsors/kazupon"
}
},
"node_modules/@intlify/message-compiler": {
"version": "9.8.0",
"resolved": "https://registry.npmmirror.com/@intlify/message-compiler/-/message-compiler-9.8.0.tgz",
"integrity": "sha512-McnYWhcoYmDJvssVu6QGR0shqlkJuL1HHdi5lK7fNqvQqRYaQ4lSLjYmZxwc8tRNMdIe9/KUKfyPxU9M6yCtNQ==",
"version": "9.9.0",
"resolved": "https://registry.npmjs.org/@intlify/message-compiler/-/message-compiler-9.9.0.tgz",
"integrity": "sha512-yDU/jdUm9KuhEzYfS+wuyja209yXgdl1XFhMlKtXEgSFTxz4COZQCRXXbbH8JrAjMsaJ7bdoPSLsKlY6mXG2iA==",
"dependencies": {
"@intlify/shared": "9.8.0",
"@intlify/shared": "9.9.0",
"source-map-js": "^1.0.2"
},
"engines": {
"node": ">= 16"
},
"funding": {
"url": "https://github.com/sponsors/kazupon"
}
},
"node_modules/@intlify/shared": {
"version": "9.8.0",
"resolved": "https://registry.npmmirror.com/@intlify/shared/-/shared-9.8.0.tgz",
"integrity": "sha512-TmgR0RCLjzrSo+W3wT0ALf9851iFMlVI9EYNGeWvZFUQTAJx0bvfsMlPdgVtV1tDNRiAfhkFsMKu6jtUY1ZLKQ==",
"version": "9.9.0",
"resolved": "https://registry.npmjs.org/@intlify/shared/-/shared-9.9.0.tgz",
"integrity": "sha512-1ECUyAHRrzOJbOizyGufYP2yukqGrWXtkmTu4PcswVnWbkcjzk3YQGmJ0bLkM7JZ0ZYAaohLGdYvBYnTOGYJ9g==",
"engines": {
"node": ">= 16"
},
"funding": {
"url": "https://github.com/sponsors/kazupon"
}
},
"node_modules/@jridgewell/sourcemap-codec": {
@ -868,36 +877,36 @@
}
},
"node_modules/@vue/compiler-core": {
"version": "3.4.3",
"resolved": "https://registry.npmjs.org/@vue/compiler-core/-/compiler-core-3.4.3.tgz",
"integrity": "sha512-u8jzgFg0EDtSrb/hG53Wwh1bAOQFtc1ZCegBpA/glyvTlgHl+tq13o1zvRfLbegYUw/E4mSTGOiCnAJ9SJ+lsg==",
"version": "3.4.5",
"resolved": "https://registry.npmjs.org/@vue/compiler-core/-/compiler-core-3.4.5.tgz",
"integrity": "sha512-Daka7P1z2AgKjzuueWXhwzIsKu0NkLB6vGbNVEV2iJ8GJTrzraZo/Sk4GWCMRtd/qVi3zwnk+Owbd/xSZbwHtQ==",
"dependencies": {
"@babel/parser": "^7.23.6",
"@vue/shared": "3.4.3",
"@vue/shared": "3.4.5",
"entities": "^4.5.0",
"estree-walker": "^2.0.2",
"source-map-js": "^1.0.2"
}
},
"node_modules/@vue/compiler-dom": {
"version": "3.4.3",
"resolved": "https://registry.npmjs.org/@vue/compiler-dom/-/compiler-dom-3.4.3.tgz",
"integrity": "sha512-oGF1E9/htI6JWj/lTJgr6UgxNCtNHbM6xKVreBWeZL9QhRGABRVoWGAzxmtBfSOd+w0Zi5BY0Es/tlJrN6WgEg==",
"version": "3.4.5",
"resolved": "https://registry.npmjs.org/@vue/compiler-dom/-/compiler-dom-3.4.5.tgz",
"integrity": "sha512-J8YlxknJVd90SXFJ4HwGANSAXsx5I0lK30sO/zvYV7s5gXf7gZR7r/1BmZ2ju7RGH1lnc6bpBc6nL61yW+PsAQ==",
"dependencies": {
"@vue/compiler-core": "3.4.3",
"@vue/shared": "3.4.3"
"@vue/compiler-core": "3.4.5",
"@vue/shared": "3.4.5"
}
},
"node_modules/@vue/compiler-sfc": {
"version": "3.4.3",
"resolved": "https://registry.npmjs.org/@vue/compiler-sfc/-/compiler-sfc-3.4.3.tgz",
"integrity": "sha512-NuJqb5is9I4uzv316VRUDYgIlPZCG8D+ARt5P4t5UDShIHKL25J3TGZAUryY/Aiy0DsY7srJnZL5ryB6DD63Zw==",
"version": "3.4.5",
"resolved": "https://registry.npmjs.org/@vue/compiler-sfc/-/compiler-sfc-3.4.5.tgz",
"integrity": "sha512-jauvkDuSSUbP0ebhfNqljhShA90YEfX/0wZ+w40oZF43IjGyWYjqYaJbvMJwGOd+9+vODW6eSvnk28f0SGV7OQ==",
"dependencies": {
"@babel/parser": "^7.23.6",
"@vue/compiler-core": "3.4.3",
"@vue/compiler-dom": "3.4.3",
"@vue/compiler-ssr": "3.4.3",
"@vue/shared": "3.4.3",
"@vue/compiler-core": "3.4.5",
"@vue/compiler-dom": "3.4.5",
"@vue/compiler-ssr": "3.4.5",
"@vue/shared": "3.4.5",
"estree-walker": "^2.0.2",
"magic-string": "^0.30.5",
"postcss": "^8.4.32",
@ -905,12 +914,12 @@
}
},
"node_modules/@vue/compiler-ssr": {
"version": "3.4.3",
"resolved": "https://registry.npmjs.org/@vue/compiler-ssr/-/compiler-ssr-3.4.3.tgz",
"integrity": "sha512-wnYQtMBkeFSxgSSQbYGQeXPhQacQiog2c6AlvMldQH6DB+gSXK/0F6DVXAJfEiuBSgBhUc8dwrrG5JQcqwalsA==",
"version": "3.4.5",
"resolved": "https://registry.npmjs.org/@vue/compiler-ssr/-/compiler-ssr-3.4.5.tgz",
"integrity": "sha512-DDdEcDzj2lWTMfUMMtEpLDhURai9LhM0zSZ219jCt7b2Vyl0/jy3keFgCPMitG0V1S1YG4Cmws3lWHWdxHQOpg==",
"dependencies": {
"@vue/compiler-dom": "3.4.3",
"@vue/shared": "3.4.3"
"@vue/compiler-dom": "3.4.5",
"@vue/shared": "3.4.5"
}
},
"node_modules/@vue/devtools-api": {
@ -919,29 +928,29 @@
"integrity": "sha512-o9KfBeaBmCKl10usN4crU53fYtC1r7jJwdGKjPT24t348rHxgfpZ0xL3Xm/gLUYnc0oTp8LAmrxOeLyu6tbk2Q=="
},
"node_modules/@vue/reactivity": {
"version": "3.4.3",
"resolved": "https://registry.npmjs.org/@vue/reactivity/-/reactivity-3.4.3.tgz",
"integrity": "sha512-q5f9HLDU+5aBKizXHAx0w4whkIANs1Muiq9R5YXm0HtorSlflqv9u/ohaMxuuhHWCji4xqpQ1eL04WvmAmGnFg==",
"version": "3.4.5",
"resolved": "https://registry.npmjs.org/@vue/reactivity/-/reactivity-3.4.5.tgz",
"integrity": "sha512-BcWkKvjdvqJwb7BhhFkXPLDCecX4d4a6GATvCduJQDLv21PkPowAE5GKuIE5p6RC07/Lp9FMkkq4AYCTVF5KlQ==",
"dependencies": {
"@vue/shared": "3.4.3"
"@vue/shared": "3.4.5"
}
},
"node_modules/@vue/runtime-core": {
"version": "3.4.3",
"resolved": "https://registry.npmjs.org/@vue/runtime-core/-/runtime-core-3.4.3.tgz",
"integrity": "sha512-C1r6QhB1qY7D591RCSFhMULyzL9CuyrGc+3PpB0h7dU4Qqw6GNyo4BNFjHZVvsWncrUlKX3DIKg0Y7rNNr06NQ==",
"version": "3.4.5",
"resolved": "https://registry.npmjs.org/@vue/runtime-core/-/runtime-core-3.4.5.tgz",
"integrity": "sha512-wh9ELIOQKeWT9SaUPdLrsxRkZv14jp+SJm9aiQGWio+/MWNM3Lib0wE6CoKEqQ9+SCYyGjDBhTOTtO47kCgbkg==",
"dependencies": {
"@vue/reactivity": "3.4.3",
"@vue/shared": "3.4.3"
"@vue/reactivity": "3.4.5",
"@vue/shared": "3.4.5"
}
},
"node_modules/@vue/runtime-dom": {
"version": "3.4.3",
"resolved": "https://registry.npmjs.org/@vue/runtime-dom/-/runtime-dom-3.4.3.tgz",
"integrity": "sha512-wrsprg7An5Ec+EhPngWdPuzkp0BEUxAKaQtN9dPU/iZctPyD9aaXmVtehPJerdQxQale6gEnhpnfywNw3zOv2A==",
"version": "3.4.5",
"resolved": "https://registry.npmjs.org/@vue/runtime-dom/-/runtime-dom-3.4.5.tgz",
"integrity": "sha512-n5ewvOjyG3IEpqGBahdPXODFSpVlSz3H4LF76Sx0XAqpIOqyJ5bIb2PrdYuH2ogBMAQPh+o5tnoH4nJpBr8U0Q==",
"dependencies": {
"@vue/runtime-core": "3.4.3",
"@vue/shared": "3.4.3",
"@vue/runtime-core": "3.4.5",
"@vue/shared": "3.4.5",
"csstype": "^3.1.3"
}
},
@ -951,21 +960,21 @@
"integrity": "sha512-M1uQkMl8rQK/szD0LNhtqxIPLpimGm8sOBwU7lLnCpSbTyY3yeU1Vc7l4KT5zT4s/yOxHH5O7tIuuLOCnLADRw=="
},
"node_modules/@vue/server-renderer": {
"version": "3.4.3",
"resolved": "https://registry.npmjs.org/@vue/server-renderer/-/server-renderer-3.4.3.tgz",
"integrity": "sha512-BUxt8oVGMKKsqSkM1uU3d3Houyfy4WAc2SpSQRebNd+XJGATVkW/rO129jkyL+kpB/2VRKzE63zwf5RtJ3XuZw==",
"version": "3.4.5",
"resolved": "https://registry.npmjs.org/@vue/server-renderer/-/server-renderer-3.4.5.tgz",
"integrity": "sha512-jOFc/VE87yvifQpNju12VcqimH8pBLxdcT+t3xMeiED1K6DfH9SORyhFEoZlW5TG2Vwfn3Ul5KE+1aC99xnSBg==",
"dependencies": {
"@vue/compiler-ssr": "3.4.3",
"@vue/shared": "3.4.3"
"@vue/compiler-ssr": "3.4.5",
"@vue/shared": "3.4.5"
},
"peerDependencies": {
"vue": "3.4.3"
"vue": "3.4.5"
}
},
"node_modules/@vue/shared": {
"version": "3.4.3",
"resolved": "https://registry.npmjs.org/@vue/shared/-/shared-3.4.3.tgz",
"integrity": "sha512-rIwlkkP1n4uKrRzivAKPZIEkHiuwY5mmhMJ2nZKCBLz8lTUlE73rQh4n1OnnMurXt1vcUNyH4ZPfdh8QweTjpQ=="
"version": "3.4.5",
"resolved": "https://registry.npmjs.org/@vue/shared/-/shared-3.4.5.tgz",
"integrity": "sha512-6XptuzlMvN4l4cDnDw36pdGEV+9njYkQ1ZE0Q6iZLwrKefKaOJyiFmcP3/KBDHbt72cJZGtllAc1GaHe6XGAyg=="
},
"node_modules/acorn": {
"version": "8.11.2",
@ -1536,9 +1545,9 @@
"dev": true
},
"node_modules/naive-ui": {
"version": "2.36.0",
"resolved": "https://registry.npmjs.org/naive-ui/-/naive-ui-2.36.0.tgz",
"integrity": "sha512-r1ydtEm1Ryf/aWpbLCf32mQAGK99jd1eXgpkCtIomcBRZeAtusfy6zCtIpCppoCuIKM3BW5DMafhVxilubk/lQ==",
"version": "2.37.0",
"resolved": "https://registry.npmjs.org/naive-ui/-/naive-ui-2.37.0.tgz",
"integrity": "sha512-TcuXM1zysnK6i/7o2ZqNjcLp3QMmcdSLWWiXcpEk+xdGpkJzs53/OXNpF4CoDM/npjha7qqtB8Pl17YPN5egFw==",
"dev": true,
"dependencies": {
"@css-render/plugin-bem": "^0.15.12",
@ -1548,6 +1557,7 @@
"@types/lodash-es": "^4.17.9",
"async-validator": "^4.2.5",
"css-render": "^0.15.12",
"csstype": "^3.1.3",
"date-fns": "^2.30.0",
"date-fns-tz": "^2.0.0",
"evtd": "^0.2.4",
@ -1558,12 +1568,18 @@
"treemate": "^0.3.11",
"vdirs": "^0.1.8",
"vooks": "^0.2.12",
"vueuc": "^0.4.54"
"vueuc": "^0.4.58"
},
"peerDependencies": {
"vue": "^3.0.0"
}
},
"node_modules/naive-ui/node_modules/csstype": {
"version": "3.1.3",
"resolved": "https://registry.npmjs.org/csstype/-/csstype-3.1.3.tgz",
"integrity": "sha512-M1uQkMl8rQK/szD0LNhtqxIPLpimGm8sOBwU7lLnCpSbTyY3yeU1Vc7l4KT5zT4s/yOxHH5O7tIuuLOCnLADRw==",
"dev": true
},
"node_modules/nanoid": {
"version": "3.3.7",
"resolved": "https://registry.npmmirror.com/nanoid/-/nanoid-3.3.7.tgz",
@ -1851,9 +1867,9 @@
}
},
"node_modules/sass": {
"version": "1.69.6",
"resolved": "https://registry.npmjs.org/sass/-/sass-1.69.6.tgz",
"integrity": "sha512-qbRr3k9JGHWXCvZU77SD2OTwUlC+gNT+61JOLcmLm+XqH4h/5D+p4IIsxvpkB89S9AwJOyb5+rWNpIucaFxSFQ==",
"version": "1.69.7",
"resolved": "https://registry.npmjs.org/sass/-/sass-1.69.7.tgz",
"integrity": "sha512-rzj2soDeZ8wtE2egyLXgOOHQvaC2iosZrkF6v3EUG+tBwEvhqUCzm0VP3k9gHF9LXbSrRhT5SksoI56Iw8NPnQ==",
"dependencies": {
"chokidar": ">=3.0.0 <4.0.0",
"immutable": "^4.0.0",
@ -2173,9 +2189,9 @@
}
},
"node_modules/vite": {
"version": "5.0.10",
"resolved": "https://registry.npmjs.org/vite/-/vite-5.0.10.tgz",
"integrity": "sha512-2P8J7WWgmc355HUMlFrwofacvr98DAjoE52BfdbwQtyLH06XKwaL/FMnmKM2crF0iX4MpmMKoDlNCB1ok7zHCw==",
"version": "5.0.11",
"resolved": "https://registry.npmjs.org/vite/-/vite-5.0.11.tgz",
"integrity": "sha512-XBMnDjZcNAw/G1gEiskiM1v6yzM4GE5aMGvhWTlHAYYhxb7S3/V1s3m2LDHa8Vh6yIWYYB0iJwsEaS523c4oYA==",
"dev": true,
"dependencies": {
"esbuild": "^0.19.3",
@ -2240,15 +2256,15 @@
}
},
"node_modules/vue": {
"version": "3.4.3",
"resolved": "https://registry.npmjs.org/vue/-/vue-3.4.3.tgz",
"integrity": "sha512-GjN+culMAGv/mUbkIv8zMKItno8npcj5gWlXkSxf1SPTQf8eJ4A+YfHIvQFyL1IfuJcMl3soA7SmN1fRxbf/wA==",
"version": "3.4.5",
"resolved": "https://registry.npmjs.org/vue/-/vue-3.4.5.tgz",
"integrity": "sha512-VH6nHFhLPjgu2oh5vEBXoNZxsGHuZNr3qf4PHClwJWw6IDqw6B3x+4J+ABdoZ0aJuT8Zi0zf3GpGlLQCrGWHrw==",
"dependencies": {
"@vue/compiler-dom": "3.4.3",
"@vue/compiler-sfc": "3.4.3",
"@vue/runtime-dom": "3.4.3",
"@vue/server-renderer": "3.4.3",
"@vue/shared": "3.4.3"
"@vue/compiler-dom": "3.4.5",
"@vue/compiler-sfc": "3.4.5",
"@vue/runtime-dom": "3.4.5",
"@vue/server-renderer": "3.4.5",
"@vue/shared": "3.4.5"
},
"peerDependencies": {
"typescript": "*"
@ -2260,25 +2276,28 @@
}
},
"node_modules/vue-i18n": {
"version": "9.8.0",
"resolved": "https://registry.npmmirror.com/vue-i18n/-/vue-i18n-9.8.0.tgz",
"integrity": "sha512-Izho+6PYjejsTq2mzjcRdBZ5VLRQoSuuexvR8029h5CpN03FYqiqBrShMyf2I1DKkN6kw/xmujcbvC+4QybpsQ==",
"version": "9.9.0",
"resolved": "https://registry.npmjs.org/vue-i18n/-/vue-i18n-9.9.0.tgz",
"integrity": "sha512-xQ5SxszUAqK5n84N+uUyHH/PiQl9xZ24FOxyAaNonmOQgXeN+rD9z/6DStOpOxNFQn4Cgcquot05gZc+CdOujA==",
"dependencies": {
"@intlify/core-base": "9.8.0",
"@intlify/shared": "9.8.0",
"@intlify/core-base": "9.9.0",
"@intlify/shared": "9.9.0",
"@vue/devtools-api": "^6.5.0"
},
"engines": {
"node": ">= 16"
},
"funding": {
"url": "https://github.com/sponsors/kazupon"
},
"peerDependencies": {
"vue": "^3.0.0"
}
},
"node_modules/vueuc": {
"version": "0.4.54",
"resolved": "https://registry.npmjs.org/vueuc/-/vueuc-0.4.54.tgz",
"integrity": "sha512-2LED7h1BSnCRPBI6AlSIf+1Yte1shN+Vb2gpspO5wHI7zWzbcq4bAu2f9nFh5yXIUKdzqmLvzRsOXDl4TrDyCw==",
"version": "0.4.58",
"resolved": "https://registry.npmjs.org/vueuc/-/vueuc-0.4.58.tgz",
"integrity": "sha512-Wnj/N8WbPRSxSt+9ji1jtDHPzda5h2OH/0sFBhvdxDRuyCZbjGg3/cKMaKqEoe+dErTexG2R+i6Q8S/Toq1MYg==",
"dev": true,
"dependencies": {
"@css-render/vue3-ssr": "^0.15.10",
@ -2654,27 +2673,27 @@
}
},
"@intlify/core-base": {
"version": "9.8.0",
"resolved": "https://registry.npmmirror.com/@intlify/core-base/-/core-base-9.8.0.tgz",
"integrity": "sha512-UxaSZVZ1DwqC/CltUZrWZNaWNhfmKtfyV4BJSt/Zt4Or/fZs1iFj0B+OekYk1+MRHfIOe3+x00uXGQI4PbO/9g==",
"version": "9.9.0",
"resolved": "https://registry.npmjs.org/@intlify/core-base/-/core-base-9.9.0.tgz",
"integrity": "sha512-C7UXPymDIOlMGSNjAhNLtKgzITc/8BjINK5gNKXg8GiWCTwL6n3MWr55czksxn8RM5wTMz0qcLOFT+adtaVQaA==",
"requires": {
"@intlify/message-compiler": "9.8.0",
"@intlify/shared": "9.8.0"
"@intlify/message-compiler": "9.9.0",
"@intlify/shared": "9.9.0"
}
},
"@intlify/message-compiler": {
"version": "9.8.0",
"resolved": "https://registry.npmmirror.com/@intlify/message-compiler/-/message-compiler-9.8.0.tgz",
"integrity": "sha512-McnYWhcoYmDJvssVu6QGR0shqlkJuL1HHdi5lK7fNqvQqRYaQ4lSLjYmZxwc8tRNMdIe9/KUKfyPxU9M6yCtNQ==",
"version": "9.9.0",
"resolved": "https://registry.npmjs.org/@intlify/message-compiler/-/message-compiler-9.9.0.tgz",
"integrity": "sha512-yDU/jdUm9KuhEzYfS+wuyja209yXgdl1XFhMlKtXEgSFTxz4COZQCRXXbbH8JrAjMsaJ7bdoPSLsKlY6mXG2iA==",
"requires": {
"@intlify/shared": "9.8.0",
"@intlify/shared": "9.9.0",
"source-map-js": "^1.0.2"
}
},
"@intlify/shared": {
"version": "9.8.0",
"resolved": "https://registry.npmmirror.com/@intlify/shared/-/shared-9.8.0.tgz",
"integrity": "sha512-TmgR0RCLjzrSo+W3wT0ALf9851iFMlVI9EYNGeWvZFUQTAJx0bvfsMlPdgVtV1tDNRiAfhkFsMKu6jtUY1ZLKQ=="
"version": "9.9.0",
"resolved": "https://registry.npmjs.org/@intlify/shared/-/shared-9.9.0.tgz",
"integrity": "sha512-1ECUyAHRrzOJbOizyGufYP2yukqGrWXtkmTu4PcswVnWbkcjzk3YQGmJ0bLkM7JZ0ZYAaohLGdYvBYnTOGYJ9g=="
},
"@jridgewell/sourcemap-codec": {
"version": "1.4.15",
@ -2843,36 +2862,36 @@
"requires": {}
},
"@vue/compiler-core": {
"version": "3.4.3",
"resolved": "https://registry.npmjs.org/@vue/compiler-core/-/compiler-core-3.4.3.tgz",
"integrity": "sha512-u8jzgFg0EDtSrb/hG53Wwh1bAOQFtc1ZCegBpA/glyvTlgHl+tq13o1zvRfLbegYUw/E4mSTGOiCnAJ9SJ+lsg==",
"version": "3.4.5",
"resolved": "https://registry.npmjs.org/@vue/compiler-core/-/compiler-core-3.4.5.tgz",
"integrity": "sha512-Daka7P1z2AgKjzuueWXhwzIsKu0NkLB6vGbNVEV2iJ8GJTrzraZo/Sk4GWCMRtd/qVi3zwnk+Owbd/xSZbwHtQ==",
"requires": {
"@babel/parser": "^7.23.6",
"@vue/shared": "3.4.3",
"@vue/shared": "3.4.5",
"entities": "^4.5.0",
"estree-walker": "^2.0.2",
"source-map-js": "^1.0.2"
}
},
"@vue/compiler-dom": {
"version": "3.4.3",
"resolved": "https://registry.npmjs.org/@vue/compiler-dom/-/compiler-dom-3.4.3.tgz",
"integrity": "sha512-oGF1E9/htI6JWj/lTJgr6UgxNCtNHbM6xKVreBWeZL9QhRGABRVoWGAzxmtBfSOd+w0Zi5BY0Es/tlJrN6WgEg==",
"version": "3.4.5",
"resolved": "https://registry.npmjs.org/@vue/compiler-dom/-/compiler-dom-3.4.5.tgz",
"integrity": "sha512-J8YlxknJVd90SXFJ4HwGANSAXsx5I0lK30sO/zvYV7s5gXf7gZR7r/1BmZ2ju7RGH1lnc6bpBc6nL61yW+PsAQ==",
"requires": {
"@vue/compiler-core": "3.4.3",
"@vue/shared": "3.4.3"
"@vue/compiler-core": "3.4.5",
"@vue/shared": "3.4.5"
}
},
"@vue/compiler-sfc": {
"version": "3.4.3",
"resolved": "https://registry.npmjs.org/@vue/compiler-sfc/-/compiler-sfc-3.4.3.tgz",
"integrity": "sha512-NuJqb5is9I4uzv316VRUDYgIlPZCG8D+ARt5P4t5UDShIHKL25J3TGZAUryY/Aiy0DsY7srJnZL5ryB6DD63Zw==",
"version": "3.4.5",
"resolved": "https://registry.npmjs.org/@vue/compiler-sfc/-/compiler-sfc-3.4.5.tgz",
"integrity": "sha512-jauvkDuSSUbP0ebhfNqljhShA90YEfX/0wZ+w40oZF43IjGyWYjqYaJbvMJwGOd+9+vODW6eSvnk28f0SGV7OQ==",
"requires": {
"@babel/parser": "^7.23.6",
"@vue/compiler-core": "3.4.3",
"@vue/compiler-dom": "3.4.3",
"@vue/compiler-ssr": "3.4.3",
"@vue/shared": "3.4.3",
"@vue/compiler-core": "3.4.5",
"@vue/compiler-dom": "3.4.5",
"@vue/compiler-ssr": "3.4.5",
"@vue/shared": "3.4.5",
"estree-walker": "^2.0.2",
"magic-string": "^0.30.5",
"postcss": "^8.4.32",
@ -2880,12 +2899,12 @@
}
},
"@vue/compiler-ssr": {
"version": "3.4.3",
"resolved": "https://registry.npmjs.org/@vue/compiler-ssr/-/compiler-ssr-3.4.3.tgz",
"integrity": "sha512-wnYQtMBkeFSxgSSQbYGQeXPhQacQiog2c6AlvMldQH6DB+gSXK/0F6DVXAJfEiuBSgBhUc8dwrrG5JQcqwalsA==",
"version": "3.4.5",
"resolved": "https://registry.npmjs.org/@vue/compiler-ssr/-/compiler-ssr-3.4.5.tgz",
"integrity": "sha512-DDdEcDzj2lWTMfUMMtEpLDhURai9LhM0zSZ219jCt7b2Vyl0/jy3keFgCPMitG0V1S1YG4Cmws3lWHWdxHQOpg==",
"requires": {
"@vue/compiler-dom": "3.4.3",
"@vue/shared": "3.4.3"
"@vue/compiler-dom": "3.4.5",
"@vue/shared": "3.4.5"
}
},
"@vue/devtools-api": {
@ -2894,29 +2913,29 @@
"integrity": "sha512-o9KfBeaBmCKl10usN4crU53fYtC1r7jJwdGKjPT24t348rHxgfpZ0xL3Xm/gLUYnc0oTp8LAmrxOeLyu6tbk2Q=="
},
"@vue/reactivity": {
"version": "3.4.3",
"resolved": "https://registry.npmjs.org/@vue/reactivity/-/reactivity-3.4.3.tgz",
"integrity": "sha512-q5f9HLDU+5aBKizXHAx0w4whkIANs1Muiq9R5YXm0HtorSlflqv9u/ohaMxuuhHWCji4xqpQ1eL04WvmAmGnFg==",
"version": "3.4.5",
"resolved": "https://registry.npmjs.org/@vue/reactivity/-/reactivity-3.4.5.tgz",
"integrity": "sha512-BcWkKvjdvqJwb7BhhFkXPLDCecX4d4a6GATvCduJQDLv21PkPowAE5GKuIE5p6RC07/Lp9FMkkq4AYCTVF5KlQ==",
"requires": {
"@vue/shared": "3.4.3"
"@vue/shared": "3.4.5"
}
},
"@vue/runtime-core": {
"version": "3.4.3",
"resolved": "https://registry.npmjs.org/@vue/runtime-core/-/runtime-core-3.4.3.tgz",
"integrity": "sha512-C1r6QhB1qY7D591RCSFhMULyzL9CuyrGc+3PpB0h7dU4Qqw6GNyo4BNFjHZVvsWncrUlKX3DIKg0Y7rNNr06NQ==",
"version": "3.4.5",
"resolved": "https://registry.npmjs.org/@vue/runtime-core/-/runtime-core-3.4.5.tgz",
"integrity": "sha512-wh9ELIOQKeWT9SaUPdLrsxRkZv14jp+SJm9aiQGWio+/MWNM3Lib0wE6CoKEqQ9+SCYyGjDBhTOTtO47kCgbkg==",
"requires": {
"@vue/reactivity": "3.4.3",
"@vue/shared": "3.4.3"
"@vue/reactivity": "3.4.5",
"@vue/shared": "3.4.5"
}
},
"@vue/runtime-dom": {
"version": "3.4.3",
"resolved": "https://registry.npmjs.org/@vue/runtime-dom/-/runtime-dom-3.4.3.tgz",
"integrity": "sha512-wrsprg7An5Ec+EhPngWdPuzkp0BEUxAKaQtN9dPU/iZctPyD9aaXmVtehPJerdQxQale6gEnhpnfywNw3zOv2A==",
"version": "3.4.5",
"resolved": "https://registry.npmjs.org/@vue/runtime-dom/-/runtime-dom-3.4.5.tgz",
"integrity": "sha512-n5ewvOjyG3IEpqGBahdPXODFSpVlSz3H4LF76Sx0XAqpIOqyJ5bIb2PrdYuH2ogBMAQPh+o5tnoH4nJpBr8U0Q==",
"requires": {
"@vue/runtime-core": "3.4.3",
"@vue/shared": "3.4.3",
"@vue/runtime-core": "3.4.5",
"@vue/shared": "3.4.5",
"csstype": "^3.1.3"
},
"dependencies": {
@ -2928,18 +2947,18 @@
}
},
"@vue/server-renderer": {
"version": "3.4.3",
"resolved": "https://registry.npmjs.org/@vue/server-renderer/-/server-renderer-3.4.3.tgz",
"integrity": "sha512-BUxt8oVGMKKsqSkM1uU3d3Houyfy4WAc2SpSQRebNd+XJGATVkW/rO129jkyL+kpB/2VRKzE63zwf5RtJ3XuZw==",
"version": "3.4.5",
"resolved": "https://registry.npmjs.org/@vue/server-renderer/-/server-renderer-3.4.5.tgz",
"integrity": "sha512-jOFc/VE87yvifQpNju12VcqimH8pBLxdcT+t3xMeiED1K6DfH9SORyhFEoZlW5TG2Vwfn3Ul5KE+1aC99xnSBg==",
"requires": {
"@vue/compiler-ssr": "3.4.3",
"@vue/shared": "3.4.3"
"@vue/compiler-ssr": "3.4.5",
"@vue/shared": "3.4.5"
}
},
"@vue/shared": {
"version": "3.4.3",
"resolved": "https://registry.npmjs.org/@vue/shared/-/shared-3.4.3.tgz",
"integrity": "sha512-rIwlkkP1n4uKrRzivAKPZIEkHiuwY5mmhMJ2nZKCBLz8lTUlE73rQh4n1OnnMurXt1vcUNyH4ZPfdh8QweTjpQ=="
"version": "3.4.5",
"resolved": "https://registry.npmjs.org/@vue/shared/-/shared-3.4.5.tgz",
"integrity": "sha512-6XptuzlMvN4l4cDnDw36pdGEV+9njYkQ1ZE0Q6iZLwrKefKaOJyiFmcP3/KBDHbt72cJZGtllAc1GaHe6XGAyg=="
},
"acorn": {
"version": "8.11.2",
@ -3382,9 +3401,9 @@
"dev": true
},
"naive-ui": {
"version": "2.36.0",
"resolved": "https://registry.npmjs.org/naive-ui/-/naive-ui-2.36.0.tgz",
"integrity": "sha512-r1ydtEm1Ryf/aWpbLCf32mQAGK99jd1eXgpkCtIomcBRZeAtusfy6zCtIpCppoCuIKM3BW5DMafhVxilubk/lQ==",
"version": "2.37.0",
"resolved": "https://registry.npmjs.org/naive-ui/-/naive-ui-2.37.0.tgz",
"integrity": "sha512-TcuXM1zysnK6i/7o2ZqNjcLp3QMmcdSLWWiXcpEk+xdGpkJzs53/OXNpF4CoDM/npjha7qqtB8Pl17YPN5egFw==",
"dev": true,
"requires": {
"@css-render/plugin-bem": "^0.15.12",
@ -3394,6 +3413,7 @@
"@types/lodash-es": "^4.17.9",
"async-validator": "^4.2.5",
"css-render": "^0.15.12",
"csstype": "^3.1.3",
"date-fns": "^2.30.0",
"date-fns-tz": "^2.0.0",
"evtd": "^0.2.4",
@ -3404,7 +3424,15 @@
"treemate": "^0.3.11",
"vdirs": "^0.1.8",
"vooks": "^0.2.12",
"vueuc": "^0.4.54"
"vueuc": "^0.4.58"
},
"dependencies": {
"csstype": {
"version": "3.1.3",
"resolved": "https://registry.npmjs.org/csstype/-/csstype-3.1.3.tgz",
"integrity": "sha512-M1uQkMl8rQK/szD0LNhtqxIPLpimGm8sOBwU7lLnCpSbTyY3yeU1Vc7l4KT5zT4s/yOxHH5O7tIuuLOCnLADRw==",
"dev": true
}
}
},
"nanoid": {
@ -3607,9 +3635,9 @@
}
},
"sass": {
"version": "1.69.6",
"resolved": "https://registry.npmjs.org/sass/-/sass-1.69.6.tgz",
"integrity": "sha512-qbRr3k9JGHWXCvZU77SD2OTwUlC+gNT+61JOLcmLm+XqH4h/5D+p4IIsxvpkB89S9AwJOyb5+rWNpIucaFxSFQ==",
"version": "1.69.7",
"resolved": "https://registry.npmjs.org/sass/-/sass-1.69.7.tgz",
"integrity": "sha512-rzj2soDeZ8wtE2egyLXgOOHQvaC2iosZrkF6v3EUG+tBwEvhqUCzm0VP3k9gHF9LXbSrRhT5SksoI56Iw8NPnQ==",
"requires": {
"chokidar": ">=3.0.0 <4.0.0",
"immutable": "^4.0.0",
@ -3832,9 +3860,9 @@
}
},
"vite": {
"version": "5.0.10",
"resolved": "https://registry.npmjs.org/vite/-/vite-5.0.10.tgz",
"integrity": "sha512-2P8J7WWgmc355HUMlFrwofacvr98DAjoE52BfdbwQtyLH06XKwaL/FMnmKM2crF0iX4MpmMKoDlNCB1ok7zHCw==",
"version": "5.0.11",
"resolved": "https://registry.npmjs.org/vite/-/vite-5.0.11.tgz",
"integrity": "sha512-XBMnDjZcNAw/G1gEiskiM1v6yzM4GE5aMGvhWTlHAYYhxb7S3/V1s3m2LDHa8Vh6yIWYYB0iJwsEaS523c4oYA==",
"dev": true,
"requires": {
"esbuild": "^0.19.3",
@ -3853,31 +3881,31 @@
}
},
"vue": {
"version": "3.4.3",
"resolved": "https://registry.npmjs.org/vue/-/vue-3.4.3.tgz",
"integrity": "sha512-GjN+culMAGv/mUbkIv8zMKItno8npcj5gWlXkSxf1SPTQf8eJ4A+YfHIvQFyL1IfuJcMl3soA7SmN1fRxbf/wA==",
"version": "3.4.5",
"resolved": "https://registry.npmjs.org/vue/-/vue-3.4.5.tgz",
"integrity": "sha512-VH6nHFhLPjgu2oh5vEBXoNZxsGHuZNr3qf4PHClwJWw6IDqw6B3x+4J+ABdoZ0aJuT8Zi0zf3GpGlLQCrGWHrw==",
"requires": {
"@vue/compiler-dom": "3.4.3",
"@vue/compiler-sfc": "3.4.3",
"@vue/runtime-dom": "3.4.3",
"@vue/server-renderer": "3.4.3",
"@vue/shared": "3.4.3"
"@vue/compiler-dom": "3.4.5",
"@vue/compiler-sfc": "3.4.5",
"@vue/runtime-dom": "3.4.5",
"@vue/server-renderer": "3.4.5",
"@vue/shared": "3.4.5"
}
},
"vue-i18n": {
"version": "9.8.0",
"resolved": "https://registry.npmmirror.com/vue-i18n/-/vue-i18n-9.8.0.tgz",
"integrity": "sha512-Izho+6PYjejsTq2mzjcRdBZ5VLRQoSuuexvR8029h5CpN03FYqiqBrShMyf2I1DKkN6kw/xmujcbvC+4QybpsQ==",
"version": "9.9.0",
"resolved": "https://registry.npmjs.org/vue-i18n/-/vue-i18n-9.9.0.tgz",
"integrity": "sha512-xQ5SxszUAqK5n84N+uUyHH/PiQl9xZ24FOxyAaNonmOQgXeN+rD9z/6DStOpOxNFQn4Cgcquot05gZc+CdOujA==",
"requires": {
"@intlify/core-base": "9.8.0",
"@intlify/shared": "9.8.0",
"@intlify/core-base": "9.9.0",
"@intlify/shared": "9.9.0",
"@vue/devtools-api": "^6.5.0"
}
},
"vueuc": {
"version": "0.4.54",
"resolved": "https://registry.npmjs.org/vueuc/-/vueuc-0.4.54.tgz",
"integrity": "sha512-2LED7h1BSnCRPBI6AlSIf+1Yte1shN+Vb2gpspO5wHI7zWzbcq4bAu2f9nFh5yXIUKdzqmLvzRsOXDl4TrDyCw==",
"version": "0.4.58",
"resolved": "https://registry.npmjs.org/vueuc/-/vueuc-0.4.58.tgz",
"integrity": "sha512-Wnj/N8WbPRSxSt+9ji1jtDHPzda5h2OH/0sFBhvdxDRuyCZbjGg3/cKMaKqEoe+dErTexG2R+i6Q8S/Toq1MYg==",
"dev": true,
"requires": {
"@css-render/vue3-ssr": "^0.15.10",

View File

@ -14,19 +14,19 @@
"lodash": "^4.17.21",
"monaco-editor": "^0.45.0",
"pinia": "^2.1.7",
"sass": "^1.69.6",
"vue": "^3.4.3",
"vue-i18n": "^9.8.0",
"sass": "^1.69.7",
"vue": "^3.4.5",
"vue-i18n": "^9.9.0",
"xterm": "^5.3.0",
"xterm-addon-fit": "^0.8.0"
},
"devDependencies": {
"@vitejs/plugin-vue": "^5.0.2",
"naive-ui": "^2.36.0",
"naive-ui": "^2.37.0",
"prettier": "^3.1.1",
"unplugin-auto-import": "^0.17.3",
"unplugin-icons": "^0.18.1",
"unplugin-vue-components": "^0.26.0",
"vite": "^5.0.10"
"vite": "^5.0.11"
}
}

View File

@ -1 +1 @@
bae1706c9c117d6fcce2d7bd649e127f
6dd5fc2cecb3eb5a0c7297245ac11808

View File

@ -16,7 +16,6 @@ const emit = defineEmits(['edit', 'delete', 'copy', 'save', 'cancel'])
</script>
<template>
<!-- TODO: support multiple save -->
<div v-if="props.editing" class="flex-box-h edit-column-func">
<icon-button :icon="Save" @click="emit('save')" />
<icon-button :icon="Close" @click="emit('cancel')" />

View File

@ -16,6 +16,7 @@ import Pub from '@/components/icons/Pub.vue'
import ContentSlog from '@/components/content_value/ContentSlog.vue'
import { decodeTypes, formatTypes } from '@/consts/value_view_type.js'
import ContentMonitor from '@/components/content_value/ContentMonitor.vue'
import { decodeRedisKey } from '@/utils/key_convert.js'
const themeVars = useThemeVars()
@ -50,7 +51,7 @@ const tabContent = computed(() => {
subTab: tab.subTab,
type: toUpper(tab.type),
db: tab.db,
keyPath: tab.key,
keyPath: tab.keyCode != null ? decodeRedisKey(tab.keyCode) : tab.key,
keyCode: tab.keyCode,
ttl: tab.ttl,
value: tab.value,

View File

@ -61,6 +61,8 @@ const columns = computed(() => [
tooltip: {
style: {
maxWidth: '80vw',
maxHeight: '60vh',
overflowY: 'scroll',
},
},
},

View File

@ -10,8 +10,10 @@ import { useI18n } from 'vue-i18n'
import IconButton from '@/components/common/IconButton.vue'
import Copy from '@/components/icons/Copy.vue'
import { ClipboardSetText } from 'wailsjs/runtime/runtime.js'
import { computed } from 'vue'
import { computed, onUnmounted, reactive, watch } from 'vue'
import { padStart } from 'lodash'
import { NIcon, useThemeVars } from 'naive-ui'
import { timeout } from '@/utils/promise.js'
const props = defineProps({
server: String,
@ -37,6 +39,12 @@ const props = defineProps({
const emit = defineEmits(['reload', 'rename', 'delete'])
const autoRefresh = reactive({
on: false,
interval: 2,
})
const themeVars = useThemeVars()
const dialogStore = useDialog()
const i18n = useI18n()
@ -61,6 +69,48 @@ const ttlString = computed(() => {
return s
})
const startAutoRefresh = async () => {
if (autoRefresh.on) {
return
}
autoRefresh.on = true
let lastExec = Date.now()
do {
if (!autoRefresh.on) {
break
}
await timeout(100)
if (props.loading || Date.now() - lastExec < autoRefresh.interval * 1000) {
continue
}
lastExec = Date.now()
emit('reload')
} while (true)
stopAutoRefresh()
}
const stopAutoRefresh = () => {
autoRefresh.on = false
}
watch(
() => props.keyPath,
() => {
stopAutoRefresh()
autoRefresh.interval = props.interval
},
)
onUnmounted(() => stopAutoRefresh())
const onToggleRefresh = (on) => {
if (on) {
startAutoRefresh()
} else {
stopAutoRefresh()
}
}
const onCopyKey = () => {
ClipboardSetText(props.keyPath)
.then((succ) => {
@ -87,14 +137,48 @@ const onTTL = () => {
<div class="content-toolbar flex-box-h">
<n-input-group>
<redis-type-tag :binary-key="binaryKey" :type="props.keyType" size="large" />
<n-input v-model:value="props.keyPath" :title="props.keyPath" readonly>
<n-input v-model:value="props.keyPath" :title="props.keyPath" readonly @dblclick="onCopyKey">
<template #suffix>
<icon-button
:icon="Refresh"
<n-popover :delay="500" keep-alive-on-hover placement="bottom" trigger="hover">
<template #trigger>
<icon-button :loading="props.loading" size="18" @click="emit('reload')">
<n-icon :size="props.size">
<component
:is="Refresh"
:class="{ 'auto-refreshing': autoRefresh.on }"
:color="autoRefresh.on ? themeVars.primaryColor : undefined"
:stroke-width="autoRefresh.on ? 5 : 3" />
</n-icon>
</icon-button>
</template>
<n-form
:show-feedback="false"
label-align="right"
label-placement="left"
label-width="auto"
size="small">
<n-form-item :label="$t('interface.auto_refresh')">
<n-switch
:loading="props.loading"
size="18"
t-tooltip="interface.reload"
@click="emit('reload')" />
:value="autoRefresh.on"
@update:value="onToggleRefresh" />
</n-form-item>
<n-form-item :label="$t('interface.refresh_interval')">
<n-input-number
v-model:value="autoRefresh.interval"
:autofocus="false"
:disabled="autoRefresh.on"
:max="9999"
:min="1"
:show-button="false"
style="max-width: 100px">
<template #suffix>
{{ $t('common.unit_second') }}
</template>
</n-input-number>
</n-form-item>
</n-form>
</n-popover>
</template>
</n-input>
<icon-button :icon="Copy" border size="18" t-tooltip="interface.copy_key" @click="onCopyKey" />
@ -111,7 +195,13 @@ const onTTL = () => {
</template>
TTL{{ `${ttl > 0 ? ': ' + ttl + $t('common.second') : ''}` }}
</n-tooltip>
<icon-button :icon="Edit" border size="18" t-tooltip="interface.rename_key" @click="emit('rename')" />
<icon-button
:disabled="binaryKey"
:icon="Edit"
:t-tooltip="binaryKey ? 'dialogue.rename_binary_key_fail' : 'interface.rename_key'"
border
size="18"
@click="emit('rename')" />
</n-button-group>
<n-tooltip :show-arrow="false">
<template #trigger>
@ -131,4 +221,14 @@ const onTTL = () => {
align-items: center;
gap: 5px;
}
.auto-refreshing {
animation: rotate 2s linear infinite;
}
@keyframes rotate {
100% {
transform: rotate(360deg);
}
}
</style>

View File

@ -1,7 +1,6 @@
<script setup>
import { computed, h, reactive, ref } from 'vue'
import { useI18n } from 'vue-i18n'
import ContentToolbar from './ContentToolbar.vue'
import AddLink from '@/components/icons/AddLink.vue'
import { NButton, NIcon, useThemeVars } from 'naive-ui'
import { types, types as redisTypes } from '@/consts/support_redis_type.js'
@ -54,7 +53,7 @@ const props = defineProps({
loading: Boolean,
})
const emit = defineEmits(['loadmore', 'loadall', 'reload', 'rename', 'delete', 'match'])
const emit = defineEmits(['loadmore', 'loadall', 'reload', 'match'])
/**
*
@ -92,8 +91,11 @@ const fieldColumn = computed(() => ({
tooltip: {
style: {
maxWidth: '80vw',
maxHeight: '60vh',
overflowY: 'scroll',
},
},
lineClamp: 10,
},
filterOptionValue: fieldFilterOption.value,
className: inEdit.value ? 'clickable' : '',
@ -121,6 +123,8 @@ const valueColumn = computed(() => ({
tooltip: {
style: {
maxWidth: '80vw',
maxHeight: '60vh',
overflowY: 'scroll',
},
},
},
@ -326,18 +330,7 @@ defineExpose({
<template>
<div class="content-wrapper flex-box-v">
<content-toolbar
:db="props.db"
:key-code="props.keyCode"
:key-path="props.keyPath"
:key-type="keyType"
:loading="props.loading"
:server="props.name"
:ttl="ttl"
class="value-item-part"
@delete="emit('delete')"
@reload="emit('reload')"
@rename="emit('rename')" />
<slot name="toolbar" />
<div class="tb2 value-item-part flex-box-h">
<div class="flex-box-h">
<content-search-input

View File

@ -1,7 +1,6 @@
<script setup>
import { computed, h, reactive, ref } from 'vue'
import { useI18n } from 'vue-i18n'
import ContentToolbar from './ContentToolbar.vue'
import AddLink from '@/components/icons/AddLink.vue'
import { NButton, NIcon, useThemeVars } from 'naive-ui'
import { isEmpty, size } from 'lodash'
@ -54,7 +53,7 @@ const props = defineProps({
loading: Boolean,
})
const emit = defineEmits(['loadmore', 'loadall', 'reload', 'rename', 'delete', 'match'])
const emit = defineEmits(['loadmore', 'loadall', 'reload', 'match'])
/**
*
@ -93,6 +92,8 @@ const valueColumn = computed(() => ({
tooltip: {
style: {
maxWidth: '80vw',
maxHeight: '60vh',
overflowY: 'scroll',
},
},
},
@ -297,18 +298,7 @@ defineExpose({
<template>
<div class="content-wrapper flex-box-v">
<content-toolbar
:db="props.db"
:key-code="props.keyCode"
:key-path="props.keyPath"
:key-type="keyType"
:loading="props.loading"
:server="props.name"
:ttl="ttl"
class="value-item-part"
@delete="emit('delete')"
@reload="emit('reload')"
@rename="emit('rename')" />
<slot name="toolbar" />
<div class="tb2 value-item-part flex-box-h">
<div class="flex-box-h">
<content-search-input

View File

@ -1,7 +1,6 @@
<script setup>
import { computed, h, reactive, ref } from 'vue'
import { useI18n } from 'vue-i18n'
import ContentToolbar from './ContentToolbar.vue'
import AddLink from '@/components/icons/AddLink.vue'
import { NButton, NIcon, useThemeVars } from 'naive-ui'
import { isEmpty, size } from 'lodash'
@ -53,7 +52,7 @@ const props = defineProps({
loading: Boolean,
})
const emit = defineEmits(['loadmore', 'loadall', 'reload', 'rename', 'delete', 'match'])
const emit = defineEmits(['loadmore', 'loadall', 'reload', 'match'])
/**
*
@ -92,6 +91,8 @@ const valueColumn = computed(() => ({
tooltip: {
style: {
maxWidth: '80vw',
maxHeight: '60vh',
overflowY: 'scroll',
},
},
},
@ -294,18 +295,7 @@ defineExpose({
<template>
<div class="content-wrapper flex-box-v">
<content-toolbar
:db="props.db"
:key-code="props.keyCode"
:key-path="props.keyPath"
:key-type="keyType"
:loading="props.loading"
:server="props.name"
:ttl="ttl"
class="value-item-part"
@delete="emit('delete')"
@reload="emit('reload')"
@rename="emit('rename')" />
<slot name="toolbar" />
<div class="tb2 value-item-part flex-box-h">
<div class="flex-box-h">
<content-search-input

View File

@ -1,7 +1,6 @@
<script setup>
import { computed, h, ref } from 'vue'
import { useI18n } from 'vue-i18n'
import ContentToolbar from './ContentToolbar.vue'
import AddLink from '@/components/icons/AddLink.vue'
import { NButton, NIcon, useThemeVars } from 'naive-ui'
import { types, types as redisTypes } from '@/consts/support_redis_type.js'
@ -50,7 +49,7 @@ const props = defineProps({
loading: Boolean,
})
const emit = defineEmits(['loadmore', 'loadall', 'reload', 'rename', 'delete', 'match'])
const emit = defineEmits(['loadmore', 'loadall', 'match'])
/**
*
@ -177,18 +176,7 @@ defineExpose({
<template>
<div class="content-wrapper flex-box-v">
<content-toolbar
:db="props.db"
:key-code="props.keyCode"
:key-path="props.keyPath"
:key-type="keyType"
:loading="props.loading"
:server="props.name"
:ttl="ttl"
class="value-item-part"
@delete="emit('delete')"
@reload="emit('reload')"
@rename="emit('rename')" />
<slot name="toolbar" />
<div class="tb2 value-item-part flex-box-h">
<div class="flex-box-h">
<content-search-input

View File

@ -1,7 +1,6 @@
<script setup>
import { computed, reactive, ref, watchEffect } from 'vue'
import { useI18n } from 'vue-i18n'
import ContentToolbar from './ContentToolbar.vue'
import Copy from '@/components/icons/Copy.vue'
import Save from '@/components/icons/Save.vue'
import { useThemeVars } from 'naive-ui'
@ -34,8 +33,6 @@ const props = defineProps({
loading: Boolean,
})
const emit = defineEmits(['reload', 'rename', 'delete'])
const i18n = useI18n()
const themeVars = useThemeVars()
const prefStore = usePreferencesStore()
@ -172,18 +169,7 @@ defineExpose({
<template>
<div class="content-wrapper flex-box-v">
<content-toolbar
:db="props.db"
:key-code="keyCode"
:key-path="keyPath"
:key-type="keyType"
:loading="loading"
:server="props.name"
:ttl="ttl"
class="value-item-part"
@delete="emit('delete')"
@reload="emit('reload')"
@rename="emit('rename')" />
<slot name="toolbar" />
<div class="tb2 value-item-part flex-box-h">
<div class="flex-item-expand"></div>
<n-button-group>

View File

@ -13,6 +13,7 @@ import { isEmpty } from 'lodash'
import useDialogStore from 'stores/dialog.js'
import { decodeTypes, formatTypes } from '@/consts/value_view_type.js'
import { useI18n } from 'vue-i18n'
import ContentToolbar from '@/components/content_value/ContentToolbar.vue'
const themeVars = useThemeVars()
const browserStore = useBrowserStore()
@ -42,6 +43,7 @@ const i18n = useI18n()
* format: String,
* decode: String,
* end: Boolean
* loading: Boolean
* }>}
*/
const data = computed(() => {
@ -49,6 +51,10 @@ const data = computed(() => {
})
const initializing = ref(false)
const loading = computed(() => {
return data.value.loading === true || initializing.value
})
const binaryKey = computed(() => {
return !!data.value.keyCode
})
@ -188,7 +194,7 @@ watch(() => data.value?.keyPath, initContent)
:key-code="data.keyCode"
:key-path="data.keyPath"
:length="data.length"
:loading="data.loading === true || initializing"
:loading="loading"
:name="data.name"
:size="data.size"
:ttl="data.ttl"
@ -197,8 +203,22 @@ watch(() => data.value?.keyPath, initContent)
@loadall="onLoadAll"
@loadmore="onLoadMore"
@match="onMatch"
@reload="onReload">
<template #toolbar>
<content-toolbar
:db="data.db"
:key-code="data.keyCode"
:key-path="data.keyPath"
:key-type="data.type"
:loading="loading"
:server="data.name"
:ttl="data.ttl"
class="value-item-part"
@delete="onDelete"
@reload="onReload"
@rename="onRename" />
</template>
</component>
<!-- </keep-alive>-->
</template>

View File

@ -1,7 +1,6 @@
<script setup>
import { computed, h, reactive, ref } from 'vue'
import { useI18n } from 'vue-i18n'
import ContentToolbar from './ContentToolbar.vue'
import AddLink from '@/components/icons/AddLink.vue'
import { NButton, NIcon, useThemeVars } from 'naive-ui'
import { types, types as redisTypes } from '@/consts/support_redis_type.js'
@ -53,7 +52,7 @@ const props = defineProps({
loading: Boolean,
})
const emit = defineEmits(['loadmore', 'loadall', 'reload', 'rename', 'delete', 'match'])
const emit = defineEmits(['loadmore', 'loadall', 'reload', 'match'])
/**
*
@ -141,6 +140,8 @@ const valueColumn = computed(() => ({
tooltip: {
style: {
maxWidth: '80vw',
maxHeight: '60vh',
overflowY: 'scroll',
},
},
},
@ -331,18 +332,7 @@ defineExpose({
<template>
<div class="content-wrapper flex-box-v">
<content-toolbar
:db="props.db"
:key-code="props.keyCode"
:key-path="props.keyPath"
:key-type="keyType"
:loading="props.loading"
:server="props.name"
:ttl="ttl"
class="value-item-part"
@delete="emit('delete')"
@reload="emit('reload')"
@rename="emit('rename')" />
<slot name="toolbar" />
<div class="tb2 value-item-part flex-box-h">
<div class="flex-box-h">
<content-search-input

View File

@ -13,6 +13,7 @@ import { NSpace } from 'naive-ui'
import useTabStore from 'stores/tab.js'
import NewStreamValue from '@/components/new_value/NewStreamValue.vue'
import useBrowserStore from 'stores/browser.js'
import Import from '@/components/icons/Import.vue'
const i18n = useI18n()
const newForm = reactive({
@ -64,6 +65,7 @@ const defaultValue = {
}
const dialogStore = useDialog()
const scrollRef = ref(null)
watchEffect(() => {
if (dialogStore.newKeyDialogVisible) {
const { prefix, server, db } = dialogStore.newKeyParam
@ -106,6 +108,12 @@ const renderTypeLabel = (option) => {
)
}
const onAppend = () => {
nextTick(() => {
scrollRef.value?.scrollTo({ position: 'bottom' })
})
}
const onChangeType = () => {
newForm.value = null
}
@ -135,6 +143,7 @@ const onAdd = async () => {
if (value == null) {
value = defaultValue[type]
}
// await browserStore.reloadKey({server, db, key: trim(key)})
const { success, msg, nodeKey } = await browserStore.setKey({
server,
db,
@ -147,7 +156,7 @@ const onAdd = async () => {
// select current key
await nextTick()
tabStore.setSelectedKeys(server, nodeKey)
browserStore.loadKeySummary({ server, db, key, clearValue: true })
browserStore.reloadKey({ server, db, key })
} else if (!isEmpty(msg)) {
$message.error(msg)
}
@ -161,6 +170,11 @@ const onAdd = async () => {
const onClose = () => {
dialogStore.closeNewKeyDialog()
}
const onImport = () => {
dialogStore.closeNewKeyDialog()
dialogStore.openImportKeyDialog(newForm.server, newForm.db)
}
</script>
<template>
@ -169,18 +183,12 @@ const onClose = () => {
:closable="false"
:close-on-esc="false"
:mask-closable="false"
:negative-button-props="{ size: 'medium' }"
:negative-text="$t('common.cancel')"
:positive-button-props="{ size: 'medium' }"
:positive-text="$t('common.confirm')"
:show-icon="false"
:title="$t('dialogue.key.new')"
preset="dialog"
style="width: 600px"
transform-origin="center"
@positive-click="onAdd"
@negative-click="onClose">
<n-scrollbar style="max-height: 500px">
transform-origin="center">
<n-scrollbar ref="scrollRef" style="max-height: 500px">
<n-form
ref="newFormRef"
:model="newForm"
@ -218,10 +226,33 @@ const onClose = () => {
</n-button>
</n-input-group>
</n-form-item>
<component :is="newValueComponent[newForm.type]" ref="subFormRef" v-model:value="newForm.value" />
<component
:is="newValueComponent[newForm.type]"
ref="subFormRef"
v-model:value="newForm.value"
@append="onAppend" />
<!-- TODO: Add import from txt file option -->
</n-form>
</n-scrollbar>
<template #action>
<div class="flex-item-expand">
<n-button :focusable="false" size="medium" @click="onImport">
<template #icon>
<n-icon :component="Import" />
</template>
{{ $t('interface.import_key') }}
</n-button>
</div>
<div class="flex-item n-dialog__action">
<n-button :focusable="false" size="medium" @click="onClose">
{{ $t('common.cancel') }}
</n-button>
<n-button :focusable="false" size="medium" type="primary" @click="onAdd">
{{ $t('common.confirm') }}
</n-button>
</div>
</template>
</n-modal>
</template>

View File

@ -3,7 +3,7 @@ import { computed, reactive, ref, watchEffect } from 'vue'
import useDialog from 'stores/dialog'
import useBrowserStore from 'stores/browser.js'
import { useI18n } from 'vue-i18n'
import { isEmpty, size } from 'lodash'
import { isEmpty } from 'lodash'
import TtlInput from '@/components/common/TtlInput.vue'
const ttlForm = reactive({

View File

@ -8,7 +8,7 @@ import IconButton from '@/components/common/IconButton.vue'
const props = defineProps({
value: Array,
})
const emit = defineEmits(['update:value'])
const emit = defineEmits(['update:value', 'append'])
/**
* @typedef Hash
@ -46,7 +46,15 @@ defineExpose({
@update:value="onUpdate">
<template #action="{ index, create, remove, move }">
<icon-button v-if="kvList.length > 1" :icon="Delete" size="18" @click="() => remove(index)" />
<icon-button :icon="Add" size="18" @click="() => create(index)" />
<icon-button
:icon="Add"
size="18"
@click="
() => {
create(index)
emit('append')
}
" />
</template>
</n-dynamic-input>
</n-form-item>

View File

@ -8,7 +8,7 @@ import IconButton from '@/components/common/IconButton.vue'
const props = defineProps({
value: Array,
})
const emit = defineEmits(['update:value'])
const emit = defineEmits(['update:value', 'append'])
const list = ref([''])
const onUpdate = (val) => {
@ -28,7 +28,15 @@ defineExpose({
<n-dynamic-input v-model:value="list" :placeholder="$t('dialogue.field.enter_elem')" @update:value="onUpdate">
<template #action="{ index, create, remove, move }">
<icon-button v-if="list.length > 1" :icon="Delete" size="18" @click="() => remove(index)" />
<icon-button :icon="Add" size="18" @click="() => create(index)" />
<icon-button
:icon="Add"
size="18"
@click="
() => {
create(index)
emit('append')
}
" />
</template>
</n-dynamic-input>
</n-form-item>

View File

@ -8,7 +8,7 @@ import IconButton from '@/components/common/IconButton.vue'
const props = defineProps({
value: Array,
})
const emit = defineEmits(['update:value'])
const emit = defineEmits(['update:value', 'append'])
const set = ref([''])
const onUpdate = (val) => {
@ -28,7 +28,15 @@ defineExpose({
<n-dynamic-input v-model:value="set" :placeholder="$t('dialogue.field.enter_elem')" @update:value="onUpdate">
<template #action="{ index, create, remove, move }">
<icon-button v-if="set.length > 1" :icon="Delete" size="18" @click="() => remove(index)" />
<icon-button :icon="Add" size="18" @click="() => create(index)" />
<icon-button
:icon="Add"
size="18"
@click="
() => {
create(index)
emit('append')
}
" />
</template>
</n-dynamic-input>
</n-form-item>

View File

@ -12,7 +12,7 @@ defineOptions({
inheritAttrs: false,
})
const id = ref('*')
const emit = defineEmits(['update:value'])
const emit = defineEmits(['update:value', 'append'])
/**
* @typedef Hash
@ -52,7 +52,15 @@ defineExpose({
@update:value="onUpdate">
<template #action="{ index, create, remove, move }">
<icon-button v-if="kvList.length > 1" :icon="Delete" size="18" @click="() => remove(index)" />
<icon-button :icon="Add" size="18" @click="() => create(index)" />
<icon-button
:icon="Add"
size="18"
@click="
() => {
create(index)
emit('append')
}
" />
</template>
</n-dynamic-input>
</n-form-item>

View File

@ -8,7 +8,7 @@ import IconButton from '@/components/common/IconButton.vue'
const props = defineProps({
value: Array,
})
const emit = defineEmits(['update:value'])
const emit = defineEmits(['update:value', 'append'])
/**
* @typedef ZSetItem
@ -57,7 +57,15 @@ defineExpose({
</template>
<template #action="{ index, create, remove, move }">
<icon-button v-if="zset.length > 1" :icon="Delete" size="18" @click="() => remove(index)" />
<icon-button :icon="Add" size="18" @click="() => create(index)" />
<icon-button
:icon="Add"
size="18"
@click="
() => {
create(index)
emit('append')
}
" />
</template>
</n-dynamic-input>
</n-form-item>

View File

@ -25,7 +25,6 @@ import More from '@/components/icons/More.vue'
import Export from '@/components/icons/Export.vue'
import { ConnectionType } from '@/consts/connection_type.js'
import Import from '@/components/icons/Import.vue'
import Down from '@/components/icons/Down.vue'
import Checkbox from '@/components/icons/Checkbox.vue'
import Timer from '@/components/icons/Timer.vue'
@ -65,12 +64,8 @@ const dbSelectOptions = computed(() => {
})
})
const addOptions = computed(() => [
{ key: 'import', label: i18n.t('interface.import_key'), icon: render.renderIcon(Import, { strokeWidth: 3.5 }) },
])
const moreOptions = computed(() => [
// { key: 'import', label: i18n.t('interface.import_key'), icon: render.renderIcon(Import, { strokeWidth: 3.5 }) },
{ key: 'import', label: i18n.t('interface.import_key'), icon: render.renderIcon(Import, { strokeWidth: 3.5 }) },
{ key: 'flush', label: i18n.t('interface.flush_db'), icon: render.renderIcon(Delete, { strokeWidth: 3.5 }) },
{ key: 'divider', type: 'divider' },
{
@ -101,10 +96,9 @@ const checkedTip = computed(() => {
const onReload = async () => {
try {
loading.value = true
tabStore.setSelectedKeys(props.server)
// tabStore.setSelectedKeys(props.server)
const db = props.db
browserStore.closeDatabase(props.server, db)
// browserTreeRef.value?.resetExpandKey(props.server, db)
let matchType = unref(filterForm.type)
if (!types.hasOwnProperty(matchType)) {
@ -200,7 +194,6 @@ const handleSelectDB = async (db) => {
await nextTick()
await connectionStore.saveLastDB(props.server, db)
tabStore.upsertTab({ server: props.server, db, clearValue: true })
// browserTreeRef.value?.resetExpandKey(props.server, db)
fullyLoaded.value = await browserStore.loadMoreKeys(props.server, db)
browserTreeRef.value?.refreshTree()
tabStore.setSelectedKeys(props.server)
@ -273,6 +266,7 @@ watch(
<redis-type-selector v-model:value="filterForm.type" @update:value="onSelectFilterType" />
</template>
</content-search-input>
<n-button-group>
<icon-button
:disabled="loading"
:icon="Refresh"
@ -282,7 +276,6 @@ watch(
stroke-width="4"
t-tooltip="interface.reload"
@click="onReload" />
<n-button-group>
<icon-button
:disabled="loading"
:icon="Plus"
@ -292,18 +285,6 @@ watch(
stroke-width="4"
t-tooltip="interface.new_key"
@click="onAddKey" />
<n-dropdown
:options="addOptions"
placement="bottom-end"
style="min-width: 130px"
trigger="click"
@select="onSelectOptions">
<n-button :focusable="false" size="small" style="padding: 0 3px">
<n-icon size="10">
<down :stroke-width="6" />
</n-icon>
</n-button>
</n-dropdown>
</n-button-group>
</div>

View File

@ -1,11 +1,11 @@
<script setup>
import { computed, h, nextTick, reactive, ref, watchEffect } from 'vue'
import { ConnectionType } from '@/consts/connection_type.js'
import { NIcon, NSpace, useThemeVars } from 'naive-ui'
import { NIcon, NSpace, NText, useThemeVars } from 'naive-ui'
import Key from '@/components/icons/Key.vue'
import Binary from '@/components/icons/Binary.vue'
import Database from '@/components/icons/Database.vue'
import { filter, find, get, includes, indexOf, isEmpty, map, remove, size, startsWith, toUpper } from 'lodash'
import { filter, find, get, includes, isEmpty, map, size, toUpper } from 'lodash'
import { useI18n } from 'vue-i18n'
import Refresh from '@/components/icons/Refresh.vue'
import CopyLink from '@/components/icons/CopyLink.vue'
@ -40,14 +40,24 @@ const props = defineProps({
const themeVars = useThemeVars()
const render = useRender()
const i18n = useI18n()
/** @type {Ref<UnwrapRef<string[]>>} */
const expandedKeys = ref([])
const connectionStore = useConnectionStore()
const browserStore = useBrowserStore()
const prefStore = usePreferencesStore()
const tabStore = useTabStore()
const dialogStore = useDialogStore()
/**
*
* @type {ComputedRef<string[]>}
*/
const expandedKeys = computed(() => {
const tab = find(tabStore.tabList, { name: props.server })
if (tab != null) {
return get(tab, 'expandedKeys', [])
}
return []
})
/**
*
* @type {ComputedRef<string[]>}
@ -168,31 +178,6 @@ const renderContextLabel = (option) => {
return h('div', { class: 'context-menu-item' }, option.label)
}
/**
*
* @param {string} key
* @param {boolean} [toggle]
*/
const expandKey = (key, toggle) => {
const idx = indexOf(expandedKeys.value, key)
if (idx === -1) {
expandedKeys.value.push(key)
} else if (toggle !== false) {
expandedKeys.value.splice(idx, 1)
}
}
const resetExpandKey = (server, db, includeDB) => {
const prefix = `${server}/db${db}`
remove(expandedKeys.value, (k) => {
if (!!!includeDB) {
return k !== prefix && startsWith(k, prefix)
} else {
return startsWith(k, prefix)
}
})
}
const handleSelectContextMenu = (key) => {
contextMenuParam.show = false
const selectedKey = get(selectedKeys.value, 0)
@ -291,14 +276,14 @@ const onUpdateSelectedKeys = (keys, options) => {
}
}
// default is load blank key to display server status
tabStore.openBlank(props.server, props.db)
// tabStore.openBlank(props.server)
} finally {
tabStore.setSelectedKeys(props.server, keys)
}
}
const onUpdateExpanded = (value, option, meta) => {
expandedKeys.value = value
tabStore.setExpandedKeys(props.server, value)
if (!meta.node) {
return
}
@ -310,13 +295,13 @@ const onUpdateExpanded = (value, option, meta) => {
switch (meta.action) {
case 'expand':
node.expanded = true
if (!includes(expandedKeys.value, key)) {
expandedKeys.value.push(key)
if (!includes(value, key)) {
tabStore.addExpandedKey(props.server, key)
}
break
case 'collapse':
node.expanded = false
remove(expandedKeys.value, (v) => v === key)
tabStore.removeExpandedKey(props.server, key)
break
}
node = node.children[0]
@ -374,8 +359,7 @@ const renderPrefix = ({ option }) => {
browserStore.loadKeyType({
server: props.server,
db: option.db,
key: option.redisKey,
keyCode: option.redisKeyCode,
key: option.redisKeyCode || option.redisKey,
})
}
switch (prefStore.keyIconType) {
@ -412,6 +396,13 @@ const renderPrefix = ({ option }) => {
const renderLabel = ({ option }) => {
switch (option.type) {
case ConnectionType.RedisKey:
if (option.label === '') {
// blank label name
return h('div', [
h(NText, { italic: true, depth: 3 }, () => '[Empty]'),
h('span', () => ` (${option.keyCount || 0})`),
])
}
return `${option.label} (${option.keyCount || 0})`
// case ConnectionType.RedisValue:
// return `[${option.keyType}]${option.label}`
@ -525,8 +516,8 @@ const nodeProps = ({ option }) => {
return
}
if (!props.checkMode) {
// default handle is expand current node
nextTick().then(() => expandKey(option.key))
// default handle is toggle expand current node
nextTick().then(() => tabStore.toggleExpandKey(props.server, option.key))
}
},
onContextmenu(e) {
@ -558,7 +549,7 @@ watchEffect(
if (!props.checkMode) {
tabStore.setCheckedKeys(props.server)
} else {
expandKey(`${ConnectionType.RedisDB}`, false)
tabStore.addExpandedKey(props.server, `${ConnectionType.RedisDB}`)
}
},
{ flush: 'post' },
@ -569,10 +560,9 @@ watchEffect(
const treeKey = ref(0)
defineExpose({
handleSelectContextMenu,
resetExpandKey,
refreshTree: () => {
treeKey.value = Date.now()
expandedKeys.value = []
tabStore.setExpandedKeys(props.server)
tabStore.setCheckedKeys(props.server)
},
deleteCheckedItems: () => {

View File

@ -246,12 +246,12 @@ const getServerMenu = (connected) => {
const getGroupMenu = () => {
return [
h(IconButton, {
tTooltip: 'interface.edit_conn',
tTooltip: 'interface.rename_conn_group',
icon: Config,
onClick: () => handleSelectContextMenu('group_rename'),
}),
h(IconButton, {
tTooltip: 'interface.remove_conn',
tTooltip: 'interface.remove_conn_group',
icon: Delete,
onClick: () => handleSelectContextMenu('group_delete'),
}),

View File

@ -13,9 +13,10 @@
"minute": "Minutes(s)",
"hour": "Hour(s)",
"day": "Day(s)",
"unit_day": "D",
"unit_hour": "H",
"unit_minute": "M",
"unit_day": "d",
"unit_hour": "h",
"unit_minute": "m",
"unit_second": "s",
"all": "All",
"key": "Key",
"value": "Value",
@ -70,15 +71,15 @@
"dup_conn": "Duplicate Connection",
"remove_conn": "Delete Connection",
"edit_conn": "Edit Connection Config",
"edit_conn_group": "Edit Connection Group",
"rename_conn_group": "Rename Connection Group",
"remove_conn_group": "Delete Connection Group",
"edit_conn_group": "Edit Group",
"rename_conn_group": "Rename Group",
"remove_conn_group": "Delete Group",
"ttl": "TTL",
"forever": "Forever",
"rename_key": "Rename Key",
"delete_key": "Delete Key",
"batch_delete_key": "Batch Delete Keys",
"import_key": "Import Key",
"import_key": "Import Key(s)",
"flush_db": "Flush Database",
"check_mode": "Check Mode",
"quit_check_mode": "Quit Check Mode",
@ -108,6 +109,8 @@
"decode_with": "Decode / Decompression",
"reload": "Reload",
"reload_disable": "Reload will enable after full loaded",
"auto_refresh": "Auto Refresh",
"refresh_interval": "Refresh Interval",
"open_connection": "Open Connection",
"copy_path": "Copy Path",
"copy_key": "Copy Key",

View File

@ -10,12 +10,13 @@
"update": "更新",
"none": "无",
"second": "秒",
"minute": "分",
"minute": "分",
"hour": "小时",
"day": "天",
"unit_day": "天",
"unit_hour": "小时",
"unit_minute": "分钟",
"unit_second": "秒",
"all": "全部",
"key": "键",
"value": "值",
@ -70,9 +71,9 @@
"dup_conn": "复制连接",
"remove_conn": "删除连接",
"edit_conn": "编辑连接配置",
"edit_conn_group": "编辑连接分组",
"rename_conn_group": "重命名连接分组",
"remove_conn_group": "删除连接分组",
"edit_conn_group": "编辑分组",
"rename_conn_group": "重命名分组",
"remove_conn_group": "删除分组",
"ttl": "TTL",
"forever": "永久",
"rename_key": "重命名键",
@ -108,6 +109,8 @@
"decode_with": "解码/解压方式",
"reload": "重新载入",
"reload_disable": "全量加载后可重新载入",
"auto_refresh": "自动刷新",
"refresh_interval": "刷新间隔",
"open_connection": "打开连接",
"copy_path": "复制路径",
"copy_key": "复制键名",

View File

@ -52,7 +52,7 @@ export class RedisServerState {
this.getRoot()
const connStore = useConnectionStore()
const { keySeparator } = connStore.getDefaultSeparator(name)
const keySeparator = connStore.getDefaultSeparator(name)
this.separator = isEmpty(keySeparator) ? ':' : keySeparator
}
@ -246,8 +246,8 @@ export class RedisServerState {
/**
* rename key to a new name
* @param key
* @param newKey
* @param {string} key
* @param {string} newKey
*/
renameKey(key, newKey) {
const oldLayer = initial(key.split(this.separator)).join(this.separator)
@ -265,7 +265,11 @@ export class RedisServerState {
const newNodeKeyName = `${ConnectionType.RedisValue}/${newKey}`
const keyNode = this.nodeMap.get(oldNodeKeyName)
keyNode.key = `${this.name}/db${this.db}#${newNodeKeyName}`
if (this.viewType === KeyViewType.Tree) {
keyNode.label = last(split(newKey, this.separator))
} else {
keyNode.label = newKey
}
keyNode.redisKey = newKey
// not support rename binary key name yet
// keyNode.redisKeyCode = []

View File

@ -16,6 +16,7 @@ export class TabItem {
* @param {string} subTab secondary tab value
* @param {string} [title] tab title
* @param {string} [icon] tab icon
* @param {string[]} expandedKeys
* @param {string[]} selectedKeys
* @param {CheckedKey[]} checkedKeys
* @param {string} [type] key type
@ -39,8 +40,9 @@ export class TabItem {
blank,
subTab,
icon,
selectedKeys,
checkedKeys,
expandedKeys = [],
selectedKeys = [],
checkedKeys = [],
type,
value,
server,
@ -61,6 +63,7 @@ export class TabItem {
this.blank = blank
this.subTab = subTab
this.icon = icon
this.expandedKeys = expandedKeys
this.selectedKeys = selectedKeys
this.checkedKeys = checkedKeys
this.type = type

View File

@ -245,6 +245,7 @@ const useBrowserStore = defineStore('browser', {
name,
separator: this.getSeparator(name),
db: -1,
viewType: view,
})
/** @type {Object.<number,RedisDatabaseItem>} **/
const databases = {}
@ -379,7 +380,7 @@ const useBrowserStore = defineStore('browser', {
})
if (success) {
const { type, ttl, size, length } = data
const k = decodeRedisKey(key)
const k = nativeRedisKey(key)
const binaryKey = k !== key
tab.upsertTab({
subTab: BrowserTabType.KeyDetail,
@ -426,23 +427,23 @@ const useBrowserStore = defineStore('browser', {
* load key type
* @param {string} server
* @param {number} db
* @param {string} key
* @param {string|number[]} key
* @param {number[]} keyCode
* @return {Promise<void>}
*/
async loadKeyType({ server, db, key, keyCode }) {
async loadKeyType({ server, db, key }) {
/** @type {RedisServerState} **/
const serverInst = this.servers[server]
if (serverInst == null) {
return
}
const node = serverInst.getNode(ConnectionType.RedisValue, key)
const node = serverInst.getNode(ConnectionType.RedisValue, nativeRedisKey(key))
if (node == null || !isEmpty(node.redisType)) {
return
}
try {
node.redisType = 'loading'
const { data, success } = await GetKeyType({ server, db, key: keyCode || key })
const { data, success, msg } = await GetKeyType({ server, db, key })
if (success) {
const { type } = data || {}
node.redisType = type
@ -504,11 +505,19 @@ const useBrowserStore = defineStore('browser', {
lite: true,
})
if (success) {
const { value, decode: retDecode, format: retFormat, match: retMatch, reset: retReset, end } = data
const {
value,
keyType,
decode: retDecode,
format: retFormat,
match: retMatch,
reset: retReset,
end,
} = data
tab.updateValue({
server,
db,
key: decodeRedisKey(key),
key: nativeRedisKey(key),
value,
decode: retDecode,
format: retFormat,
@ -757,10 +766,10 @@ const useBrowserStore = defineStore('browser', {
serverInst.updateDBKeyCount(db, newKey)
}
}
const tab = useTabStore()
tab.updateValue({ server, db, key, value })
// const tab = useTabStore()
// tab.updateValue({ server, db, key, value })
this.loadKeySummary({ server, db, key })
// this.loadKeySummary({ server, db, key })
return {
success,
nodeKey: `${server}/db${db}#${ConnectionType.RedisValue}/${key}`,
@ -1497,7 +1506,7 @@ const useBrowserStore = defineStore('browser', {
tabStore.updateTTL({
server,
db,
key,
key: nativeRedisKey(key),
ttl,
})
}
@ -1806,6 +1815,7 @@ const useBrowserStore = defineStore('browser', {
tab.emptyTab(server)
tab.setSelectedKeys(server)
tab.setCheckedKeys(server)
tab.setExpandedKeys(server)
return true
}
} finally {

View File

@ -364,8 +364,8 @@ const useConnectionStore = defineStore('connections', {
* @return {string}
*/
getDefaultSeparator(name) {
const { defaultSeparator = ':' } = this.serverProfile[name] || {}
return defaultSeparator
const { keySeparator = ':' } = this.serverProfile[name] || {}
return keySeparator
},
},
})

View File

@ -1,7 +1,6 @@
import { assign, find, findIndex, get, isEmpty, pullAt, remove, set, size } from 'lodash'
import { assign, find, findIndex, get, indexOf, isEmpty, pullAt, remove, set, size } from 'lodash'
import { defineStore } from 'pinia'
import { TabItem } from '@/objects/tabItem.js'
import { decodeRedisKey } from '@/utils/key_convert.js'
const useTabStore = defineStore('tab', {
/**
@ -543,11 +542,11 @@ const useTabStore = defineStore('tab', {
* update ttl in tab
* @param {string} server
* @param {number} db
* @param {string|number[]} key
* @param {string} key
* @param {number} ttl
*/
updateTTL({ server, db, key, ttl }) {
let tab = find(this.tabList, { name: server, db, key: decodeRedisKey(key) })
let tab = find(this.tabList, { name: server, db, key })
if (tab == null) {
return
}
@ -638,11 +637,73 @@ const useTabStore = defineStore('tab', {
},
/**
* set selected keys in current display browser tree
* set expanded keys for server
* @param {string} server
* @param {string[]} keys
*/
setExpandedKeys(server, keys = []) {
/** @type TabItem**/
let tab = find(this.tabList, { name: server })
if (tab != null) {
if (isEmpty(keys)) {
tab.expandedKeys = []
} else {
tab.expandedKeys = keys
}
}
},
/**
*
* @param {string} server
* @param {string} key
*/
addExpandedKey(server, key) {
/** @type TabItem**/
let tab = find(this.tabList, { name: server })
if (tab != null) {
tab.expandedKeys.push(key)
}
},
/**
*
* @param {string} server
* @param {string} key
*/
toggleExpandKey(server, key) {
/** @type TabItem**/
let tab = find(this.tabList, { name: server })
if (tab != null) {
const idx = indexOf(tab.expandedKeys, key)
if (idx === -1) {
tab.expandedKeys.push(key)
} else {
tab.expandedKeys.splice(idx, 1)
}
}
},
/**
*
* @param {string} server
* @param {string} key
*/
removeExpandedKey(server, key) {
/** @type TabItem**/
let tab = find(this.tabList, { name: server })
if (tab != null) {
remove(tab.expandedKeys, (v) => v === key)
}
},
/**
* set selected keys for server
* @param {string} server
* @param {string|string[]} [keys]
*/
setSelectedKeys(server, keys = null) {
/** @type TabItem**/
let tab = find(this.tabList, { name: server })
if (tab != null) {
if (keys == null) {
@ -662,6 +723,7 @@ const useTabStore = defineStore('tab', {
* @returns {CheckedKey[]}
*/
getCheckedKeys(server) {
/** @type TabItem**/
let tab = find(this.tabList, { name: server })
if (tab != null) {
return tab.checkedKeys || []
@ -670,11 +732,12 @@ const useTabStore = defineStore('tab', {
},
/**
* set checked keys in current display browser tree
* set checked keys for server
* @param {string} server
* @param {CheckedKey[]} [keys]
*/
setCheckedKeys(server, keys = null) {
/** @type TabItem**/
let tab = find(this.tabList, { name: server })
if (tab != null) {
if (isEmpty(keys)) {

View File

@ -91,6 +91,9 @@ const _darkThemeOverrides = {
Dropdown: {
color: '#272727',
},
Popover: {
color: '#2C2C32',
},
}
export const darkThemeOverrides = merge({}, themeOverrides, _darkThemeOverrides)