diff --git a/backend/services/connection_service.go b/backend/services/connection_service.go index d7ebe4b..f82184c 100644 --- a/backend/services/connection_service.go +++ b/backend/services/connection_service.go @@ -508,12 +508,15 @@ func (c *connectionService) GetKeyValue(connName string, db int, key string) (re } var value any + var size int64 var cursor uint64 switch strings.ToLower(keyType) { case "string": value, err = rdb.Get(ctx, key).Result() + size, _ = rdb.StrLen(ctx, key).Result() case "list": value, err = rdb.LRange(ctx, key, 0, -1).Result() + size, _ = rdb.LLen(ctx, key).Result() case "hash": //value, err = rdb.HGetAll(ctx, key).Result() items := map[string]string{} @@ -532,6 +535,7 @@ func (c *connectionService) GetKeyValue(connName string, db int, key string) (re } } value = items + size, _ = rdb.HLen(ctx, key).Result() case "set": //value, err = rdb.SMembers(ctx, key).Result() items := []string{} @@ -548,6 +552,7 @@ func (c *connectionService) GetKeyValue(connName string, db int, key string) (re } } value = items + size, _ = rdb.SCard(ctx, key).Result() case "zset": //value, err = rdb.ZRangeWithScores(ctx, key, 0, -1).Result() var items []types.ZSetItem @@ -572,6 +577,7 @@ func (c *connectionService) GetKeyValue(connName string, db int, key string) (re } } value = items + size, _ = rdb.ZCard(ctx, key).Result() case "stream": var msgs []redis.XMessage items := []types.StreamItem{} @@ -587,6 +593,7 @@ func (c *connectionService) GetKeyValue(connName string, db int, key string) (re }) } value = items + size, _ = rdb.XLen(ctx, key).Result() } if err != nil { resp.Msg = err.Error() @@ -597,6 +604,7 @@ func (c *connectionService) GetKeyValue(connName string, db int, key string) (re "type": keyType, "ttl": ttl, "value": value, + "size": size, } return } diff --git a/frontend/src/components/content/ContentPane.vue b/frontend/src/components/content/ContentPane.vue index 70774e2..568545c 100644 --- a/frontend/src/components/content/ContentPane.vue +++ b/frontend/src/components/content/ContentPane.vue @@ -97,6 +97,7 @@ const tabContent = computed(() => { keyPath: tab.key, ttl: tab.ttl, value: tab.value, + size: tab.size || 0, } }) @@ -151,7 +152,8 @@ const onReloadKey = async () => { :key-path="tabContent.keyPath" :name="tabContent.name" :ttl="tabContent.ttl" - :value="tabContent.value" /> + :value="tabContent.value" + :size="tabContent.size" /> diff --git a/frontend/src/components/content_value/ContentValueHash.vue b/frontend/src/components/content_value/ContentValueHash.vue index 360487a..9c5686a 100644 --- a/frontend/src/components/content_value/ContentValueHash.vue +++ b/frontend/src/components/content_value/ContentValueHash.vue @@ -19,6 +19,7 @@ const props = defineProps({ default: -1, }, value: Object, + size: Number, }) const filterOption = [ @@ -257,7 +258,9 @@ const onUpdateFilter = (filters, sourceColumn) => { @update:value="onFilterInput" /> -
+
+ {{ $t('interface.total', { size: props.size }) }} +