Compare commits
6 Commits
84b73bd5e7
...
23087a5374
Author | SHA1 | Date |
---|---|---|
Lykin | 23087a5374 | |
Lykin | a71f5e0070 | |
Lykin | 1340f911c8 | |
Lykin | 37efe5e72a | |
Lykin | 36a8c38877 | |
Lykin | 18f1b976c6 |
|
@ -1,7 +1,7 @@
|
||||||
<script setup>
|
<script setup>
|
||||||
import ContentPane from './components/content/ContentPane.vue'
|
import ContentPane from './components/content/ContentPane.vue'
|
||||||
import BrowserPane from './components/sidebar/BrowserPane.vue'
|
import BrowserPane from './components/sidebar/BrowserPane.vue'
|
||||||
import { computed, onMounted, reactive, ref, watch } from 'vue'
|
import { computed, onMounted, reactive, ref, watchEffect } from 'vue'
|
||||||
import { debounce } from 'lodash'
|
import { debounce } from 'lodash'
|
||||||
import { useThemeVars } from 'naive-ui'
|
import { useThemeVars } from 'naive-ui'
|
||||||
import Ribbon from './components/sidebar/Ribbon.vue'
|
import Ribbon from './components/sidebar/Ribbon.vue'
|
||||||
|
@ -43,14 +43,11 @@ const handleResize = () => {
|
||||||
saveSidebarWidth()
|
saveSidebarWidth()
|
||||||
}
|
}
|
||||||
|
|
||||||
watch(
|
watchEffect(() => {
|
||||||
() => tabStore.nav,
|
if (tabStore.nav === 'log') {
|
||||||
(nav) => {
|
|
||||||
if (nav === 'log') {
|
|
||||||
logPaneRef.value?.refresh()
|
logPaneRef.value?.refresh()
|
||||||
}
|
}
|
||||||
},
|
})
|
||||||
)
|
|
||||||
|
|
||||||
const logoWrapperWidth = computed(() => {
|
const logoWrapperWidth = computed(() => {
|
||||||
return `${data.navMenuWidth + prefStore.behavior.asideWidth - 4}px`
|
return `${data.navMenuWidth + prefStore.behavior.asideWidth - 4}px`
|
||||||
|
|
|
@ -90,6 +90,7 @@ defineExpose({
|
||||||
v-model:value="inputData.filter"
|
v-model:value="inputData.filter"
|
||||||
:placeholder="$t('interface.filter')"
|
:placeholder="$t('interface.filter')"
|
||||||
:size="props.small ? 'small' : ''"
|
:size="props.small ? 'small' : ''"
|
||||||
|
:theme-overrides="{ paddingSmall: '0 3px', paddingMedium: '0 6px' }"
|
||||||
clearable
|
clearable
|
||||||
@clear="onClearFilter"
|
@clear="onClearFilter"
|
||||||
@input="onInput"
|
@input="onInput"
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
<script setup>
|
<script setup>
|
||||||
import { computed, reactive, watch } from 'vue'
|
import { computed, reactive, watchEffect } from 'vue'
|
||||||
import { types } from '@/consts/support_redis_type.js'
|
import { types } from '@/consts/support_redis_type.js'
|
||||||
import useDialog from 'stores/dialog'
|
import useDialog from 'stores/dialog'
|
||||||
import NewStringValue from '@/components/new_value/NewStringValue.vue'
|
import NewStringValue from '@/components/new_value/NewStringValue.vue'
|
||||||
|
@ -63,10 +63,8 @@ const title = computed(() => {
|
||||||
})
|
})
|
||||||
|
|
||||||
const dialogStore = useDialog()
|
const dialogStore = useDialog()
|
||||||
watch(
|
watchEffect(() => {
|
||||||
() => dialogStore.addFieldsDialogVisible,
|
if (dialogStore.addFieldsDialogVisible) {
|
||||||
(visible) => {
|
|
||||||
if (visible) {
|
|
||||||
const { server, db, key, keyCode, type } = dialogStore.addFieldParam
|
const { server, db, key, keyCode, type } = dialogStore.addFieldParam
|
||||||
newForm.server = server
|
newForm.server = server
|
||||||
newForm.db = db
|
newForm.db = db
|
||||||
|
@ -76,8 +74,7 @@ watch(
|
||||||
newForm.opType = 0
|
newForm.opType = 0
|
||||||
newForm.value = null
|
newForm.value = null
|
||||||
}
|
}
|
||||||
},
|
})
|
||||||
)
|
|
||||||
|
|
||||||
const browserStore = useBrowserStore()
|
const browserStore = useBrowserStore()
|
||||||
const tab = useTabStore()
|
const tab = useTabStore()
|
||||||
|
@ -222,7 +219,7 @@ const onClose = () => {
|
||||||
:is="addValueComponent[newForm.type]"
|
:is="addValueComponent[newForm.type]"
|
||||||
v-model:type="newForm.opType"
|
v-model:type="newForm.opType"
|
||||||
v-model:value="newForm.value" />
|
v-model:value="newForm.value" />
|
||||||
<n-form-item label=" " path="key" required>
|
<n-form-item :show-label="false" path="key" required>
|
||||||
<n-checkbox v-model:checked="newForm.reload">
|
<n-checkbox v-model:checked="newForm.reload">
|
||||||
{{ $t('dialogue.field.reload_when_succ') }}
|
{{ $t('dialogue.field.reload_when_succ') }}
|
||||||
</n-checkbox>
|
</n-checkbox>
|
||||||
|
|
|
@ -289,6 +289,7 @@ const onClose = () => {
|
||||||
v-model:value="generalForm.port"
|
v-model:value="generalForm.port"
|
||||||
:max="65535"
|
:max="65535"
|
||||||
:min="1"
|
:min="1"
|
||||||
|
:show-button="false"
|
||||||
style="width: 200px" />
|
style="width: 200px" />
|
||||||
</n-form-item-gi>
|
</n-form-item-gi>
|
||||||
<n-form-item-gi :label="$t('dialogue.connection.pwd')" :span="12" path="password">
|
<n-form-item-gi :label="$t('dialogue.connection.pwd')" :span="12" path="password">
|
||||||
|
@ -336,7 +337,12 @@ const onClose = () => {
|
||||||
:label="$t('dialogue.connection.advn.conn_timeout')"
|
:label="$t('dialogue.connection.advn.conn_timeout')"
|
||||||
:span="12"
|
:span="12"
|
||||||
path="connTimeout">
|
path="connTimeout">
|
||||||
<n-input-number v-model:value="generalForm.connTimeout" :max="999999" :min="1">
|
<n-input-number
|
||||||
|
v-model:value="generalForm.connTimeout"
|
||||||
|
:max="999999"
|
||||||
|
:min="1"
|
||||||
|
:show-button="false"
|
||||||
|
style="width: 100%">
|
||||||
<template #suffix>
|
<template #suffix>
|
||||||
{{ $t('common.second') }}
|
{{ $t('common.second') }}
|
||||||
</template>
|
</template>
|
||||||
|
@ -346,7 +352,12 @@ const onClose = () => {
|
||||||
:label="$t('dialogue.connection.advn.exec_timeout')"
|
:label="$t('dialogue.connection.advn.exec_timeout')"
|
||||||
:span="12"
|
:span="12"
|
||||||
path="execTimeout">
|
path="execTimeout">
|
||||||
<n-input-number v-model:value="generalForm.execTimeout" :max="999999" :min="1">
|
<n-input-number
|
||||||
|
v-model:value="generalForm.execTimeout"
|
||||||
|
:max="999999"
|
||||||
|
:min="1"
|
||||||
|
:show-button="false"
|
||||||
|
style="width: 100%">
|
||||||
<template #suffix>
|
<template #suffix>
|
||||||
{{ $t('common.second') }}
|
{{ $t('common.second') }}
|
||||||
</template>
|
</template>
|
||||||
|
@ -363,7 +374,11 @@ const onClose = () => {
|
||||||
</n-radio-group>
|
</n-radio-group>
|
||||||
</n-form-item-gi>
|
</n-form-item-gi>
|
||||||
<n-form-item-gi :label="$t('dialogue.connection.advn.load_size')" :span="12">
|
<n-form-item-gi :label="$t('dialogue.connection.advn.load_size')" :span="12">
|
||||||
<n-input-number v-model:value="generalForm.loadSize" :min="0" />
|
<n-input-number
|
||||||
|
v-model:value="generalForm.loadSize"
|
||||||
|
:min="0"
|
||||||
|
:show-button="false"
|
||||||
|
style="width: 100%" />
|
||||||
</n-form-item-gi>
|
</n-form-item-gi>
|
||||||
<n-form-item-gi :label="$t('dialogue.connection.advn.dbfilter_type')" :span="24">
|
<n-form-item-gi :label="$t('dialogue.connection.advn.dbfilter_type')" :span="24">
|
||||||
<n-radio-group
|
<n-radio-group
|
||||||
|
@ -470,6 +485,7 @@ const onClose = () => {
|
||||||
v-model:value="generalForm.ssh.port"
|
v-model:value="generalForm.ssh.port"
|
||||||
:max="65535"
|
:max="65535"
|
||||||
:min="1"
|
:min="1"
|
||||||
|
:show-button="false"
|
||||||
style="width: 200px" />
|
style="width: 200px" />
|
||||||
</n-form-item>
|
</n-form-item>
|
||||||
<n-form-item :label="$t('dialogue.connection.ssh.login_type')">
|
<n-form-item :label="$t('dialogue.connection.ssh.login_type')">
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
<script setup>
|
<script setup>
|
||||||
import { computed, nextTick, reactive, ref, watch } from 'vue'
|
import { computed, nextTick, reactive, ref, watchEffect } from 'vue'
|
||||||
import useDialog from 'stores/dialog'
|
import useDialog from 'stores/dialog'
|
||||||
import { useI18n } from 'vue-i18n'
|
import { useI18n } from 'vue-i18n'
|
||||||
import { isEmpty, map, size } from 'lodash'
|
import { isEmpty, map, size } from 'lodash'
|
||||||
|
@ -18,10 +18,9 @@ const deleteForm = reactive({
|
||||||
|
|
||||||
const dialogStore = useDialog()
|
const dialogStore = useDialog()
|
||||||
const browserStore = useBrowserStore()
|
const browserStore = useBrowserStore()
|
||||||
watch(
|
|
||||||
() => dialogStore.deleteKeyDialogVisible,
|
watchEffect(() => {
|
||||||
(visible) => {
|
if (dialogStore.deleteKeyDialogVisible) {
|
||||||
if (visible) {
|
|
||||||
const { server, db, key } = dialogStore.deleteKeyParam
|
const { server, db, key } = dialogStore.deleteKeyParam
|
||||||
deleteForm.server = server
|
deleteForm.server = server
|
||||||
deleteForm.db = db
|
deleteForm.db = db
|
||||||
|
@ -38,8 +37,7 @@ watch(
|
||||||
deleteForm.affectedKeys = []
|
deleteForm.affectedKeys = []
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
})
|
||||||
)
|
|
||||||
|
|
||||||
const loading = ref(false)
|
const loading = ref(false)
|
||||||
const deleting = ref(false)
|
const deleting = ref(false)
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
<script setup>
|
<script setup>
|
||||||
import { reactive, ref, watch } from 'vue'
|
import { reactive, ref, watchEffect } from 'vue'
|
||||||
import useDialog from 'stores/dialog'
|
import useDialog from 'stores/dialog'
|
||||||
import { useI18n } from 'vue-i18n'
|
import { useI18n } from 'vue-i18n'
|
||||||
import useBrowserStore from 'stores/browser.js'
|
import useBrowserStore from 'stores/browser.js'
|
||||||
|
@ -14,10 +14,9 @@ const flushForm = reactive({
|
||||||
|
|
||||||
const dialogStore = useDialog()
|
const dialogStore = useDialog()
|
||||||
const browserStore = useBrowserStore()
|
const browserStore = useBrowserStore()
|
||||||
watch(
|
|
||||||
() => dialogStore.flushDBDialogVisible,
|
watchEffect(() => {
|
||||||
(visible) => {
|
if (dialogStore.flushDBDialogVisible) {
|
||||||
if (visible) {
|
|
||||||
const { server, db } = dialogStore.flushDBParam
|
const { server, db } = dialogStore.flushDBParam
|
||||||
flushForm.server = server
|
flushForm.server = server
|
||||||
flushForm.db = db
|
flushForm.db = db
|
||||||
|
@ -25,8 +24,7 @@ watch(
|
||||||
flushForm.confirm = false
|
flushForm.confirm = false
|
||||||
loading.value = false
|
loading.value = false
|
||||||
}
|
}
|
||||||
},
|
})
|
||||||
)
|
|
||||||
|
|
||||||
const loading = ref(false)
|
const loading = ref(false)
|
||||||
const i18n = useI18n()
|
const i18n = useI18n()
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
<script setup>
|
<script setup>
|
||||||
import { computed, reactive, ref, watch } from 'vue'
|
import { computed, reactive, ref, watchEffect } from 'vue'
|
||||||
import useDialog from 'stores/dialog'
|
import useDialog from 'stores/dialog'
|
||||||
import { useI18n } from 'vue-i18n'
|
import { useI18n } from 'vue-i18n'
|
||||||
import useConnectionStore from 'stores/connections.js'
|
import useConnectionStore from 'stores/connections.js'
|
||||||
|
@ -36,14 +36,11 @@ const isRenameMode = computed(() => !isEmpty(editGroup.value))
|
||||||
|
|
||||||
const dialogStore = useDialog()
|
const dialogStore = useDialog()
|
||||||
const connectionStore = useConnectionStore()
|
const connectionStore = useConnectionStore()
|
||||||
watch(
|
watchEffect(() => {
|
||||||
() => dialogStore.groupDialogVisible,
|
if (dialogStore.groupDialogVisible) {
|
||||||
(visible) => {
|
|
||||||
if (visible) {
|
|
||||||
groupForm.name = editGroup.value = dialogStore.editGroup
|
groupForm.name = editGroup.value = dialogStore.editGroup
|
||||||
}
|
}
|
||||||
},
|
})
|
||||||
)
|
|
||||||
|
|
||||||
const i18n = useI18n()
|
const i18n = useI18n()
|
||||||
const onConfirm = async () => {
|
const onConfirm = async () => {
|
||||||
|
|
|
@ -10,6 +10,7 @@ const importKeyForm = reactive({
|
||||||
server: '',
|
server: '',
|
||||||
db: 0,
|
db: 0,
|
||||||
expire: true,
|
expire: true,
|
||||||
|
reload: true,
|
||||||
file: '',
|
file: '',
|
||||||
type: 0,
|
type: 0,
|
||||||
conflict: 0,
|
conflict: 0,
|
||||||
|
@ -25,6 +26,7 @@ watchEffect(() => {
|
||||||
importKeyForm.server = server
|
importKeyForm.server = server
|
||||||
importKeyForm.db = db
|
importKeyForm.db = db
|
||||||
importKeyForm.expire = true
|
importKeyForm.expire = true
|
||||||
|
importKeyForm.reload = true
|
||||||
importKeyForm.file = ''
|
importKeyForm.file = ''
|
||||||
importKeyForm.type = 0
|
importKeyForm.type = 0
|
||||||
importKeyForm.conflict = 0
|
importKeyForm.conflict = 0
|
||||||
|
@ -33,7 +35,7 @@ watchEffect(() => {
|
||||||
})
|
})
|
||||||
|
|
||||||
const i18n = useI18n()
|
const i18n = useI18n()
|
||||||
const conflictOption = [
|
const conflictOption = computed(() => [
|
||||||
{
|
{
|
||||||
value: 0,
|
value: 0,
|
||||||
label: i18n.t('dialogue.import.conflict_overwrite'),
|
label: i18n.t('dialogue.import.conflict_overwrite'),
|
||||||
|
@ -42,7 +44,7 @@ const conflictOption = [
|
||||||
value: 1,
|
value: 1,
|
||||||
label: i18n.t('dialogue.import.conflict_ignore'),
|
label: i18n.t('dialogue.import.conflict_ignore'),
|
||||||
},
|
},
|
||||||
]
|
])
|
||||||
|
|
||||||
const importEnable = computed(() => {
|
const importEnable = computed(() => {
|
||||||
return !isEmpty(importKeyForm.file)
|
return !isEmpty(importKeyForm.file)
|
||||||
|
@ -51,8 +53,8 @@ const importEnable = computed(() => {
|
||||||
const onConfirmImport = async () => {
|
const onConfirmImport = async () => {
|
||||||
try {
|
try {
|
||||||
importing.value = true
|
importing.value = true
|
||||||
const { server, db, file, conflict, expire } = importKeyForm
|
const { server, db, file, conflict, expire, reload } = importKeyForm
|
||||||
browserStore.importKeysFromCSVFile(server, db, file, conflict, expire).catch((e) => {})
|
browserStore.importKeysFromCSVFile(server, db, file, conflict, expire, reload).catch((e) => {})
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
$message.error(e.message)
|
$message.error(e.message)
|
||||||
return
|
return
|
||||||
|
@ -93,11 +95,6 @@ const onClose = () => {
|
||||||
:placeholder="$t('dialogue.import.open_csv_file_tip')"
|
:placeholder="$t('dialogue.import.open_csv_file_tip')"
|
||||||
ext="csv" />
|
ext="csv" />
|
||||||
</n-form-item>
|
</n-form-item>
|
||||||
<n-form-item :label="$t('dialogue.import.import_expire_title')">
|
|
||||||
<n-checkbox v-model:checked="importKeyForm.expire" :autofocus="false">
|
|
||||||
{{ $t('dialogue.import.import_expire') }}
|
|
||||||
</n-checkbox>
|
|
||||||
</n-form-item>
|
|
||||||
<n-form-item :label="$t('dialogue.import.conflict_handle')">
|
<n-form-item :label="$t('dialogue.import.conflict_handle')">
|
||||||
<n-radio-group v-model:value="importKeyForm.conflict">
|
<n-radio-group v-model:value="importKeyForm.conflict">
|
||||||
<n-radio-button
|
<n-radio-button
|
||||||
|
@ -107,6 +104,16 @@ const onClose = () => {
|
||||||
:value="op.value" />
|
:value="op.value" />
|
||||||
</n-radio-group>
|
</n-radio-group>
|
||||||
</n-form-item>
|
</n-form-item>
|
||||||
|
<n-form-item :label="$t('dialogue.import.import_expire_title')" :show-label="false">
|
||||||
|
<n-space :wrap-item="false">
|
||||||
|
<n-checkbox v-model:checked="importKeyForm.expire" :autofocus="false">
|
||||||
|
{{ $t('dialogue.import.import_expire') }}
|
||||||
|
</n-checkbox>
|
||||||
|
<n-checkbox v-model:checked="importKeyForm.reload" :autofocus="false">
|
||||||
|
{{ $t('dialogue.import.reload') }}
|
||||||
|
</n-checkbox>
|
||||||
|
</n-space>
|
||||||
|
</n-form-item>
|
||||||
</n-form>
|
</n-form>
|
||||||
</n-spin>
|
</n-spin>
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
<script setup>
|
<script setup>
|
||||||
import { computed, reactive, ref, watch } from 'vue'
|
import { computed, reactive, ref, watchEffect } from 'vue'
|
||||||
import useDialog from 'stores/dialog'
|
import useDialog from 'stores/dialog'
|
||||||
import { useI18n } from 'vue-i18n'
|
import { useI18n } from 'vue-i18n'
|
||||||
import { types } from '@/consts/support_redis_type.js'
|
import { types } from '@/consts/support_redis_type.js'
|
||||||
|
@ -26,18 +26,16 @@ const typeOptions = computed(() => {
|
||||||
})
|
})
|
||||||
|
|
||||||
const dialogStore = useDialog()
|
const dialogStore = useDialog()
|
||||||
watch(
|
|
||||||
() => dialogStore.keyFilterDialogVisible,
|
watchEffect(() => {
|
||||||
(visible) => {
|
if (dialogStore.keyFilterDialogVisible) {
|
||||||
if (visible) {
|
|
||||||
const { server, db, type, pattern } = dialogStore.keyFilterParam
|
const { server, db, type, pattern } = dialogStore.keyFilterParam
|
||||||
filterForm.server = server
|
filterForm.server = server
|
||||||
filterForm.db = db || 0
|
filterForm.db = db || 0
|
||||||
filterForm.type = type || ''
|
filterForm.type = type || ''
|
||||||
filterForm.pattern = pattern || '*'
|
filterForm.pattern = pattern || '*'
|
||||||
}
|
}
|
||||||
},
|
})
|
||||||
)
|
|
||||||
|
|
||||||
const browserStore = useBrowserStore()
|
const browserStore = useBrowserStore()
|
||||||
const onConfirm = () => {}
|
const onConfirm = () => {}
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
<script setup>
|
<script setup>
|
||||||
import { computed, h, nextTick, reactive, ref, watch } from 'vue'
|
import { computed, h, nextTick, reactive, ref, watchEffect } from 'vue'
|
||||||
import { types, typesColor } from '@/consts/support_redis_type.js'
|
import { types, typesColor } from '@/consts/support_redis_type.js'
|
||||||
import useDialog from 'stores/dialog'
|
import useDialog from 'stores/dialog'
|
||||||
import { endsWith, get, isEmpty, keys, map, trim } from 'lodash'
|
import { endsWith, get, isEmpty, keys, map, trim } from 'lodash'
|
||||||
|
@ -64,10 +64,8 @@ const defaultValue = {
|
||||||
}
|
}
|
||||||
|
|
||||||
const dialogStore = useDialog()
|
const dialogStore = useDialog()
|
||||||
watch(
|
watchEffect(() => {
|
||||||
() => dialogStore.newKeyDialogVisible,
|
if (dialogStore.newKeyDialogVisible) {
|
||||||
(visible) => {
|
|
||||||
if (visible) {
|
|
||||||
const { prefix, server, db } = dialogStore.newKeyParam
|
const { prefix, server, db } = dialogStore.newKeyParam
|
||||||
const separator = browserStore.getSeparator(server)
|
const separator = browserStore.getSeparator(server)
|
||||||
newForm.server = server
|
newForm.server = server
|
||||||
|
@ -85,8 +83,7 @@ watch(
|
||||||
newForm.ttl = -1
|
newForm.ttl = -1
|
||||||
newForm.value = null
|
newForm.value = null
|
||||||
}
|
}
|
||||||
},
|
})
|
||||||
)
|
|
||||||
|
|
||||||
const renderTypeLabel = (option) => {
|
const renderTypeLabel = (option) => {
|
||||||
return h(
|
return h(
|
||||||
|
@ -210,6 +207,7 @@ const onClose = () => {
|
||||||
v-model:value="newForm.ttl"
|
v-model:value="newForm.ttl"
|
||||||
:max="Number.MAX_SAFE_INTEGER"
|
:max="Number.MAX_SAFE_INTEGER"
|
||||||
:min="-1"
|
:min="-1"
|
||||||
|
:show-button="false"
|
||||||
placeholder="TTL">
|
placeholder="TTL">
|
||||||
<template #suffix>
|
<template #suffix>
|
||||||
{{ $t('common.second') }}
|
{{ $t('common.second') }}
|
||||||
|
|
|
@ -101,7 +101,11 @@ const onClose = () => {
|
||||||
<n-input-number v-model:value="prefStore.general.fontSize" :max="65535" :min="1" />
|
<n-input-number v-model:value="prefStore.general.fontSize" :max="65535" :min="1" />
|
||||||
</n-form-item-gi>
|
</n-form-item-gi>
|
||||||
<n-form-item-gi :label="$t('preferences.general.scan_size')" :span="12">
|
<n-form-item-gi :label="$t('preferences.general.scan_size')" :span="12">
|
||||||
<n-input-number v-model:value="prefStore.general.scanSize" :min="1" />
|
<n-input-number
|
||||||
|
v-model:value="prefStore.general.scanSize"
|
||||||
|
:min="1"
|
||||||
|
:show-button="false"
|
||||||
|
style="width: 100%" />
|
||||||
</n-form-item-gi>
|
</n-form-item-gi>
|
||||||
<n-form-item-gi :label="$t('preferences.general.key_icon_style')" :span="12">
|
<n-form-item-gi :label="$t('preferences.general.key_icon_style')" :span="12">
|
||||||
<n-select v-model:value="prefStore.general.keyIconStyle" :options="keyOptions" />
|
<n-select v-model:value="prefStore.general.keyIconStyle" :options="keyOptions" />
|
||||||
|
@ -128,13 +132,13 @@ const onClose = () => {
|
||||||
<n-tab-pane :tab="$t('preferences.editor.name')" display-directive="show" name="editor">
|
<n-tab-pane :tab="$t('preferences.editor.name')" display-directive="show" name="editor">
|
||||||
<n-form :disabled="loading" :model="prefStore.editor" :show-require-mark="false" label-placement="top">
|
<n-form :disabled="loading" :model="prefStore.editor" :show-require-mark="false" label-placement="top">
|
||||||
<n-grid :x-gap="10">
|
<n-grid :x-gap="10">
|
||||||
<n-form-item-gi :label="$t('preferences.general.font')" :span="24" required>
|
<n-form-item-gi :label="$t('preferences.general.font')" :span="12" required>
|
||||||
<n-select
|
<n-select
|
||||||
v-model:value="prefStore.editor.font"
|
v-model:value="prefStore.editor.font"
|
||||||
:options="prefStore.fontOption"
|
:options="prefStore.fontOption"
|
||||||
filterable />
|
filterable />
|
||||||
</n-form-item-gi>
|
</n-form-item-gi>
|
||||||
<n-form-item-gi :label="$t('preferences.general.font_size')" :show-feedback="false" :span="24">
|
<n-form-item-gi :label="$t('preferences.general.font_size')" :show-feedback="false" :span="12">
|
||||||
<n-input-number v-model:value="prefStore.editor.fontSize" :max="65535" :min="1" />
|
<n-input-number v-model:value="prefStore.editor.fontSize" :max="65535" :min="1" />
|
||||||
</n-form-item-gi>
|
</n-form-item-gi>
|
||||||
<n-form-item-gi :show-feedback="false" :span="24">
|
<n-form-item-gi :show-feedback="false" :span="24">
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
<script setup>
|
<script setup>
|
||||||
import { reactive, watch } from 'vue'
|
import { reactive, watchEffect } from 'vue'
|
||||||
import useDialog from 'stores/dialog'
|
import useDialog from 'stores/dialog'
|
||||||
import { useI18n } from 'vue-i18n'
|
import { useI18n } from 'vue-i18n'
|
||||||
import useBrowserStore from 'stores/browser.js'
|
import useBrowserStore from 'stores/browser.js'
|
||||||
|
@ -15,18 +15,16 @@ const renameForm = reactive({
|
||||||
const dialogStore = useDialog()
|
const dialogStore = useDialog()
|
||||||
const browserStore = useBrowserStore()
|
const browserStore = useBrowserStore()
|
||||||
const tab = useTabStore()
|
const tab = useTabStore()
|
||||||
watch(
|
|
||||||
() => dialogStore.renameDialogVisible,
|
watchEffect(() => {
|
||||||
(visible) => {
|
if (dialogStore.renameDialogVisible) {
|
||||||
if (visible) {
|
|
||||||
const { server, db, key } = dialogStore.renameKeyParam
|
const { server, db, key } = dialogStore.renameKeyParam
|
||||||
renameForm.server = server
|
renameForm.server = server
|
||||||
renameForm.db = db
|
renameForm.db = db
|
||||||
renameForm.key = key
|
renameForm.key = key
|
||||||
renameForm.newKey = key
|
renameForm.newKey = key
|
||||||
}
|
}
|
||||||
},
|
})
|
||||||
)
|
|
||||||
|
|
||||||
const i18n = useI18n()
|
const i18n = useI18n()
|
||||||
const onRename = async () => {
|
const onRename = async () => {
|
||||||
|
@ -57,9 +55,9 @@ const onClose = () => {
|
||||||
:closable="false"
|
:closable="false"
|
||||||
:close-on-esc="false"
|
:close-on-esc="false"
|
||||||
:mask-closable="false"
|
:mask-closable="false"
|
||||||
:negative-button-props="{ size: 'medium' }"
|
:negative-button-props="{ focusable: false, size: 'medium' }"
|
||||||
:negative-text="$t('common.cancel')"
|
:negative-text="$t('common.cancel')"
|
||||||
:positive-button-props="{ size: 'medium' }"
|
:positive-button-props="{ focusable: false, size: 'medium' }"
|
||||||
:positive-text="$t('common.confirm')"
|
:positive-text="$t('common.confirm')"
|
||||||
:show-icon="false"
|
:show-icon="false"
|
||||||
:title="$t('interface.rename_key')"
|
:title="$t('interface.rename_key')"
|
||||||
|
|
|
@ -1,10 +1,11 @@
|
||||||
<script setup>
|
<script setup>
|
||||||
import { reactive, watch } from 'vue'
|
import { computed, reactive, watchEffect } from 'vue'
|
||||||
import useDialog from 'stores/dialog'
|
import useDialog from 'stores/dialog'
|
||||||
import useTabStore from 'stores/tab.js'
|
import useTabStore from 'stores/tab.js'
|
||||||
import Binary from '@/components/icons/Binary.vue'
|
import Binary from '@/components/icons/Binary.vue'
|
||||||
import { isEmpty } from 'lodash'
|
import { isEmpty } from 'lodash'
|
||||||
import useBrowserStore from 'stores/browser.js'
|
import useBrowserStore from 'stores/browser.js'
|
||||||
|
import { useI18n } from 'vue-i18n'
|
||||||
|
|
||||||
const ttlForm = reactive({
|
const ttlForm = reactive({
|
||||||
server: '',
|
server: '',
|
||||||
|
@ -12,16 +13,15 @@ const ttlForm = reactive({
|
||||||
key: '',
|
key: '',
|
||||||
keyCode: null,
|
keyCode: null,
|
||||||
ttl: -1,
|
ttl: -1,
|
||||||
|
unit: 1,
|
||||||
})
|
})
|
||||||
|
|
||||||
const dialogStore = useDialog()
|
const dialogStore = useDialog()
|
||||||
const browserStore = useBrowserStore()
|
const browserStore = useBrowserStore()
|
||||||
const tabStore = useTabStore()
|
const tabStore = useTabStore()
|
||||||
|
|
||||||
watch(
|
watchEffect(() => {
|
||||||
() => dialogStore.ttlDialogVisible,
|
if (dialogStore.ttlDialogVisible) {
|
||||||
(visible) => {
|
|
||||||
if (visible) {
|
|
||||||
// get ttl from current tab
|
// get ttl from current tab
|
||||||
const tab = tabStore.currentTab
|
const tab = tabStore.currentTab
|
||||||
if (tab != null) {
|
if (tab != null) {
|
||||||
|
@ -29,6 +29,7 @@ watch(
|
||||||
ttlForm.db = tab.db
|
ttlForm.db = tab.db
|
||||||
ttlForm.key = tab.key
|
ttlForm.key = tab.key
|
||||||
ttlForm.keyCode = tab.keyCode
|
ttlForm.keyCode = tab.keyCode
|
||||||
|
ttlForm.unit = 1
|
||||||
if (tab.ttl < 0) {
|
if (tab.ttl < 0) {
|
||||||
// forever
|
// forever
|
||||||
ttlForm.ttl = -1
|
ttlForm.ttl = -1
|
||||||
|
@ -37,8 +38,37 @@ watch(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
const i18n = useI18n()
|
||||||
|
const unit = computed(() => [
|
||||||
|
{ value: 1, label: i18n.t('common.second') },
|
||||||
|
{
|
||||||
|
value: 60,
|
||||||
|
label: i18n.t('common.minute'),
|
||||||
},
|
},
|
||||||
)
|
{
|
||||||
|
value: 3600,
|
||||||
|
label: i18n.t('common.hour'),
|
||||||
|
},
|
||||||
|
{
|
||||||
|
value: 86400,
|
||||||
|
label: i18n.t('common.day'),
|
||||||
|
},
|
||||||
|
])
|
||||||
|
|
||||||
|
const quickOption = computed(() => [
|
||||||
|
{ value: -1, unit: 1, label: i18n.t('interface.forever') },
|
||||||
|
{ value: 10, unit: 1, label: `10 ${i18n.t('common.second')}` },
|
||||||
|
{ value: 1, unit: 60, label: `1 ${i18n.t('common.minute')}` },
|
||||||
|
{ value: 1, unit: 3600, label: `1 ${i18n.t('common.hour')}` },
|
||||||
|
{ value: 1, unit: 86400, label: `1 ${i18n.t('common.day')}` },
|
||||||
|
])
|
||||||
|
|
||||||
|
const onQuickSet = (opt) => {
|
||||||
|
ttlForm.ttl = opt.value
|
||||||
|
ttlForm.unit = opt.unit
|
||||||
|
}
|
||||||
|
|
||||||
const onClose = () => {
|
const onClose = () => {
|
||||||
dialogStore.closeTTLDialog()
|
dialogStore.closeTTLDialog()
|
||||||
|
@ -51,13 +81,14 @@ const onConfirm = async () => {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
const key = isEmpty(ttlForm.keyCode) ? ttlForm.key : ttlForm.keyCode
|
const key = isEmpty(ttlForm.keyCode) ? ttlForm.key : ttlForm.keyCode
|
||||||
const success = await browserStore.setTTL(tab.name, tab.db, key, ttlForm.ttl)
|
const ttl = ttlForm.ttl * (ttlForm.unit || 1)
|
||||||
|
const success = await browserStore.setTTL(tab.name, tab.db, key, ttl)
|
||||||
if (success) {
|
if (success) {
|
||||||
tabStore.updateTTL({
|
tabStore.updateTTL({
|
||||||
server: ttlForm.server,
|
server: ttlForm.server,
|
||||||
db: ttlForm.db,
|
db: ttlForm.db,
|
||||||
key: ttlForm.key,
|
key: ttlForm.key,
|
||||||
ttl: ttlForm.ttl,
|
ttl: ttl,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
|
@ -74,6 +105,12 @@ const onConfirm = async () => {
|
||||||
:closable="false"
|
:closable="false"
|
||||||
:close-on-esc="false"
|
:close-on-esc="false"
|
||||||
:mask-closable="false"
|
:mask-closable="false"
|
||||||
|
:negative-button-props="{ focusable: false, size: 'medium' }"
|
||||||
|
:negative-text="$t('common.cancel')"
|
||||||
|
:on-negative-click="onClose"
|
||||||
|
:on-positive-click="onConfirm"
|
||||||
|
:positive-button-props="{ focusable: false, size: 'medium' }"
|
||||||
|
:positive-text="$t('common.save')"
|
||||||
:show-icon="false"
|
:show-icon="false"
|
||||||
:title="$t('dialogue.ttl.title')"
|
:title="$t('dialogue.ttl.title')"
|
||||||
preset="dialog"
|
preset="dialog"
|
||||||
|
@ -87,27 +124,30 @@ const onConfirm = async () => {
|
||||||
</n-input>
|
</n-input>
|
||||||
</n-form-item>
|
</n-form-item>
|
||||||
<n-form-item :label="$t('interface.ttl')" required>
|
<n-form-item :label="$t('interface.ttl')" required>
|
||||||
|
<n-input-group>
|
||||||
<n-input-number
|
<n-input-number
|
||||||
v-model:value="ttlForm.ttl"
|
v-model:value="ttlForm.ttl"
|
||||||
:max="Number.MAX_SAFE_INTEGER"
|
:max="Number.MAX_SAFE_INTEGER"
|
||||||
:min="-1"
|
:min="-1"
|
||||||
style="width: 100%">
|
:show-button="false"
|
||||||
<template #suffix>
|
class="flex-item-expand" />
|
||||||
{{ $t('common.second') }}
|
<n-select v-model:value="ttlForm.unit" :options="unit" style="max-width: 150px" />
|
||||||
</template>
|
</n-input-group>
|
||||||
</n-input-number>
|
</n-form-item>
|
||||||
|
<n-form-item :label="$t('dialogue.ttl.quick_set')" :show-feedback="false">
|
||||||
|
<n-space :wrap="true" :wrap-item="false">
|
||||||
|
<n-button
|
||||||
|
v-for="(opt, i) in quickOption"
|
||||||
|
:key="i"
|
||||||
|
round
|
||||||
|
secondary
|
||||||
|
size="small"
|
||||||
|
@click="onQuickSet(opt)">
|
||||||
|
{{ opt.label }}
|
||||||
|
</n-button>
|
||||||
|
</n-space>
|
||||||
</n-form-item>
|
</n-form-item>
|
||||||
</n-form>
|
</n-form>
|
||||||
|
|
||||||
<template #action>
|
|
||||||
<div class="flex-item-expand">
|
|
||||||
<n-button :focusable="false" @click="ttlForm.ttl = -1">{{ $t('dialogue.key.persist_key') }}</n-button>
|
|
||||||
</div>
|
|
||||||
<div class="flex-item n-dialog__action">
|
|
||||||
<n-button :focusable="false" @click="onClose">{{ $t('common.cancel') }}</n-button>
|
|
||||||
<n-button :focusable="false" type="primary" @click="onConfirm">{{ $t('common.save') }}</n-button>
|
|
||||||
</div>
|
|
||||||
</template>
|
|
||||||
</n-modal>
|
</n-modal>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
|
|
|
@ -72,6 +72,7 @@ const onUpdate = () => {
|
||||||
<n-input-number
|
<n-input-number
|
||||||
v-model:value="value.score"
|
v-model:value="value.score"
|
||||||
:placeholder="$t('dialogue.field.enter_score')"
|
:placeholder="$t('dialogue.field.enter_score')"
|
||||||
|
:show-button="false"
|
||||||
@update:value="onUpdate" />
|
@update:value="onUpdate" />
|
||||||
</template>
|
</template>
|
||||||
<template #action="{ index, create, remove, move }">
|
<template #action="{ index, create, remove, move }">
|
||||||
|
|
|
@ -52,6 +52,7 @@ defineExpose({
|
||||||
<n-input-number
|
<n-input-number
|
||||||
v-model:value="value.score"
|
v-model:value="value.score"
|
||||||
:placeholder="$t('dialogue.field.enter_score')"
|
:placeholder="$t('dialogue.field.enter_score')"
|
||||||
|
:show-button="false"
|
||||||
@update:value="onUpdate" />
|
@update:value="onUpdate" />
|
||||||
</template>
|
</template>
|
||||||
<template #action="{ index, create, remove, move }">
|
<template #action="{ index, create, remove, move }">
|
||||||
|
|
|
@ -3,7 +3,7 @@ import { useThemeVars } from 'naive-ui'
|
||||||
import BrowserTree from './BrowserTree.vue'
|
import BrowserTree from './BrowserTree.vue'
|
||||||
import IconButton from '@/components/common/IconButton.vue'
|
import IconButton from '@/components/common/IconButton.vue'
|
||||||
import useTabStore from 'stores/tab.js'
|
import useTabStore from 'stores/tab.js'
|
||||||
import { computed, nextTick, onMounted, reactive, ref, unref } from 'vue'
|
import { computed, nextTick, onMounted, reactive, ref, unref, watch } from 'vue'
|
||||||
import { find, get, map, size } from 'lodash'
|
import { find, get, map, size } from 'lodash'
|
||||||
import Refresh from '@/components/icons/Refresh.vue'
|
import Refresh from '@/components/icons/Refresh.vue'
|
||||||
import useDialogStore from 'stores/dialog.js'
|
import useDialogStore from 'stores/dialog.js'
|
||||||
|
@ -238,6 +238,11 @@ const onSelectOptions = (select) => {
|
||||||
}
|
}
|
||||||
|
|
||||||
onMounted(() => onReload())
|
onMounted(() => onReload())
|
||||||
|
|
||||||
|
watch(
|
||||||
|
() => browserStore.getReloadKey(props.server),
|
||||||
|
(key) => onReload(),
|
||||||
|
)
|
||||||
// forbid dynamic switch key view due to performance issues
|
// forbid dynamic switch key view due to performance issues
|
||||||
// const viewType = ref(0)
|
// const viewType = ref(0)
|
||||||
// const onSwitchView = (selectView) => {
|
// const onSwitchView = (selectView) => {
|
||||||
|
@ -284,6 +289,7 @@ onMounted(() => onReload())
|
||||||
:options="addOptions"
|
:options="addOptions"
|
||||||
placement="bottom-end"
|
placement="bottom-end"
|
||||||
style="min-width: 130px"
|
style="min-width: 130px"
|
||||||
|
trigger="click"
|
||||||
@select="onSelectOptions">
|
@select="onSelectOptions">
|
||||||
<n-button :focusable="false" size="small" style="padding: 0 3px">
|
<n-button :focusable="false" size="small" style="padding: 0 3px">
|
||||||
<n-icon size="10">
|
<n-icon size="10">
|
||||||
|
|
|
@ -367,13 +367,7 @@ const renderPrefix = ({ option }) => {
|
||||||
|
|
||||||
case ConnectionType.RedisValue:
|
case ConnectionType.RedisValue:
|
||||||
if (prefStore.keyIconType === typesIconStyle.ICON) {
|
if (prefStore.keyIconType === typesIconStyle.ICON) {
|
||||||
return h(
|
return h(NIcon, { size: 20 }, () => h(Key))
|
||||||
NIcon,
|
|
||||||
{ size: 20 },
|
|
||||||
{
|
|
||||||
default: () => h(!!option.redisKeyCode ? Binary : Key),
|
|
||||||
},
|
|
||||||
)
|
|
||||||
}
|
}
|
||||||
const loading = isEmpty(option.redisType) || option.redisType === 'loading'
|
const loading = isEmpty(option.redisType) || option.redisType === 'loading'
|
||||||
if (loading) {
|
if (loading) {
|
||||||
|
@ -506,10 +500,8 @@ const calcValueMenu = () => {
|
||||||
|
|
||||||
// render menu function icon
|
// render menu function icon
|
||||||
const renderSuffix = ({ option }) => {
|
const renderSuffix = ({ option }) => {
|
||||||
if (
|
const selected = includes(selectedKeys.value, option.key)
|
||||||
(option.type === ConnectionType.RedisDB && option.opened) ||
|
if (selected && !props.checkMode) {
|
||||||
(includes(selectedKeys.value, option.key) && !props.checkMode)
|
|
||||||
) {
|
|
||||||
switch (option.type) {
|
switch (option.type) {
|
||||||
case ConnectionType.RedisDB:
|
case ConnectionType.RedisDB:
|
||||||
return renderIconMenu(calcDBMenu(option.opened, option.loading, option.fullLoaded))
|
return renderIconMenu(calcDBMenu(option.opened, option.loading, option.fullLoaded))
|
||||||
|
@ -518,6 +510,9 @@ const renderSuffix = ({ option }) => {
|
||||||
case ConnectionType.RedisValue:
|
case ConnectionType.RedisValue:
|
||||||
return renderIconMenu(calcValueMenu())
|
return renderIconMenu(calcValueMenu())
|
||||||
}
|
}
|
||||||
|
} else if (!selected && !!option.redisKeyCode && option.type === ConnectionType.RedisValue) {
|
||||||
|
// render binary icon
|
||||||
|
return renderIconMenu(h(NIcon, { size: 20 }, () => h(Binary)))
|
||||||
}
|
}
|
||||||
return null
|
return null
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,6 +10,9 @@
|
||||||
"update": "Update",
|
"update": "Update",
|
||||||
"none": "None",
|
"none": "None",
|
||||||
"second": "Second(s)",
|
"second": "Second(s)",
|
||||||
|
"minute": "Minutes(s)",
|
||||||
|
"hour": "Hour(s)",
|
||||||
|
"day": "Day(s)",
|
||||||
"unit_day": "D",
|
"unit_day": "D",
|
||||||
"unit_hour": "H",
|
"unit_hour": "H",
|
||||||
"unit_minute": "M",
|
"unit_minute": "M",
|
||||||
|
@ -274,6 +277,8 @@
|
||||||
},
|
},
|
||||||
"export": {
|
"export": {
|
||||||
"name": "Export Data",
|
"name": "Export Data",
|
||||||
|
"export_expire_title": "Expiration",
|
||||||
|
"export_expire": "Include Expiration Time",
|
||||||
"export": "Export",
|
"export": "Export",
|
||||||
"save_file": "Export Path",
|
"save_file": "Export Path",
|
||||||
"save_file_tip": "Select the path to save exported file",
|
"save_file_tip": "Select the path to save exported file",
|
||||||
|
@ -282,19 +287,21 @@
|
||||||
},
|
},
|
||||||
"import": {
|
"import": {
|
||||||
"name": "Import Data",
|
"name": "Import Data",
|
||||||
"export_expire_title": "Expiration",
|
"import_expire_title": "Expiration",
|
||||||
"export_expire": "Export Expiration Time",
|
"import_expire": "Import Expiration Time",
|
||||||
"import": "Import",
|
"import": "Import",
|
||||||
|
"reload": "Reload Keys After Imported",
|
||||||
"open_csv_file": "Import File",
|
"open_csv_file": "Import File",
|
||||||
"open_csv_file_tip": "Select the file for import",
|
"open_csv_file_tip": "Select the file for import",
|
||||||
"conflict_handle": "Handle Key Conflict",
|
"conflict_handle": "Key Conflict Resolution",
|
||||||
"conflict_overwrite": "Overwrite",
|
"conflict_overwrite": "Overwrite",
|
||||||
"conflict_ignore": "Ignore",
|
"conflict_ignore": "Ignore",
|
||||||
"importing": "Importing Keys imported/overwrite:{imported} conflict/fail:{conflict}",
|
"importing": "Importing Keys imported/overwrite:{imported} conflict/fail:{conflict}",
|
||||||
"import_completed": "Import completed, {success} successes, {ignored} failed"
|
"import_completed": "Import completed, {success} successes, {ignored} failed"
|
||||||
},
|
},
|
||||||
"ttl": {
|
"ttl": {
|
||||||
"title": "Set Key TTL"
|
"title": "Set Key TTL",
|
||||||
|
"quick_set": "Quick Settings"
|
||||||
},
|
},
|
||||||
"upgrade": {
|
"upgrade": {
|
||||||
"title": "New Version Available",
|
"title": "New Version Available",
|
||||||
|
|
|
@ -10,6 +10,9 @@
|
||||||
"update": "更新",
|
"update": "更新",
|
||||||
"none": "无",
|
"none": "无",
|
||||||
"second": "秒",
|
"second": "秒",
|
||||||
|
"minute": "分钟",
|
||||||
|
"hour": "小时",
|
||||||
|
"day": "天",
|
||||||
"unit_day": "天",
|
"unit_day": "天",
|
||||||
"unit_hour": "小时",
|
"unit_hour": "小时",
|
||||||
"unit_minute": "分钟",
|
"unit_minute": "分钟",
|
||||||
|
@ -286,6 +289,7 @@
|
||||||
"name": "导入数据",
|
"name": "导入数据",
|
||||||
"import_expire_title": "过期时间",
|
"import_expire_title": "过期时间",
|
||||||
"import_expire": "包含键过期时间",
|
"import_expire": "包含键过期时间",
|
||||||
|
"reload": "导入完成后重新载入",
|
||||||
"import": "确认导入",
|
"import": "确认导入",
|
||||||
"open_csv_file": "导入文件路径",
|
"open_csv_file": "导入文件路径",
|
||||||
"open_csv_file_tip": "选择需要导入的文件",
|
"open_csv_file_tip": "选择需要导入的文件",
|
||||||
|
@ -296,7 +300,8 @@
|
||||||
"import_completed": "已完成导入操作,成功{success}个,忽略{ignored}个"
|
"import_completed": "已完成导入操作,成功{success}个,忽略{ignored}个"
|
||||||
},
|
},
|
||||||
"ttl": {
|
"ttl": {
|
||||||
"title": "设置键存活时间"
|
"title": "设置键存活时间",
|
||||||
|
"quick_set": "快捷设置"
|
||||||
},
|
},
|
||||||
"upgrade": {
|
"upgrade": {
|
||||||
"title": "有可用新版本",
|
"title": "有可用新版本",
|
||||||
|
|
|
@ -19,6 +19,7 @@ export class RedisServerState {
|
||||||
/**
|
/**
|
||||||
* @param {string} name server name
|
* @param {string} name server name
|
||||||
* @param {number} db current opened database
|
* @param {number} db current opened database
|
||||||
|
* @param {number} reloadKey try to reload when changed
|
||||||
* @param {{}} stats current server status info
|
* @param {{}} stats current server status info
|
||||||
* @param {Object.<number, RedisDatabaseItem>} databases database list
|
* @param {Object.<number, RedisDatabaseItem>} databases database list
|
||||||
* @param {string|null} patternFilter pattern filter
|
* @param {string|null} patternFilter pattern filter
|
||||||
|
@ -40,6 +41,7 @@ export class RedisServerState {
|
||||||
}) {
|
}) {
|
||||||
this.name = name
|
this.name = name
|
||||||
this.db = db
|
this.db = db
|
||||||
|
this.reloadKey = Date.now()
|
||||||
this.stats = stats
|
this.stats = stats
|
||||||
this.databases = databases
|
this.databases = databases
|
||||||
this.patternFilter = patternFilter
|
this.patternFilter = patternFilter
|
||||||
|
@ -83,7 +85,7 @@ export class RedisServerState {
|
||||||
* @param {number} updateVal
|
* @param {number} updateVal
|
||||||
*/
|
*/
|
||||||
updateDBKeyCount(db, updateVal) {
|
updateDBKeyCount(db, updateVal) {
|
||||||
const dbInst = this.databases[this.db]
|
const dbInst = this.databases[db]
|
||||||
if (dbInst != null) {
|
if (dbInst != null) {
|
||||||
dbInst.maxKeys = Math.max(0, dbInst.maxKeys + updateVal)
|
dbInst.maxKeys = Math.max(0, dbInst.maxKeys + updateVal)
|
||||||
}
|
}
|
||||||
|
@ -288,6 +290,11 @@ export class RedisServerState {
|
||||||
// clear all key nodes
|
// clear all key nodes
|
||||||
this.nodeMap.clear()
|
this.nodeMap.clear()
|
||||||
this.getRoot()
|
this.getRoot()
|
||||||
|
const dbInst = this.databases[this.db]
|
||||||
|
if (dbInst != null) {
|
||||||
|
dbInst.maxKeys = 0
|
||||||
|
dbInst.keyCount = 0
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
const keyParts = split(key, this.separator)
|
const keyParts = split(key, this.separator)
|
||||||
const totalParts = size(keyParts)
|
const totalParts = size(keyParts)
|
||||||
|
|
|
@ -166,6 +166,20 @@ const useBrowserStore = defineStore('browser', {
|
||||||
return get(rootNode, 'children', [])
|
return get(rootNode, 'children', [])
|
||||||
},
|
},
|
||||||
|
|
||||||
|
getReloadKey(server) {
|
||||||
|
/** @type {RedisServerState} **/
|
||||||
|
const serverInst = this.servers[server]
|
||||||
|
return serverInst != null ? serverInst.reloadKey : 0
|
||||||
|
},
|
||||||
|
|
||||||
|
reloadServer(server) {
|
||||||
|
/** @type {RedisServerState} **/
|
||||||
|
const serverInst = this.servers[server]
|
||||||
|
if (serverInst != null) {
|
||||||
|
serverInst.reloadKey = Date.now()
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* switch key view
|
* switch key view
|
||||||
* @param {string} connName
|
* @param {string} connName
|
||||||
|
@ -1493,7 +1507,7 @@ const useBrowserStore = defineStore('browser', {
|
||||||
*/
|
*/
|
||||||
async deleteKey(server, db, key, soft) {
|
async deleteKey(server, db, key, soft) {
|
||||||
try {
|
try {
|
||||||
let deleteCount = 0
|
let deleteCount = 1
|
||||||
if (soft !== true) {
|
if (soft !== true) {
|
||||||
const { data } = await DeleteKey(server, db, key)
|
const { data } = await DeleteKey(server, db, key)
|
||||||
deleteCount = get(data, 'deleteCount', 0)
|
deleteCount = get(data, 'deleteCount', 0)
|
||||||
|
@ -1660,9 +1674,10 @@ const useBrowserStore = defineStore('browser', {
|
||||||
* @param {string} path
|
* @param {string} path
|
||||||
* @param {number} conflict
|
* @param {number} conflict
|
||||||
* @param {boolean} [expire]
|
* @param {boolean} [expire]
|
||||||
|
* @param {boolean} [reload]
|
||||||
* @return {Promise<void>}
|
* @return {Promise<void>}
|
||||||
*/
|
*/
|
||||||
async importKeysFromCSVFile(server, db, path, conflict, expire) {
|
async importKeysFromCSVFile(server, db, path, conflict, expire, reload) {
|
||||||
const msgRef = $message.loading('', { duration: 0, closable: true })
|
const msgRef = $message.loading('', { duration: 0, closable: true })
|
||||||
let imported = 0
|
let imported = 0
|
||||||
let ignored = 0
|
let ignored = 0
|
||||||
|
@ -1695,8 +1710,11 @@ const useBrowserStore = defineStore('browser', {
|
||||||
if (canceled) {
|
if (canceled) {
|
||||||
$message.info(i18nGlobal.t('dialogue.handle_cancel'))
|
$message.info(i18nGlobal.t('dialogue.handle_cancel'))
|
||||||
} else {
|
} else {
|
||||||
// no fail
|
// finish
|
||||||
$message.success(i18nGlobal.t('dialogue.import.import_completed', { success: imported, ignored }))
|
$message.success(i18nGlobal.t('dialogue.import.import_completed', { success: imported, ignored }))
|
||||||
|
if (reload) {
|
||||||
|
this.reloadServer(server)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -1717,7 +1735,6 @@ const useBrowserStore = defineStore('browser', {
|
||||||
if (serverInst != null) {
|
if (serverInst != null) {
|
||||||
// update tree view data
|
// update tree view data
|
||||||
serverInst.removeKeyNode()
|
serverInst.removeKeyNode()
|
||||||
serverInst.setDBKeyCount(db, 0)
|
|
||||||
}
|
}
|
||||||
// set tab content empty
|
// set tab content empty
|
||||||
const tab = useTabStore()
|
const tab = useTabStore()
|
||||||
|
|
|
@ -23,7 +23,7 @@ export const themeOverrides = {
|
||||||
paddingMedium: '0 12px',
|
paddingMedium: '0 12px',
|
||||||
},
|
},
|
||||||
Tag: {
|
Tag: {
|
||||||
// borderRadius: '3px'
|
borderRadius: '4px',
|
||||||
heightLarge: '32px',
|
heightLarge: '32px',
|
||||||
},
|
},
|
||||||
Input: {
|
Input: {
|
||||||
|
|
Loading…
Reference in New Issue