feat(redis): custom hover scrollbar for key and value views

This commit is contained in:
zipg authored and GitHub committed 2026-09-04 15:14:06 +08:00
1 parent 372e5130cd
commit a5c97067ba
12 files changed
+204 -20

No files matched your search

@@ -60,6 +60,7 @@ import {
import { decompressRedisValue, decodeBase64RedisValue, decodePickle, decodeProtobuf, isGzipMagic, type RedisDecompressAlgorithm } from "@/lib/redis/codec";
import { canFullHighlightRedisText, findRedisTextMatches, nextRedisSearchMatchIndex, REDIS_VALUE_SEARCH_MATCH_LIMIT, renderRedisTextSearchHtml, redisValueSearchStatus } from "@/lib/redis/redisValueSearch";
import TextContentSearchBar from "@/components/common/TextContentSearchBar.vue";
import RedisHorizontalScrollbar from "@/components/redis/RedisHorizontalScrollbar.vue";
import { decodeJsonUnicodeEscapes, formatJsonSource, mapDisplayToRaw } from "@/lib/common/safeJsonFormat";
import { unixSecondsToCalendarDateTime } from "@/components/ui/date-time-picker/dateTimePicker";
import { applyRedisExpiryPolicy, type RedisExpiryMode, redisExpiryModeForTtl, validateRedisExpiry } from "@/lib/redis/redisExpiry";
@@ -97,7 +98,6 @@ const REDIS_AUTO_REFRESH_INTERVAL_STORAGE_KEY = "dbx-redis-auto-refresh-interval
const REDIS_AUTO_REFRESH_INTERVAL_OPTIONS = [1, 3, 5, 10] as const;
const REDIS_COLLECTION_ROW_HEIGHT = 32;
const REDIS_STREAM_MIN_ROW_HEIGHT = 96;
const data = ref<RedisValue | null>(null);
const loading = ref(false);
const loadingMore = ref(false);
@@ -2804,7 +2804,7 @@ defineExpose({ focusSearch });
<div v-if="isStringLikeKind && stringValueDetail" class="flex-1 flex flex-col overflow-hidden">
<div class="flex h-9 items-center gap-2 border-b px-4 text-xs shrink-0">
<span class="shrink-0 text-muted-foreground">{{ t("redis.codecRowLabel") }}</span>
<div class="flex max-w-full overflow-x-auto rounded-md border bg-muted/20 p-0.5">
<RedisHorizontalScrollbar>
<Button
v-for="codec in REDIS_VALUE_CODEC_ORDER"
:key="codec"
@@ -2818,7 +2818,7 @@ defineExpose({ focusSearch });
>
{{ redisCodecLabel(codec) }}
</Button>
</div>
</RedisHorizontalScrollbar>
<FileArchive v-if="!isStringValueTruncated && stringGzipBadge && stringValueCodec === 'none'" class="h-3.5 w-3.5 shrink-0 text-muted-foreground" :title="t('redis.gzipBadgeTitle')" :aria-label="t('redis.gzipBadgeTitle')" />
<span class="flex-1" />
<label v-if="isTextRedisFormat(stringValueView) || activeStructuredStringDetail || isDecompressCodec(stringValueCodec)" class="flex items-center gap-1.5 text-muted-foreground">
@@ -2829,7 +2829,7 @@ defineExpose({ focusSearch });
</div>
<div class="flex h-9 items-center gap-2 border-b px-4 text-xs shrink-0">
<span class="shrink-0 text-muted-foreground">{{ t("redis.viewRowLabel") }}</span>
<div class="flex max-w-full overflow-x-auto rounded-md border bg-muted/20 p-0.5">
<RedisHorizontalScrollbar>
<Button
v-for="format in REDIS_VALUE_FORMAT_DISPLAY_ORDER"
:key="format"
@@ -2842,7 +2842,7 @@ defineExpose({ focusSearch });
>
{{ redisFormatLabel(format, stringValueDetail.rawLabel) }}
</Button>
</div>
</RedisHorizontalScrollbar>
<span class="flex-1" />
<div v-if="stringValueView === 'json' && stringValueDetail.json && stringValueCodec === 'none'" class="flex shrink-0 overflow-hidden rounded-md border bg-muted/20 p-0.5">
<Button variant="ghost" size="sm" class="h-6 shrink-0 rounded-[5px] px-2 text-xs" :class="{ 'bg-background shadow-sm': !redisJsonDecoded }" @click="setRedisJsonUnicodeMode('raw')">{{ t("redis.jsonViewRaw") }}</Button>
@@ -3584,11 +3584,11 @@ defineExpose({ focusSearch });
<template v-else>
<div class="flex h-9 items-center gap-2 border-b px-5 text-xs">
<span class="shrink-0 text-muted-foreground">{{ t("redis.codecRowLabel") }}</span>
<div class="flex max-w-full overflow-x-auto rounded-md border bg-muted/20 p-0.5">
<RedisHorizontalScrollbar>
<Button v-for="codec in REDIS_VALUE_CODEC_ORDER" :key="codec" variant="ghost" size="sm" class="h-6 shrink-0 rounded-[5px] px-2 text-xs" :class="{ 'bg-background shadow-sm': memberValueCodec === codec }" @click="setMemberValueCodec(codec)">
{{ redisCodecLabel(codec) }}
</Button>
</div>
</RedisHorizontalScrollbar>
<span class="flex-1" />
<label v-if="isTextRedisFormat(memberValueView) || activeStructuredMemberDetail || isDecompressCodec(memberValueCodec)" class="flex items-center gap-1.5 text-muted-foreground">
<WrapText class="h-3.5 w-3.5" />
@@ -3598,7 +3598,7 @@ defineExpose({ focusSearch });
</div>
<div class="flex h-9 items-center gap-2 border-b px-5 text-xs">
<span class="shrink-0 text-muted-foreground">{{ t("redis.viewRowLabel") }}</span>
<div class="flex max-w-full overflow-x-auto rounded-md border bg-muted/20 p-0.5">
<RedisHorizontalScrollbar>
<Button
v-for="format in REDIS_VALUE_FORMAT_DISPLAY_ORDER"
:key="format"
@@ -3611,7 +3611,7 @@ defineExpose({ focusSearch });
>
{{ redisFormatLabel(format, selectedMemberDetail.rawLabel) }}
</Button>
</div>
</RedisHorizontalScrollbar>
<span class="flex-1" />
<div v-if="memberValueView === 'json' && selectedMemberDetail.json && memberValueCodec === 'none'" class="flex shrink-0 overflow-hidden rounded-md border bg-muted/20 p-0.5">
<Button variant="ghost" size="sm" class="h-6 shrink-0 rounded-[5px] px-2 text-xs" :class="{ 'bg-background shadow-sm': !redisJsonDecoded }" @click="setRedisJsonUnicodeMode('raw')">{{ t("redis.jsonViewRaw") }}</Button>