perf: support display binary key name which unreadable(convert to hex string) #49

This commit is contained in:
tiny-craft
2023-10-11 01:15:23 +08:00
parent a6645e3340
commit a4412d21d4
24 changed files with 485 additions and 145 deletions

View File

@@ -15,6 +15,10 @@ const props = defineProps({
name: String,
db: Number,
keyPath: String,
keyCode: {
type: Array,
default: null,
},
ttl: {
type: Number,
default: -1,
@@ -23,6 +27,14 @@ const props = defineProps({
size: Number,
})
/**
*
* @type {ComputedRef<string|number[]>}
*/
const keyName = computed(() => {
return !isEmpty(props.keyCode) ? props.keyCode : props.keyPath
})
const filterOption = [
{
value: 1,
@@ -149,11 +161,11 @@ const actionColumn = {
const { success, msg } = await connectionStore.removeZSetItem(
props.name,
props.db,
props.keyPath,
keyName.value,
row.value,
)
if (success) {
connectionStore.loadKeyValue(props.name, props.db, props.keyPath).then((r) => {})
connectionStore.loadKeyValue(props.name, props.db, keyName.value).then((r) => {})
$message.success(i18n.t('dialogue.delete_key_succ', { key: row.value }))
} else {
$message.error(msg)
@@ -172,13 +184,13 @@ const actionColumn = {
const { success, msg } = await connectionStore.updateZSetItem(
props.name,
props.db,
props.keyPath,
keyName.value,
row.value,
newValue,
currentEditRow.value.score,
)
if (success) {
connectionStore.loadKeyValue(props.name, props.db, props.keyPath).then((r) => {})
connectionStore.loadKeyValue(props.name, props.db, keyName.value).then((r) => {})
$message.success(i18n.t('dialogue.save_value_succ'))
} else {
$message.error(msg)
@@ -222,7 +234,7 @@ const tableData = computed(() => {
})
const onAddRow = () => {
dialogStore.openAddFieldsDialog(props.name, props.db, props.keyPath, types.ZSET)
dialogStore.openAddFieldsDialog(props.name, props.db, props.keyPath, props.keyCode, types.ZSET)
}
const filterValue = ref('')
@@ -266,7 +278,13 @@ const onUpdateFilter = (filters, sourceColumn) => {
<template>
<div class="content-wrapper flex-box-v">
<content-toolbar :db="props.db" :key-path="props.keyPath" :key-type="keyType" :server="props.name" :ttl="ttl" />
<content-toolbar
:db="props.db"
:key-path="props.keyPath"
:key-code="props.keyCode"
:key-type="keyType"
:server="props.name"
:ttl="ttl" />
<div class="tb2 flex-box-h">
<div class="flex-box-h">
<n-input-group>