diff --git a/backend/services/browser_service.go b/backend/services/browser_service.go index 6c733b9..49afbc1 100644 --- a/backend/services/browser_service.go +++ b/backend/services/browser_service.go @@ -600,7 +600,6 @@ func (b *browserService) GetKeySummary(param types.KeySummaryParam) (resp types. pipe := client.Pipeline() typeVal := pipe.Type(ctx, key) ttlVal := pipe.TTL(ctx, key) - sizeVal := pipe.MemoryUsage(ctx, key, 0) _, err = pipe.Exec(ctx) if err != nil { resp.Msg = err.Error() @@ -611,9 +610,10 @@ func (b *browserService) GetKeySummary(param types.KeySummaryParam) (resp types. resp.Msg = typeVal.Err().Error() return } + size, _ := client.MemoryUsage(ctx, key, 0).Result() data := types.KeySummary{ Type: strings.ToLower(typeVal.Val()), - Size: sizeVal.Val(), + Size: size, } if data.Type == "none" { resp.Msg = "key not exists" diff --git a/frontend/src/components/content_value/ContentValueHash.vue b/frontend/src/components/content_value/ContentValueHash.vue index 153c17d..44c151f 100644 --- a/frontend/src/components/content_value/ContentValueHash.vue +++ b/frontend/src/components/content_value/ContentValueHash.vue @@ -298,6 +298,10 @@ const loadProgress = computed(() => { return (len * 100) / Math.max(len, props.length) }) +const showMemoryUsage = computed(() => { + return !isNaN(props.size) && props.size > 0 +}) + const onAddRow = () => { dialogStore.openAddFieldsDialog(props.name, props.db, props.keyPath, props.keyCode, types.HASH) } @@ -415,8 +419,8 @@ defineExpose({
diff --git a/frontend/src/components/content_value/ContentValueString.vue b/frontend/src/components/content_value/ContentValueString.vue index 4dde3f9..5ed639c 100644 --- a/frontend/src/components/content_value/ContentValueString.vue +++ b/frontend/src/components/content_value/ContentValueString.vue @@ -70,6 +70,7 @@ const editingContent = ref('') const enableSave = computed(() => { return editingContent.value !== viewAs.value && !props.loading }) + const displayValue = computed(() => { if (props.loading) { return '' @@ -77,6 +78,10 @@ const displayValue = computed(() => { return viewAs.value || decodeRedisKey(props.value) }) +const showMemoryUsage = computed(() => { + return !isNaN(props.size) && props.size > 0 +}) + watchEffect( () => { if (props.value !== undefined) { @@ -209,8 +214,8 @@ defineExpose({