Skip to content

Commit 5a6758a

Browse files
committed
pref: improve large entry loading and display
1 parent 85baf17 commit 5a6758a

File tree

6 files changed

+39
-14
lines changed

6 files changed

+39
-14
lines changed

frontend/src/components/content_value/ContentValueHash.vue

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,9 @@ const fieldColumn = computed(() => ({
9999
filterOptionValue: fieldFilterOption.value,
100100
className: inEdit.value ? 'clickable wordline' : 'wordline',
101101
filter: (value, row) => {
102+
if (isEmpty(value)) {
103+
return true
104+
}
102105
return !!~row.k.indexOf(value.toString())
103106
},
104107
render: (row) => {
@@ -140,15 +143,17 @@ const valueColumn = computed(() => ({
140143
// return !!~row.v.indexOf(value.toString())
141144
// },
142145
render: (row) => {
143-
let val = row.dv || nativeRedisKey(row.v)
144146
if (isCode.value) {
147+
let val = row.dv || nativeRedisKey(row.v)
145148
return h('pre', { class: 'pre-wrap' }, val)
149+
} else {
150+
let val = row.dv || nativeRedisKey(row.v, 500)
151+
val = truncate(val, { length: 500 })
152+
if (row.rm === true) {
153+
return h('s', {}, val)
154+
}
155+
return val
146156
}
147-
val = truncate(val, { length: 500 })
148-
if (row.rm === true) {
149-
return h('s', {}, val)
150-
}
151-
return val
152157
},
153158
}))
154159

frontend/src/components/content_value/ContentValueList.vue

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -107,15 +107,20 @@ const valueColumn = computed(() => ({
107107
filterOptionValue: valueFilterOption.value,
108108
className: inEdit.value ? 'clickable' : '',
109109
filter: (filterValue, row) => {
110+
if (isEmpty(filterValue)) {
111+
return true
112+
}
110113
const val = row.dv || nativeRedisKey(row.v)
111114
return !!~val.indexOf(filterValue.toString())
112115
},
113116
render: (row) => {
114-
const val = row.dv || nativeRedisKey(row.v)
115117
if (isCode.value) {
118+
const val = row.dv || nativeRedisKey(row.v)
116119
return h('pre', { class: 'pre-wrap' }, val)
120+
} else {
121+
const val = row.dv || nativeRedisKey(row.v, 500)
122+
return truncate(val, { length: 500 })
117123
}
118-
return truncate(val, { length: 500 })
119124
},
120125
}))
121126

frontend/src/components/content_value/ContentValueSet.vue

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -106,15 +106,20 @@ const valueColumn = computed(() => ({
106106
filterOptionValue: valueFilterOption.value,
107107
className: inEdit.value ? 'clickable' : '',
108108
filter: (filterValue, row) => {
109+
if (isEmpty(filterValue)) {
110+
return true
111+
}
109112
const val = row.dv || nativeRedisKey(row.v)
110113
return !!~val.indexOf(filterValue.toString())
111114
},
112115
render: (row) => {
113-
const val = row.dv || nativeRedisKey(row.v)
114116
if (isCode.value) {
117+
const val = row.dv || nativeRedisKey(row.v)
115118
return h('pre', { class: 'pre-wrap' }, val)
119+
} else {
120+
const val = row.dv || nativeRedisKey(row.v, 500)
121+
return truncate(val, { length: 500 })
116122
}
117-
return truncate(val, { length: 500 })
118123
},
119124
}))
120125

frontend/src/components/content_value/ContentValueStream.vue

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,9 @@ const valueColumn = computed(() => ({
8181
filterOptionValue: valueFilterOption.value,
8282
filter: (value, row) => {
8383
const v = value.toString()
84+
if (isEmpty(v)) {
85+
return true
86+
}
8487
if (row.dv) {
8588
return includes(row.dv, v)
8689
}

frontend/src/components/content_value/ContentValueZSet.vue

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -160,11 +160,13 @@ const valueColumn = computed(() => ({
160160
},
161161
// sorter: (row1, row2) => row1.value - row2.value,
162162
render: (row) => {
163-
const val = row.dv || nativeRedisKey(row.v)
164163
if (isCode.value) {
164+
const val = row.dv || nativeRedisKey(row.v)
165165
return h('pre', { class: 'pre-wrap' }, val)
166+
} else {
167+
const val = row.dv || nativeRedisKey(row.v, 500)
168+
return truncate(val, { length: 500 })
166169
}
167-
return truncate(val, { length: 500 })
168170
},
169171
}))
170172

frontend/src/utils/key_convert.js

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { join, map } from 'lodash'
1+
import { join, map, take } from 'lodash'
22

33
/**
44
* converted binary data in strings to hex format
@@ -25,10 +25,15 @@ export function decodeRedisKey(key) {
2525
/**
2626
* convert char code array to string
2727
* @param {string|number[]} key
28+
* @param {number|undefined} truncate
2829
* @return {string}
2930
*/
30-
export function nativeRedisKey(key) {
31+
export function nativeRedisKey(key, truncate) {
3132
if (key instanceof Array) {
33+
// truncate char code array
34+
if (typeof truncate === 'number' && truncate > 0) {
35+
key = take(key, truncate)
36+
}
3237
return map(key, (c) => String.fromCharCode(c)).join('')
3338
}
3439
return key

0 commit comments

Comments
 (0)