Compare commits
No commits in common. "3c43f960c3a0d4068a357d6700b90ec322108c42" and "f0c9b745456cdce2af3d94ecf172904432855b3f" have entirely different histories.
3c43f960c3
...
f0c9b74545
|
@ -135,7 +135,7 @@ const onKeyShortcut = (e) => {
|
|||
return
|
||||
|
||||
case 'd':
|
||||
if (e.metaKey && isMacOS()) {
|
||||
if (e.metaKey) {
|
||||
onDelete()
|
||||
}
|
||||
return
|
||||
|
|
|
@ -26,7 +26,6 @@ import RedisTypeTag from '@/components/common/RedisTypeTag.vue'
|
|||
import usePreferencesStore from 'stores/preferences.js'
|
||||
import { typesIconStyle } from '@/consts/support_redis_type.js'
|
||||
import { nativeRedisKey } from '@/utils/key_convert.js'
|
||||
import { isMacOS } from '@/utils/platform.js'
|
||||
|
||||
const props = defineProps({
|
||||
server: String,
|
||||
|
@ -281,96 +280,6 @@ const handleKeyRight = () => {
|
|||
}
|
||||
}
|
||||
|
||||
const handleKeyDelete = () => {
|
||||
const selectedKey = get(selectedKeys.value, 0)
|
||||
if (selectedKey == null) {
|
||||
return
|
||||
}
|
||||
let node = browserStore.getNode(selectedKey)
|
||||
if (node == null) {
|
||||
return
|
||||
}
|
||||
|
||||
const { db = 0, key: nodeKey, redisKey: rk = '', redisKeyCode: rkc, label } = node || {}
|
||||
const redisKey = rkc || rk
|
||||
const redisKeyName = !!rkc ? label : redisKey
|
||||
switch (node.type) {
|
||||
case ConnectionType.RedisKey:
|
||||
dialogStore.openDeleteKeyDialog(props.server, db, isEmpty(redisKey) ? '*' : redisKey + ':*')
|
||||
break
|
||||
case ConnectionType.RedisValue:
|
||||
$dialog.warning(i18n.t('dialogue.remove_tip', { name: redisKeyName }), () => {
|
||||
browserStore.deleteKey(props.server, db, redisKey).then((success) => {
|
||||
if (success) {
|
||||
$message.success(i18n.t('dialogue.delete.success', { key: redisKeyName }))
|
||||
}
|
||||
})
|
||||
})
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
const handleKeyCopy = () => {
|
||||
const selectedKey = get(selectedKeys.value, 0)
|
||||
if (selectedKey == null) {
|
||||
return
|
||||
}
|
||||
let node = browserStore.getNode(selectedKey)
|
||||
if (node == null) {
|
||||
return
|
||||
}
|
||||
|
||||
if (node.type === ConnectionType.RedisValue) {
|
||||
ClipboardSetText(nativeRedisKey(node.redisKeyCode || node.redisKey))
|
||||
.then((succ) => {
|
||||
if (succ) {
|
||||
$message.success(i18n.t('interface.copy_succ'))
|
||||
}
|
||||
})
|
||||
.catch((e) => {
|
||||
$message.error(e.message)
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
const onKeyShortcut = (e) => {
|
||||
switch (e.key) {
|
||||
case 'ArrowUp':
|
||||
handleKeyUp()
|
||||
break
|
||||
case 'ArrowDown':
|
||||
handleKeyDown()
|
||||
break
|
||||
case 'ArrowLeft':
|
||||
handleKeyLeft()
|
||||
break
|
||||
case 'ArrowRight':
|
||||
handleKeyRight()
|
||||
break
|
||||
case 'c':
|
||||
if (e.metaKey) {
|
||||
handleKeyCopy()
|
||||
}
|
||||
break
|
||||
case 'Delete':
|
||||
handleKeyDelete()
|
||||
break
|
||||
case 'd':
|
||||
if (e.metaKey && isMacOS()) {
|
||||
handleKeyDelete()
|
||||
}
|
||||
break
|
||||
case 'F5':
|
||||
handleSelectContextMenu('value_reload')
|
||||
break
|
||||
case 'r':
|
||||
if (e.metaKey && isMacOS()) {
|
||||
handleSelectContextMenu('value_reload')
|
||||
}
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
const handleSelectContextMenu = (action) => {
|
||||
contextMenuParam.show = false
|
||||
const selectedKey = get(selectedKeys.value, 0)
|
||||
|
@ -843,7 +752,11 @@ defineExpose({
|
|||
class="fill-height"
|
||||
virtual-scroll
|
||||
:keyboard="false"
|
||||
@keydown="onKeyShortcut"
|
||||
@keydown.up="handleKeyUp"
|
||||
@keydown.down="handleKeyDown"
|
||||
@keydown.left="handleKeyLeft"
|
||||
@keydown.right="handleKeyRight"
|
||||
@keydown.delete="handleSelectContextMenu('value_remove')"
|
||||
@update:selected-keys="onUpdateSelectedKeys"
|
||||
@update:expanded-keys="onUpdateExpanded"
|
||||
@update:checked-keys="onUpdateCheckedKeys">
|
||||
|
|
Loading…
Reference in New Issue