Skip to content

Commit fdfd04d

Browse files
committed
pref: add a tooltip if the type filter is not supported (#274)
1 parent 410dcd9 commit fdfd04d

13 files changed

Lines changed: 62 additions & 30 deletions

File tree

frontend/src/components/common/RedisTypeSelector.vue

Lines changed: 40 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
import { computed, h } from 'vue'
33
import { NSpace, useThemeVars } from 'naive-ui'
44
import { types, typesBgColor, typesColor, typesShortName } from '@/consts/support_redis_type.js'
5-
import { get, map, toUpper } from 'lodash'
5+
import { get, isEmpty, map, toUpper } from 'lodash'
66
import RedisTypeTag from '@/components/common/RedisTypeTag.vue'
77
88
const props = defineProps({
@@ -18,6 +18,10 @@ const props = defineProps({
1818
type: Boolean,
1919
default: false,
2020
},
21+
disableTip: {
22+
type: String,
23+
default: '',
24+
},
2125
})
2226
2327
const emit = defineEmits(['update:value', 'select'])
@@ -86,24 +90,42 @@ const handleSelect = (select) => {
8690
</script>
8791

8892
<template>
89-
<n-dropdown
90-
:disabled="props.disabled"
91-
:options="options"
92-
:placement="props.placement"
93-
:render-icon="renderIcon"
94-
:render-label="renderLabel"
95-
show-arrow
96-
@select="handleSelect">
97-
<n-tag
98-
:bordered="true"
99-
:color="{ color: backgroundColor, textColor: fontColor }"
93+
<template v-if="props.disabled">
94+
<n-tooltip :disabled="isEmpty(props.disableTip)">
95+
<div>{{ props.disableTip }}</div>
96+
<template #trigger>
97+
<n-tag
98+
:bordered="true"
99+
:color="{ color: backgroundColor, textColor: fontColor }"
100+
class="redis-tag"
101+
disabled
102+
size="medium"
103+
strong>
104+
{{ displayValue }}
105+
</n-tag>
106+
</template>
107+
</n-tooltip>
108+
</template>
109+
<template v-else>
110+
<n-dropdown
100111
:disabled="props.disabled"
101-
class="redis-tag"
102-
size="medium"
103-
strong>
104-
{{ displayValue }}
105-
</n-tag>
106-
</n-dropdown>
112+
:options="options"
113+
:placement="props.placement"
114+
:render-icon="renderIcon"
115+
:render-label="renderLabel"
116+
show-arrow
117+
@select="handleSelect">
118+
<n-tag
119+
:bordered="true"
120+
:color="{ color: backgroundColor, textColor: fontColor }"
121+
:disabled="props.disabled"
122+
class="redis-tag"
123+
size="medium"
124+
strong>
125+
{{ displayValue }}
126+
</n-tag>
127+
</n-dropdown>
128+
</template>
107129
</template>
108130

109131
<style lang="scss" scoped>

frontend/src/components/content_value/ContentValueWrapper.vue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -209,8 +209,6 @@ watch(() => data.value?.keyPath, initContent)
209209
<!-- FIXME: keep alive may cause virtual list null value error. -->
210210
<!-- <keep-alive v-else> -->
211211
<component
212-
tabindex="0"
213-
@keydown="onKeyShortcut"
214212
:is="valueComponents[data.type]"
215213
v-else
216214
ref="contentRef"
@@ -226,7 +224,9 @@ watch(() => data.value?.keyPath, initContent)
226224
:size="data.size"
227225
:ttl="data.ttl"
228226
:value="data.value"
227+
tabindex="0"
229228
@delete="onDelete"
229+
@keydown="onKeyShortcut"
230230
@loadall="onLoadAll"
231231
@loadmore="onLoadMore"
232232
@match="onMatch"

frontend/src/components/sidebar/BrowserPane.vue

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -311,6 +311,7 @@ watch(
311311
<redis-type-selector
312312
v-model:value="filterForm.type"
313313
:disabled="!showTypeFilter"
314+
:disable-tip="$t('dialogue.filter.filter_type_not_support')"
314315
@update:value="onSelectFilterType" />
315316
</template>
316317
</content-search-input>

frontend/src/components/sidebar/BrowserTree.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -812,6 +812,7 @@ defineExpose({
812812
:expand-on-click="false"
813813
:expanded-keys="expandedKeys"
814814
:filter="(pattern, node) => includes(node.redisKey, pattern)"
815+
:keyboard="false"
815816
:node-props="nodeProps"
816817
:pattern="props.pattern"
817818
:render-label="renderLabel"
@@ -822,7 +823,6 @@ defineExpose({
822823
check-strategy="child"
823824
class="fill-height"
824825
virtual-scroll
825-
:keyboard="false"
826826
@keydown="onKeyShortcut"
827827
@update:selected-keys="onUpdateSelectedKeys"
828828
@update:expanded-keys="onUpdateExpanded"

frontend/src/langs/en-us.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -331,7 +331,8 @@
331331
"set_key_filter": "Set Key Filter",
332332
"filter_pattern": "Pattern",
333333
"filter_pattern_tip": "Filter by directly input, and scan by press 'Enter'.\n\n* matches 0 or more chars, e.g. 'key*' \n? matches single char, e.g. 'key?'\n[] matches range, e.g. 'key[1-3]'\n\\ escapes special chars",
334-
"exact_match_tip": "Exact Match"
334+
"exact_match_tip": "Exact Match",
335+
"filter_type_not_support": "Type filtering is not supported for Redis 5.x and below."
335336
},
336337
"export": {
337338
"name": "Export Data",

frontend/src/langs/es-es.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -331,7 +331,8 @@
331331
"set_key_filter": "Establecer filtro de clave",
332332
"filter_pattern": "Patrón",
333333
"filter_pattern_tip": "Filtre la lista actual ingresando directamente, y escanee el servidor presionando 'Ingresar'.\n\n* coincide con 0 o más caracteres, ej. 'key*'\n? coincide con un carácter, ej. 'key?'\n[] coincide con un rango, ej. 'key[1-3]'\n\\ escapa caracteres especiales",
334-
"exact_match_tip": "Coincidencia exacta"
334+
"exact_match_tip": "Coincidencia exacta",
335+
"filter_type_not_support": "El filtrado por tipo no es compatible con Redis 5.x y versiones anteriores"
335336
},
336337
"export": {
337338
"name": "Exportar datos",

frontend/src/langs/fr-fr.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -331,7 +331,8 @@
331331
"set_key_filter": "Définir le filtre de clé",
332332
"filter_pattern": "Modèle",
333333
"filter_pattern_tip": "Filtrez la liste actuelle en saisissant directement, et scannez le serveur en appuyant sur 'Entrée'.\n\n* correspond à 0 ou plusieurs caractères, ex : 'key*'\n? correspond à un seul caractère, ex : 'key?'\n[] correspond à une plage, ex : 'key[1-3]' échappe les caractères spéciaux",
334-
"exact_match_tip": "Correspondance exacte"
334+
"exact_match_tip": "Correspondance exacte",
335+
"filter_type_not_support": "Le filtrage par type n’est pas pris en charge pour Redis 5.x et les versions antérieures"
335336
},
336337
"export": {
337338
"name": "Exporter les données",

frontend/src/langs/ja-jp.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -331,7 +331,8 @@
331331
"set_key_filter": "キーフィルターを設定",
332332
"filter_pattern": "パターン",
333333
"filter_pattern_tip": "直接入力して現在のリストをフィルタリングし、Enterキーを押すとサーバーをスキャンできます。\n\n*:0文字以上にマッチ。例:\"key*\"\"key\"で始まるすべてのキーにマッチ\n?:1文字にマッチ。例:\"key?\"\"key1\"\"key2\"にマッチ\n[ ]:指定範囲の1文字にマッチ。例:\"key[1-3]\"\"key1\"\"key2\"\"key3\"にマッチ\n\\:エスケープ文字。*、?、[、]をリテラルとして解釈したい場合は\"\\ \"をつける",
334-
"exact_match_tip": "完全一致"
334+
"exact_match_tip": "完全一致",
335+
"filter_type_not_support": "タイプフィルタリングは、Redis 5.x 以前のバージョンには対応していません"
335336
},
336337
"export": {
337338
"name": "データをエクスポート",

frontend/src/langs/ko-kr.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -331,7 +331,8 @@
331331
"set_key_filter": "키 필터 설정",
332332
"filter_pattern": "패턴",
333333
"filter_pattern_tip": "직접 입력하여 현재 목록을 필터링하고, Enter키를 누르면 서버를 스캔할 수 있습니다.\n\n* 0개 이상의 문자 일치, 예) 'key*'\n? 단일 문자 일치, 예) 'key?'\n[] 범위 일치, 예) 'key[1-3]'\n\\ 특수문자 이스케이프",
334-
"exact_match_tip": "완전 일치"
334+
"exact_match_tip": "완전 일치",
335+
"filter_type_not_support": "타입 필터링은 Redis 5.x 및 이전 버전을 지원하지 않습니다"
335336
},
336337
"export": {
337338
"name": "데이터 내보내기",

frontend/src/langs/pt-br.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -331,7 +331,8 @@
331331
"set_key_filter": "Definir Filtro de Chave",
332332
"filter_pattern": "Padrão",
333333
"filter_pattern_tip": "Filtre a lista atual inserindo diretamente, e escaneie o servidor pressionando 'Enter'.\n\n* corresponde a 0 ou mais caracteres, ex: 'chave*'\n? corresponde a um único caractere, ex: 'chave?'\n[] corresponde a um intervalo, ex: 'chave[1-3]'\n\\ escapa caracteres especiais",
334-
"exact_match_tip": "Correspondência Exata"
334+
"exact_match_tip": "Correspondência Exata",
335+
"filter_type_not_support": "A filtragem por tipo não é suportada para Redis 5.x e versões anteriores"
335336
},
336337
"export": {
337338
"name": "Exportar Dados",

0 commit comments

Comments
 (0)