diff --git a/backend/services/browser_service.go b/backend/services/browser_service.go
index 924f5b9..cdc4198 100644
--- a/backend/services/browser_service.go
+++ b/backend/services/browser_service.go
@@ -2293,7 +2293,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())
diff --git a/frontend/src/components/content/ContentPane.vue b/frontend/src/components/content/ContentPane.vue
index ff73259..f0a2996 100644
--- a/frontend/src/components/content/ContentPane.vue
+++ b/frontend/src/components/content/ContentPane.vue
@@ -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,
diff --git a/frontend/src/components/content_value/ContentToolbar.vue b/frontend/src/components/content_value/ContentToolbar.vue
index 9a041d7..8209421 100644
--- a/frontend/src/components/content_value/ContentToolbar.vue
+++ b/frontend/src/components/content_value/ContentToolbar.vue
@@ -111,7 +111,13 @@ const onTTL = () => {
TTL{{ `${ttl > 0 ? ': ' + ttl + $t('common.second') : ''}` }}
-
+
diff --git a/frontend/src/components/sidebar/BrowserTree.vue b/frontend/src/components/sidebar/BrowserTree.vue
index 016d751..504e9fe 100644
--- a/frontend/src/components/sidebar/BrowserTree.vue
+++ b/frontend/src/components/sidebar/BrowserTree.vue
@@ -359,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) {
diff --git a/frontend/src/components/sidebar/ConnectionTree.vue b/frontend/src/components/sidebar/ConnectionTree.vue
index a83e28c..be32730 100644
--- a/frontend/src/components/sidebar/ConnectionTree.vue
+++ b/frontend/src/components/sidebar/ConnectionTree.vue
@@ -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'),
}),
diff --git a/frontend/src/langs/en-us.json b/frontend/src/langs/en-us.json
index 2f1b3cf..9eea756 100644
--- a/frontend/src/langs/en-us.json
+++ b/frontend/src/langs/en-us.json
@@ -70,9 +70,9 @@
"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",
diff --git a/frontend/src/langs/zh-cn.json b/frontend/src/langs/zh-cn.json
index e10b2d3..cfb1603 100644
--- a/frontend/src/langs/zh-cn.json
+++ b/frontend/src/langs/zh-cn.json
@@ -70,9 +70,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": "重命名键",
diff --git a/frontend/src/objects/redisServerState.js b/frontend/src/objects/redisServerState.js
index 928b883..2f64a71 100644
--- a/frontend/src/objects/redisServerState.js
+++ b/frontend/src/objects/redisServerState.js
@@ -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}`
- keyNode.label = last(split(newKey, this.separator))
+ 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 = []
diff --git a/frontend/src/stores/browser.js b/frontend/src/stores/browser.js
index 3b57956..f9a94b1 100644
--- a/frontend/src/stores/browser.js
+++ b/frontend/src/stores/browser.js
@@ -245,6 +245,7 @@ const useBrowserStore = defineStore('browser', {
name,
separator: this.getSeparator(name),
db: -1,
+ viewType: view,
})
/** @type {Object.} **/
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}
*/
- 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
@@ -508,7 +509,7 @@ const useBrowserStore = defineStore('browser', {
tab.updateValue({
server,
db,
- key: decodeRedisKey(key),
+ key: nativeRedisKey(key),
value,
decode: retDecode,
format: retFormat,
@@ -1497,7 +1498,7 @@ const useBrowserStore = defineStore('browser', {
tabStore.updateTTL({
server,
db,
- key,
+ key: nativeRedisKey(key),
ttl,
})
}
diff --git a/frontend/src/stores/connections.js b/frontend/src/stores/connections.js
index c235cd2..22fe796 100644
--- a/frontend/src/stores/connections.js
+++ b/frontend/src/stores/connections.js
@@ -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
},
},
})
diff --git a/frontend/src/stores/tab.js b/frontend/src/stores/tab.js
index 6f5b686..be6b075 100644
--- a/frontend/src/stores/tab.js
+++ b/frontend/src/stores/tab.js
@@ -1,7 +1,6 @@
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
}