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 cursor uint64
scanSize := int64(Preferences().GetScanSize())
doFilter := matchPattern != "*"
if param.Full || doFilter {
// load all
var loadedVal []string
if param.Full || matchPattern != "*" {
// load all
cursor, reset = 0, true
for {
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 {
cursor, _, reset = getEntryCursor()
}
var loadedVal []redis.Z
loadedVal, err = client.ZRangeWithScores(ctx, key, int64(cursor), int64(cursor)+scanSize-1).Result()
cursor = cursor + uint64(scanSize)
if len(loadedVal) < int(scanSize) {
cursor = 0
}
items = make([]types.ZSetEntryItem, 0, len(loadedVal))
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,
})
loadedVal, cursor, err = client.ZScan(ctx, key, cursor, matchPattern, scanSize).Result()
loadedLen := len(loadedVal)
items = make([]types.ZSetEntryItem, loadedLen/2)
var score float64
for i := 0; i < loadedLen; i += 2 {
if score, err = strconv.ParseFloat(loadedVal[i+1], 64); err == nil {
items[i/2].Score = score
items[i/2].Value = loadedVal[i]
if doConvert {
if dv, _, _ := strutil.ConvertTo(val, param.Decode, param.Format); dv != val {
items[len(items)-1].DisplayValue = dv
if dv, _, _ := strutil.ConvertTo(loadedVal[i], param.Decode, param.Format); dv != loadedVal[i] {
items[i/2].DisplayValue = dv
}
}
}
}

View File

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

View File

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