diff --git a/frontend/src/components/sidebar/BrowserPane.vue b/frontend/src/components/sidebar/BrowserPane.vue index a4f85d2..5c07f3b 100644 --- a/frontend/src/components/sidebar/BrowserPane.vue +++ b/frontend/src/components/sidebar/BrowserPane.vue @@ -72,8 +72,10 @@ const dbSelectOptions = computed(() => { const moreOptions = [ { key: 'import', label: 'interface.import_key', icon: Import }, + { key: 'divider1', type: 'divider' }, + { key: 'delete', label: 'interface.batch_delete_key', icon: Delete }, { key: 'flush', label: 'interface.flush_db', icon: Delete }, - { key: 'divider', type: 'divider' }, + { key: 'divider2', type: 'divider' }, { key: 'disconnect', label: 'interface.disconnect', icon: Unlink }, ] @@ -230,6 +232,21 @@ const onSelectOptions = (select) => { case 'import': onImportData() break + case 'delete': + let key = '*' + const selectedKey = get(browserTreeRef.value?.getSelectedKey(), 0) + if (selectedKey != null) { + const node = browserStore.getNode(selectedKey) + if (node != null) { + const { type = ConnectionType.RedisValue, redisKey } = node + if (type === ConnectionType.RedisKey) { + // has prefix + key = redisKey + browserStore.getSeparator(props.server) + '*' + } + } + } + dialogStore.openDeleteKeyDialog(props.server, props.db, key) + break case 'flush': onFlush() break diff --git a/frontend/src/stores/dialog.js b/frontend/src/stores/dialog.js index b776d1b..b619705 100644 --- a/frontend/src/stores/dialog.js +++ b/frontend/src/stores/dialog.js @@ -183,9 +183,9 @@ const useDialogStore = defineStore('dialog', { * * @param {string} server * @param {number} db - * @param {string|string[]} key + * @param {string|string[]} [key] */ - openDeleteKeyDialog(server, db, key) { + openDeleteKeyDialog(server, db, key = '*') { this.deleteKeyParam.server = server this.deleteKeyParam.db = db this.deleteKeyParam.key = key