pref: correct display raw value for list/set/zset
This commit is contained in:
parent
53e8c26380
commit
1c322fdac5
|
@ -877,7 +877,7 @@ func (b *browserService) GetKeyDetail(param types.KeyDetailParam) (resp types.JS
|
||||||
}
|
}
|
||||||
items = append(items, types.ListEntryItem{
|
items = append(items, types.ListEntryItem{
|
||||||
Index: len(items),
|
Index: len(items),
|
||||||
Value: val,
|
Value: strutil.EncodeRedisKey(val),
|
||||||
})
|
})
|
||||||
if doConvert {
|
if doConvert {
|
||||||
if dv, _, _ := convutil.ConvertTo(val, param.Decode, param.Format, decoder); dv != val {
|
if dv, _, _ := convutil.ConvertTo(val, param.Decode, param.Format, decoder); dv != val {
|
||||||
|
@ -994,7 +994,7 @@ func (b *browserService) GetKeyDetail(param types.KeyDetailParam) (resp types.JS
|
||||||
}
|
}
|
||||||
for _, val := range loadedKey {
|
for _, val := range loadedKey {
|
||||||
items = append(items, types.SetEntryItem{
|
items = append(items, types.SetEntryItem{
|
||||||
Value: val,
|
Value: strutil.EncodeRedisKey(val),
|
||||||
})
|
})
|
||||||
if doConvert {
|
if doConvert {
|
||||||
if dv, _, _ := convutil.ConvertTo(val, param.Decode, param.Format, decoder); dv != val {
|
if dv, _, _ := convutil.ConvertTo(val, param.Decode, param.Format, decoder); dv != val {
|
||||||
|
@ -1015,7 +1015,7 @@ func (b *browserService) GetKeyDetail(param types.KeyDetailParam) (resp types.JS
|
||||||
loadedKey, cursor, subErr = client.SScan(ctx, key, cursor, matchPattern, scanSize).Result()
|
loadedKey, cursor, subErr = client.SScan(ctx, key, cursor, matchPattern, scanSize).Result()
|
||||||
items = make([]types.SetEntryItem, len(loadedKey))
|
items = make([]types.SetEntryItem, len(loadedKey))
|
||||||
for i, val := range loadedKey {
|
for i, val := range loadedKey {
|
||||||
items[i].Value = val
|
items[i].Value = strutil.EncodeRedisKey(val)
|
||||||
if doConvert {
|
if doConvert {
|
||||||
if dv, _, _ := convutil.ConvertTo(val, param.Decode, param.Format, decoder); dv != val {
|
if dv, _, _ := convutil.ConvertTo(val, param.Decode, param.Format, decoder); dv != val {
|
||||||
items[i].DisplayValue = dv
|
items[i].DisplayValue = dv
|
||||||
|
@ -1061,7 +1061,7 @@ func (b *browserService) GetKeyDetail(param types.KeyDetailParam) (resp types.JS
|
||||||
for i := 0; i < len(loadedVal); i += 2 {
|
for i := 0; i < len(loadedVal); i += 2 {
|
||||||
if score, err = strconv.ParseFloat(loadedVal[i+1], 64); err == nil {
|
if score, err = strconv.ParseFloat(loadedVal[i+1], 64); err == nil {
|
||||||
items = append(items, types.ZSetEntryItem{
|
items = append(items, types.ZSetEntryItem{
|
||||||
Value: loadedVal[i],
|
Value: strutil.EncodeRedisKey(loadedVal[i]),
|
||||||
Score: score,
|
Score: score,
|
||||||
})
|
})
|
||||||
if doConvert {
|
if doConvert {
|
||||||
|
@ -1095,7 +1095,7 @@ func (b *browserService) GetKeyDetail(param types.KeyDetailParam) (resp types.JS
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
entry := types.ZSetEntryItem{
|
entry := types.ZSetEntryItem{
|
||||||
Value: val,
|
Value: strutil.EncodeRedisKey(val),
|
||||||
}
|
}
|
||||||
if math.IsInf(z.Score, 1) {
|
if math.IsInf(z.Score, 1) {
|
||||||
entry.ScoreStr = "+inf"
|
entry.ScoreStr = "+inf"
|
||||||
|
|
|
@ -33,7 +33,7 @@ type SetEntryItem struct {
|
||||||
type ZSetEntryItem struct {
|
type ZSetEntryItem struct {
|
||||||
Score float64 `json:"s"`
|
Score float64 `json:"s"`
|
||||||
ScoreStr string `json:"ss,omitempty"`
|
ScoreStr string `json:"ss,omitempty"`
|
||||||
Value string `json:"v"`
|
Value any `json:"v"`
|
||||||
DisplayValue string `json:"dv,omitempty"`
|
DisplayValue string `json:"dv,omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -22,6 +22,7 @@ import { TextAlignType } from '@/consts/text_align_type.js'
|
||||||
import AlignLeft from '@/components/icons/AlignLeft.vue'
|
import AlignLeft from '@/components/icons/AlignLeft.vue'
|
||||||
import AlignCenter from '@/components/icons/AlignCenter.vue'
|
import AlignCenter from '@/components/icons/AlignCenter.vue'
|
||||||
import SwitchButton from '@/components/common/SwitchButton.vue'
|
import SwitchButton from '@/components/common/SwitchButton.vue'
|
||||||
|
import { nativeRedisKey } from '@/utils/key_convert.js'
|
||||||
|
|
||||||
const i18n = useI18n()
|
const i18n = useI18n()
|
||||||
const themeVars = useThemeVars()
|
const themeVars = useThemeVars()
|
||||||
|
@ -105,17 +106,16 @@ const valueColumn = computed(() => ({
|
||||||
},
|
},
|
||||||
filterOptionValue: valueFilterOption.value,
|
filterOptionValue: valueFilterOption.value,
|
||||||
className: inEdit.value ? 'clickable' : '',
|
className: inEdit.value ? 'clickable' : '',
|
||||||
filter: (value, row) => {
|
filter: (filterValue, row) => {
|
||||||
if (row.dv) {
|
const val = row.dv || nativeRedisKey(row.v)
|
||||||
return !!~row.dv.indexOf(value.toString())
|
return !!~val.indexOf(filterValue.toString())
|
||||||
}
|
|
||||||
return !!~row.v.indexOf(value.toString())
|
|
||||||
},
|
},
|
||||||
render: (row) => {
|
render: (row) => {
|
||||||
|
const val = row.dv || nativeRedisKey(row.v)
|
||||||
if (isCode.value) {
|
if (isCode.value) {
|
||||||
return h('pre', { class: 'pre-wrap' }, row.dv || row.v)
|
return h('pre', { class: 'pre-wrap' }, val)
|
||||||
}
|
}
|
||||||
return row.dv || row.v
|
return val
|
||||||
},
|
},
|
||||||
}))
|
}))
|
||||||
|
|
||||||
|
|
|
@ -22,6 +22,7 @@ import AlignLeft from '@/components/icons/AlignLeft.vue'
|
||||||
import AlignCenter from '@/components/icons/AlignCenter.vue'
|
import AlignCenter from '@/components/icons/AlignCenter.vue'
|
||||||
import SwitchButton from '@/components/common/SwitchButton.vue'
|
import SwitchButton from '@/components/common/SwitchButton.vue'
|
||||||
import { TextAlignType } from '@/consts/text_align_type.js'
|
import { TextAlignType } from '@/consts/text_align_type.js'
|
||||||
|
import { nativeRedisKey } from '@/utils/key_convert.js'
|
||||||
|
|
||||||
const i18n = useI18n()
|
const i18n = useI18n()
|
||||||
const themeVars = useThemeVars()
|
const themeVars = useThemeVars()
|
||||||
|
@ -104,17 +105,16 @@ const valueColumn = computed(() => ({
|
||||||
},
|
},
|
||||||
filterOptionValue: valueFilterOption.value,
|
filterOptionValue: valueFilterOption.value,
|
||||||
className: inEdit.value ? 'clickable' : '',
|
className: inEdit.value ? 'clickable' : '',
|
||||||
filter: (value, row) => {
|
filter: (filterValue, row) => {
|
||||||
if (row.dv) {
|
const val = row.dv || nativeRedisKey(row.v)
|
||||||
return !!~row.dv.indexOf(value.toString())
|
return !!~val.indexOf(filterValue.toString())
|
||||||
}
|
|
||||||
return !!~row.v.indexOf(value.toString())
|
|
||||||
},
|
},
|
||||||
render: (row) => {
|
render: (row) => {
|
||||||
|
const val = row.dv || nativeRedisKey(row.v)
|
||||||
if (isCode.value) {
|
if (isCode.value) {
|
||||||
return h('pre', { class: 'pre-wrap' }, row.dv || row.v)
|
return h('pre', { class: 'pre-wrap' }, val)
|
||||||
}
|
}
|
||||||
return row.dv || row.v
|
return val
|
||||||
},
|
},
|
||||||
}))
|
}))
|
||||||
|
|
||||||
|
|
|
@ -22,6 +22,7 @@ import { TextAlignType } from '@/consts/text_align_type.js'
|
||||||
import AlignLeft from '@/components/icons/AlignLeft.vue'
|
import AlignLeft from '@/components/icons/AlignLeft.vue'
|
||||||
import AlignCenter from '@/components/icons/AlignCenter.vue'
|
import AlignCenter from '@/components/icons/AlignCenter.vue'
|
||||||
import SwitchButton from '@/components/common/SwitchButton.vue'
|
import SwitchButton from '@/components/common/SwitchButton.vue'
|
||||||
|
import { nativeRedisKey } from '@/utils/key_convert.js'
|
||||||
|
|
||||||
const i18n = useI18n()
|
const i18n = useI18n()
|
||||||
const themeVars = useThemeVars()
|
const themeVars = useThemeVars()
|
||||||
|
@ -153,18 +154,17 @@ const valueColumn = computed(() => ({
|
||||||
},
|
},
|
||||||
filterOptionValue: valueFilterOption.value,
|
filterOptionValue: valueFilterOption.value,
|
||||||
className: inEdit.value ? 'clickable' : '',
|
className: inEdit.value ? 'clickable' : '',
|
||||||
filter(value, row) {
|
filter(filterValue, row) {
|
||||||
if (row.dv) {
|
const val = row.dv || nativeRedisKey(row.v)
|
||||||
return !!~row.dv.indexOf(value.toString())
|
return !!~val.indexOf(filterValue.toString())
|
||||||
}
|
|
||||||
return !!~row.v.indexOf(value.toString())
|
|
||||||
},
|
},
|
||||||
// sorter: (row1, row2) => row1.value - row2.value,
|
// sorter: (row1, row2) => row1.value - row2.value,
|
||||||
render: (row) => {
|
render: (row) => {
|
||||||
|
const val = row.dv || nativeRedisKey(row.v)
|
||||||
if (isCode.value) {
|
if (isCode.value) {
|
||||||
return h('pre', { class: 'pre-wrap' }, row.dv || row.v)
|
return h('pre', { class: 'pre-wrap' }, val)
|
||||||
}
|
}
|
||||||
return row.dv || row.v
|
return val
|
||||||
},
|
},
|
||||||
}))
|
}))
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue