Compare commits

...

4 Commits

Author SHA1 Message Date
tiny-craft 6996421cde fix: can not save scan size less than default value in preference
fix: incorrect delete pattern when flush database with any key selected
2023-10-31 22:33:58 +08:00
tiny-craft 5a29a34ea1 fix: add cli fit the window when resize 2023-10-31 17:57:54 +08:00
tiny-craft ca8403d784 perf: keep view format and decode method when reload the same key 2023-10-31 17:29:56 +08:00
tiny-craft 51ed14dcf8 style: add padding to message component
chore: update dependencies
2023-10-31 16:12:13 +08:00
15 changed files with 132 additions and 43 deletions

View File

@ -46,7 +46,9 @@ func (p *PreferencesStorage) GetPreferences() (ret types.Preferences) {
defer p.mutex.Unlock()
ret = p.getPreferences()
ret.General.ScanSize = max(ret.General.ScanSize, consts.DEFAULT_SCAN_SIZE)
if ret.General.ScanSize <= 0 {
ret.General.ScanSize = consts.DEFAULT_SCAN_SIZE
}
ret.Behavior.AsideWidth = max(ret.Behavior.AsideWidth, consts.DEFAULT_ASIDE_WIDTH)
ret.Behavior.WindowWidth = max(ret.Behavior.WindowWidth, consts.MIN_WINDOW_WIDTH)
ret.Behavior.WindowHeight = max(ret.Behavior.WindowHeight, consts.MIN_WINDOW_HEIGHT)

View File

@ -8,13 +8,14 @@
"name": "frontend",
"version": "0.0.0",
"dependencies": {
"bytes": "^3.1.2",
"dayjs": "^1.11.10",
"highlight.js": "^11.9.0",
"lodash": "^4.17.21",
"pinia": "^2.1.7",
"sass": "^1.69.5",
"vue": "^3.3.7",
"vue-i18n": "^9.6.0",
"vue-i18n": "^9.6.2",
"xterm": "^5.3.0",
"xterm-addon-fit": "^0.8.0"
},
@ -464,23 +465,23 @@
}
},
"node_modules/@intlify/core-base": {
"version": "9.6.0",
"resolved": "https://registry.npmmirror.com/@intlify/core-base/-/core-base-9.6.0.tgz",
"integrity": "sha512-9xWsUFrQq4iP1amH3cEIlUHsCXO541RGRDfrKqaDhlYvMbf2qTzpSjqeL3kWw1b+rC8XWHw+cgZXa4VPdOzqfg==",
"version": "9.6.2",
"resolved": "https://registry.npmmirror.com/@intlify/core-base/-/core-base-9.6.2.tgz",
"integrity": "sha512-ci0j2nbEL/pamvqgcCqyIVeQ3LS41F1IRqI5rCBNnpSp0FjNnH8bpha8R3OifkhqatzlP4wGOuN/UqfLYVDv7g==",
"dependencies": {
"@intlify/message-compiler": "9.6.0",
"@intlify/shared": "9.6.0"
"@intlify/message-compiler": "9.6.2",
"@intlify/shared": "9.6.2"
},
"engines": {
"node": ">= 16"
}
},
"node_modules/@intlify/message-compiler": {
"version": "9.6.0",
"resolved": "https://registry.npmmirror.com/@intlify/message-compiler/-/message-compiler-9.6.0.tgz",
"integrity": "sha512-GucIIYA2H86gdf/lKHAahfLpyYm9Q1IUc/yUEMk8wwwfrzBwuYmTDg90ooed7eRVx2N/omyDyuhKV4cRp3b+DQ==",
"version": "9.6.2",
"resolved": "https://registry.npmmirror.com/@intlify/message-compiler/-/message-compiler-9.6.2.tgz",
"integrity": "sha512-kgZQL9zeJDeEB5vvD93Y++HvFUELnT48PjnpfCcF3EJaLLVs9he8IzODiNK42Z40lWbFyja0SXJZjsalybQygA==",
"dependencies": {
"@intlify/shared": "9.6.0",
"@intlify/shared": "9.6.2",
"source-map-js": "^1.0.2"
},
"engines": {
@ -488,9 +489,9 @@
}
},
"node_modules/@intlify/shared": {
"version": "9.6.0",
"resolved": "https://registry.npmmirror.com/@intlify/shared/-/shared-9.6.0.tgz",
"integrity": "sha512-vZeID7kn10rhgRYZQvjULTOYXDGnC0j49HI0AD9CK08aj4nWmlPai/8awTsMg0qrfHVMTna8ZMNmBZNyFAUCfA==",
"version": "9.6.2",
"resolved": "https://registry.npmmirror.com/@intlify/shared/-/shared-9.6.2.tgz",
"integrity": "sha512-9KBcXmJNxElp7QMnU8V0/tScTOitDqyFi4HceEZqJyyDkMi8K5DBPMTIuXIAMmtMlXpe/nj5pke7tRw97VeQRA==",
"engines": {
"node": ">= 16"
}
@ -779,6 +780,14 @@
"node": ">=8"
}
},
"node_modules/bytes": {
"version": "3.1.2",
"resolved": "https://registry.npmmirror.com/bytes/-/bytes-3.1.2.tgz",
"integrity": "sha512-/Nf7TyzTx6S3yRJObOAV7956r8cr2+Oj8AC5dt8wSP3BQAoeX58NoHyCU8P8zGkNXStjTSi6fzO6F0pBdcYbEg==",
"engines": {
"node": ">= 0.8"
}
},
"node_modules/chokidar": {
"version": "3.5.3",
"resolved": "https://registry.npmmirror.com/chokidar/-/chokidar-3.5.3.tgz",
@ -1917,12 +1926,12 @@
}
},
"node_modules/vue-i18n": {
"version": "9.6.0",
"resolved": "https://registry.npmmirror.com/vue-i18n/-/vue-i18n-9.6.0.tgz",
"integrity": "sha512-DSUaHmc2qpXpB0oeHXrW4JtOXnzpmAeaPopDIlubRyXkxIdbzGTsQekZYrCoI3rCEouYKwD1tIw01/YYSYqWAw==",
"version": "9.6.2",
"resolved": "https://registry.npmmirror.com/vue-i18n/-/vue-i18n-9.6.2.tgz",
"integrity": "sha512-J43grTQjPR8LCUxvx3mkoM+11xhTnej1Al4lvJCEeKmQqf8eqbuYPQb54HXnEg/UzZyaxLBAwPAUTbrZ8V7hcg==",
"dependencies": {
"@intlify/core-base": "9.6.0",
"@intlify/shared": "9.6.0",
"@intlify/core-base": "9.6.2",
"@intlify/shared": "9.6.2",
"@vue/devtools-api": "^6.5.0"
},
"engines": {
@ -2229,27 +2238,27 @@
}
},
"@intlify/core-base": {
"version": "9.6.0",
"resolved": "https://registry.npmmirror.com/@intlify/core-base/-/core-base-9.6.0.tgz",
"integrity": "sha512-9xWsUFrQq4iP1amH3cEIlUHsCXO541RGRDfrKqaDhlYvMbf2qTzpSjqeL3kWw1b+rC8XWHw+cgZXa4VPdOzqfg==",
"version": "9.6.2",
"resolved": "https://registry.npmmirror.com/@intlify/core-base/-/core-base-9.6.2.tgz",
"integrity": "sha512-ci0j2nbEL/pamvqgcCqyIVeQ3LS41F1IRqI5rCBNnpSp0FjNnH8bpha8R3OifkhqatzlP4wGOuN/UqfLYVDv7g==",
"requires": {
"@intlify/message-compiler": "9.6.0",
"@intlify/shared": "9.6.0"
"@intlify/message-compiler": "9.6.2",
"@intlify/shared": "9.6.2"
}
},
"@intlify/message-compiler": {
"version": "9.6.0",
"resolved": "https://registry.npmmirror.com/@intlify/message-compiler/-/message-compiler-9.6.0.tgz",
"integrity": "sha512-GucIIYA2H86gdf/lKHAahfLpyYm9Q1IUc/yUEMk8wwwfrzBwuYmTDg90ooed7eRVx2N/omyDyuhKV4cRp3b+DQ==",
"version": "9.6.2",
"resolved": "https://registry.npmmirror.com/@intlify/message-compiler/-/message-compiler-9.6.2.tgz",
"integrity": "sha512-kgZQL9zeJDeEB5vvD93Y++HvFUELnT48PjnpfCcF3EJaLLVs9he8IzODiNK42Z40lWbFyja0SXJZjsalybQygA==",
"requires": {
"@intlify/shared": "9.6.0",
"@intlify/shared": "9.6.2",
"source-map-js": "^1.0.2"
}
},
"@intlify/shared": {
"version": "9.6.0",
"resolved": "https://registry.npmmirror.com/@intlify/shared/-/shared-9.6.0.tgz",
"integrity": "sha512-vZeID7kn10rhgRYZQvjULTOYXDGnC0j49HI0AD9CK08aj4nWmlPai/8awTsMg0qrfHVMTna8ZMNmBZNyFAUCfA=="
"version": "9.6.2",
"resolved": "https://registry.npmmirror.com/@intlify/shared/-/shared-9.6.2.tgz",
"integrity": "sha512-9KBcXmJNxElp7QMnU8V0/tScTOitDqyFi4HceEZqJyyDkMi8K5DBPMTIuXIAMmtMlXpe/nj5pke7tRw97VeQRA=="
},
"@jridgewell/sourcemap-codec": {
"version": "1.4.15",
@ -2493,6 +2502,11 @@
"fill-range": "^7.0.1"
}
},
"bytes": {
"version": "3.1.2",
"resolved": "https://registry.npmmirror.com/bytes/-/bytes-3.1.2.tgz",
"integrity": "sha512-/Nf7TyzTx6S3yRJObOAV7956r8cr2+Oj8AC5dt8wSP3BQAoeX58NoHyCU8P8zGkNXStjTSi6fzO6F0pBdcYbEg=="
},
"chokidar": {
"version": "3.5.3",
"resolved": "https://registry.npmmirror.com/chokidar/-/chokidar-3.5.3.tgz",
@ -3309,12 +3323,12 @@
}
},
"vue-i18n": {
"version": "9.6.0",
"resolved": "https://registry.npmmirror.com/vue-i18n/-/vue-i18n-9.6.0.tgz",
"integrity": "sha512-DSUaHmc2qpXpB0oeHXrW4JtOXnzpmAeaPopDIlubRyXkxIdbzGTsQekZYrCoI3rCEouYKwD1tIw01/YYSYqWAw==",
"version": "9.6.2",
"resolved": "https://registry.npmmirror.com/vue-i18n/-/vue-i18n-9.6.2.tgz",
"integrity": "sha512-J43grTQjPR8LCUxvx3mkoM+11xhTnej1Al4lvJCEeKmQqf8eqbuYPQb54HXnEg/UzZyaxLBAwPAUTbrZ8V7hcg==",
"requires": {
"@intlify/core-base": "9.6.0",
"@intlify/shared": "9.6.0",
"@intlify/core-base": "9.6.2",
"@intlify/shared": "9.6.2",
"@vue/devtools-api": "^6.5.0"
}
},

View File

@ -9,13 +9,14 @@
"preview": "vite preview"
},
"dependencies": {
"bytes": "^3.1.2",
"dayjs": "^1.11.10",
"highlight.js": "^11.9.0",
"lodash": "^4.17.21",
"pinia": "^2.1.7",
"sass": "^1.69.5",
"vue": "^3.3.7",
"vue-i18n": "^9.6.0",
"vue-i18n": "^9.6.2",
"xterm": "^5.3.0",
"xterm-addon-fit": "^0.8.0"
},

View File

@ -1 +1 @@
7c3f3d30a242641f2f308ca9c3a8e4f1
24a0be173ef3e3939a15eb9c7fff5e1a

View File

@ -58,7 +58,7 @@ onMounted(() => {
const { term, fitAddon } = newTerm()
termInst = term
fitAddonInst = fitAddon
// window.addEventListener('resize', resizeTerm)
window.addEventListener('resize', resizeTerm)
term.writeln('\r\n' + i18nGlobal.t('interface.cli_welcome'))
// term.write('\x1b[4h') // insert mode
@ -71,7 +71,7 @@ onMounted(() => {
})
onUnmounted(() => {
// window.removeEventListener('resize', resizeTerm)
window.removeEventListener('resize', resizeTerm)
EventsOff(`cmd:output:${props.name}`)
termInst.dispose()
termInst = null

View File

@ -13,6 +13,7 @@ import Copy from '@/components/icons/Copy.vue'
import { ClipboardSetText } from 'wailsjs/runtime/runtime.js'
import { computed } from 'vue'
import { isEmpty, padStart } from 'lodash'
import { decodeTypes, formatTypes } from '@/consts/value_view_type.js'
const props = defineProps({
server: String,
@ -33,6 +34,14 @@ const props = defineProps({
type: Number,
default: -1,
},
viewAs: {
type: String,
default: formatTypes.PLAIN_TEXT,
},
decode: {
type: String,
default: decodeTypes.NONE,
},
})
const dialogStore = useDialog()
@ -69,7 +78,7 @@ const ttlString = computed(() => {
})
const onReloadKey = () => {
connectionStore.loadKeyValue(props.server, props.db, keyName.value)
connectionStore.loadKeyValue(props.server, props.db, keyName.value, props.viewAs, props.decode)
}
const onCopyKey = () => {

View File

@ -10,6 +10,7 @@ import useDialogStore from 'stores/dialog.js'
import useConnectionStore from 'stores/connections.js'
import { isEmpty } from 'lodash'
import bytes from 'bytes'
import { decodeTypes, formatTypes } from '@/consts/value_view_type.js'
const i18n = useI18n()
const themeVars = useThemeVars()
@ -29,6 +30,14 @@ const props = defineProps({
value: Object,
size: Number,
length: Number,
viewAs: {
type: String,
default: formatTypes.PLAIN_TEXT,
},
decode: {
type: String,
default: decodeTypes.NONE,
},
})
/**
@ -259,11 +268,13 @@ const onUpdateFilter = (filters, sourceColumn) => {
<div class="content-wrapper flex-box-v">
<content-toolbar
:db="props.db"
:decode="props.decode"
:key-code="props.keyCode"
:key-path="props.keyPath"
:key-type="keyType"
:server="props.name"
:ttl="ttl"
:view-as="props.viewAs"
class="value-item-part" />
<div class="tb2 value-item-part flex-box-h">
<div class="flex-box-h">

View File

@ -10,6 +10,7 @@ import EditableTableColumn from '@/components/common/EditableTableColumn.vue'
import useDialogStore from 'stores/dialog.js'
import useConnectionStore from 'stores/connections.js'
import bytes from 'bytes'
import { decodeTypes, formatTypes } from '@/consts/value_view_type.js'
const i18n = useI18n()
const themeVars = useThemeVars()
@ -29,6 +30,14 @@ const props = defineProps({
value: Object,
size: Number,
length: Number,
viewAs: {
type: String,
default: formatTypes.PLAIN_TEXT,
},
decode: {
type: String,
default: decodeTypes.NONE,
},
})
/**
@ -191,11 +200,13 @@ const onUpdateFilter = (filters, sourceColumn) => {
<div class="content-wrapper flex-box-v">
<content-toolbar
:db="props.db"
:decode="props.decode"
:key-code="props.keyCode"
:key-path="props.keyPath"
:key-type="keyType"
:server="props.name"
:ttl="ttl"
:view-as="props.viewAs"
class="value-item-part" />
<div class="tb2 value-item-part flex-box-h">
<div class="flex-box-h">

View File

@ -10,6 +10,7 @@ import { types, types as redisTypes } from '@/consts/support_redis_type.js'
import EditableTableColumn from '@/components/common/EditableTableColumn.vue'
import useConnectionStore from 'stores/connections.js'
import bytes from 'bytes'
import { decodeTypes, formatTypes } from '@/consts/value_view_type.js'
const i18n = useI18n()
const themeVars = useThemeVars()
@ -29,6 +30,14 @@ const props = defineProps({
value: Array,
size: Number,
length: Number,
viewAs: {
type: String,
default: formatTypes.PLAIN_TEXT,
},
decode: {
type: String,
default: decodeTypes.NONE,
},
})
/**
@ -186,11 +195,13 @@ const onUpdateFilter = (filters, sourceColumn) => {
<div class="content-wrapper flex-box-v">
<content-toolbar
:db="props.db"
:decode="props.decode"
:key-code="props.keyCode"
:key-path="props.keyPath"
:key-type="keyType"
:server="props.name"
:ttl="ttl"
:view-as="props.viewAs"
class="value-item-part" />
<div class="tb2 value-item-part flex-box-h">
<div class="flex-box-h">

View File

@ -10,6 +10,7 @@ import useDialogStore from 'stores/dialog.js'
import useConnectionStore from 'stores/connections.js'
import { includes, isEmpty, keys, some, values } from 'lodash'
import bytes from 'bytes'
import { decodeTypes, formatTypes } from '@/consts/value_view_type.js'
const i18n = useI18n()
const themeVars = useThemeVars()
@ -29,6 +30,14 @@ const props = defineProps({
value: Object,
size: Number,
length: Number,
viewAs: {
type: String,
default: formatTypes.PLAIN_TEXT,
},
decode: {
type: String,
default: decodeTypes.NONE,
},
})
/**
@ -171,11 +180,13 @@ const onUpdateFilter = (filters, sourceColumn) => {
<div class="content-wrapper flex-box-v">
<content-toolbar
:db="props.db"
:decode="props.decode"
:key-code="props.keyCode"
:key-path="props.keyPath"
:key-type="keyType"
:server="props.name"
:ttl="ttl"
:view-as="props.viewAs"
class="value-item-part" />
<div class="tb2 value-item-part flex-box-h">
<div class="flex-box-h">

View File

@ -144,11 +144,13 @@ const onSaveValue = async () => {
<div class="content-wrapper flex-box-v">
<content-toolbar
:db="props.db"
:decode="props.decode"
:key-code="keyCode"
:key-path="keyPath"
:key-type="keyType"
:server="props.name"
:ttl="ttl"
:view-as="props.viewAs"
class="value-item-part" />
<div class="tb2 value-item-part flex-box-h">
<div class="flex-item-expand"></div>

View File

@ -10,6 +10,7 @@ import { isEmpty } from 'lodash'
import useDialogStore from 'stores/dialog.js'
import useConnectionStore from 'stores/connections.js'
import bytes from 'bytes'
import { decodeTypes, formatTypes } from '@/consts/value_view_type.js'
const i18n = useI18n()
const themeVars = useThemeVars()
@ -29,6 +30,14 @@ const props = defineProps({
value: Object,
size: Number,
length: Number,
viewAs: {
type: String,
default: formatTypes.PLAIN_TEXT,
},
decode: {
type: String,
default: decodeTypes.NONE,
},
})
/**
@ -284,11 +293,13 @@ const onUpdateFilter = (filters, sourceColumn) => {
<div class="content-wrapper flex-box-v">
<content-toolbar
:db="props.db"
:decode="props.decode"
:key-code="props.keyCode"
:key-path="props.keyPath"
:key-type="keyType"
:server="props.name"
:ttl="ttl"
:view-as="props.viewAs"
class="value-item-part" />
<div class="tb2 value-item-part flex-box-h">
<div class="flex-box-h">

View File

@ -259,6 +259,9 @@ const handleSelectContextMenu = (key) => {
resetExpandKey(props.server, db, true)
connectionStore.closeDatabase(props.server, db)
break
case 'db_flush':
dialogStore.openDeleteKeyDialog(props.server, db, '*')
break
case 'db_newkey':
case 'key_newkey':
dialogStore.openNewKeyDialog(redisKey, props.server, db)
@ -548,7 +551,7 @@ const getDatabaseMenu = (opened, loading, end) => {
tTooltip: 'interface.batch_delete',
icon: Delete,
disabled: loading === true,
onClick: () => handleSelectContextMenu('key_remove'),
onClick: () => handleSelectContextMenu('db_flush'),
}),
// h(IconButton, {
// tTooltip: 'interface.more_action',

View File

@ -79,7 +79,7 @@
"entries": "Entries",
"memory_usage": "Memory Usage",
"view_as": "View As",
"decode_with": "Decode/Decompress Type",
"decode_with": "Decode / Decompression",
"reload": "Reload",
"open_connection": "Open Connection",
"batch_delete": "Batch Delete",

View File

@ -53,6 +53,9 @@ export const themeOverrides = {
buttonColorActive: '#D13B37',
buttonTextColorActive: '#FFF',
},
Message: {
margin: '0 0 38px 0',
},
}
/**