Compare commits

..

No commits in common. "5deb6ce44320129a95821f88c833dd9a85af0ae5" and "29b51f836f6ef65ce7bca7cbe6dc5ebc6fbe0be0" have entirely different histories.

20 changed files with 31 additions and 210 deletions

View File

@ -27,12 +27,11 @@ func NewPreferences() Preferences {
AllowTrack: true,
},
Editor: PreferencesEditor{
FontSize: consts.DEFAULT_FONT_SIZE,
ShowLineNum: true,
ShowFolding: true,
DropText: true,
Links: true,
EntryTextAlign: 0,
FontSize: consts.DEFAULT_FONT_SIZE,
ShowLineNum: true,
ShowFolding: true,
DropText: true,
Links: true,
},
Cli: PreferencesCli{
FontSize: consts.DEFAULT_FONT_SIZE,
@ -68,14 +67,13 @@ type PreferencesGeneral struct {
}
type PreferencesEditor struct {
Font string `json:"font" yaml:"font,omitempty"`
FontFamily []string `json:"fontFamily" yaml:"font_family,omitempty"`
FontSize int `json:"fontSize" yaml:"font_size"`
ShowLineNum bool `json:"showLineNum" yaml:"show_line_num"`
ShowFolding bool `json:"showFolding" yaml:"show_folding"`
DropText bool `json:"dropText" yaml:"drop_text"`
Links bool `json:"links" yaml:"links"`
EntryTextAlign int `json:"entryTextAlign" yaml:"entry_text_align"`
Font string `json:"font" yaml:"font,omitempty"`
FontFamily []string `json:"fontFamily" yaml:"font_family,omitempty"`
FontSize int `json:"fontSize" yaml:"font_size"`
ShowLineNum bool `json:"showLineNum" yaml:"show_line_num"`
ShowFolding bool `json:"showFolding" yaml:"show_folding"`
DropText bool `json:"dropText" yaml:"drop_text"`
Links bool `json:"links" yaml:"links"`
}
type PreferencesCli struct {

View File

@ -253,15 +253,6 @@ const onTermKey = (e) => {
}
// block all ctrl key combinations input
return false
} else {
switch (e.key) {
case 'Home': // move to head of line
moveInputCursorTo(0)
return false
case 'End': // move to tail of line
moveInputCursorTo(Number.MAX_SAFE_INTEGER)
return false
}
}
}
return true

View File

@ -19,10 +19,6 @@ import { decodeRedisKey } from '@/utils/key_convert.js'
import ContentSearchInput from '@/components/content_value/ContentSearchInput.vue'
import { formatBytes } from '@/utils/byte_convert.js'
import copy from 'copy-text-to-clipboard'
import SwitchButton from '@/components/common/SwitchButton.vue'
import AlignLeft from '@/components/icons/AlignLeft.vue'
import AlignCenter from '@/components/icons/AlignCenter.vue'
import { TextAlignType } from '@/consts/text_align_type.js'
const i18n = useI18n()
const themeVars = useThemeVars()
@ -49,10 +45,9 @@ const props = defineProps({
decode: String,
end: Boolean,
loading: Boolean,
textAlign: Number,
})
const emit = defineEmits(['loadmore', 'loadall', 'reload', 'match', 'update:textAlign'])
const emit = defineEmits(['loadmore', 'loadall', 'reload', 'match'])
/**
*
@ -83,7 +78,7 @@ const fieldFilterOption = ref(null)
const fieldColumn = computed(() => ({
key: 'key',
title: () => i18n.t('common.field'),
align: props.textAlign !== TextAlignType.Left ? 'center' : 'left',
align: 'center',
titleAlign: 'center',
resizable: true,
ellipsis: {
@ -116,7 +111,7 @@ const isCode = computed(() => {
const valueColumn = computed(() => ({
key: 'value',
title: () => i18n.t('common.value'),
align: isCode.value ? 'left' : props.textAlign !== TextAlignType.Left ? 'center' : 'left',
align: isCode.value ? 'left' : 'center',
titleAlign: 'center',
resizable: true,
ellipsis: isCode.value
@ -269,7 +264,7 @@ const columns = computed(() => {
key: 'no',
title: '#',
width: 80,
align: props.textAlign !== TextAlignType.Left ? 'center' : 'left',
align: 'center',
titleAlign: 'center',
render: (row, index) => {
return index + 1
@ -285,7 +280,7 @@ const columns = computed(() => {
key: 'no',
title: '#',
width: 80,
align: props.textAlign !== TextAlignType.Left ? 'center' : 'left',
align: 'center',
titleAlign: 'center',
render: (row, index) => {
if (index + 1 === currentEditRow.no) {
@ -447,13 +442,6 @@ defineExpose({
<n-divider v-if="showMemoryUsage" vertical />
<n-text v-if="showMemoryUsage">{{ $t('interface.memory_usage') }}: {{ formatBytes(props.size) }}</n-text>
<div class="flex-item-expand"></div>
<switch-button
:icons="[AlignCenter, AlignLeft]"
:stroke-width="3.5"
:t-tooltips="['interface.text_align_center', 'interface.text_align_left']"
:value="props.textAlign"
unselect-stroke-width="3"
@update:value="(val) => emit('update:textAlign', val)" />
<format-selector
v-show="!inEdit"
:decode="props.decode"

View File

@ -18,10 +18,6 @@ import Edit from '@/components/icons/Edit.vue'
import ContentSearchInput from '@/components/content_value/ContentSearchInput.vue'
import { formatBytes } from '@/utils/byte_convert.js'
import copy from 'copy-text-to-clipboard'
import { TextAlignType } from '@/consts/text_align_type.js'
import AlignLeft from '@/components/icons/AlignLeft.vue'
import AlignCenter from '@/components/icons/AlignCenter.vue'
import SwitchButton from '@/components/common/SwitchButton.vue'
const i18n = useI18n()
const themeVars = useThemeVars()
@ -55,10 +51,9 @@ const props = defineProps({
},
end: Boolean,
loading: Boolean,
textAlign: Number,
})
const emit = defineEmits(['loadmore', 'loadall', 'reload', 'match', 'update:textAlign'])
const emit = defineEmits(['loadmore', 'loadall', 'reload', 'match'])
/**
*
@ -89,7 +84,7 @@ const valueFilterOption = ref(null)
const valueColumn = computed(() => ({
key: 'value',
title: () => i18n.t('common.value'),
align: isCode.value ? 'left' : props.textAlign !== TextAlignType.Left ? 'center' : 'left',
align: isCode.value ? 'left' : 'center',
titleAlign: 'center',
ellipsis: isCode.value
? false
@ -219,7 +214,7 @@ const columns = computed(() => {
key: 'no',
title: '#',
width: 80,
align: props.textAlign !== TextAlignType.Left ? 'center' : 'left',
align: 'center',
titleAlign: 'center',
render: (row, index) => {
return index + 1
@ -234,7 +229,7 @@ const columns = computed(() => {
key: 'no',
title: '#',
width: 80,
align: props.textAlign !== TextAlignType.Left ? 'center' : 'left',
align: 'center',
titleAlign: 'center',
render: (row, index) => {
if (index + 1 === currentEditRow.no) {
@ -396,13 +391,6 @@ defineExpose({
<n-divider v-if="showMemoryUsage" vertical />
<n-text v-if="showMemoryUsage">{{ $t('interface.memory_usage') }}: {{ formatBytes(props.size) }}</n-text>
<div class="flex-item-expand"></div>
<switch-button
:icons="[AlignCenter, AlignLeft]"
:stroke-width="3.5"
:t-tooltips="['interface.text_align_center', 'interface.text_align_left']"
:value="props.textAlign"
unselect-stroke-width="3"
@update:value="(val) => emit('update:textAlign', val)" />
<format-selector
v-show="!inEdit"
:decode="props.decode"

View File

@ -18,10 +18,6 @@ import FormatSelector from '@/components/content_value/FormatSelector.vue'
import ContentSearchInput from '@/components/content_value/ContentSearchInput.vue'
import { formatBytes } from '@/utils/byte_convert.js'
import copy from 'copy-text-to-clipboard'
import AlignLeft from '@/components/icons/AlignLeft.vue'
import AlignCenter from '@/components/icons/AlignCenter.vue'
import SwitchButton from '@/components/common/SwitchButton.vue'
import { TextAlignType } from '@/consts/text_align_type.js'
const i18n = useI18n()
const themeVars = useThemeVars()
@ -54,10 +50,9 @@ const props = defineProps({
},
end: Boolean,
loading: Boolean,
textAlign: Number,
})
const emit = defineEmits(['loadmore', 'loadall', 'reload', 'match', 'update:textAlign'])
const emit = defineEmits(['loadmore', 'loadall', 'reload', 'match'])
/**
*
@ -88,7 +83,7 @@ const valueFilterOption = ref(null)
const valueColumn = computed(() => ({
key: 'value',
title: () => i18n.t('common.value'),
align: isCode.value ? 'left' : props.textAlign !== TextAlignType.Left ? 'center' : 'left',
align: isCode.value ? 'left' : 'center',
titleAlign: 'center',
ellipsis: isCode.value
? false
@ -216,7 +211,7 @@ const columns = computed(() => {
key: 'no',
title: '#',
width: 80,
align: props.textAlign !== TextAlignType.Left ? 'center' : 'left',
align: 'center',
titleAlign: 'center',
render: (row, index) => {
return index + 1
@ -231,7 +226,7 @@ const columns = computed(() => {
key: 'no',
title: '#',
width: 80,
align: props.textAlign !== TextAlignType.Left ? 'center' : 'left',
align: 'center',
titleAlign: 'center',
render: (row, index) => {
if (index + 1 === currentEditRow.no) {
@ -393,13 +388,6 @@ defineExpose({
<n-divider v-if="showMemoryUsage" vertical />
<n-text v-if="showMemoryUsage">{{ $t('interface.memory_usage') }}: {{ formatBytes(props.size) }}</n-text>
<div class="flex-item-expand"></div>
<switch-button
:icons="[AlignCenter, AlignLeft]"
:stroke-width="3.5"
:t-tooltips="['interface.text_align_center', 'interface.text_align_left']"
:value="props.textAlign"
unselect-stroke-width="3"
@update:value="(val) => emit('update:textAlign', val)" />
<format-selector
v-show="!inEdit"
:decode="props.decode"

View File

@ -14,13 +14,10 @@ import useDialogStore from 'stores/dialog.js'
import { useI18n } from 'vue-i18n'
import ContentToolbar from '@/components/content_value/ContentToolbar.vue'
import ContentValueJson from '@/components/content_value/ContentValueJson.vue'
import usePreferencesStore from 'stores/preferences.js'
import { TextAlignType } from '@/consts/text_align_type.js'
const themeVars = useThemeVars()
const browserStore = useBrowserStore()
const dialogStore = useDialogStore()
const prefStore = usePreferencesStore()
const props = defineProps({
blank: Boolean,
@ -181,11 +178,6 @@ const onMatch = (match) => {
loadData(true, false, match || '')
}
const onEntryTextAlignChanged = (align) => {
prefStore.editor.entryTextAlign = align !== TextAlignType.Left ? TextAlignType.Center : TextAlignType.Left
prefStore.savePreferences()
}
const contentRef = ref(null)
const initContent = async () => {
// onReload()
@ -233,14 +225,12 @@ watch(() => data.value?.keyPath, initContent)
:ttl="data.ttl"
:value="data.value"
tabindex="0"
:text-align="prefStore.entryTextAlign"
@delete="onDelete"
@keydown="onKeyShortcut"
@loadall="onLoadAll"
@loadmore="onLoadMore"
@match="onMatch"
@reload="onReload"
@update:text-align="onEntryTextAlignChanged">
@reload="onReload">
<template #toolbar>
<content-toolbar
:db="data.db"

View File

@ -18,10 +18,6 @@ import Edit from '@/components/icons/Edit.vue'
import ContentSearchInput from '@/components/content_value/ContentSearchInput.vue'
import { formatBytes } from '@/utils/byte_convert.js'
import copy from 'copy-text-to-clipboard'
import { TextAlignType } from '@/consts/text_align_type.js'
import AlignLeft from '@/components/icons/AlignLeft.vue'
import AlignCenter from '@/components/icons/AlignCenter.vue'
import SwitchButton from '@/components/common/SwitchButton.vue'
const i18n = useI18n()
const themeVars = useThemeVars()
@ -54,10 +50,9 @@ const props = defineProps({
},
end: Boolean,
loading: Boolean,
textAlign: Number,
})
const emit = defineEmits(['loadmore', 'loadall', 'reload', 'match', 'update:textAlign'])
const emit = defineEmits(['loadmore', 'loadall', 'reload', 'match'])
/**
*
@ -87,7 +82,7 @@ const fullEdit = ref(false)
const scoreColumn = computed(() => ({
key: 'score',
title: () => i18n.t('common.score'),
align: props.textAlign !== TextAlignType.Left ? 'center' : 'left',
align: 'center',
titleAlign: 'center',
resizable: true,
sorter: (row1, row2) => row1.s - row2.s,
@ -136,7 +131,7 @@ const valueFilterOption = ref(null)
const valueColumn = computed(() => ({
key: 'value',
title: () => i18n.t('common.value'),
align: isCode.value ? 'left' : props.textAlign !== TextAlignType.Left ? 'center' : 'left',
align: isCode.value ? 'left' : 'center',
titleAlign: 'center',
resizable: true,
ellipsis: isCode.value
@ -261,7 +256,7 @@ const columns = computed(() => {
key: 'no',
title: '#',
width: 80,
align: props.textAlign !== TextAlignType.Left ? 'center' : 'left',
align: 'center',
titleAlign: 'center',
render: (row, index) => {
return index + 1
@ -277,7 +272,7 @@ const columns = computed(() => {
key: 'no',
title: '#',
width: 80,
align: props.textAlign !== TextAlignType.Left ? 'center' : 'left',
align: 'center',
titleAlign: 'center',
render: (row, index) => {
if (index + 1 === currentEditRow.no) {
@ -426,13 +421,6 @@ defineExpose({
<n-divider v-if="showMemoryUsage" vertical />
<n-text v-if="showMemoryUsage">{{ $t('interface.memory_usage') }}: {{ formatBytes(props.size) }}</n-text>
<div class="flex-item-expand"></div>
<switch-button
:icons="[AlignCenter, AlignLeft]"
:stroke-width="3.5"
:t-tooltips="['interface.text_align_center', 'interface.text_align_left']"
:value="props.textAlign"
unselect-stroke-width="3"
@update:value="(val) => emit('update:textAlign', val)" />
<format-selector
v-show="!inEdit"
:decode="props.decode"

View File

@ -1,39 +0,0 @@
<script setup>
const props = defineProps({
strokeWidth: {
type: [Number, String],
default: 3,
},
})
</script>
<template>
<svg fill="none" viewBox="0 0 48 48" xmlns="http://www.w3.org/2000/svg">
<path
:stroke-width="props.strokeWidth"
d="M36 19H12"
stroke="currentColor"
stroke-linecap="round"
stroke-linejoin="round" />
<path
:stroke-width="props.strokeWidth"
d="M42 9H6"
stroke="currentColor"
stroke-linecap="round"
stroke-linejoin="round" />
<path
:stroke-width="props.strokeWidth"
d="M42 29H6"
stroke="currentColor"
stroke-linecap="round"
stroke-linejoin="round" />
<path
:stroke-width="props.strokeWidth"
d="M36 39H12"
stroke="currentColor"
stroke-linecap="round"
stroke-linejoin="round" />
</svg>
</template>
<style lang="scss" scoped></style>

View File

@ -1,39 +0,0 @@
<script setup>
const props = defineProps({
strokeWidth: {
type: [Number, String],
default: 3,
},
})
</script>
<template>
<svg fill="none" viewBox="0 0 48 48" xmlns="http://www.w3.org/2000/svg">
<path
:stroke-width="props.strokeWidth"
d="M42 9H6"
stroke="currentColor"
stroke-linecap="round"
stroke-linejoin="round" />
<path
:stroke-width="props.strokeWidth"
d="M34 19H6"
stroke="currentColor"
stroke-linecap="round"
stroke-linejoin="round" />
<path
:stroke-width="props.strokeWidth"
d="M42 29H6"
stroke="currentColor"
stroke-linecap="round"
stroke-linejoin="round" />
<path
:stroke-width="props.strokeWidth"
d="M34 39H6"
stroke="currentColor"
stroke-linecap="round"
stroke-linejoin="round" />
</svg>
</template>
<style lang="scss" scoped></style>

View File

@ -1,8 +0,0 @@
/**
* all types of text alignment
* @enum {number}
*/
export const TextAlignType = {
Center: 0,
Left: 1,
}

View File

@ -126,8 +126,6 @@
"length": "Length",
"entries": "Entries",
"memory_usage": "Memory Usage",
"text_align_left": "Text Align Left",
"text_align_center": "Text Align Center",
"view_as": "View As",
"decode_with": "Decode / Decompress",
"custom_decoder": "New Custom Decoder",

View File

@ -126,8 +126,6 @@
"length": "Longitud",
"entries": "Entradas",
"memory_usage": "Uso de memoria",
"text_align_left": "Alinear a la izquierda",
"text_align_center": "Centrar",
"view_as": "Ver como",
"decode_with": "Decodificar / Descomprimir",
"custom_decoder": "Nuevo decodificador personalizado",

View File

@ -126,8 +126,6 @@
"length": "Longueur",
"entries": "Entrées",
"memory_usage": "Utilisation de la mémoire",
"text_align_left": "Aligner à gauche",
"text_align_center": "Centrer",
"view_as": "Voir comme",
"decode_with": "Décoder / Décompresser",
"custom_decoder": "Nouveau décodeur personnalisé",

View File

@ -126,8 +126,6 @@
"length": "長さ",
"entries": "エントリ",
"memory_usage": "メモリ使用量",
"text_align_left": "左揃え",
"text_align_center": "中央揃え",
"view_as": "表示形式",
"decode_with": "デコード/解凍",
"custom_decoder": "新しいカスタムデコーダー",

View File

@ -126,8 +126,6 @@
"length": "길이",
"entries": "항목 수",
"memory_usage": "메모리 사용량",
"text_align_left": "텍스트 왼쪽 정렬",
"text_align_center": "텍스트 가운데 정렬",
"view_as": "보기",
"decode_with": "디코딩/압축 해제",
"custom_decoder": "새 사용자 정의 디코더",

View File

@ -126,8 +126,6 @@
"length": "Tamanho",
"entries": "Entradas",
"memory_usage": "Uso de Memória",
"text_align_left": "Alinhar à esquerda",
"text_align_center": "Centralizar",
"view_as": "Visualizar Como",
"decode_with": "Decodificar / Descompressão",
"custom_decoder": "Novo Decodificador Personalizado",

View File

@ -126,8 +126,6 @@
"length": "Длина",
"entries": "Записи",
"memory_usage": "Использование памяти",
"text_align_left": "Выравнивание по левому краю",
"text_align_center": "Выравнивание по центру",
"view_as": "Вид",
"decode_with": "Декодировать/Распаковать",
"custom_decoder": "Новый пользовательский декодер",

View File

@ -126,8 +126,6 @@
"length": "长度",
"entries": "条目",
"memory_usage": "内存占用",
"text_align_left": "文本居左",
"text_align_center": "文本居中",
"view_as": "查看方式",
"decode_with": "解码/解压方式",
"custom_decoder": "添加自定义解码",

View File

@ -126,8 +126,6 @@
"length": "長度",
"entries": "條目",
"memory_usage": "記憶體使用量",
"text_align_left": "文字靠左",
"text_align_center": "文字置中",
"view_as": "檢視方式",
"decode_with": "解碼/解壓方式",
"custom_decoder": "新增自定義解碼",

View File

@ -15,7 +15,6 @@ import { enUS, NButton, NSpace, useOsTheme, zhCN } from 'naive-ui'
import { h, nextTick } from 'vue'
import { compareVersion } from '@/utils/version.js'
import { typesIconStyle } from '@/consts/support_redis_type.js'
import { TextAlignType } from '@/consts/text_align_type.js'
const osTheme = useOsTheme()
const usePreferencesStore = defineStore('preferences', {
@ -64,7 +63,6 @@ const usePreferencesStore = defineStore('preferences', {
showFolding: true,
dropText: true,
links: true,
entryTextAlign: TextAlignType.Center,
},
cli: {
fontFamily: [],
@ -273,10 +271,6 @@ const usePreferencesStore = defineStore('preferences', {
keyIconType() {
return get(this.general, 'keyIconStyle', typesIconStyle.SHORT)
},
entryTextAlign() {
return get(this.editor, 'entryTextAlign', TextAlignType.Center)
},
},
actions: {
_applyPreferences(data) {