2023-06-27 15:53:29 +08:00
|
|
|
<script setup>
|
|
|
|
import { computed, h, reactive, ref } from 'vue'
|
|
|
|
import { useI18n } from 'vue-i18n'
|
2023-07-03 23:48:41 +08:00
|
|
|
import ContentToolbar from './ContentToolbar.vue'
|
2023-08-02 17:57:39 +08:00
|
|
|
import AddLink from '@/components/icons/AddLink.vue'
|
2023-11-13 15:28:13 +08:00
|
|
|
import { NButton, NIcon, NInput, useThemeVars } from 'naive-ui'
|
2023-08-02 17:57:39 +08:00
|
|
|
import { types, types as redisTypes } from '@/consts/support_redis_type.js'
|
|
|
|
import EditableTableColumn from '@/components/common/EditableTableColumn.vue'
|
|
|
|
import useDialogStore from 'stores/dialog.js'
|
2023-11-08 23:45:33 +08:00
|
|
|
import { isEmpty, size } from 'lodash'
|
2023-10-30 00:54:45 +08:00
|
|
|
import bytes from 'bytes'
|
2023-10-31 17:29:56 +08:00
|
|
|
import { decodeTypes, formatTypes } from '@/consts/value_view_type.js'
|
2023-11-05 11:57:52 +08:00
|
|
|
import useBrowserStore from 'stores/browser.js'
|
2023-11-08 23:45:33 +08:00
|
|
|
import LoadList from '@/components/icons/LoadList.vue'
|
|
|
|
import LoadAll from '@/components/icons/LoadAll.vue'
|
|
|
|
import IconButton from '@/components/common/IconButton.vue'
|
2023-11-13 15:28:13 +08:00
|
|
|
import ContentEntryEditor from '@/components/content_value/ContentEntryEditor.vue'
|
|
|
|
import Edit from '@/components/icons/Edit.vue'
|
2023-11-13 22:31:18 +08:00
|
|
|
import FormatSelector from '@/components/content_value/FormatSelector.vue'
|
|
|
|
import { decodeRedisKey } from '@/utils/key_convert.js'
|
2023-06-27 15:53:29 +08:00
|
|
|
|
|
|
|
const i18n = useI18n()
|
2023-10-30 00:54:45 +08:00
|
|
|
const themeVars = useThemeVars()
|
|
|
|
|
2023-06-27 15:53:29 +08:00
|
|
|
const props = defineProps({
|
|
|
|
name: String,
|
|
|
|
db: Number,
|
|
|
|
keyPath: String,
|
2023-10-11 01:15:23 +08:00
|
|
|
keyCode: {
|
|
|
|
type: Array,
|
|
|
|
default: null,
|
|
|
|
},
|
2023-06-27 15:53:29 +08:00
|
|
|
ttl: {
|
|
|
|
type: Number,
|
|
|
|
default: -1,
|
|
|
|
},
|
2023-11-13 22:31:18 +08:00
|
|
|
value: {
|
|
|
|
type: Array,
|
|
|
|
default: () => [],
|
|
|
|
},
|
2023-09-28 16:01:58 +08:00
|
|
|
size: Number,
|
2023-10-30 00:54:45 +08:00
|
|
|
length: Number,
|
2023-11-13 15:28:13 +08:00
|
|
|
format: {
|
2023-10-31 17:29:56 +08:00
|
|
|
type: String,
|
2023-11-13 22:41:33 +08:00
|
|
|
default: formatTypes.RAW,
|
2023-10-31 17:29:56 +08:00
|
|
|
},
|
|
|
|
decode: {
|
|
|
|
type: String,
|
|
|
|
default: decodeTypes.NONE,
|
|
|
|
},
|
2023-11-08 23:45:33 +08:00
|
|
|
end: Boolean,
|
|
|
|
loading: Boolean,
|
2023-06-27 15:53:29 +08:00
|
|
|
})
|
|
|
|
|
2023-11-08 23:45:33 +08:00
|
|
|
const emit = defineEmits(['loadmore', 'loadall', 'reload', 'rename', 'delete'])
|
|
|
|
|
2023-10-11 01:15:23 +08:00
|
|
|
/**
|
|
|
|
*
|
|
|
|
* @type {ComputedRef<string|number[]>}
|
|
|
|
*/
|
|
|
|
const keyName = computed(() => {
|
|
|
|
return !isEmpty(props.keyCode) ? props.keyCode : props.keyPath
|
|
|
|
})
|
|
|
|
|
2023-08-24 01:34:42 +08:00
|
|
|
const filterOption = [
|
2023-07-03 23:30:04 +08:00
|
|
|
{
|
|
|
|
value: 1,
|
2023-09-07 18:38:34 +08:00
|
|
|
label: i18n.t('common.field'),
|
2023-07-03 23:30:04 +08:00
|
|
|
},
|
|
|
|
{
|
|
|
|
value: 2,
|
2023-09-07 18:38:34 +08:00
|
|
|
label: i18n.t('common.value'),
|
2023-07-03 23:30:04 +08:00
|
|
|
},
|
2023-08-24 01:34:42 +08:00
|
|
|
]
|
2023-07-03 23:30:04 +08:00
|
|
|
const filterType = ref(1)
|
|
|
|
|
2023-11-05 11:57:52 +08:00
|
|
|
const browserStore = useBrowserStore()
|
2023-06-27 15:53:29 +08:00
|
|
|
const dialogStore = useDialogStore()
|
|
|
|
const keyType = redisTypes.HASH
|
2023-11-13 22:31:18 +08:00
|
|
|
const currentEditRow = reactive({
|
2023-06-27 15:53:29 +08:00
|
|
|
no: 0,
|
|
|
|
key: '',
|
|
|
|
value: null,
|
2023-11-13 22:41:33 +08:00
|
|
|
format: formatTypes.RAW,
|
2023-11-13 15:28:13 +08:00
|
|
|
decode: decodeTypes.NONE,
|
2023-06-27 15:53:29 +08:00
|
|
|
})
|
2023-11-13 15:28:13 +08:00
|
|
|
|
|
|
|
const inEdit = computed(() => {
|
2023-11-13 22:31:18 +08:00
|
|
|
return currentEditRow.no > 0
|
2023-11-13 15:28:13 +08:00
|
|
|
})
|
2023-11-14 22:58:44 +08:00
|
|
|
const fullEdit = ref(false)
|
|
|
|
const inFullEdit = computed(() => {
|
|
|
|
return inEdit.value && fullEdit.value
|
|
|
|
})
|
|
|
|
|
2023-11-13 15:28:13 +08:00
|
|
|
const tableRef = ref(null)
|
2023-06-27 15:53:29 +08:00
|
|
|
const fieldColumn = reactive({
|
|
|
|
key: 'key',
|
2023-09-07 18:38:34 +08:00
|
|
|
title: i18n.t('common.field'),
|
2023-06-27 15:53:29 +08:00
|
|
|
align: 'center',
|
|
|
|
titleAlign: 'center',
|
|
|
|
resizable: true,
|
2023-11-13 15:28:13 +08:00
|
|
|
ellipsis: {
|
|
|
|
tooltip: true,
|
|
|
|
},
|
2023-06-27 15:53:29 +08:00
|
|
|
filterOptionValue: null,
|
2023-11-14 22:58:44 +08:00
|
|
|
className: inEdit ? 'clickable' : '',
|
2023-11-14 14:49:16 +08:00
|
|
|
filter: (value, row) => {
|
2023-11-13 22:31:18 +08:00
|
|
|
return !!~row.k.indexOf(value.toString())
|
|
|
|
},
|
2023-11-14 14:49:16 +08:00
|
|
|
render: (row) => {
|
2023-11-13 22:31:18 +08:00
|
|
|
return decodeRedisKey(row.k)
|
2023-06-27 15:53:29 +08:00
|
|
|
},
|
|
|
|
})
|
|
|
|
const valueColumn = reactive({
|
|
|
|
key: 'value',
|
2023-09-07 18:38:34 +08:00
|
|
|
title: i18n.t('common.value'),
|
2023-06-27 15:53:29 +08:00
|
|
|
align: 'center',
|
|
|
|
titleAlign: 'center',
|
|
|
|
resizable: true,
|
2023-11-13 15:28:13 +08:00
|
|
|
ellipsis: {
|
|
|
|
tooltip: true,
|
|
|
|
},
|
2023-06-27 15:53:29 +08:00
|
|
|
filterOptionValue: null,
|
2023-11-14 22:58:44 +08:00
|
|
|
className: inEdit ? 'clickable' : '',
|
2023-11-14 14:49:16 +08:00
|
|
|
filter: (value, row) => {
|
|
|
|
return !!~row.v.indexOf(value.toString())
|
2023-06-27 15:53:29 +08:00
|
|
|
},
|
2023-11-14 14:49:16 +08:00
|
|
|
render: (row) => {
|
|
|
|
return row.dv || row.v
|
2023-11-13 22:31:18 +08:00
|
|
|
},
|
2023-11-13 15:28:13 +08:00
|
|
|
})
|
|
|
|
|
2023-11-14 14:49:16 +08:00
|
|
|
const startEdit = async (no, key, value) => {
|
2023-11-13 22:31:18 +08:00
|
|
|
currentEditRow.no = no
|
|
|
|
currentEditRow.key = key
|
2023-11-15 23:41:53 +08:00
|
|
|
currentEditRow.value = value
|
2023-11-13 15:28:13 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
const saveEdit = async (field, value, decode, format) => {
|
|
|
|
try {
|
2023-11-13 22:31:18 +08:00
|
|
|
const row = props.value[currentEditRow.no - 1]
|
2023-11-13 15:28:13 +08:00
|
|
|
if (row == null) {
|
|
|
|
throw new Error('row not exists')
|
|
|
|
}
|
|
|
|
|
|
|
|
const { updated, success, msg } = await browserStore.setHash({
|
|
|
|
server: props.name,
|
|
|
|
db: props.db,
|
|
|
|
key: keyName.value,
|
2023-11-13 22:31:18 +08:00
|
|
|
field: row.k,
|
2023-11-13 15:28:13 +08:00
|
|
|
newField: field,
|
|
|
|
value,
|
|
|
|
decode,
|
|
|
|
format,
|
|
|
|
})
|
|
|
|
if (success) {
|
2023-11-13 22:31:18 +08:00
|
|
|
row.k = field
|
|
|
|
row.v = updated[row.k] || ''
|
|
|
|
const { value: displayVal } = await browserStore.convertValue({
|
|
|
|
value: row.v,
|
|
|
|
decode: props.decode,
|
|
|
|
format: props.format,
|
|
|
|
})
|
|
|
|
row.dv = displayVal
|
2023-11-13 15:28:13 +08:00
|
|
|
$message.success(i18n.t('dialogue.save_value_succ'))
|
2023-06-27 15:53:29 +08:00
|
|
|
} else {
|
2023-11-13 15:28:13 +08:00
|
|
|
$message.error(msg)
|
2023-06-27 15:53:29 +08:00
|
|
|
}
|
2023-11-13 15:28:13 +08:00
|
|
|
} catch (e) {
|
|
|
|
$message.error(e.message)
|
|
|
|
}
|
|
|
|
}
|
2023-11-10 23:24:01 +08:00
|
|
|
|
2023-11-13 15:28:13 +08:00
|
|
|
const resetEdit = () => {
|
2023-11-13 22:31:18 +08:00
|
|
|
currentEditRow.no = 0
|
|
|
|
currentEditRow.key = ''
|
|
|
|
currentEditRow.value = null
|
2023-11-13 22:41:33 +08:00
|
|
|
currentEditRow.format = formatTypes.RAW
|
2023-11-13 22:31:18 +08:00
|
|
|
currentEditRow.decode = decodeTypes.NONE
|
2023-11-10 23:24:01 +08:00
|
|
|
}
|
|
|
|
|
2023-06-27 15:53:29 +08:00
|
|
|
const actionColumn = {
|
|
|
|
key: 'action',
|
2023-09-07 18:38:34 +08:00
|
|
|
title: i18n.t('interface.action'),
|
2023-06-27 15:53:29 +08:00
|
|
|
width: 100,
|
|
|
|
align: 'center',
|
|
|
|
titleAlign: 'center',
|
|
|
|
fixed: 'right',
|
2023-11-13 22:31:18 +08:00
|
|
|
render: (row, index) => {
|
2023-06-27 15:53:29 +08:00
|
|
|
return h(EditableTableColumn, {
|
2023-11-13 15:28:13 +08:00
|
|
|
editing: false,
|
2023-11-13 22:31:18 +08:00
|
|
|
bindKey: row.k,
|
2023-11-14 14:49:16 +08:00
|
|
|
onEdit: () => startEdit(index + 1, row.k, row.v),
|
2023-06-27 15:53:29 +08:00
|
|
|
onDelete: async () => {
|
|
|
|
try {
|
2023-11-15 23:41:53 +08:00
|
|
|
const { removed, success, msg } = await browserStore.removeHashField(
|
2023-06-27 15:53:29 +08:00
|
|
|
props.name,
|
|
|
|
props.db,
|
2023-10-11 01:15:23 +08:00
|
|
|
keyName.value,
|
2023-11-13 22:31:18 +08:00
|
|
|
row.k,
|
2023-06-27 15:53:29 +08:00
|
|
|
)
|
|
|
|
if (success) {
|
2023-11-15 23:41:53 +08:00
|
|
|
props.value.splice(index, 1)
|
2023-11-13 22:31:18 +08:00
|
|
|
$message.success(i18n.t('dialogue.delete_key_succ', { key: row.k }))
|
2023-06-27 15:53:29 +08:00
|
|
|
} else {
|
2023-08-24 00:44:19 +08:00
|
|
|
$message.error(msg)
|
2023-06-27 15:53:29 +08:00
|
|
|
}
|
|
|
|
} catch (e) {
|
2023-08-24 00:44:19 +08:00
|
|
|
$message.error(e.message)
|
2023-06-27 15:53:29 +08:00
|
|
|
}
|
|
|
|
},
|
|
|
|
})
|
|
|
|
},
|
|
|
|
}
|
2023-11-13 15:28:13 +08:00
|
|
|
|
|
|
|
const columns = computed(() => {
|
|
|
|
if (!inEdit.value) {
|
|
|
|
return [
|
|
|
|
{
|
|
|
|
key: 'no',
|
|
|
|
title: '#',
|
|
|
|
width: 80,
|
|
|
|
align: 'center',
|
|
|
|
titleAlign: 'center',
|
2023-11-14 14:49:16 +08:00
|
|
|
render: (row, index) => {
|
2023-11-13 22:31:18 +08:00
|
|
|
return index + 1
|
|
|
|
},
|
2023-11-13 15:28:13 +08:00
|
|
|
},
|
|
|
|
fieldColumn,
|
|
|
|
valueColumn,
|
|
|
|
actionColumn,
|
|
|
|
]
|
|
|
|
} else {
|
|
|
|
return [
|
|
|
|
{
|
|
|
|
key: 'no',
|
|
|
|
title: '#',
|
|
|
|
width: 80,
|
|
|
|
align: 'center',
|
|
|
|
titleAlign: 'center',
|
2023-11-14 14:49:16 +08:00
|
|
|
render: (row, index) => {
|
2023-11-13 22:31:18 +08:00
|
|
|
if (index + 1 === currentEditRow.no) {
|
2023-11-13 15:28:13 +08:00
|
|
|
// editing row, show edit state
|
|
|
|
return h(NIcon, { size: 16, color: 'red' }, () => h(Edit, { strokeWidth: 5 }))
|
|
|
|
} else {
|
2023-11-13 22:31:18 +08:00
|
|
|
return index + 1
|
2023-11-13 15:28:13 +08:00
|
|
|
}
|
|
|
|
},
|
|
|
|
},
|
|
|
|
fieldColumn,
|
|
|
|
]
|
|
|
|
}
|
|
|
|
})
|
2023-06-27 15:53:29 +08:00
|
|
|
|
2023-11-13 22:31:18 +08:00
|
|
|
const rowProps = (row, index) => {
|
2023-11-13 15:28:13 +08:00
|
|
|
return {
|
|
|
|
onClick: () => {
|
|
|
|
// in edit mode, switch edit row by click
|
|
|
|
if (inEdit.value) {
|
2023-11-14 14:49:16 +08:00
|
|
|
startEdit(index + 1, row.k, row.v)
|
2023-11-13 15:28:13 +08:00
|
|
|
}
|
|
|
|
},
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2023-11-08 23:45:33 +08:00
|
|
|
const entries = computed(() => {
|
2023-11-13 22:31:18 +08:00
|
|
|
const len = size(props.value)
|
2023-11-08 23:45:33 +08:00
|
|
|
return `${len} / ${Math.max(len, props.length)}`
|
|
|
|
})
|
|
|
|
|
2023-06-27 15:53:29 +08:00
|
|
|
const onAddRow = () => {
|
2023-10-11 01:15:23 +08:00
|
|
|
dialogStore.openAddFieldsDialog(props.name, props.db, props.keyPath, props.keyCode, types.HASH)
|
2023-06-27 15:53:29 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
const filterValue = ref('')
|
|
|
|
const onFilterInput = (val) => {
|
|
|
|
switch (filterType.value) {
|
2023-11-14 14:49:16 +08:00
|
|
|
case filterOption[0].value:
|
2023-07-03 23:30:04 +08:00
|
|
|
// filter field
|
2023-06-27 15:53:29 +08:00
|
|
|
valueColumn.filterOptionValue = null
|
|
|
|
fieldColumn.filterOptionValue = val
|
|
|
|
break
|
2023-11-14 14:49:16 +08:00
|
|
|
case filterOption[1].value:
|
2023-07-03 23:30:04 +08:00
|
|
|
// filter value
|
2023-06-27 15:53:29 +08:00
|
|
|
fieldColumn.filterOptionValue = null
|
|
|
|
valueColumn.filterOptionValue = val
|
|
|
|
break
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
const onChangeFilterType = (type) => {
|
|
|
|
onFilterInput(filterValue.value)
|
|
|
|
}
|
|
|
|
|
|
|
|
const clearFilter = () => {
|
|
|
|
fieldColumn.filterOptionValue = null
|
|
|
|
valueColumn.filterOptionValue = null
|
|
|
|
}
|
|
|
|
|
|
|
|
const onUpdateFilter = (filters, sourceColumn) => {
|
|
|
|
switch (filterType.value) {
|
2023-11-14 14:49:16 +08:00
|
|
|
case filterOption[0].value:
|
2023-06-27 15:53:29 +08:00
|
|
|
fieldColumn.filterOptionValue = filters[sourceColumn.key]
|
|
|
|
break
|
2023-11-14 14:49:16 +08:00
|
|
|
case filterOption[1].value:
|
2023-06-27 15:53:29 +08:00
|
|
|
valueColumn.filterOptionValue = filters[sourceColumn.key]
|
|
|
|
break
|
|
|
|
}
|
|
|
|
}
|
2023-11-09 20:31:07 +08:00
|
|
|
|
2023-11-13 22:31:18 +08:00
|
|
|
const onFormatChanged = (selDecode, selFormat) => {
|
|
|
|
emit('reload', selDecode, selFormat)
|
|
|
|
}
|
|
|
|
|
2023-11-09 20:31:07 +08:00
|
|
|
defineExpose({
|
|
|
|
reset: () => {
|
|
|
|
clearFilter()
|
2023-11-13 15:28:13 +08:00
|
|
|
resetEdit()
|
2023-11-09 20:31:07 +08:00
|
|
|
},
|
|
|
|
})
|
2023-06-27 15:53:29 +08:00
|
|
|
</script>
|
|
|
|
|
|
|
|
<template>
|
|
|
|
<div class="content-wrapper flex-box-v">
|
2023-10-11 01:15:23 +08:00
|
|
|
<content-toolbar
|
2023-11-14 22:58:44 +08:00
|
|
|
v-show="!inFullEdit"
|
2023-10-11 01:15:23 +08:00
|
|
|
:db="props.db"
|
|
|
|
:key-code="props.keyCode"
|
2023-10-20 18:34:19 +08:00
|
|
|
:key-path="props.keyPath"
|
2023-10-11 01:15:23 +08:00
|
|
|
:key-type="keyType"
|
2023-11-08 23:45:33 +08:00
|
|
|
:loading="props.loading"
|
2023-10-11 01:15:23 +08:00
|
|
|
:server="props.name"
|
2023-10-30 00:54:45 +08:00
|
|
|
:ttl="ttl"
|
2023-11-08 23:45:33 +08:00
|
|
|
class="value-item-part"
|
|
|
|
@delete="emit('delete')"
|
|
|
|
@reload="emit('reload')"
|
|
|
|
@rename="emit('rename')" />
|
2023-11-14 22:58:44 +08:00
|
|
|
<div v-show="!inFullEdit" class="tb2 value-item-part flex-box-h">
|
2023-06-27 15:53:29 +08:00
|
|
|
<div class="flex-box-h">
|
|
|
|
<n-input-group>
|
|
|
|
<n-select
|
|
|
|
v-model:value="filterType"
|
|
|
|
:consistent-menu-width="false"
|
|
|
|
:options="filterOption"
|
|
|
|
style="width: 120px"
|
2023-08-24 15:23:25 +08:00
|
|
|
@update:value="onChangeFilterType" />
|
2023-06-27 15:53:29 +08:00
|
|
|
<n-input
|
|
|
|
v-model:value="filterValue"
|
2023-09-07 18:38:34 +08:00
|
|
|
:placeholder="$t('interface.search')"
|
2023-06-27 15:53:29 +08:00
|
|
|
clearable
|
|
|
|
@clear="clearFilter"
|
2023-08-24 15:23:25 +08:00
|
|
|
@update:value="onFilterInput" />
|
2023-06-27 15:53:29 +08:00
|
|
|
</n-input-group>
|
|
|
|
</div>
|
2023-10-30 00:54:45 +08:00
|
|
|
<div class="flex-item-expand"></div>
|
2023-11-08 23:45:33 +08:00
|
|
|
<n-button-group>
|
|
|
|
<icon-button
|
|
|
|
:disabled="props.end || props.loading"
|
|
|
|
:icon="LoadList"
|
|
|
|
border
|
|
|
|
size="18"
|
|
|
|
t-tooltip="interface.load_more_entries"
|
|
|
|
@click="emit('loadmore')" />
|
|
|
|
<icon-button
|
|
|
|
:disabled="props.end || props.loading"
|
|
|
|
:icon="LoadAll"
|
|
|
|
border
|
|
|
|
size="18"
|
|
|
|
t-tooltip="interface.load_all_entries"
|
|
|
|
@click="emit('loadall')" />
|
|
|
|
</n-button-group>
|
2023-10-20 18:34:19 +08:00
|
|
|
<n-button :focusable="false" plain @click="onAddRow">
|
2023-06-27 15:53:29 +08:00
|
|
|
<template #icon>
|
|
|
|
<n-icon :component="AddLink" size="18" />
|
|
|
|
</template>
|
2023-09-07 18:38:34 +08:00
|
|
|
{{ $t('interface.add_row') }}
|
2023-06-27 15:53:29 +08:00
|
|
|
</n-button>
|
|
|
|
</div>
|
2023-11-13 15:28:13 +08:00
|
|
|
<div id="content-table" class="value-wrapper value-item-part flex-box-h flex-item-expand">
|
|
|
|
<!-- table -->
|
2023-06-27 15:53:29 +08:00
|
|
|
<n-data-table
|
2023-11-13 15:28:13 +08:00
|
|
|
ref="tableRef"
|
2023-11-14 22:58:44 +08:00
|
|
|
v-show="!inFullEdit"
|
2023-10-20 18:34:19 +08:00
|
|
|
:bordered="false"
|
|
|
|
:bottom-bordered="false"
|
2023-06-27 15:53:29 +08:00
|
|
|
:columns="columns"
|
2023-11-13 22:31:18 +08:00
|
|
|
:data="props.value"
|
2023-11-08 23:45:33 +08:00
|
|
|
:loading="props.loading"
|
2023-11-13 15:28:13 +08:00
|
|
|
:row-props="rowProps"
|
2023-06-27 15:53:29 +08:00
|
|
|
:single-column="true"
|
|
|
|
:single-line="false"
|
2023-11-08 23:45:33 +08:00
|
|
|
class="flex-item-expand"
|
2023-06-27 15:53:29 +08:00
|
|
|
flex-height
|
|
|
|
size="small"
|
|
|
|
striped
|
|
|
|
virtual-scroll
|
2023-08-24 15:23:25 +08:00
|
|
|
@update:filters="onUpdateFilter" />
|
2023-11-13 15:28:13 +08:00
|
|
|
|
|
|
|
<!-- edit pane -->
|
|
|
|
<content-entry-editor
|
|
|
|
v-show="inEdit"
|
2023-11-14 22:58:44 +08:00
|
|
|
v-model:fullscreen="fullEdit"
|
2023-11-13 15:28:13 +08:00
|
|
|
:decode="currentEditRow.decode"
|
|
|
|
:field="currentEditRow.key"
|
2023-11-14 14:49:16 +08:00
|
|
|
:field-label="$t('common.field')"
|
2023-11-13 15:28:13 +08:00
|
|
|
:format="currentEditRow.format"
|
|
|
|
:value="currentEditRow.value"
|
|
|
|
:value-label="$t('common.value')"
|
|
|
|
class="flex-item-expand"
|
|
|
|
style="width: 100%"
|
2023-11-14 22:58:44 +08:00
|
|
|
@close="resetEdit"
|
2023-11-13 15:28:13 +08:00
|
|
|
@save="saveEdit" />
|
2023-06-27 15:53:29 +08:00
|
|
|
</div>
|
2023-10-30 00:54:45 +08:00
|
|
|
<div class="value-footer flex-box-h">
|
2023-11-08 23:45:33 +08:00
|
|
|
<n-text v-if="!isNaN(props.length)">{{ $t('interface.entries') }}: {{ entries }}</n-text>
|
2023-10-30 00:54:45 +08:00
|
|
|
<n-divider v-if="!isNaN(props.length)" vertical />
|
|
|
|
<n-text v-if="!isNaN(props.size)">{{ $t('interface.memory_usage') }}: {{ bytes(props.size) }}</n-text>
|
|
|
|
<div class="flex-item-expand"></div>
|
2023-11-13 22:31:18 +08:00
|
|
|
<format-selector
|
|
|
|
v-show="!inEdit"
|
|
|
|
:decode="props.decode"
|
|
|
|
:disabled="inEdit"
|
|
|
|
:format="props.format"
|
|
|
|
@format-changed="onFormatChanged" />
|
2023-10-30 00:54:45 +08:00
|
|
|
</div>
|
2023-06-27 15:53:29 +08:00
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
|
2023-10-30 00:54:45 +08:00
|
|
|
<style lang="scss" scoped>
|
|
|
|
.value-footer {
|
|
|
|
border-top: v-bind('themeVars.borderColor') 1px solid;
|
|
|
|
background-color: v-bind('themeVars.tableHeaderColor');
|
|
|
|
}
|
|
|
|
</style>
|