Compare commits
No commits in common. "7934fc275ac11e49a8099e9a936017c6b9a59965" and "ab8077999d08dd6dc4590ab20481e081b80ddab0" have entirely different histories.
7934fc275a
...
ab8077999d
|
@ -200,7 +200,6 @@ func (b *browserService) OpenConnection(name string) (resp types.JSResp) {
|
||||||
resp.Data = map[string]any{
|
resp.Data = map[string]any{
|
||||||
"db": dbs,
|
"db": dbs,
|
||||||
"view": selConn.KeyView,
|
"view": selConn.KeyView,
|
||||||
"lastDB": selConn.LastDB,
|
|
||||||
}
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
|
@ -358,20 +358,3 @@ func (c *connectionService) DeleteGroup(name string, includeConn bool) (resp typ
|
||||||
resp.Success = true
|
resp.Success = true
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
// SaveLastDB save last selected database index
|
|
||||||
func (c *connectionService) SaveLastDB(name string, db int) (resp types.JSResp) {
|
|
||||||
param := c.conns.GetConnection(name)
|
|
||||||
if param == nil {
|
|
||||||
resp.Msg = "no connection named \"" + name + "\""
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
param.LastDB = db
|
|
||||||
if err := c.conns.UpdateConnection(name, param.ConnectionConfig); err != nil {
|
|
||||||
resp.Msg = "save connection fail:" + err.Error()
|
|
||||||
return
|
|
||||||
}
|
|
||||||
resp.Success = true
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
|
@ -5,7 +5,6 @@ type ConnectionCategory int
|
||||||
type ConnectionConfig struct {
|
type ConnectionConfig struct {
|
||||||
Name string `json:"name" yaml:"name"`
|
Name string `json:"name" yaml:"name"`
|
||||||
Group string `json:"group,omitempty" yaml:"-"`
|
Group string `json:"group,omitempty" yaml:"-"`
|
||||||
LastDB int `json:"lastDB" yaml:"last_db"`
|
|
||||||
Addr string `json:"addr,omitempty" yaml:"addr,omitempty"`
|
Addr string `json:"addr,omitempty" yaml:"addr,omitempty"`
|
||||||
Port int `json:"port,omitempty" yaml:"port,omitempty"`
|
Port int `json:"port,omitempty" yaml:"port,omitempty"`
|
||||||
Username string `json:"username,omitempty" yaml:"username,omitempty"`
|
Username string `json:"username,omitempty" yaml:"username,omitempty"`
|
||||||
|
|
|
@ -4,7 +4,6 @@ import Delete from '@/components/icons/Delete.vue'
|
||||||
import Edit from '@/components/icons/Edit.vue'
|
import Edit from '@/components/icons/Edit.vue'
|
||||||
import Close from '@/components/icons/Close.vue'
|
import Close from '@/components/icons/Close.vue'
|
||||||
import Save from '@/components/icons/Save.vue'
|
import Save from '@/components/icons/Save.vue'
|
||||||
import Copy from '@/components/icons/Copy.vue'
|
|
||||||
|
|
||||||
const props = defineProps({
|
const props = defineProps({
|
||||||
bindKey: String,
|
bindKey: String,
|
||||||
|
@ -12,7 +11,7 @@ const props = defineProps({
|
||||||
readonly: Boolean,
|
readonly: Boolean,
|
||||||
})
|
})
|
||||||
|
|
||||||
const emit = defineEmits(['edit', 'delete', 'copy', 'save', 'cancel'])
|
const emit = defineEmits(['edit', 'delete', 'save', 'cancel'])
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
|
@ -22,14 +21,13 @@ const emit = defineEmits(['edit', 'delete', 'copy', 'save', 'cancel'])
|
||||||
<icon-button :icon="Close" @click="emit('cancel')" />
|
<icon-button :icon="Close" @click="emit('cancel')" />
|
||||||
</div>
|
</div>
|
||||||
<div v-else class="flex-box-h edit-column-func">
|
<div v-else class="flex-box-h edit-column-func">
|
||||||
<icon-button :icon="Copy" :title="$t('interface.copy_value')" @click="emit('copy')" />
|
<icon-button v-if="!props.readonly" :icon="Edit" @click="emit('edit')" />
|
||||||
<icon-button v-if="!props.readonly" :icon="Edit" :title="$t('interface.edit_row')" @click="emit('edit')" />
|
|
||||||
<n-popconfirm
|
<n-popconfirm
|
||||||
:negative-text="$t('common.cancel')"
|
:negative-text="$t('common.cancel')"
|
||||||
:positive-text="$t('common.confirm')"
|
:positive-text="$t('common.confirm')"
|
||||||
@positive-click="emit('delete')">
|
@positive-click="emit('delete')">
|
||||||
<template #trigger>
|
<template #trigger>
|
||||||
<icon-button :icon="Delete" :title="$t('interface.delete_row')" />
|
<icon-button :icon="Delete" />
|
||||||
</template>
|
</template>
|
||||||
{{ $t('dialogue.remove_tip', { name: props.bindKey }) }}
|
{{ $t('dialogue.remove_tip', { name: props.bindKey }) }}
|
||||||
</n-popconfirm>
|
</n-popconfirm>
|
||||||
|
|
|
@ -65,7 +65,7 @@ const onCopyKey = () => {
|
||||||
ClipboardSetText(props.keyPath)
|
ClipboardSetText(props.keyPath)
|
||||||
.then((succ) => {
|
.then((succ) => {
|
||||||
if (succ) {
|
if (succ) {
|
||||||
$message.success(i18n.t('interface.copy_succ'))
|
$message.success(i18n.t('dialogue.copy_succ'))
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
.catch((e) => {
|
.catch((e) => {
|
||||||
|
|
|
@ -19,7 +19,6 @@ import Edit from '@/components/icons/Edit.vue'
|
||||||
import FormatSelector from '@/components/content_value/FormatSelector.vue'
|
import FormatSelector from '@/components/content_value/FormatSelector.vue'
|
||||||
import { decodeRedisKey } from '@/utils/key_convert.js'
|
import { decodeRedisKey } from '@/utils/key_convert.js'
|
||||||
import ContentSearchInput from '@/components/content_value/ContentSearchInput.vue'
|
import ContentSearchInput from '@/components/content_value/ContentSearchInput.vue'
|
||||||
import { ClipboardSetText } from 'wailsjs/runtime/runtime.js'
|
|
||||||
|
|
||||||
const i18n = useI18n()
|
const i18n = useI18n()
|
||||||
const themeVars = useThemeVars()
|
const themeVars = useThemeVars()
|
||||||
|
@ -164,7 +163,7 @@ const saveEdit = async (field, value, decode, format) => {
|
||||||
})
|
})
|
||||||
if (success) {
|
if (success) {
|
||||||
currentEditRow.value = value
|
currentEditRow.value = value
|
||||||
$message.success(i18n.t('interface.save_value_succ'))
|
$message.success(i18n.t('dialogue.save_value_succ'))
|
||||||
} else {
|
} else {
|
||||||
$message.error(msg)
|
$message.error(msg)
|
||||||
}
|
}
|
||||||
|
@ -184,7 +183,7 @@ const resetEdit = () => {
|
||||||
const actionColumn = {
|
const actionColumn = {
|
||||||
key: 'action',
|
key: 'action',
|
||||||
title: i18n.t('interface.action'),
|
title: i18n.t('interface.action'),
|
||||||
width: 120,
|
width: 100,
|
||||||
align: 'center',
|
align: 'center',
|
||||||
titleAlign: 'center',
|
titleAlign: 'center',
|
||||||
fixed: 'right',
|
fixed: 'right',
|
||||||
|
@ -192,16 +191,6 @@ const actionColumn = {
|
||||||
return h(EditableTableColumn, {
|
return h(EditableTableColumn, {
|
||||||
editing: false,
|
editing: false,
|
||||||
bindKey: row.k,
|
bindKey: row.k,
|
||||||
onCopy: async () => {
|
|
||||||
try {
|
|
||||||
const succ = await ClipboardSetText(row.v)
|
|
||||||
if (succ) {
|
|
||||||
$message.success(i18n.t('interface.copy_succ'))
|
|
||||||
}
|
|
||||||
} catch (e) {
|
|
||||||
$message.error(e.message)
|
|
||||||
}
|
|
||||||
},
|
|
||||||
onEdit: () => startEdit(index + 1, row.k, row.v),
|
onEdit: () => startEdit(index + 1, row.k, row.v),
|
||||||
onDelete: async () => {
|
onDelete: async () => {
|
||||||
try {
|
try {
|
||||||
|
|
|
@ -18,7 +18,6 @@ import ContentEntryEditor from '@/components/content_value/ContentEntryEditor.vu
|
||||||
import FormatSelector from '@/components/content_value/FormatSelector.vue'
|
import FormatSelector from '@/components/content_value/FormatSelector.vue'
|
||||||
import Edit from '@/components/icons/Edit.vue'
|
import Edit from '@/components/icons/Edit.vue'
|
||||||
import ContentSearchInput from '@/components/content_value/ContentSearchInput.vue'
|
import ContentSearchInput from '@/components/content_value/ContentSearchInput.vue'
|
||||||
import { ClipboardSetText } from 'wailsjs/runtime/runtime.js'
|
|
||||||
|
|
||||||
const i18n = useI18n()
|
const i18n = useI18n()
|
||||||
const themeVars = useThemeVars()
|
const themeVars = useThemeVars()
|
||||||
|
@ -143,7 +142,7 @@ const saveEdit = async (pos, value, decode, format) => {
|
||||||
format,
|
format,
|
||||||
})
|
})
|
||||||
if (success) {
|
if (success) {
|
||||||
$message.success(i18n.t('interface.save_value_succ'))
|
$message.success(i18n.t('dialogue.save_value_succ'))
|
||||||
} else {
|
} else {
|
||||||
$message.error(msg)
|
$message.error(msg)
|
||||||
}
|
}
|
||||||
|
@ -160,7 +159,7 @@ const resetEdit = () => {
|
||||||
const actionColumn = {
|
const actionColumn = {
|
||||||
key: 'action',
|
key: 'action',
|
||||||
title: i18n.t('interface.action'),
|
title: i18n.t('interface.action'),
|
||||||
width: 120,
|
width: 100,
|
||||||
align: 'center',
|
align: 'center',
|
||||||
titleAlign: 'center',
|
titleAlign: 'center',
|
||||||
fixed: 'right',
|
fixed: 'right',
|
||||||
|
@ -168,16 +167,6 @@ const actionColumn = {
|
||||||
return h(EditableTableColumn, {
|
return h(EditableTableColumn, {
|
||||||
editing: false,
|
editing: false,
|
||||||
bindKey: `#${index + 1}`,
|
bindKey: `#${index + 1}`,
|
||||||
onCopy: async () => {
|
|
||||||
try {
|
|
||||||
const succ = await ClipboardSetText(row.v)
|
|
||||||
if (succ) {
|
|
||||||
$message.success(i18n.t('interface.copy_succ'))
|
|
||||||
}
|
|
||||||
} catch (e) {
|
|
||||||
$message.error(e.message)
|
|
||||||
}
|
|
||||||
},
|
|
||||||
onEdit: () => {
|
onEdit: () => {
|
||||||
startEdit(index + 1, row.v)
|
startEdit(index + 1, row.v)
|
||||||
},
|
},
|
||||||
|
|
|
@ -18,7 +18,6 @@ import Edit from '@/components/icons/Edit.vue'
|
||||||
import ContentEntryEditor from '@/components/content_value/ContentEntryEditor.vue'
|
import ContentEntryEditor from '@/components/content_value/ContentEntryEditor.vue'
|
||||||
import FormatSelector from '@/components/content_value/FormatSelector.vue'
|
import FormatSelector from '@/components/content_value/FormatSelector.vue'
|
||||||
import ContentSearchInput from '@/components/content_value/ContentSearchInput.vue'
|
import ContentSearchInput from '@/components/content_value/ContentSearchInput.vue'
|
||||||
import { ClipboardSetText } from 'wailsjs/runtime/runtime.js'
|
|
||||||
|
|
||||||
const i18n = useI18n()
|
const i18n = useI18n()
|
||||||
const themeVars = useThemeVars()
|
const themeVars = useThemeVars()
|
||||||
|
@ -140,7 +139,7 @@ const saveEdit = async (pos, value, decode, format) => {
|
||||||
retFormat: props.format,
|
retFormat: props.format,
|
||||||
})
|
})
|
||||||
if (success) {
|
if (success) {
|
||||||
$message.success(i18n.t('interface.save_value_succ'))
|
$message.success(i18n.t('dialogue.save_value_succ'))
|
||||||
} else {
|
} else {
|
||||||
$message.error(msg)
|
$message.error(msg)
|
||||||
}
|
}
|
||||||
|
@ -157,7 +156,7 @@ const resetEdit = () => {
|
||||||
const actionColumn = {
|
const actionColumn = {
|
||||||
key: 'action',
|
key: 'action',
|
||||||
title: i18n.t('interface.action'),
|
title: i18n.t('interface.action'),
|
||||||
width: 120,
|
width: 100,
|
||||||
align: 'center',
|
align: 'center',
|
||||||
titleAlign: 'center',
|
titleAlign: 'center',
|
||||||
fixed: 'right',
|
fixed: 'right',
|
||||||
|
@ -165,16 +164,6 @@ const actionColumn = {
|
||||||
return h(EditableTableColumn, {
|
return h(EditableTableColumn, {
|
||||||
editing: false,
|
editing: false,
|
||||||
bindKey: `#${index + 1}`,
|
bindKey: `#${index + 1}`,
|
||||||
onCopy: async () => {
|
|
||||||
try {
|
|
||||||
const succ = await ClipboardSetText(row.v)
|
|
||||||
if (succ) {
|
|
||||||
$message.success(i18n.t('interface.copy_succ'))
|
|
||||||
}
|
|
||||||
} catch (e) {
|
|
||||||
$message.error(e.message)
|
|
||||||
}
|
|
||||||
},
|
|
||||||
onEdit: () => {
|
onEdit: () => {
|
||||||
startEdit(index + 1, row.v)
|
startEdit(index + 1, row.v)
|
||||||
},
|
},
|
||||||
|
|
|
@ -15,7 +15,6 @@ import LoadList from '@/components/icons/LoadList.vue'
|
||||||
import LoadAll from '@/components/icons/LoadAll.vue'
|
import LoadAll from '@/components/icons/LoadAll.vue'
|
||||||
import IconButton from '@/components/common/IconButton.vue'
|
import IconButton from '@/components/common/IconButton.vue'
|
||||||
import ContentSearchInput from '@/components/content_value/ContentSearchInput.vue'
|
import ContentSearchInput from '@/components/content_value/ContentSearchInput.vue'
|
||||||
import { ClipboardSetText } from 'wailsjs/runtime/runtime.js'
|
|
||||||
|
|
||||||
const i18n = useI18n()
|
const i18n = useI18n()
|
||||||
const themeVars = useThemeVars()
|
const themeVars = useThemeVars()
|
||||||
|
@ -100,7 +99,7 @@ const valueColumn = computed(() => ({
|
||||||
const actionColumn = {
|
const actionColumn = {
|
||||||
key: 'action',
|
key: 'action',
|
||||||
title: i18n.t('interface.action'),
|
title: i18n.t('interface.action'),
|
||||||
width: 80,
|
width: 60,
|
||||||
align: 'center',
|
align: 'center',
|
||||||
titleAlign: 'center',
|
titleAlign: 'center',
|
||||||
fixed: 'right',
|
fixed: 'right',
|
||||||
|
@ -108,16 +107,6 @@ const actionColumn = {
|
||||||
return h(EditableTableColumn, {
|
return h(EditableTableColumn, {
|
||||||
bindKey: row.id,
|
bindKey: row.id,
|
||||||
readonly: true,
|
readonly: true,
|
||||||
onCopy: async () => {
|
|
||||||
try {
|
|
||||||
const succ = await ClipboardSetText(JSON.stringify(row.v))
|
|
||||||
if (succ) {
|
|
||||||
$message.success(i18n.t('interface.copy_succ'))
|
|
||||||
}
|
|
||||||
} catch (e) {
|
|
||||||
$message.error(e.message)
|
|
||||||
}
|
|
||||||
},
|
|
||||||
onDelete: async () => {
|
onDelete: async () => {
|
||||||
try {
|
try {
|
||||||
const { success, msg } = await browserStore.removeStreamValues(
|
const { success, msg } = await browserStore.removeStreamValues(
|
||||||
|
@ -186,6 +175,20 @@ defineExpose({
|
||||||
@rename="emit('rename')" />
|
@rename="emit('rename')" />
|
||||||
<div class="tb2 value-item-part flex-box-h">
|
<div class="tb2 value-item-part flex-box-h">
|
||||||
<div class="flex-box-h">
|
<div class="flex-box-h">
|
||||||
|
<!-- <n-input-group>-->
|
||||||
|
<!-- <n-select-->
|
||||||
|
<!-- v-model:value="filterType"-->
|
||||||
|
<!-- :consistent-menu-width="false"-->
|
||||||
|
<!-- :options="filterOption"-->
|
||||||
|
<!-- style="width: 120px"-->
|
||||||
|
<!-- @update:value="onChangeFilterType" />-->
|
||||||
|
<!-- <n-input-->
|
||||||
|
<!-- v-model:value="filterValue"-->
|
||||||
|
<!-- :placeholder="$t('interface.search')"-->
|
||||||
|
<!-- clearable-->
|
||||||
|
<!-- @clear="clearFilter"-->
|
||||||
|
<!-- @update:value="onFilterInput" />-->
|
||||||
|
<!-- </n-input-group>-->
|
||||||
<content-search-input
|
<content-search-input
|
||||||
ref="searchInputRef"
|
ref="searchInputRef"
|
||||||
@filter-changed="onFilterInput"
|
@filter-changed="onFilterInput"
|
||||||
|
|
|
@ -77,16 +77,13 @@ const displayValue = computed(() => {
|
||||||
watch(
|
watch(
|
||||||
() => props.value,
|
() => props.value,
|
||||||
(val, oldVal) => {
|
(val, oldVal) => {
|
||||||
if (val !== undefined) {
|
if (val !== undefined && oldVal !== undefined) {
|
||||||
onFormatChanged(viewAs.decode, viewAs.format)
|
onFormatChanged(viewAs.decode, viewAs.format)
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
|
|
||||||
const converting = ref(false)
|
|
||||||
const onFormatChanged = async (decode = '', format = '') => {
|
const onFormatChanged = async (decode = '', format = '') => {
|
||||||
try {
|
|
||||||
converting.value = true
|
|
||||||
const {
|
const {
|
||||||
value,
|
value,
|
||||||
decode: retDecode,
|
decode: retDecode,
|
||||||
|
@ -99,9 +96,6 @@ const onFormatChanged = async (decode = '', format = '') => {
|
||||||
editingContent.value = viewAs.value = value
|
editingContent.value = viewAs.value = value
|
||||||
viewAs.decode = decode || retDecode
|
viewAs.decode = decode || retDecode
|
||||||
viewAs.format = format || retFormat
|
viewAs.format = format || retFormat
|
||||||
} finally {
|
|
||||||
converting.value = false
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -111,7 +105,7 @@ const onCopyValue = () => {
|
||||||
ClipboardSetText(displayValue.value)
|
ClipboardSetText(displayValue.value)
|
||||||
.then((succ) => {
|
.then((succ) => {
|
||||||
if (succ) {
|
if (succ) {
|
||||||
$message.success(i18n.t('interface.copy_succ'))
|
$message.success(i18n.t('dialogue.copy_succ'))
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
.catch((e) => {
|
.catch((e) => {
|
||||||
|
@ -144,7 +138,7 @@ const onSave = async () => {
|
||||||
})
|
})
|
||||||
if (success) {
|
if (success) {
|
||||||
// await browserStore.loadKeyDetail({ server: props.name, db: props.db, key: keyName.value })
|
// await browserStore.loadKeyDetail({ server: props.name, db: props.db, key: keyName.value })
|
||||||
$message.success(i18n.t('interface.save_value_succ'))
|
$message.success(i18n.t('dialogue.save_value_succ'))
|
||||||
} else {
|
} else {
|
||||||
$message.error(msg)
|
$message.error(msg)
|
||||||
}
|
}
|
||||||
|
@ -158,10 +152,9 @@ const onSave = async () => {
|
||||||
defineExpose({
|
defineExpose({
|
||||||
reset: () => {
|
reset: () => {
|
||||||
viewAs.value = ''
|
viewAs.value = ''
|
||||||
viewAs.decode = ''
|
|
||||||
viewAs.format = ''
|
|
||||||
editingContent.value = ''
|
editingContent.value = ''
|
||||||
},
|
},
|
||||||
|
beforeShow: () => onFormatChanged(),
|
||||||
})
|
})
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
@ -202,9 +195,9 @@ defineExpose({
|
||||||
</n-button-group>
|
</n-button-group>
|
||||||
</div>
|
</div>
|
||||||
<div class="value-wrapper value-item-part flex-item-expand flex-box-v">
|
<div class="value-wrapper value-item-part flex-item-expand flex-box-v">
|
||||||
<n-spin :show="props.loading || converting" />
|
<n-spin :show="props.loading" />
|
||||||
<content-editor
|
<content-editor
|
||||||
v-show="!(props.loading || converting)"
|
v-show="!props.loading"
|
||||||
:content="displayValue"
|
:content="displayValue"
|
||||||
:language="viewLanguage"
|
:language="viewLanguage"
|
||||||
:loading="props.loading"
|
:loading="props.loading"
|
||||||
|
|
|
@ -156,6 +156,9 @@ const initContent = async () => {
|
||||||
contentRef.value?.reset()
|
contentRef.value?.reset()
|
||||||
}
|
}
|
||||||
await loadData(true, false, '')
|
await loadData(true, false, '')
|
||||||
|
if (contentRef.value?.beforeShow != null) {
|
||||||
|
await contentRef.value?.beforeShow()
|
||||||
|
}
|
||||||
} finally {
|
} finally {
|
||||||
initializing.value = false
|
initializing.value = false
|
||||||
}
|
}
|
||||||
|
|
|
@ -18,7 +18,6 @@ import ContentEntryEditor from '@/components/content_value/ContentEntryEditor.vu
|
||||||
import FormatSelector from '@/components/content_value/FormatSelector.vue'
|
import FormatSelector from '@/components/content_value/FormatSelector.vue'
|
||||||
import Edit from '@/components/icons/Edit.vue'
|
import Edit from '@/components/icons/Edit.vue'
|
||||||
import ContentSearchInput from '@/components/content_value/ContentSearchInput.vue'
|
import ContentSearchInput from '@/components/content_value/ContentSearchInput.vue'
|
||||||
import { ClipboardSetText } from 'wailsjs/runtime/runtime.js'
|
|
||||||
|
|
||||||
const i18n = useI18n()
|
const i18n = useI18n()
|
||||||
const themeVars = useThemeVars()
|
const themeVars = useThemeVars()
|
||||||
|
@ -186,7 +185,7 @@ const saveEdit = async (field, value, decode, format) => {
|
||||||
format,
|
format,
|
||||||
})
|
})
|
||||||
if (success) {
|
if (success) {
|
||||||
$message.success(i18n.t('interface.save_value_succ'))
|
$message.success(i18n.t('dialogue.save_value_succ'))
|
||||||
} else {
|
} else {
|
||||||
$message.error(msg)
|
$message.error(msg)
|
||||||
}
|
}
|
||||||
|
@ -206,7 +205,7 @@ const resetEdit = () => {
|
||||||
const actionColumn = {
|
const actionColumn = {
|
||||||
key: 'action',
|
key: 'action',
|
||||||
title: i18n.t('interface.action'),
|
title: i18n.t('interface.action'),
|
||||||
width: 120,
|
width: 100,
|
||||||
align: 'center',
|
align: 'center',
|
||||||
titleAlign: 'center',
|
titleAlign: 'center',
|
||||||
fixed: 'right',
|
fixed: 'right',
|
||||||
|
@ -214,16 +213,6 @@ const actionColumn = {
|
||||||
return h(EditableTableColumn, {
|
return h(EditableTableColumn, {
|
||||||
editing: false,
|
editing: false,
|
||||||
bindKey: row.v,
|
bindKey: row.v,
|
||||||
onCopy: async () => {
|
|
||||||
try {
|
|
||||||
const succ = await ClipboardSetText(row.v)
|
|
||||||
if (succ) {
|
|
||||||
$message.success(i18n.t('interface.copy_succ'))
|
|
||||||
}
|
|
||||||
} catch (e) {
|
|
||||||
$message.error(e.message)
|
|
||||||
}
|
|
||||||
},
|
|
||||||
onEdit: () => startEdit(index + 1, row.s, row.v),
|
onEdit: () => startEdit(index + 1, row.s, row.v),
|
||||||
onDelete: async () => {
|
onDelete: async () => {
|
||||||
try {
|
try {
|
||||||
|
|
|
@ -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, watch } from 'vue'
|
import { computed, onMounted, reactive, ref, unref, watch } from 'vue'
|
||||||
import { get, map } from 'lodash'
|
import { get, map } 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'
|
||||||
|
@ -19,7 +19,6 @@ import { useRender } from '@/utils/render.js'
|
||||||
import RedisTypeSelector from '@/components/common/RedisTypeSelector.vue'
|
import RedisTypeSelector from '@/components/common/RedisTypeSelector.vue'
|
||||||
import { types } from '@/consts/support_redis_type.js'
|
import { types } from '@/consts/support_redis_type.js'
|
||||||
import Plus from '@/components/icons/Plus.vue'
|
import Plus from '@/components/icons/Plus.vue'
|
||||||
import useConnectionStore from 'stores/connections.js'
|
|
||||||
|
|
||||||
const themeVars = useThemeVars()
|
const themeVars = useThemeVars()
|
||||||
const i18n = useI18n()
|
const i18n = useI18n()
|
||||||
|
@ -27,7 +26,6 @@ const dialogStore = useDialogStore()
|
||||||
// const prefStore = usePreferencesStore()
|
// const prefStore = usePreferencesStore()
|
||||||
const tabStore = useTabStore()
|
const tabStore = useTabStore()
|
||||||
const browserStore = useBrowserStore()
|
const browserStore = useBrowserStore()
|
||||||
const connectionStore = useConnectionStore()
|
|
||||||
const render = useRender()
|
const render = useRender()
|
||||||
const currentName = computed(() => get(tabStore.currentTab, 'name', ''))
|
const currentName = computed(() => get(tabStore.currentTab, 'name', ''))
|
||||||
const browserTreeRef = ref(null)
|
const browserTreeRef = ref(null)
|
||||||
|
@ -161,8 +159,6 @@ watch(
|
||||||
browserTreeRef.value?.resetExpandKey(currentName.value, db)
|
browserTreeRef.value?.resetExpandKey(currentName.value, db)
|
||||||
fullyLoaded.value = await browserStore.loadMoreKeys(currentName.value, db)
|
fullyLoaded.value = await browserStore.loadMoreKeys(currentName.value, db)
|
||||||
browserTreeRef.value?.refreshTree()
|
browserTreeRef.value?.refreshTree()
|
||||||
|
|
||||||
nextTick().then(() => connectionStore.saveLastDB(currentName.value, db))
|
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
$message.error(e.message)
|
$message.error(e.message)
|
||||||
} finally {
|
} finally {
|
||||||
|
@ -273,7 +269,7 @@ onMounted(() => onReload())
|
||||||
size="20"
|
size="20"
|
||||||
t-tooltip="interface.load_all"
|
t-tooltip="interface.load_all"
|
||||||
@click="onLoadAll" />
|
@click="onLoadAll" />
|
||||||
<div class="flex-item-expand" style="min-width: 10px" />
|
<div class="flex-item-expand" />
|
||||||
<icon-button
|
<icon-button
|
||||||
:button-class="['nav-pane-func-btn']"
|
:button-class="['nav-pane-func-btn']"
|
||||||
:icon="Delete"
|
:icon="Delete"
|
||||||
|
|
|
@ -220,7 +220,7 @@ const handleSelectContextMenu = (key) => {
|
||||||
ClipboardSetText(redisKey)
|
ClipboardSetText(redisKey)
|
||||||
.then((succ) => {
|
.then((succ) => {
|
||||||
if (succ) {
|
if (succ) {
|
||||||
$message.success(i18n.t('interface.copy_succ'))
|
$message.success(i18n.t('dialogue.copy_succ'))
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
.catch((e) => {
|
.catch((e) => {
|
||||||
|
|
|
@ -94,8 +94,6 @@
|
||||||
"open_connection": "Open Connection",
|
"open_connection": "Open Connection",
|
||||||
"copy_path": "Copy Path",
|
"copy_path": "Copy Path",
|
||||||
"copy_key": "Copy Key",
|
"copy_key": "Copy Key",
|
||||||
"save_value_succ": "Value Saved !",
|
|
||||||
"copy_succ": "Value Copied !",
|
|
||||||
"binary_key": "Binary Key Name",
|
"binary_key": "Binary Key Name",
|
||||||
"remove_key": "Remove Key",
|
"remove_key": "Remove Key",
|
||||||
"new_key": "Add Key",
|
"new_key": "Add Key",
|
||||||
|
@ -132,6 +130,8 @@
|
||||||
"remove_tip": "{type} \"{name}\" will be deleted",
|
"remove_tip": "{type} \"{name}\" will be deleted",
|
||||||
"remove_group_tip": "Group \"{name}\" and all connections in it will be deleted",
|
"remove_group_tip": "Group \"{name}\" and all connections in it will be deleted",
|
||||||
"delete_key_succ": "\"{key}\" has been deleted",
|
"delete_key_succ": "\"{key}\" has been deleted",
|
||||||
|
"save_value_succ": "Value Saved !",
|
||||||
|
"copy_succ": "Value Copied !",
|
||||||
"rename_binary_key_fail": "Rename binary key name is unsupported",
|
"rename_binary_key_fail": "Rename binary key name is unsupported",
|
||||||
"handle_succ": "Success!",
|
"handle_succ": "Success!",
|
||||||
"reload_succ": "Reloaded!",
|
"reload_succ": "Reloaded!",
|
||||||
|
|
|
@ -88,8 +88,6 @@
|
||||||
"open_connection": "Abrir Conexão",
|
"open_connection": "Abrir Conexão",
|
||||||
"copy_path": "Copiar Caminho",
|
"copy_path": "Copiar Caminho",
|
||||||
"copy_key": "Copiar Chave",
|
"copy_key": "Copiar Chave",
|
||||||
"save_value_succ": "Valor Salvo!",
|
|
||||||
"copy_succ": "Valor Copiado!",
|
|
||||||
"binary_key": "Nome da Chave Binária",
|
"binary_key": "Nome da Chave Binária",
|
||||||
"remove_key": "Remover Chave",
|
"remove_key": "Remover Chave",
|
||||||
"new_key": "Adicionar Chave",
|
"new_key": "Adicionar Chave",
|
||||||
|
@ -124,6 +122,8 @@
|
||||||
"remove_tip": "{type} \"{name}\" será excluído",
|
"remove_tip": "{type} \"{name}\" será excluído",
|
||||||
"remove_group_tip": "O grupo \"{name}\" e todas as conexões nele serão excluídos",
|
"remove_group_tip": "O grupo \"{name}\" e todas as conexões nele serão excluídos",
|
||||||
"delete_key_succ": "\"{key}\" foi excluída",
|
"delete_key_succ": "\"{key}\" foi excluída",
|
||||||
|
"save_value_succ": "Valor Salvo!",
|
||||||
|
"copy_succ": "Valor Copiado!",
|
||||||
"rename_binary_key_fail": "Renomear nome de chave binária não é suportado",
|
"rename_binary_key_fail": "Renomear nome de chave binária não é suportado",
|
||||||
"handle_succ": "Sucesso!",
|
"handle_succ": "Sucesso!",
|
||||||
"reload_succ": "Recarregado!",
|
"reload_succ": "Recarregado!",
|
||||||
|
|
|
@ -94,8 +94,6 @@
|
||||||
"open_connection": "打开连接",
|
"open_connection": "打开连接",
|
||||||
"copy_path": "复制路径",
|
"copy_path": "复制路径",
|
||||||
"copy_key": "复制键名",
|
"copy_key": "复制键名",
|
||||||
"save_value_succ": "已保存值",
|
|
||||||
"copy_succ": "已复制到剪切板",
|
|
||||||
"binary_key": "二进制键名",
|
"binary_key": "二进制键名",
|
||||||
"remove_key": "删除键",
|
"remove_key": "删除键",
|
||||||
"new_key": "添加新键",
|
"new_key": "添加新键",
|
||||||
|
@ -132,6 +130,8 @@
|
||||||
"remove_tip": "{type} \"{name}\" 将会被删除",
|
"remove_tip": "{type} \"{name}\" 将会被删除",
|
||||||
"remove_group_tip": "分组 \"{name}\"及其所有连接将会被删除",
|
"remove_group_tip": "分组 \"{name}\"及其所有连接将会被删除",
|
||||||
"delete_key_succ": "{key} 已被删除",
|
"delete_key_succ": "{key} 已被删除",
|
||||||
|
"save_value_succ": "已保存值",
|
||||||
|
"copy_succ": "已复制到剪切板",
|
||||||
"rename_binary_key_fail": "不支持重命名二进制键名",
|
"rename_binary_key_fail": "不支持重命名二进制键名",
|
||||||
"handle_succ": "操作成功",
|
"handle_succ": "操作成功",
|
||||||
"reload_succ": "已重新载入",
|
"reload_succ": "已重新载入",
|
||||||
|
|
|
@ -255,12 +255,11 @@ const useBrowserStore = defineStore('browser', {
|
||||||
// if (connNode == null) {
|
// if (connNode == null) {
|
||||||
// throw new Error('no such connection')
|
// throw new Error('no such connection')
|
||||||
// }
|
// }
|
||||||
const { db, view = KeyViewType.Tree, lastDB } = data
|
const { db, view = KeyViewType.Tree } = data
|
||||||
if (isEmpty(db)) {
|
if (isEmpty(db)) {
|
||||||
throw new Error('no db loaded')
|
throw new Error('no db loaded')
|
||||||
}
|
}
|
||||||
const dbs = []
|
const dbs = []
|
||||||
let containLastDB = false
|
|
||||||
for (let i = 0; i < db.length; i++) {
|
for (let i = 0; i < db.length; i++) {
|
||||||
this._getNodeMap(name, i).clear()
|
this._getNodeMap(name, i).clear()
|
||||||
this._getKeySet(name, i).clear()
|
this._getKeySet(name, i).clear()
|
||||||
|
@ -275,18 +274,10 @@ const useBrowserStore = defineStore('browser', {
|
||||||
isLeaf: false,
|
isLeaf: false,
|
||||||
children: undefined,
|
children: undefined,
|
||||||
})
|
})
|
||||||
if (db[i].index === lastDB) {
|
|
||||||
containLastDB = true
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
this.databases[name] = dbs
|
this.databases[name] = dbs
|
||||||
this.viewType[name] = view
|
this.viewType[name] = view
|
||||||
// get last selected db
|
|
||||||
if (containLastDB) {
|
|
||||||
this.openedDB[name] = lastDB
|
|
||||||
} else {
|
|
||||||
this.openedDB[name] = get(dbs, '0.db', 0)
|
this.openedDB[name] = get(dbs, '0.db', 0)
|
||||||
}
|
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -8,7 +8,6 @@ import {
|
||||||
ListConnection,
|
ListConnection,
|
||||||
RenameGroup,
|
RenameGroup,
|
||||||
SaveConnection,
|
SaveConnection,
|
||||||
SaveLastDB,
|
|
||||||
SaveSortedConnection,
|
SaveSortedConnection,
|
||||||
} from 'wailsjs/go/services/connectionService.js'
|
} from 'wailsjs/go/services/connectionService.js'
|
||||||
import { ConnectionType } from '@/consts/connection_type.js'
|
import { ConnectionType } from '@/consts/connection_type.js'
|
||||||
|
@ -334,20 +333,6 @@ const useConnectionStore = defineStore('connections', {
|
||||||
return { success: true }
|
return { success: true }
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
|
||||||
* save last selected database
|
|
||||||
* @param {string} name
|
|
||||||
* @param {number} db
|
|
||||||
* @return {Promise<{success: boolean, [msg]: string}>}
|
|
||||||
*/
|
|
||||||
async saveLastDB(name, db) {
|
|
||||||
const { success, msg } = await SaveLastDB(name, db)
|
|
||||||
if (!success) {
|
|
||||||
return { success: false, msg }
|
|
||||||
}
|
|
||||||
return { success: true }
|
|
||||||
},
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* get default key filter pattern by server name
|
* get default key filter pattern by server name
|
||||||
* @param name
|
* @param name
|
||||||
|
|
|
@ -235,7 +235,7 @@ const useTabStore = defineStore('tab', {
|
||||||
tabData.value = assign(value, tabData.value || {})
|
tabData.value = assign(value, tabData.value || {})
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
tabData.value = value
|
tabData.value = value || []
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue