Skip to content

Commit 4b950ee

Browse files
committed
pref: improve display speed of large hash content (#453)
1 parent 35c1629 commit 4b950ee

File tree

4 files changed

+9
-8
lines changed

4 files changed

+9
-8
lines changed

frontend/src/components/content_value/ContentValueHash.vue

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import { NButton, NIcon, useThemeVars } from 'naive-ui'
66
import { types, types as redisTypes } from '@/consts/support_redis_type.js'
77
import EditableTableColumn from '@/components/common/EditableTableColumn.vue'
88
import useDialogStore from 'stores/dialog.js'
9-
import { isEmpty, size } from 'lodash'
9+
import { isEmpty, size, truncate } from 'lodash'
1010
import { decodeTypes, formatTypes } from '@/consts/value_view_type.js'
1111
import useBrowserStore from 'stores/browser.js'
1212
import LoadList from '@/components/icons/LoadList.vue'
@@ -140,10 +140,11 @@ const valueColumn = computed(() => ({
140140
// return !!~row.v.indexOf(value.toString())
141141
// },
142142
render: (row) => {
143-
const val = row.dv || nativeRedisKey(row.v)
143+
let val = row.dv || nativeRedisKey(row.v)
144144
if (isCode.value) {
145145
return h('pre', { class: 'pre-wrap' }, val)
146146
}
147+
val = truncate(val, { length: 500 })
147148
if (row.rm === true) {
148149
return h('s', {}, val)
149150
}

frontend/src/components/content_value/ContentValueList.vue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import { computed, h, reactive, ref } from 'vue'
33
import { useI18n } from 'vue-i18n'
44
import AddLink from '@/components/icons/AddLink.vue'
55
import { NButton, NIcon, useThemeVars } from 'naive-ui'
6-
import { isEmpty, size } from 'lodash'
6+
import { isEmpty, size, truncate } from 'lodash'
77
import { types, types as redisTypes } from '@/consts/support_redis_type.js'
88
import EditableTableColumn from '@/components/common/EditableTableColumn.vue'
99
import useDialogStore from 'stores/dialog.js'
@@ -115,7 +115,7 @@ const valueColumn = computed(() => ({
115115
if (isCode.value) {
116116
return h('pre', { class: 'pre-wrap' }, val)
117117
}
118-
return val
118+
return truncate(val, { length: 500 })
119119
},
120120
}))
121121

frontend/src/components/content_value/ContentValueSet.vue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import { computed, h, reactive, ref } from 'vue'
33
import { useI18n } from 'vue-i18n'
44
import AddLink from '@/components/icons/AddLink.vue'
55
import { NButton, NIcon, useThemeVars } from 'naive-ui'
6-
import { isEmpty, size } from 'lodash'
6+
import { isEmpty, size, truncate } from 'lodash'
77
import useDialogStore from 'stores/dialog.js'
88
import { types, types as redisTypes } from '@/consts/support_redis_type.js'
99
import EditableTableColumn from '@/components/common/EditableTableColumn.vue'
@@ -114,7 +114,7 @@ const valueColumn = computed(() => ({
114114
if (isCode.value) {
115115
return h('pre', { class: 'pre-wrap' }, val)
116116
}
117-
return val
117+
return truncate(val, { length: 500 })
118118
},
119119
}))
120120

frontend/src/components/content_value/ContentValueZSet.vue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import AddLink from '@/components/icons/AddLink.vue'
55
import { NButton, NIcon, useThemeVars } from 'naive-ui'
66
import { types, types as redisTypes } from '@/consts/support_redis_type.js'
77
import EditableTableColumn from '@/components/common/EditableTableColumn.vue'
8-
import { isEmpty, size } from 'lodash'
8+
import { isEmpty, size, truncate } from 'lodash'
99
import useDialogStore from 'stores/dialog.js'
1010
import { decodeTypes, formatTypes } from '@/consts/value_view_type.js'
1111
import useBrowserStore from 'stores/browser.js'
@@ -164,7 +164,7 @@ const valueColumn = computed(() => ({
164164
if (isCode.value) {
165165
return h('pre', { class: 'pre-wrap' }, val)
166166
}
167-
return val
167+
return truncate(val, { length: 500 })
168168
},
169169
}))
170170

0 commit comments

Comments
 (0)