diff --git a/frontend/src/components/sidebar/BrowserTree.vue b/frontend/src/components/sidebar/BrowserTree.vue index 041591d..4fe13cc 100644 --- a/frontend/src/components/sidebar/BrowserTree.vue +++ b/frontend/src/components/sidebar/BrowserTree.vue @@ -119,6 +119,15 @@ const menuOptions = { label: i18n.t('filter_key'), icon: renderIcon(Filter), }, + { + type: 'divider', + key: 'd2', + }, + { + key: 'key_remove', + label: i18n.t('batch_delete'), + icon: renderIcon(Delete), + }, { type: 'divider', key: 'd1', @@ -161,7 +170,7 @@ const menuOptions = { }, { key: 'key_remove', - label: i18n.t('remove_path'), + label: i18n.t('batch_delete'), icon: renderIcon(Delete), }, ], @@ -445,7 +454,7 @@ const handleSelectContextMenu = (key) => { connectionStore.loadKeyValue(props.server, db, redisKey) break case 'key_remove': - dialogStore.openDeleteKeyDialog(props.server, db, redisKey + ':*') + dialogStore.openDeleteKeyDialog(props.server, db, isEmpty(redisKey) ? '*' : redisKey + ':*') break case 'value_remove': confirmDialog.warning(i18n.t('remove_tip', { name: redisKey }), () => { diff --git a/frontend/src/langs/en.json b/frontend/src/langs/en.json index 05c333d..1e307d7 100644 --- a/frontend/src/langs/en.json +++ b/frontend/src/langs/en.json @@ -52,7 +52,7 @@ "remove_conn_group": "Delete Connection Group", "no_group": "No Group", "copy_path": "Copy Path", - "remove_path": "Remove Path", + "batch_delete": "Batch Delete", "copy_key": "Copy Key Name", "remove_key": "Remove Key", "new_conn_title": "New Connection", diff --git a/frontend/src/langs/zh-cn.json b/frontend/src/langs/zh-cn.json index 8e5671e..0ddaf40 100644 --- a/frontend/src/langs/zh-cn.json +++ b/frontend/src/langs/zh-cn.json @@ -54,7 +54,7 @@ "remove_conn_group": "删除连接分组", "no_group": "无分组", "copy_path": "复制路径", - "remove_path": "删除路径", + "batch_delete": "批量删除键", "copy_key": "复制键名", "remove_key": "删除键", "new_conn_title": "新建连接", diff --git a/frontend/src/stores/connections.js b/frontend/src/stores/connections.js index 9dbc928..4f2f807 100644 --- a/frontend/src/stores/connections.js +++ b/frontend/src/stores/connections.js @@ -316,6 +316,7 @@ const useConnectionStore = defineStore('connections', { } const dbs = [] for (let i = 0; i < db.length; i++) { + this._getNodeMap(name, i).clear() dbs.push({ key: `${name}/${db[i].name}`, label: db[i].name, @@ -324,6 +325,7 @@ const useConnectionStore = defineStore('connections', { db: i, type: ConnectionType.RedisDB, isLeaf: false, + children: undefined, }) } this.databases[name] = dbs @@ -344,7 +346,7 @@ const useConnectionStore = defineStore('connections', { const dbs = this.databases[name] for (const db of dbs) { this.removeKeyFilter(name, db.db) - this.nodeMap[`${name}#${db.db}`]?.clear() + this._getNodeMap(name, db.db).clear() } this.removeKeyFilter(name, -1) delete this.databases[name] @@ -469,7 +471,7 @@ const useConnectionStore = defineStore('connections', { dbs[db].children = undefined dbs[db].isLeaf = false - this.nodeMap[`${connName}#${db}`]?.clear() + this._getNodeMap(connName, db).clear() }, /** @@ -483,7 +485,7 @@ const useConnectionStore = defineStore('connections', { dbs[db].isLeaf = false dbs[db].opened = false - this.nodeMap[`${connName}#${db}`]?.clear() + this._getNodeMap(connName, db).clear() }, /**