feat: replace min size filter with key name + type filter
Remove the minSizeKB number input (rarely useful). Add: - Key name search input (case-insensitive substring match) - Type dropdown filter (string/hash/list/set/zset/stream) Updated i18n for all 5 locales (en, zh-CN, ja, ko, de).
This commit is contained in:
@@ -16,7 +16,8 @@ const entries = shallowRef<KeyEntry[]>([])
|
|||||||
const scanning = ref(false)
|
const scanning = ref(false)
|
||||||
const paused = ref(false)
|
const paused = ref(false)
|
||||||
const scannedCount = ref(0)
|
const scannedCount = ref(0)
|
||||||
const minSizeKB = ref(0)
|
const filterKey = ref('')
|
||||||
|
const filterType = ref('')
|
||||||
const sortAsc = ref(false)
|
const sortAsc = ref(false)
|
||||||
const scanAbort = ref<AbortController | null>(null)
|
const scanAbort = ref<AbortController | null>(null)
|
||||||
|
|
||||||
@@ -30,9 +31,14 @@ const ROW_HEIGHT = 36
|
|||||||
const BUFFER = 10
|
const BUFFER = 10
|
||||||
|
|
||||||
const sortedEntries = computed(() => {
|
const sortedEntries = computed(() => {
|
||||||
const filtered = minSizeKB.value > 0
|
let filtered = entries.value
|
||||||
? entries.value.filter(e => e.size >= minSizeKB.value * 1024)
|
if (filterKey.value) {
|
||||||
: entries.value
|
const kw = filterKey.value.toLowerCase()
|
||||||
|
filtered = filtered.filter(e => e.key.toLowerCase().includes(kw))
|
||||||
|
}
|
||||||
|
if (filterType.value) {
|
||||||
|
filtered = filtered.filter(e => e.type === filterType.value)
|
||||||
|
}
|
||||||
return [...filtered].sort((a, b) => sortAsc.value ? a.size - b.size : b.size - a.size)
|
return [...filtered].sort((a, b) => sortAsc.value ? a.size - b.size : b.size - a.size)
|
||||||
})
|
})
|
||||||
|
|
||||||
@@ -187,16 +193,27 @@ onUnmounted(() => {
|
|||||||
<span class="ma-stat-label">{{ t('memory.totalSize') }}: {{ formatSize(totalFiltered) }}</span>
|
<span class="ma-stat-label">{{ t('memory.totalSize') }}: {{ formatSize(totalFiltered) }}</span>
|
||||||
</div>
|
</div>
|
||||||
<div class="ma-filters">
|
<div class="ma-filters">
|
||||||
<el-input-number
|
<el-input
|
||||||
v-model="minSizeKB"
|
v-model="filterKey"
|
||||||
:min="0"
|
|
||||||
:max="10240"
|
|
||||||
:step="1"
|
|
||||||
size="small"
|
size="small"
|
||||||
controls-position="right"
|
clearable
|
||||||
:placeholder="t('memory.minSize')"
|
:placeholder="t('memory.filterKey')"
|
||||||
style="width:140px"
|
style="width:200px"
|
||||||
/>
|
/>
|
||||||
|
<el-select
|
||||||
|
v-model="filterType"
|
||||||
|
size="small"
|
||||||
|
clearable
|
||||||
|
:placeholder="t('memory.filterType')"
|
||||||
|
style="width:120px"
|
||||||
|
>
|
||||||
|
<el-option :label="t('types.string')" value="string" />
|
||||||
|
<el-option :label="t('types.hash')" value="hash" />
|
||||||
|
<el-option :label="t('types.list')" value="list" />
|
||||||
|
<el-option :label="t('types.set')" value="set" />
|
||||||
|
<el-option :label="t('types.zset')" value="zset" />
|
||||||
|
<el-option :label="t('types.stream')" value="stream" />
|
||||||
|
</el-select>
|
||||||
<el-button size="small" @click="sortAsc = !sortAsc">
|
<el-button size="small" @click="sortAsc = !sortAsc">
|
||||||
{{ sortAsc ? t('memory.sortAsc') : t('memory.sortDesc') }}
|
{{ sortAsc ? t('memory.sortAsc') : t('memory.sortDesc') }}
|
||||||
</el-button>
|
</el-button>
|
||||||
|
|||||||
@@ -244,7 +244,8 @@ export default {
|
|||||||
size: 'Größe',
|
size: 'Größe',
|
||||||
type: 'Typ',
|
type: 'Typ',
|
||||||
totalSize: 'Gesamtgröße',
|
totalSize: 'Gesamtgröße',
|
||||||
minSize: 'Mindestgröße (KB)',
|
filterKey: 'Schlüssel suchen...',
|
||||||
|
filterType: 'Alle Typen',
|
||||||
sortAsc: 'Aufsteigend',
|
sortAsc: 'Aufsteigend',
|
||||||
sortDesc: 'Absteigend',
|
sortDesc: 'Absteigend',
|
||||||
scanned: '{n} Schlüssel gescannt',
|
scanned: '{n} Schlüssel gescannt',
|
||||||
|
|||||||
@@ -244,7 +244,8 @@ export default {
|
|||||||
size: 'Size',
|
size: 'Size',
|
||||||
type: 'Type',
|
type: 'Type',
|
||||||
totalSize: 'Total Size',
|
totalSize: 'Total Size',
|
||||||
minSize: 'Min Size (KB)',
|
filterKey: 'Search key...',
|
||||||
|
filterType: 'All Types',
|
||||||
sortAsc: 'Ascending',
|
sortAsc: 'Ascending',
|
||||||
sortDesc: 'Descending',
|
sortDesc: 'Descending',
|
||||||
scanned: '{n} keys scanned',
|
scanned: '{n} keys scanned',
|
||||||
|
|||||||
@@ -244,7 +244,8 @@ export default {
|
|||||||
size: 'サイズ',
|
size: 'サイズ',
|
||||||
type: 'タイプ',
|
type: 'タイプ',
|
||||||
totalSize: '合計サイズ',
|
totalSize: '合計サイズ',
|
||||||
minSize: '最小サイズ (KB)',
|
filterKey: 'キー名検索...',
|
||||||
|
filterType: 'すべてのタイプ',
|
||||||
sortAsc: '昇順',
|
sortAsc: '昇順',
|
||||||
sortDesc: '降順',
|
sortDesc: '降順',
|
||||||
scanned: '{n} 個のキーをスキャンしました',
|
scanned: '{n} 個のキーをスキャンしました',
|
||||||
|
|||||||
@@ -244,7 +244,8 @@ export default {
|
|||||||
size: '크기',
|
size: '크기',
|
||||||
type: '유형',
|
type: '유형',
|
||||||
totalSize: '총 크기',
|
totalSize: '총 크기',
|
||||||
minSize: '최소 크기 (KB)',
|
filterKey: '키 이름 검색...',
|
||||||
|
filterType: '모든 유형',
|
||||||
sortAsc: '오름차순',
|
sortAsc: '오름차순',
|
||||||
sortDesc: '내림차순',
|
sortDesc: '내림차순',
|
||||||
scanned: '{n}개 키 스캔됨',
|
scanned: '{n}개 키 스캔됨',
|
||||||
|
|||||||
@@ -244,7 +244,8 @@ export default {
|
|||||||
size: '大小',
|
size: '大小',
|
||||||
type: '类型',
|
type: '类型',
|
||||||
totalSize: '总大小',
|
totalSize: '总大小',
|
||||||
minSize: '最小大小 (KB)',
|
filterKey: '搜索键名...',
|
||||||
|
filterType: '所有类型',
|
||||||
sortAsc: '升序',
|
sortAsc: '升序',
|
||||||
sortDesc: '降序',
|
sortDesc: '降序',
|
||||||
scanned: '已扫描 {n} 个',
|
scanned: '已扫描 {n} 个',
|
||||||
|
|||||||
Reference in New Issue
Block a user