Compare commits

..

No commits in common. "71978c325b6d6eca66410a63580368dd097a7c82" and "66a057f504fada96645674d64d18cf89eeb31077" have entirely different histories.

3 changed files with 22 additions and 31 deletions

View File

@ -839,10 +839,9 @@ func (b *browserService) GetKeyDetail(param types.KeyDetailParam) (resp types.JS
var reset bool var reset bool
var cursor uint64 var cursor uint64
scanSize := int64(Preferences().GetScanSize()) scanSize := int64(Preferences().GetScanSize())
doFilter := matchPattern != "*"
if param.Full || doFilter {
// load all
var loadedVal []string var loadedVal []string
if param.Full || matchPattern != "*" {
// load all
cursor, reset = 0, true cursor, reset = 0, true
for { for {
loadedVal, cursor, err = client.ZScan(ctx, key, cursor, matchPattern, scanSize).Result() loadedVal, cursor, err = client.ZScan(ctx, key, cursor, matchPattern, scanSize).Result()
@ -873,26 +872,18 @@ func (b *browserService) GetKeyDetail(param types.KeyDetailParam) (resp types.JS
} else { } else {
cursor, _, reset = getEntryCursor() cursor, _, reset = getEntryCursor()
} }
var loadedVal []redis.Z loadedVal, cursor, err = client.ZScan(ctx, key, cursor, matchPattern, scanSize).Result()
loadedVal, err = client.ZRangeWithScores(ctx, key, int64(cursor), int64(cursor)+scanSize-1).Result() loadedLen := len(loadedVal)
cursor = cursor + uint64(scanSize) items = make([]types.ZSetEntryItem, loadedLen/2)
if len(loadedVal) < int(scanSize) { var score float64
cursor = 0 for i := 0; i < loadedLen; i += 2 {
} if score, err = strconv.ParseFloat(loadedVal[i+1], 64); err == nil {
items[i/2].Score = score
items = make([]types.ZSetEntryItem, 0, len(loadedVal)) items[i/2].Value = loadedVal[i]
for _, z := range loadedVal {
val := strutil.AnyToString(z.Score, "", 0)
if doFilter && !strings.Contains(val, param.MatchPattern) {
continue
}
items = append(items, types.ZSetEntryItem{
Score: z.Score,
Value: val,
})
if doConvert { if doConvert {
if dv, _, _ := strutil.ConvertTo(val, param.Decode, param.Format); dv != val { if dv, _, _ := strutil.ConvertTo(loadedVal[i], param.Decode, param.Format); dv != loadedVal[i] {
items[len(items)-1].DisplayValue = dv items[i/2].DisplayValue = dv
}
} }
} }
} }

View File

@ -63,7 +63,7 @@ watch(
) )
const loading = ref(false) const loading = ref(false)
const isPin = ref(false) const pin = ref(false)
const viewAs = reactive({ const viewAs = reactive({
field: '', field: '',
value: '', value: '',
@ -130,13 +130,13 @@ const onToggleFullscreen = () => {
} }
const onClose = () => { const onClose = () => {
isPin.value = false pin.value = false
emit('close') emit('close')
} }
const onSave = () => { const onSave = () => {
emit('save', viewAs.field, viewAs.value, viewAs.decode, viewAs.format) emit('save', viewAs.field, viewAs.value, viewAs.decode, viewAs.format)
if (!isPin.value) { if (!pin.value) {
nextTick().then(onClose) nextTick().then(onClose)
} }
} }
@ -178,12 +178,13 @@ const onSave = () => {
<template #header-extra> <template #header-extra>
<n-space :size="5"> <n-space :size="5">
<icon-button <icon-button
:button-style="isPin ? pinBtnStyle : btnStyle" :button-style="pin ? pinBtnStyle : btnStyle"
:icon="Pin"
:size="19" :size="19"
:t-tooltip="isPin ? 'interface.unpin_edit' : 'interface.pin_edit'" :t-tooltip="pin ? 'interface.unpin_edit' : 'interface.pin_edit'"
stroke-width="4" stroke-width="4"
@click="isPin = !isPin" /> @click="pin = !pin">
<Pin :inverse="pin" stroke-width="4" />
</icon-button>
<icon-button <icon-button
:button-style="btnStyle" :button-style="btnStyle"
:icon="props.fullscreen ? OffScreen : FullScreen" :icon="props.fullscreen ? OffScreen : FullScreen"

View File

@ -85,7 +85,6 @@ const scoreColumn = computed(() => ({
align: 'center', align: 'center',
titleAlign: 'center', titleAlign: 'center',
resizable: true, resizable: true,
sorter: (row1, row2) => row1.s - row2.s,
// filterOptionValue: scoreFilterOption.value, // filterOptionValue: scoreFilterOption.value,
// filter(value, row) { // filter(value, row) {
// const score = parseFloat(row.s) // const score = parseFloat(row.s)