diff --git a/backend/services/connection_service.go b/backend/services/connection_service.go
index 336eac0..fad3c80 100644
--- a/backend/services/connection_service.go
+++ b/backend/services/connection_service.go
@@ -825,17 +825,19 @@ func (c *connectionService) GetKeyValue(connName string, db int, k any, viewAs,
}
var value any
- var size int64
+ var size, length int64
var cursor uint64
switch strings.ToLower(keyType) {
case "string":
var str string
str, err = client.Get(ctx, key).Result()
value, decodeType, viewAs = strutil.ConvertTo(str, decodeType, viewAs)
- size, _ = client.StrLen(ctx, key).Result()
+ length, _ = client.StrLen(ctx, key).Result()
+ size, _ = client.MemoryUsage(ctx, key, 0).Result()
case "list":
value, err = client.LRange(ctx, key, 0, -1).Result()
- size, _ = client.LLen(ctx, key).Result()
+ length, _ = client.LLen(ctx, key).Result()
+ size, _ = client.MemoryUsage(ctx, key, 0).Result()
case "hash":
//value, err = client.HGetAll(ctx, key).Result()
items := map[string]string{}
@@ -855,7 +857,8 @@ func (c *connectionService) GetKeyValue(connName string, db int, k any, viewAs,
}
}
value = items
- size, _ = client.HLen(ctx, key).Result()
+ length, _ = client.HLen(ctx, key).Result()
+ size, _ = client.MemoryUsage(ctx, key, 0).Result()
case "set":
//value, err = client.SMembers(ctx, key).Result()
items := []string{}
@@ -873,7 +876,8 @@ func (c *connectionService) GetKeyValue(connName string, db int, k any, viewAs,
}
}
value = items
- size, _ = client.SCard(ctx, key).Result()
+ length, _ = client.SCard(ctx, key).Result()
+ size, _ = client.MemoryUsage(ctx, key, 0).Result()
case "zset":
//value, err = client.ZRangeWithScores(ctx, key, 0, -1).Result()
var items []types.ZSetItem
@@ -899,7 +903,8 @@ func (c *connectionService) GetKeyValue(connName string, db int, k any, viewAs,
}
}
value = items
- size, _ = client.ZCard(ctx, key).Result()
+ length, _ = client.ZCard(ctx, key).Result()
+ size, _ = client.MemoryUsage(ctx, key, 0).Result()
case "stream":
var msgs []redis.XMessage
items := []types.StreamItem{}
@@ -915,7 +920,8 @@ func (c *connectionService) GetKeyValue(connName string, db int, k any, viewAs,
})
}
value = items
- size, _ = client.XLen(ctx, key).Result()
+ length, _ = client.XLen(ctx, key).Result()
+ size, _ = client.MemoryUsage(ctx, key, 0).Result()
}
if err != nil {
resp.Msg = err.Error()
@@ -927,6 +933,7 @@ func (c *connectionService) GetKeyValue(connName string, db int, k any, viewAs,
"ttl": ttl,
"value": value,
"size": size,
+ "length": length,
"viewAs": viewAs,
"decode": decodeType,
}
diff --git a/frontend/src/components/content/ContentPane.vue b/frontend/src/components/content/ContentPane.vue
index c60b270..5432573 100644
--- a/frontend/src/components/content/ContentPane.vue
+++ b/frontend/src/components/content/ContentPane.vue
@@ -50,6 +50,7 @@ const tabContent = computed(() => {
ttl: tab.ttl,
value: tab.value,
size: tab.size || 0,
+ length: tab.length || 0,
viewAs: tab.viewAs,
decode: tab.decode,
}
@@ -131,6 +132,7 @@ watch(
:decode="tabContent.decode"
:key-code="tabContent.keyCode"
:key-path="tabContent.keyPath"
+ :length="tabContent.length"
:name="tabContent.name"
:size="tabContent.size"
:ttl="tabContent.ttl"
diff --git a/frontend/src/components/content_value/ContentValueHash.vue b/frontend/src/components/content_value/ContentValueHash.vue
index dbf1f53..9cf5694 100644
--- a/frontend/src/components/content_value/ContentValueHash.vue
+++ b/frontend/src/components/content_value/ContentValueHash.vue
@@ -3,14 +3,17 @@ import { computed, h, reactive, ref } from 'vue'
import { useI18n } from 'vue-i18n'
import ContentToolbar from './ContentToolbar.vue'
import AddLink from '@/components/icons/AddLink.vue'
-import { NButton, NCode, NIcon, NInput } from 'naive-ui'
+import { NButton, NCode, NIcon, NInput, useThemeVars } from 'naive-ui'
import { types, types as redisTypes } from '@/consts/support_redis_type.js'
import EditableTableColumn from '@/components/common/EditableTableColumn.vue'
import useDialogStore from 'stores/dialog.js'
import useConnectionStore from 'stores/connections.js'
import { isEmpty } from 'lodash'
+import bytes from 'bytes'
const i18n = useI18n()
+const themeVars = useThemeVars()
+
const props = defineProps({
name: String,
db: Number,
@@ -25,6 +28,7 @@ const props = defineProps({
},
value: Object,
size: Number,
+ length: Number,
})
/**
@@ -259,8 +263,9 @@ const onUpdateFilter = (filters, sourceColumn) => {
:key-path="props.keyPath"
:key-type="keyType"
:server="props.name"
- :ttl="ttl" />
-
+ :ttl="ttl"
+ class="value-item-part" />
+
{
@update:value="onFilterInput" />
-
- {{ $t('interface.total', { size: props.size }) }}
-
+
@@ -287,7 +290,7 @@ const onUpdateFilter = (filters, sourceColumn) => {
{{ $t('interface.add_row') }}
-
+
{
virtual-scroll
@update:filters="onUpdateFilter" />
+
-
+
diff --git a/frontend/src/components/content_value/ContentValueList.vue b/frontend/src/components/content_value/ContentValueList.vue
index 23251ad..3ef6e19 100644
--- a/frontend/src/components/content_value/ContentValueList.vue
+++ b/frontend/src/components/content_value/ContentValueList.vue
@@ -3,14 +3,17 @@ import { computed, h, reactive, ref } from 'vue'
import { useI18n } from 'vue-i18n'
import ContentToolbar from './ContentToolbar.vue'
import AddLink from '@/components/icons/AddLink.vue'
-import { NButton, NCode, NIcon, NInput } from 'naive-ui'
+import { NButton, NCode, NIcon, NInput, useThemeVars } from 'naive-ui'
import { isEmpty, size } from 'lodash'
import { types, types as redisTypes } from '@/consts/support_redis_type.js'
import EditableTableColumn from '@/components/common/EditableTableColumn.vue'
import useDialogStore from 'stores/dialog.js'
import useConnectionStore from 'stores/connections.js'
+import bytes from 'bytes'
const i18n = useI18n()
+const themeVars = useThemeVars()
+
const props = defineProps({
name: String,
db: Number,
@@ -25,6 +28,7 @@ const props = defineProps({
},
value: Object,
size: Number,
+ length: Number,
})
/**
@@ -191,8 +195,9 @@ const onUpdateFilter = (filters, sourceColumn) => {
:key-path="props.keyPath"
:key-type="keyType"
:server="props.name"
- :ttl="ttl" />
-
+ :ttl="ttl"
+ class="value-item-part" />
+
{
@clear="clearFilter"
@update:value="onFilterInput" />
-
- {{ $t('interface.total', { size: props.size }) }}
-
+
@@ -211,7 +214,7 @@ const onUpdateFilter = (filters, sourceColumn) => {
{{ $t('interface.add_row') }}
-
+
{
virtual-scroll
@update:filters="onUpdateFilter" />
+
-
+
diff --git a/frontend/src/components/content_value/ContentValueSet.vue b/frontend/src/components/content_value/ContentValueSet.vue
index 35c973a..fa66c4e 100644
--- a/frontend/src/components/content_value/ContentValueSet.vue
+++ b/frontend/src/components/content_value/ContentValueSet.vue
@@ -3,14 +3,17 @@ import { computed, h, reactive, ref } from 'vue'
import { useI18n } from 'vue-i18n'
import ContentToolbar from './ContentToolbar.vue'
import AddLink from '@/components/icons/AddLink.vue'
-import { NButton, NCode, NIcon, NInput } from 'naive-ui'
+import { NButton, NCode, NIcon, NInput, useThemeVars } from 'naive-ui'
import { isEmpty, size } from 'lodash'
import useDialogStore from 'stores/dialog.js'
import { types, types as redisTypes } from '@/consts/support_redis_type.js'
import EditableTableColumn from '@/components/common/EditableTableColumn.vue'
import useConnectionStore from 'stores/connections.js'
+import bytes from 'bytes'
const i18n = useI18n()
+const themeVars = useThemeVars()
+
const props = defineProps({
name: String,
db: Number,
@@ -25,6 +28,7 @@ const props = defineProps({
},
value: Array,
size: Number,
+ length: Number,
})
/**
@@ -186,8 +190,9 @@ const onUpdateFilter = (filters, sourceColumn) => {
:key-path="props.keyPath"
:key-type="keyType"
:server="props.name"
- :ttl="ttl" />
-
+ :ttl="ttl"
+ class="value-item-part" />
+
{
@clear="clearFilter"
@update:value="onFilterInput" />
-
- {{ $t('interface.total', { size: props.size }) }}
-
+
@@ -206,7 +209,7 @@ const onUpdateFilter = (filters, sourceColumn) => {
{{ $t('interface.add_row') }}
-
+
{
virtual-scroll
@update:filters="onUpdateFilter" />
+
-
+
diff --git a/frontend/src/components/content_value/ContentValueStream.vue b/frontend/src/components/content_value/ContentValueStream.vue
index 66baa22..d35b5cb 100644
--- a/frontend/src/components/content_value/ContentValueStream.vue
+++ b/frontend/src/components/content_value/ContentValueStream.vue
@@ -3,14 +3,17 @@ import { computed, h, reactive, ref } from 'vue'
import { useI18n } from 'vue-i18n'
import ContentToolbar from './ContentToolbar.vue'
import AddLink from '@/components/icons/AddLink.vue'
-import { NButton, NCode, NIcon, NInput } from 'naive-ui'
+import { NButton, NCode, NIcon, NInput, useThemeVars } from 'naive-ui'
import { types, types as redisTypes } from '@/consts/support_redis_type.js'
import EditableTableColumn from '@/components/common/EditableTableColumn.vue'
import useDialogStore from 'stores/dialog.js'
import useConnectionStore from 'stores/connections.js'
import { includes, isEmpty, keys, some, values } from 'lodash'
+import bytes from 'bytes'
const i18n = useI18n()
+const themeVars = useThemeVars()
+
const props = defineProps({
name: String,
db: Number,
@@ -25,6 +28,7 @@ const props = defineProps({
},
value: Object,
size: Number,
+ length: Number,
})
/**
@@ -171,8 +175,9 @@ const onUpdateFilter = (filters, sourceColumn) => {
:key-path="props.keyPath"
:key-type="keyType"
:server="props.name"
- :ttl="ttl" />
-
+ :ttl="ttl"
+ class="value-item-part" />
+
{
@update:value="onFilterInput" />
-
- {{ $t('interface.total', { size: props.size }) }}
-
+
@@ -199,7 +202,7 @@ const onUpdateFilter = (filters, sourceColumn) => {
{{ $t('interface.add_row') }}
-
+
{
virtual-scroll
@update:filters="onUpdateFilter" />
+
+
-
+
diff --git a/frontend/src/components/content_value/ContentValueString.vue b/frontend/src/components/content_value/ContentValueString.vue
index 2f7e964..0258987 100644
--- a/frontend/src/components/content_value/ContentValueString.vue
+++ b/frontend/src/components/content_value/ContentValueString.vue
@@ -15,6 +15,7 @@ import DropdownSelector from '@/components/content_value/DropdownSelector.vue'
import Code from '@/components/icons/Code.vue'
import Conversion from '@/components/icons/Conversion.vue'
import EditFile from '@/components/icons/EditFile.vue'
+import bytes from 'bytes'
const i18n = useI18n()
const themeVars = useThemeVars()
@@ -33,6 +34,7 @@ const props = defineProps({
},
value: String,
size: Number,
+ length: Number,
viewAs: {
type: String,
default: formatTypes.PLAIN_TEXT,
@@ -192,6 +194,9 @@ const onSaveValue = async () => {
type="textarea" />