Compare commits
2 Commits
66a057f504
...
71978c325b
Author | SHA1 | Date |
---|---|---|
Lykin | 71978c325b | |
Lykin | 79c943f85d |
|
@ -839,9 +839,10 @@ func (b *browserService) GetKeyDetail(param types.KeyDetailParam) (resp types.JS
|
|||
var reset bool
|
||||
var cursor uint64
|
||||
scanSize := int64(Preferences().GetScanSize())
|
||||
var loadedVal []string
|
||||
if param.Full || matchPattern != "*" {
|
||||
doFilter := matchPattern != "*"
|
||||
if param.Full || doFilter {
|
||||
// load all
|
||||
var loadedVal []string
|
||||
cursor, reset = 0, true
|
||||
for {
|
||||
loadedVal, cursor, err = client.ZScan(ctx, key, cursor, matchPattern, scanSize).Result()
|
||||
|
@ -872,18 +873,26 @@ func (b *browserService) GetKeyDetail(param types.KeyDetailParam) (resp types.JS
|
|||
} else {
|
||||
cursor, _, reset = getEntryCursor()
|
||||
}
|
||||
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(loadedVal[i], param.Decode, param.Format); dv != loadedVal[i] {
|
||||
items[i/2].DisplayValue = dv
|
||||
}
|
||||
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,
|
||||
})
|
||||
if doConvert {
|
||||
if dv, _, _ := strutil.ConvertTo(val, param.Decode, param.Format); dv != val {
|
||||
items[len(items)-1].DisplayValue = dv
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -63,7 +63,7 @@ watch(
|
|||
)
|
||||
|
||||
const loading = ref(false)
|
||||
const pin = ref(false)
|
||||
const isPin = ref(false)
|
||||
const viewAs = reactive({
|
||||
field: '',
|
||||
value: '',
|
||||
|
@ -130,13 +130,13 @@ const onToggleFullscreen = () => {
|
|||
}
|
||||
|
||||
const onClose = () => {
|
||||
pin.value = false
|
||||
isPin.value = false
|
||||
emit('close')
|
||||
}
|
||||
|
||||
const onSave = () => {
|
||||
emit('save', viewAs.field, viewAs.value, viewAs.decode, viewAs.format)
|
||||
if (!pin.value) {
|
||||
if (!isPin.value) {
|
||||
nextTick().then(onClose)
|
||||
}
|
||||
}
|
||||
|
@ -178,13 +178,12 @@ const onSave = () => {
|
|||
<template #header-extra>
|
||||
<n-space :size="5">
|
||||
<icon-button
|
||||
:button-style="pin ? pinBtnStyle : btnStyle"
|
||||
:button-style="isPin ? pinBtnStyle : btnStyle"
|
||||
:icon="Pin"
|
||||
:size="19"
|
||||
:t-tooltip="pin ? 'interface.unpin_edit' : 'interface.pin_edit'"
|
||||
:t-tooltip="isPin ? 'interface.unpin_edit' : 'interface.pin_edit'"
|
||||
stroke-width="4"
|
||||
@click="pin = !pin">
|
||||
<Pin :inverse="pin" stroke-width="4" />
|
||||
</icon-button>
|
||||
@click="isPin = !isPin" />
|
||||
<icon-button
|
||||
:button-style="btnStyle"
|
||||
:icon="props.fullscreen ? OffScreen : FullScreen"
|
||||
|
|
|
@ -85,6 +85,7 @@ 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)
|
||||
|
|
Loading…
Reference in New Issue