perf: add batch delete to menu item "more" in browser pane
This commit is contained in:
parent
c2c1e9cfba
commit
ff2043c0e2
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue