Compare commits

...

5 Commits

Author SHA1 Message Date
Lykin e3e0ed0a91 fix: connection not release after failure 2024-01-20 17:59:51 +08:00
Lykin 74ab68b280 chore: update vite 2024-01-20 17:07:59 +08:00
Lykin cee25a8015 chore: add x link to ribbon 2024-01-20 17:00:25 +08:00
Lykin bbcbc8b661 feat: support some emacs bash shortcut(ctrl+a/e/f/b/d/h/u/k/w/p/n/l) #126 2024-01-20 16:09:09 +08:00
Lykin 673159dc85 fix: db alias not display in empty database 2024-01-20 11:17:45 +08:00
8 changed files with 285 additions and 121 deletions

View File

@ -177,12 +177,12 @@ func (b *browserService) OpenConnection(name string) (resp types.JSResp) {
queryDB := func(idx int) types.ConnectionDB {
dbName := "db" + strconv.Itoa(idx)
dbInfoStr := info["Keyspace"][dbName]
if len(dbInfoStr) > 0 {
dbInfo := b.parseDBItemInfo(dbInfoStr)
var alias string
if selConn.Alias != nil {
alias = selConn.Alias[idx]
}
if len(dbInfoStr) > 0 {
dbInfo := b.parseDBItemInfo(dbInfoStr)
return types.ConnectionDB{
Name: dbName,
Alias: alias,
@ -194,6 +194,7 @@ func (b *browserService) OpenConnection(name string) (resp types.JSResp) {
} else {
return types.ConnectionDB{
Name: dbName,
Alias: alias,
Index: idx,
}
}
@ -318,6 +319,9 @@ func (b *browserService) getRedisClient(server string, db int) (item *connection
var connConfig = selConn.ConnectionConfig
connConfig.LastDB = db
client, err = b.createRedisClient(connConfig)
if err != nil {
return
}
ctx, cancelFunc := context.WithCancel(b.ctx)
item = &connectionItem{
client: client,

View File

@ -14,7 +14,7 @@
"monaco-editor": "^0.45.0",
"pinia": "^2.1.7",
"sass": "^1.70.0",
"vue": "^3.4.14",
"vue": "^3.4.15",
"vue-chartjs": "^5.3.0",
"vue-i18n": "^9.9.0",
"xterm": "^5.3.0",
@ -27,7 +27,7 @@
"unplugin-auto-import": "^0.17.3",
"unplugin-icons": "^0.18.2",
"unplugin-vue-components": "^0.26.0",
"vite": "^5.0.11"
"vite": "^5.0.12"
}
},
"node_modules/@antfu/install-pkg": {
@ -883,36 +883,36 @@
}
},
"node_modules/@vue/compiler-core": {
"version": "3.4.14",
"resolved": "https://registry.npmjs.org/@vue/compiler-core/-/compiler-core-3.4.14.tgz",
"integrity": "sha512-ro4Zzl/MPdWs7XwxT7omHRxAjMbDFRZEEjD+2m3NBf8YzAe3HuoSEZosXQo+m1GQ1G3LQ1LdmNh1RKTYe+ssEg==",
"version": "3.4.15",
"resolved": "https://registry.npmjs.org/@vue/compiler-core/-/compiler-core-3.4.15.tgz",
"integrity": "sha512-XcJQVOaxTKCnth1vCxEChteGuwG6wqnUHxAm1DO3gCz0+uXKaJNx8/digSz4dLALCy8n2lKq24jSUs8segoqIw==",
"dependencies": {
"@babel/parser": "^7.23.6",
"@vue/shared": "3.4.14",
"@vue/shared": "3.4.15",
"entities": "^4.5.0",
"estree-walker": "^2.0.2",
"source-map-js": "^1.0.2"
}
},
"node_modules/@vue/compiler-dom": {
"version": "3.4.14",
"resolved": "https://registry.npmjs.org/@vue/compiler-dom/-/compiler-dom-3.4.14.tgz",
"integrity": "sha512-nOZTY+veWNa0DKAceNWxorAbWm0INHdQq7cejFaWM1WYnoNSJbSEKYtE7Ir6lR/+mo9fttZpPVI9ZFGJ1juUEQ==",
"version": "3.4.15",
"resolved": "https://registry.npmjs.org/@vue/compiler-dom/-/compiler-dom-3.4.15.tgz",
"integrity": "sha512-wox0aasVV74zoXyblarOM3AZQz/Z+OunYcIHe1OsGclCHt8RsRm04DObjefaI82u6XDzv+qGWZ24tIsRAIi5MQ==",
"dependencies": {
"@vue/compiler-core": "3.4.14",
"@vue/shared": "3.4.14"
"@vue/compiler-core": "3.4.15",
"@vue/shared": "3.4.15"
}
},
"node_modules/@vue/compiler-sfc": {
"version": "3.4.14",
"resolved": "https://registry.npmjs.org/@vue/compiler-sfc/-/compiler-sfc-3.4.14.tgz",
"integrity": "sha512-1vHc9Kv1jV+YBZC/RJxQJ9JCxildTI+qrhtDh6tPkR1O8S+olBUekimY0km0ZNn8nG1wjtFAe9XHij+YLR8cRQ==",
"version": "3.4.15",
"resolved": "https://registry.npmjs.org/@vue/compiler-sfc/-/compiler-sfc-3.4.15.tgz",
"integrity": "sha512-LCn5M6QpkpFsh3GQvs2mJUOAlBQcCco8D60Bcqmf3O3w5a+KWS5GvYbrrJBkgvL1BDnTp+e8q0lXCLgHhKguBA==",
"dependencies": {
"@babel/parser": "^7.23.6",
"@vue/compiler-core": "3.4.14",
"@vue/compiler-dom": "3.4.14",
"@vue/compiler-ssr": "3.4.14",
"@vue/shared": "3.4.14",
"@vue/compiler-core": "3.4.15",
"@vue/compiler-dom": "3.4.15",
"@vue/compiler-ssr": "3.4.15",
"@vue/shared": "3.4.15",
"estree-walker": "^2.0.2",
"magic-string": "^0.30.5",
"postcss": "^8.4.33",
@ -920,12 +920,12 @@
}
},
"node_modules/@vue/compiler-ssr": {
"version": "3.4.14",
"resolved": "https://registry.npmjs.org/@vue/compiler-ssr/-/compiler-ssr-3.4.14.tgz",
"integrity": "sha512-bXT6+oAGlFjTYVOTtFJ4l4Jab1wjsC0cfSfOe2B4Z0N2vD2zOBSQ9w694RsCfhjk+bC2DY5Gubb1rHZVii107Q==",
"version": "3.4.15",
"resolved": "https://registry.npmjs.org/@vue/compiler-ssr/-/compiler-ssr-3.4.15.tgz",
"integrity": "sha512-1jdeQyiGznr8gjFDadVmOJqZiLNSsMa5ZgqavkPZ8O2wjHv0tVuAEsw5hTdUoUW4232vpBbL/wJhzVW/JwY1Uw==",
"dependencies": {
"@vue/compiler-dom": "3.4.14",
"@vue/shared": "3.4.14"
"@vue/compiler-dom": "3.4.15",
"@vue/shared": "3.4.15"
}
},
"node_modules/@vue/devtools-api": {
@ -934,29 +934,29 @@
"integrity": "sha512-o9KfBeaBmCKl10usN4crU53fYtC1r7jJwdGKjPT24t348rHxgfpZ0xL3Xm/gLUYnc0oTp8LAmrxOeLyu6tbk2Q=="
},
"node_modules/@vue/reactivity": {
"version": "3.4.14",
"resolved": "https://registry.npmjs.org/@vue/reactivity/-/reactivity-3.4.14.tgz",
"integrity": "sha512-xRYwze5Q4tK7tT2J4uy4XLhK/AIXdU5EBUu9PLnIHcOKXO0uyXpNNMzlQKuq7B+zwtq6K2wuUL39pHA6ZQzObw==",
"version": "3.4.15",
"resolved": "https://registry.npmjs.org/@vue/reactivity/-/reactivity-3.4.15.tgz",
"integrity": "sha512-55yJh2bsff20K5O84MxSvXKPHHt17I2EomHznvFiJCAZpJTNW8IuLj1xZWMLELRhBK3kkFV/1ErZGHJfah7i7w==",
"dependencies": {
"@vue/shared": "3.4.14"
"@vue/shared": "3.4.15"
}
},
"node_modules/@vue/runtime-core": {
"version": "3.4.14",
"resolved": "https://registry.npmjs.org/@vue/runtime-core/-/runtime-core-3.4.14.tgz",
"integrity": "sha512-qu+NMkfujCoZL6cfqK5NOfxgXJROSlP2ZPs4CTcVR+mLrwl4TtycF5Tgo0QupkdBL+2kigc6EsJlTcuuZC1NaQ==",
"version": "3.4.15",
"resolved": "https://registry.npmjs.org/@vue/runtime-core/-/runtime-core-3.4.15.tgz",
"integrity": "sha512-6E3by5m6v1AkW0McCeAyhHTw+3y17YCOKG0U0HDKDscV4Hs0kgNT5G+GCHak16jKgcCDHpI9xe5NKb8sdLCLdw==",
"dependencies": {
"@vue/reactivity": "3.4.14",
"@vue/shared": "3.4.14"
"@vue/reactivity": "3.4.15",
"@vue/shared": "3.4.15"
}
},
"node_modules/@vue/runtime-dom": {
"version": "3.4.14",
"resolved": "https://registry.npmjs.org/@vue/runtime-dom/-/runtime-dom-3.4.14.tgz",
"integrity": "sha512-B85XmcR4E7XsirEHVqhmy4HPbRT9WLFWV9Uhie3OapV9m1MEN9+Er6hmUIE6d8/l2sUygpK9RstFM2bmHEUigA==",
"version": "3.4.15",
"resolved": "https://registry.npmjs.org/@vue/runtime-dom/-/runtime-dom-3.4.15.tgz",
"integrity": "sha512-EVW8D6vfFVq3V/yDKNPBFkZKGMFSvZrUQmx196o/v2tHKdwWdiZjYUBS+0Ez3+ohRyF8Njwy/6FH5gYJ75liUw==",
"dependencies": {
"@vue/runtime-core": "3.4.14",
"@vue/shared": "3.4.14",
"@vue/runtime-core": "3.4.15",
"@vue/shared": "3.4.15",
"csstype": "^3.1.3"
}
},
@ -966,21 +966,21 @@
"integrity": "sha512-M1uQkMl8rQK/szD0LNhtqxIPLpimGm8sOBwU7lLnCpSbTyY3yeU1Vc7l4KT5zT4s/yOxHH5O7tIuuLOCnLADRw=="
},
"node_modules/@vue/server-renderer": {
"version": "3.4.14",
"resolved": "https://registry.npmjs.org/@vue/server-renderer/-/server-renderer-3.4.14.tgz",
"integrity": "sha512-pwSKXQfYdJBTpvWHGEYI+akDE18TXAiLcGn+Q/2Fj8wQSHWztoo7PSvfMNqu6NDhp309QXXbPFEGCU5p85HqkA==",
"version": "3.4.15",
"resolved": "https://registry.npmjs.org/@vue/server-renderer/-/server-renderer-3.4.15.tgz",
"integrity": "sha512-3HYzaidu9cHjrT+qGUuDhFYvF/j643bHC6uUN9BgM11DVy+pM6ATsG6uPBLnkwOgs7BpJABReLmpL3ZPAsUaqw==",
"dependencies": {
"@vue/compiler-ssr": "3.4.14",
"@vue/shared": "3.4.14"
"@vue/compiler-ssr": "3.4.15",
"@vue/shared": "3.4.15"
},
"peerDependencies": {
"vue": "3.4.14"
"vue": "3.4.15"
}
},
"node_modules/@vue/shared": {
"version": "3.4.14",
"resolved": "https://registry.npmjs.org/@vue/shared/-/shared-3.4.14.tgz",
"integrity": "sha512-nmi3BtLpvqXAWoRZ6HQ+pFJOHBU4UnH3vD3opgmwXac7vhaHKA9nj1VeGjMggdB9eLtW83eHyPCmOU1qzdsC7Q=="
"version": "3.4.15",
"resolved": "https://registry.npmjs.org/@vue/shared/-/shared-3.4.15.tgz",
"integrity": "sha512-KzfPTxVaWfB+eGcGdbSf4CWdaXcGDqckoeXUh7SB3fZdEtzPCK2Vq9B/lRRL3yutax/LWITz+SwvgyOxz5V75g=="
},
"node_modules/acorn": {
"version": "8.11.2",
@ -2215,9 +2215,9 @@
}
},
"node_modules/vite": {
"version": "5.0.11",
"resolved": "https://registry.npmjs.org/vite/-/vite-5.0.11.tgz",
"integrity": "sha512-XBMnDjZcNAw/G1gEiskiM1v6yzM4GE5aMGvhWTlHAYYhxb7S3/V1s3m2LDHa8Vh6yIWYYB0iJwsEaS523c4oYA==",
"version": "5.0.12",
"resolved": "https://registry.npmjs.org/vite/-/vite-5.0.12.tgz",
"integrity": "sha512-4hsnEkG3q0N4Tzf1+t6NdN9dg/L3BM+q8SWgbSPnJvrgH2kgdyzfVJwbR1ic69/4uMJJ/3dqDZZE5/WwqW8U1w==",
"dev": true,
"dependencies": {
"esbuild": "^0.19.3",
@ -2282,15 +2282,15 @@
}
},
"node_modules/vue": {
"version": "3.4.14",
"resolved": "https://registry.npmjs.org/vue/-/vue-3.4.14.tgz",
"integrity": "sha512-Rop5Al/ZcBbBz+KjPZaZDgHDX0kUP4duEzDbm+1o91uxYUNmJrZSBuegsNIJvUGy+epLevNRNhLjm08VKTgGyw==",
"version": "3.4.15",
"resolved": "https://registry.npmjs.org/vue/-/vue-3.4.15.tgz",
"integrity": "sha512-jC0GH4KkWLWJOEQjOpkqU1bQsBwf4R1rsFtw5GQJbjHVKWDzO6P0nWWBTmjp1xSemAioDFj1jdaK1qa3DnMQoQ==",
"dependencies": {
"@vue/compiler-dom": "3.4.14",
"@vue/compiler-sfc": "3.4.14",
"@vue/runtime-dom": "3.4.14",
"@vue/server-renderer": "3.4.14",
"@vue/shared": "3.4.14"
"@vue/compiler-dom": "3.4.15",
"@vue/compiler-sfc": "3.4.15",
"@vue/runtime-dom": "3.4.15",
"@vue/server-renderer": "3.4.15",
"@vue/shared": "3.4.15"
},
"peerDependencies": {
"typescript": "*"
@ -2902,36 +2902,36 @@
"requires": {}
},
"@vue/compiler-core": {
"version": "3.4.14",
"resolved": "https://registry.npmjs.org/@vue/compiler-core/-/compiler-core-3.4.14.tgz",
"integrity": "sha512-ro4Zzl/MPdWs7XwxT7omHRxAjMbDFRZEEjD+2m3NBf8YzAe3HuoSEZosXQo+m1GQ1G3LQ1LdmNh1RKTYe+ssEg==",
"version": "3.4.15",
"resolved": "https://registry.npmjs.org/@vue/compiler-core/-/compiler-core-3.4.15.tgz",
"integrity": "sha512-XcJQVOaxTKCnth1vCxEChteGuwG6wqnUHxAm1DO3gCz0+uXKaJNx8/digSz4dLALCy8n2lKq24jSUs8segoqIw==",
"requires": {
"@babel/parser": "^7.23.6",
"@vue/shared": "3.4.14",
"@vue/shared": "3.4.15",
"entities": "^4.5.0",
"estree-walker": "^2.0.2",
"source-map-js": "^1.0.2"
}
},
"@vue/compiler-dom": {
"version": "3.4.14",
"resolved": "https://registry.npmjs.org/@vue/compiler-dom/-/compiler-dom-3.4.14.tgz",
"integrity": "sha512-nOZTY+veWNa0DKAceNWxorAbWm0INHdQq7cejFaWM1WYnoNSJbSEKYtE7Ir6lR/+mo9fttZpPVI9ZFGJ1juUEQ==",
"version": "3.4.15",
"resolved": "https://registry.npmjs.org/@vue/compiler-dom/-/compiler-dom-3.4.15.tgz",
"integrity": "sha512-wox0aasVV74zoXyblarOM3AZQz/Z+OunYcIHe1OsGclCHt8RsRm04DObjefaI82u6XDzv+qGWZ24tIsRAIi5MQ==",
"requires": {
"@vue/compiler-core": "3.4.14",
"@vue/shared": "3.4.14"
"@vue/compiler-core": "3.4.15",
"@vue/shared": "3.4.15"
}
},
"@vue/compiler-sfc": {
"version": "3.4.14",
"resolved": "https://registry.npmjs.org/@vue/compiler-sfc/-/compiler-sfc-3.4.14.tgz",
"integrity": "sha512-1vHc9Kv1jV+YBZC/RJxQJ9JCxildTI+qrhtDh6tPkR1O8S+olBUekimY0km0ZNn8nG1wjtFAe9XHij+YLR8cRQ==",
"version": "3.4.15",
"resolved": "https://registry.npmjs.org/@vue/compiler-sfc/-/compiler-sfc-3.4.15.tgz",
"integrity": "sha512-LCn5M6QpkpFsh3GQvs2mJUOAlBQcCco8D60Bcqmf3O3w5a+KWS5GvYbrrJBkgvL1BDnTp+e8q0lXCLgHhKguBA==",
"requires": {
"@babel/parser": "^7.23.6",
"@vue/compiler-core": "3.4.14",
"@vue/compiler-dom": "3.4.14",
"@vue/compiler-ssr": "3.4.14",
"@vue/shared": "3.4.14",
"@vue/compiler-core": "3.4.15",
"@vue/compiler-dom": "3.4.15",
"@vue/compiler-ssr": "3.4.15",
"@vue/shared": "3.4.15",
"estree-walker": "^2.0.2",
"magic-string": "^0.30.5",
"postcss": "^8.4.33",
@ -2939,12 +2939,12 @@
}
},
"@vue/compiler-ssr": {
"version": "3.4.14",
"resolved": "https://registry.npmjs.org/@vue/compiler-ssr/-/compiler-ssr-3.4.14.tgz",
"integrity": "sha512-bXT6+oAGlFjTYVOTtFJ4l4Jab1wjsC0cfSfOe2B4Z0N2vD2zOBSQ9w694RsCfhjk+bC2DY5Gubb1rHZVii107Q==",
"version": "3.4.15",
"resolved": "https://registry.npmjs.org/@vue/compiler-ssr/-/compiler-ssr-3.4.15.tgz",
"integrity": "sha512-1jdeQyiGznr8gjFDadVmOJqZiLNSsMa5ZgqavkPZ8O2wjHv0tVuAEsw5hTdUoUW4232vpBbL/wJhzVW/JwY1Uw==",
"requires": {
"@vue/compiler-dom": "3.4.14",
"@vue/shared": "3.4.14"
"@vue/compiler-dom": "3.4.15",
"@vue/shared": "3.4.15"
}
},
"@vue/devtools-api": {
@ -2953,29 +2953,29 @@
"integrity": "sha512-o9KfBeaBmCKl10usN4crU53fYtC1r7jJwdGKjPT24t348rHxgfpZ0xL3Xm/gLUYnc0oTp8LAmrxOeLyu6tbk2Q=="
},
"@vue/reactivity": {
"version": "3.4.14",
"resolved": "https://registry.npmjs.org/@vue/reactivity/-/reactivity-3.4.14.tgz",
"integrity": "sha512-xRYwze5Q4tK7tT2J4uy4XLhK/AIXdU5EBUu9PLnIHcOKXO0uyXpNNMzlQKuq7B+zwtq6K2wuUL39pHA6ZQzObw==",
"version": "3.4.15",
"resolved": "https://registry.npmjs.org/@vue/reactivity/-/reactivity-3.4.15.tgz",
"integrity": "sha512-55yJh2bsff20K5O84MxSvXKPHHt17I2EomHznvFiJCAZpJTNW8IuLj1xZWMLELRhBK3kkFV/1ErZGHJfah7i7w==",
"requires": {
"@vue/shared": "3.4.14"
"@vue/shared": "3.4.15"
}
},
"@vue/runtime-core": {
"version": "3.4.14",
"resolved": "https://registry.npmjs.org/@vue/runtime-core/-/runtime-core-3.4.14.tgz",
"integrity": "sha512-qu+NMkfujCoZL6cfqK5NOfxgXJROSlP2ZPs4CTcVR+mLrwl4TtycF5Tgo0QupkdBL+2kigc6EsJlTcuuZC1NaQ==",
"version": "3.4.15",
"resolved": "https://registry.npmjs.org/@vue/runtime-core/-/runtime-core-3.4.15.tgz",
"integrity": "sha512-6E3by5m6v1AkW0McCeAyhHTw+3y17YCOKG0U0HDKDscV4Hs0kgNT5G+GCHak16jKgcCDHpI9xe5NKb8sdLCLdw==",
"requires": {
"@vue/reactivity": "3.4.14",
"@vue/shared": "3.4.14"
"@vue/reactivity": "3.4.15",
"@vue/shared": "3.4.15"
}
},
"@vue/runtime-dom": {
"version": "3.4.14",
"resolved": "https://registry.npmjs.org/@vue/runtime-dom/-/runtime-dom-3.4.14.tgz",
"integrity": "sha512-B85XmcR4E7XsirEHVqhmy4HPbRT9WLFWV9Uhie3OapV9m1MEN9+Er6hmUIE6d8/l2sUygpK9RstFM2bmHEUigA==",
"version": "3.4.15",
"resolved": "https://registry.npmjs.org/@vue/runtime-dom/-/runtime-dom-3.4.15.tgz",
"integrity": "sha512-EVW8D6vfFVq3V/yDKNPBFkZKGMFSvZrUQmx196o/v2tHKdwWdiZjYUBS+0Ez3+ohRyF8Njwy/6FH5gYJ75liUw==",
"requires": {
"@vue/runtime-core": "3.4.14",
"@vue/shared": "3.4.14",
"@vue/runtime-core": "3.4.15",
"@vue/shared": "3.4.15",
"csstype": "^3.1.3"
},
"dependencies": {
@ -2987,18 +2987,18 @@
}
},
"@vue/server-renderer": {
"version": "3.4.14",
"resolved": "https://registry.npmjs.org/@vue/server-renderer/-/server-renderer-3.4.14.tgz",
"integrity": "sha512-pwSKXQfYdJBTpvWHGEYI+akDE18TXAiLcGn+Q/2Fj8wQSHWztoo7PSvfMNqu6NDhp309QXXbPFEGCU5p85HqkA==",
"version": "3.4.15",
"resolved": "https://registry.npmjs.org/@vue/server-renderer/-/server-renderer-3.4.15.tgz",
"integrity": "sha512-3HYzaidu9cHjrT+qGUuDhFYvF/j643bHC6uUN9BgM11DVy+pM6ATsG6uPBLnkwOgs7BpJABReLmpL3ZPAsUaqw==",
"requires": {
"@vue/compiler-ssr": "3.4.14",
"@vue/shared": "3.4.14"
"@vue/compiler-ssr": "3.4.15",
"@vue/shared": "3.4.15"
}
},
"@vue/shared": {
"version": "3.4.14",
"resolved": "https://registry.npmjs.org/@vue/shared/-/shared-3.4.14.tgz",
"integrity": "sha512-nmi3BtLpvqXAWoRZ6HQ+pFJOHBU4UnH3vD3opgmwXac7vhaHKA9nj1VeGjMggdB9eLtW83eHyPCmOU1qzdsC7Q=="
"version": "3.4.15",
"resolved": "https://registry.npmjs.org/@vue/shared/-/shared-3.4.15.tgz",
"integrity": "sha512-KzfPTxVaWfB+eGcGdbSf4CWdaXcGDqckoeXUh7SB3fZdEtzPCK2Vq9B/lRRL3yutax/LWITz+SwvgyOxz5V75g=="
},
"acorn": {
"version": "8.11.2",
@ -3903,9 +3903,9 @@
}
},
"vite": {
"version": "5.0.11",
"resolved": "https://registry.npmjs.org/vite/-/vite-5.0.11.tgz",
"integrity": "sha512-XBMnDjZcNAw/G1gEiskiM1v6yzM4GE5aMGvhWTlHAYYhxb7S3/V1s3m2LDHa8Vh6yIWYYB0iJwsEaS523c4oYA==",
"version": "5.0.12",
"resolved": "https://registry.npmjs.org/vite/-/vite-5.0.12.tgz",
"integrity": "sha512-4hsnEkG3q0N4Tzf1+t6NdN9dg/L3BM+q8SWgbSPnJvrgH2kgdyzfVJwbR1ic69/4uMJJ/3dqDZZE5/WwqW8U1w==",
"dev": true,
"requires": {
"esbuild": "^0.19.3",
@ -3924,15 +3924,15 @@
}
},
"vue": {
"version": "3.4.14",
"resolved": "https://registry.npmjs.org/vue/-/vue-3.4.14.tgz",
"integrity": "sha512-Rop5Al/ZcBbBz+KjPZaZDgHDX0kUP4duEzDbm+1o91uxYUNmJrZSBuegsNIJvUGy+epLevNRNhLjm08VKTgGyw==",
"version": "3.4.15",
"resolved": "https://registry.npmjs.org/vue/-/vue-3.4.15.tgz",
"integrity": "sha512-jC0GH4KkWLWJOEQjOpkqU1bQsBwf4R1rsFtw5GQJbjHVKWDzO6P0nWWBTmjp1xSemAioDFj1jdaK1qa3DnMQoQ==",
"requires": {
"@vue/compiler-dom": "3.4.14",
"@vue/compiler-sfc": "3.4.14",
"@vue/runtime-dom": "3.4.14",
"@vue/server-renderer": "3.4.14",
"@vue/shared": "3.4.14"
"@vue/compiler-dom": "3.4.15",
"@vue/compiler-sfc": "3.4.15",
"@vue/runtime-dom": "3.4.15",
"@vue/server-renderer": "3.4.15",
"@vue/shared": "3.4.15"
}
},
"vue-chartjs": {

View File

@ -15,7 +15,7 @@
"monaco-editor": "^0.45.0",
"pinia": "^2.1.7",
"sass": "^1.70.0",
"vue": "^3.4.14",
"vue": "^3.4.15",
"vue-chartjs": "^5.3.0",
"vue-i18n": "^9.9.0",
"xterm": "^5.3.0",
@ -28,6 +28,6 @@
"unplugin-auto-import": "^0.17.3",
"unplugin-icons": "^0.18.2",
"unplugin-vue-components": "^0.26.0",
"vite": "^5.0.11"
"vite": "^5.0.12"
}
}

View File

@ -1 +1 @@
43b12c3794341237a522ac6457ab81da
6403086a3d7567446771161c9ad44994

View File

@ -51,6 +51,7 @@ const newTerm = () => {
term.loadAddon(fitAddon)
term.onData(onTermData)
term.attachCustomKeyEventHandler(onTermKey)
return { term, fitAddon }
}
@ -177,6 +178,70 @@ const onTermData = (data) => {
// term.write(data)
}
/**
*
* @param e
* @return {boolean}
*/
const onTermKey = (e) => {
if (e.type === 'keydown') {
if (e.ctrlKey) {
switch (e.key) {
case 'a': // move to head of line
moveInputCursorTo(0)
return false
case 'e': // move to tail of line
moveInputCursorTo(Number.MAX_VALUE)
return false
case 'f': // move forward
moveInputCursor(1)
return false
case 'b': // move backward
moveInputCursor(-1)
return false
case 'd': // delete char
deleteInput(false)
return false
case 'h': // back delete
deleteInput(true)
return false
case 'u': // delete all text before cursor
deleteInput2(false)
return false
case 'k': // delete all text after cursor
deleteInput2(true)
return false
case 'w': // delete word before cursor
deleteWord(false)
return false
case 'p': // previous history
changeHistory(true)
return false
case 'n': // next history
changeHistory(false)
return false
case 'l': // clear screen
termInst.clear()
replaceTermInput()
newInputLine()
return false
}
}
}
return true
}
/**
* move input cursor by step
* @param {number} step above 0 indicate move right; 0 indicate move to last
@ -283,6 +348,85 @@ const deleteInput = (back = false) => {
moveInputCursorTo(inputCursor)
}
/**
* delete to the end
* @param back
*/
const deleteInput2 = (back = false) => {
if (termInst == null) {
return
}
let currentLine = getCurrentInput()
if (back) {
// delete until tail
currentLine = currentLine.substring(0, inputCursor - 1)
inputCursor = currentLine.length
} else {
// delete until head
currentLine = currentLine.substring(inputCursor)
inputCursor = 0
}
replaceTermInput(currentLine)
updateCurrentInput(currentLine)
moveInputCursorTo(inputCursor)
}
/**
* delete one word
* @param back
*/
const deleteWord = (back = false) => {
if (termInst == null) {
return
}
let currentLine = getCurrentInput()
if (back) {
const prefix = currentLine.substring(0, inputCursor)
let firstNonChar = false
let cursor = inputCursor
while (cursor < currentLine.length) {
const isChar =
(currentLine[cursor] >= 'a' && currentLine[cursor] <= 'z') ||
(currentLine[cursor] >= 'A' && currentLine[cursor] <= 'Z') ||
(currentLine[cursor] >= '0' && currentLine[cursor] <= '9')
if (!firstNonChar || isChar) {
if (!isChar) {
firstNonChar = true
}
cursor++
} else {
break
}
}
currentLine = prefix + currentLine.substring(cursor)
} else {
const suffix = currentLine.substring(inputCursor)
let firstNonChar = false
while (inputCursor >= 0) {
const isChar =
(currentLine[inputCursor] >= 'a' && currentLine[inputCursor] <= 'z') ||
(currentLine[inputCursor] >= 'A' && currentLine[inputCursor] <= 'Z') ||
(currentLine[inputCursor] >= '0' && currentLine[inputCursor] <= '9')
if (!firstNonChar || isChar) {
if (!isChar) {
firstNonChar = true
}
inputCursor--
} else {
break
}
}
currentLine = currentLine.substring(0, inputCursor) + suffix
}
replaceTermInput(currentLine)
updateCurrentInput(currentLine)
moveInputCursorTo(inputCursor)
}
const getCurrentInput = () => {
return get(inputHistory, historyIndex, '')
}

View File

@ -109,6 +109,10 @@ const onSelectPreferenceMenu = (key) => {
}
}
const openX = () => {
BrowserOpenURL('https://twitter.com/LykinHuang')
}
const openGithub = () => {
BrowserOpenURL('https://github.com/tiny-craft/tiny-rdm')
}
@ -149,20 +153,30 @@ const exThemeVars = computed(() => {
:render-icon="({ icon }) => render.renderIcon(icon)"
:render-label="({ label }) => render.renderLabel($t(label), { class: 'context-menu-item' })"
trigger="click"
content-class="nav-menu-button"
@select="onSelectPreferenceMenu">
<icon-button :icon="Config" :size="iconSize" :stroke-width="3" class="nav-menu-button" />
<icon-button :icon="Config" :size="iconSize" :stroke-width="3" />
</n-dropdown>
<icon-button
v-if="prefStore.currentLanguage === 'zh'"
:icon="QRCode"
:size="iconSize"
:tooltip="$t('ribbon.wechat_official')"
t-tooltip="ribbon.wechat_official"
class="nav-menu-button"
@click="showWechat = true" />
<icon-button
v-else
:border="false"
:size="iconSize"
class="nav-menu-button"
t-tooltip="ribbon.follow_x"
@click="openX">
<span style="font-weight: bold; font-size: 24px">𝕏</span>
</icon-button>
<icon-button
:icon="Github"
:size="iconSize"
:tooltip="$t('ribbon.github')"
t-tooltip="ribbon.github"
class="nav-menu-button"
@click="openGithub" />
</div>

View File

@ -146,6 +146,7 @@
"browser": "Data Browser",
"log": "Log",
"wechat_official": "Wechat Official Account",
"follow_x": "Follow My \uD835\uDD4F",
"github": "Github"
},
"dialogue": {

View File

@ -146,6 +146,7 @@
"browser": "数据浏览",
"log": "日志",
"wechat_official": "微信公众号",
"follow_x": "关注的我\uD835\uDD4F",
"github": "Github"
},
"dialogue": {