Skip to content

Commit

Permalink
refactor: reorganized the structure of the multi-language content.
Browse files Browse the repository at this point in the history
  • Loading branch information
tiny-craft committed Sep 8, 2023
1 parent e15bf3a commit 9152a32
Show file tree
Hide file tree
Showing 41 changed files with 748 additions and 641 deletions.
7 changes: 5 additions & 2 deletions frontend/src/components/common/EditableTableColumn.vue
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,14 @@ const emit = defineEmits(['edit', 'delete', 'save', 'cancel'])
</div>
<div v-else class="flex-box-h edit-column-func">
<icon-button v-if="!props.readonly" :icon="Edit" @click="emit('edit')" />
<n-popconfirm :negative-text="$t('cancel')" :positive-text="$t('confirm')" @positive-click="emit('delete')">
<n-popconfirm
:negative-text="$t('common.cancel')"
:positive-text="$t('common.confirm')"
@positive-click="emit('delete')">
<template #trigger>
<icon-button :icon="Delete" />
</template>
{{ $t('remove_tip', { name: props.bindKey }) }}
{{ $t('dialogue.remove_tip', { name: props.bindKey }) }}
</n-popconfirm>
</div>
</template>
Expand Down
24 changes: 12 additions & 12 deletions frontend/src/components/content/ContentLogPane.vue
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ const filterServerOption = computed(() => {
value: server,
}))
options.splice(0, 0, {
label: i18n.t('all'),
label: i18n.t('common.all'),
value: '',
})
return options
Expand All @@ -45,15 +45,15 @@ const loadHistory = () => {
}
const cleanHistory = async () => {
$dialog.warning(i18n.t('confirm_clean_log'), () => {
$dialog.warning(i18n.t('log.confirm_clean_log'), () => {
data.loading = true
connectionStore
.cleanCmdHistory()
.then((success) => {
if (success) {
data.history = []
tableRef.value?.scrollTo({ top: 0 })
$message.success(i18n.t('success'))
$message.success(i18n.t('common.success'))
}
})
.finally(() => {
Expand All @@ -69,34 +69,34 @@ defineExpose({
<template>
<n-card
:title="$t('launch_log')"
:title="$t('log.launch_log')"
:bordered="false"
class="content-container flex-box-v"
content-style="display: flex;flex-direction: column; overflow: hidden;">
<n-form :disabled="data.loading" class="flex-item" inline>
<n-form-item :label="$t('filter_server')">
<n-form-item :label="$t('log.filter_server')">
<n-select
v-model:value="data.server"
:consistent-menu-width="false"
:options="filterServerOption"
style="min-width: 100px" />
</n-form-item>
<n-form-item :label="$t('filter_keyword')">
<n-form-item :label="$t('log.filter_keyword')">
<n-input v-model:value="data.keyword" clearable placeholder="" />
</n-form-item>
<n-form-item label="&nbsp;">
<icon-button :icon="Refresh" border t-tooltip="refresh" @click="loadHistory" />
<icon-button :icon="Refresh" border t-tooltip="log.refresh" @click="loadHistory" />
</n-form-item>
<n-form-item label="&nbsp;">
<icon-button :icon="Delete" border t-tooltip="clean_log" @click="cleanHistory" />
<icon-button :icon="Delete" border t-tooltip="log.clean_log" @click="cleanHistory" />
</n-form-item>
</n-form>
<div class="content-value fill-height flex-box-h">
<n-data-table
ref="tableRef"
:columns="[
{
title: $t('exec_time'),
title: $t('log.exec_time'),
key: 'timestamp',
defaultSortOrder: 'ascend',
sorter: 'default',
Expand All @@ -108,7 +108,7 @@ defineExpose({
},
},
{
title: $t('server'),
title: $t('log.server'),
key: 'server',
filterOptionValue: data.server,
filter(value, row) {
Expand All @@ -120,7 +120,7 @@ defineExpose({
ellipsis: true,
},
{
title: $t('cmd'),
title: $t('log.cmd'),
key: 'cmd',
titleAlign: 'center',
filterOptionValue: data.keyword,
Expand All @@ -130,7 +130,7 @@ defineExpose({
},
},
{
title: $t('cost_time'),
title: $t('log.cost_time'),
key: 'cost',
width: 100,
align: 'center',
Expand Down
4 changes: 2 additions & 2 deletions frontend/src/components/content/ContentPane.vue
Original file line number Diff line number Diff line change
Expand Up @@ -138,9 +138,9 @@ const onReloadKey = async () => {
@refresh="refreshInfo(true)" />
</div>
<div v-else-if="showNonexists" class="content-container flex-item-expand flex-box-v">
<n-empty :description="$t('nonexist_tab_content')" class="empty-content">
<n-empty :description="$t('interface.nonexist_tab_content')" class="empty-content">
<template #extra>
<n-button :focusable="false" @click="onReloadKey">{{ $t('reload') }}</n-button>
<n-button :focusable="false" @click="onReloadKey">{{ $t('interface.reload') }}</n-button>
</template>
</n-empty>
</div>
Expand Down
4 changes: 2 additions & 2 deletions frontend/src/components/content/ContentServerPane.vue
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,13 @@ const dialogStore = useDialogStore()
<template>
<div class="content-container flex-box-v">
<!-- TODO: replace icon to app icon -->
<n-empty :description="$t('empty_server_content')">
<n-empty :description="$t('interface.empty_server_content')">
<template #extra>
<n-button :focusable="false" @click="dialogStore.openNewDialog()">
<template #icon>
<n-icon :component="AddLink" size="18" />
</template>
{{ $t('new_conn') }}
{{ $t('interface.new_conn') }}
</n-button>
</template>
</n-empty>
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/components/content/ContentValueTab.vue
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ const tabStore = useTabStore()
const connectionStore = useConnectionStore()
const onCloseTab = (tabIndex) => {
$dialog.warning(i18n.t('close_confirm'), () => {
$dialog.warning(i18n.t('dialogue.close_confirm'), () => {
const tab = get(tabStore.tabs, tabIndex)
if (tab != null) {
connectionStore.closeConnection(tab.name)
Expand Down
20 changes: 10 additions & 10 deletions frontend/src/components/content_value/ContentServerStatus.vue
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ const role = computed(() => {
return get(props.info, 'Replication.role', '')
})
const timeUnit = ['unit_minute', 'unit_hour', 'unit_day']
const timeUnit = ['common.unit_minute', 'common.unit_hour', 'common.unit_day']
const uptime = computed(() => {
let seconds = get(props.info, 'Server.uptime_in_seconds', 0)
seconds /= 60
Expand Down Expand Up @@ -102,13 +102,13 @@ const infoFilter = ref('')
</template>
<template #header-extra>
<n-space align="center" inline>
{{ $t('auto_refresh') }}
{{ $t('status.auto_refresh') }}
<n-switch
:value="props.autoRefresh"
:loading="props.autoLoading"
@update:value="(v) => emit('update:autoRefresh', v)" />
<n-tooltip>
{{ $t('refresh') }}
{{ $t('status.refresh') }}
<template #trigger>
<n-button
circle
Expand All @@ -127,31 +127,31 @@ const infoFilter = ref('')
<n-spin :show="props.loading">
<n-grid style="min-width: 500px" x-gap="5">
<n-gi :span="6">
<n-statistic :label="$t('uptime')" :value="uptime[0]">
<n-statistic :label="$t('status.uptime')" :value="uptime[0]">
<template #suffix>{{ $t(uptime[1]) }}</template>
</n-statistic>
</n-gi>
<n-gi :span="6">
<n-statistic
:label="$t('connected_clients')"
:label="$t('status.connected_clients')"
:value="get(props.info, 'Clients.connected_clients', 0)" />
</n-gi>
<n-gi :span="6">
<n-statistic :value="totalKeys">
<template #label>
{{ $t('total_keys') }}
{{ $t('status.total_keys') }}
</template>
</n-statistic>
</n-gi>
<n-gi :span="6">
<n-statistic :label="$t('memory_used')" :value="usedMemory[0]">
<n-statistic :label="$t('status.memory_used')" :value="usedMemory[0]">
<template #suffix>{{ usedMemory[1] }}</template>
</n-statistic>
</n-gi>
</n-grid>
</n-spin>
</n-card>
<n-card :title="$t('all_info')">
<n-card :title="$t('status.all_info')">
<template #header-extra>
<n-input v-model:value="infoFilter" clearable placeholder="">
<template #prefix>
Expand All @@ -165,7 +165,7 @@ const infoFilter = ref('')
<n-data-table
:columns="[
{
title: $t('key'),
title: $t('common.key'),
key: 'key',
defaultSortOrder: 'ascend',
sorter: 'default',
Expand All @@ -175,7 +175,7 @@ const infoFilter = ref('')
return !!~row.key.indexOf(value.toString())
},
},
{ title: $t('value'), key: 'value' },
{ title: $t('common.value'), key: 'value' },
]"
:data="map(v, (value, key) => ({ value, key }))" />
</n-tab-pane>
Expand Down
18 changes: 9 additions & 9 deletions frontend/src/components/content_value/ContentToolbar.vue
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ const onCopyKey = () => {
ClipboardSetText(props.keyPath)
.then((succ) => {
if (succ) {
$message.success(i18n.t('copy_succ'))
$message.success(i18n.t('dialogue.copy_succ'))
}
})
.catch((e) => {
Expand All @@ -50,10 +50,10 @@ const onCopyKey = () => {
}
const onDeleteKey = () => {
$dialog.warning(i18n.t('remove_tip', { name: props.keyPath }), () => {
$dialog.warning(i18n.t('dialogue.remove_tip', { name: props.keyPath }), () => {
connectionStore.deleteKey(props.server, props.db, props.keyPath).then((success) => {
if (success) {
$message.success(i18n.t('delete_key_succ', { key: props.keyPath }))
$message.success(i18n.t('dialogue.delete_key_succ', { key: props.keyPath }))
}
})
})
Expand All @@ -66,10 +66,10 @@ const onDeleteKey = () => {
<redis-type-tag :type="props.keyType" size="large" />
<n-input v-model:value="props.keyPath">
<template #suffix>
<icon-button :icon="Refresh" size="18" t-tooltip="reload" @click="onReloadKey" />
<icon-button :icon="Refresh" size="18" t-tooltip="interface.reload" @click="onReloadKey" />
</template>
</n-input>
<icon-button :icon="Copy" border size="18" t-tooltip="copy_key" @click="onCopyKey" />
<icon-button :icon="Copy" border size="18" t-tooltip="interface.copy_key" @click="onCopyKey" />
</n-input-group>
<n-button-group>
<n-tooltip>
Expand All @@ -79,9 +79,9 @@ const onDeleteKey = () => {
<n-icon :component="Timer" size="18" />
</template>
<template v-if="ttl < 0">
{{ $t('forever') }}
{{ $t('interface.forever') }}
</template>
<template v-else>{{ ttl }} {{ $t('second') }}</template>
<template v-else>{{ ttl }} {{ $t('common.second') }}</template>
</n-button>
</template>
TTL
Expand All @@ -90,7 +90,7 @@ const onDeleteKey = () => {
:icon="Edit"
border
size="18"
t-tooltip="rename_key"
t-tooltip="interface.rename_key"
@click="dialogStore.openRenameKeyDialog(props.server, props.db, props.keyPath)" />
</n-button-group>
<n-tooltip>
Expand All @@ -101,7 +101,7 @@ const onDeleteKey = () => {
</template>
</n-button>
</template>
{{ $t('delete_key') }}
{{ $t('interface.delete_key') }}
</n-tooltip>
</div>
</template>
Expand Down
18 changes: 9 additions & 9 deletions frontend/src/components/content_value/ContentValueHash.vue
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,11 @@ const props = defineProps({
const filterOption = [
{
value: 1,
label: i18n.t('field'),
label: i18n.t('common.field'),
},
{
value: 2,
label: i18n.t('value'),
label: i18n.t('common.value'),
},
]
const filterType = ref(1)
Expand All @@ -43,7 +43,7 @@ const currentEditRow = ref({
})
const fieldColumn = reactive({
key: 'key',
title: i18n.t('field'),
title: i18n.t('common.field'),
align: 'center',
titleAlign: 'center',
resizable: true,
Expand All @@ -68,7 +68,7 @@ const fieldColumn = reactive({
})
const valueColumn = reactive({
key: 'value',
title: i18n.t('value'),
title: i18n.t('common.value'),
align: 'center',
titleAlign: 'center',
resizable: true,
Expand Down Expand Up @@ -99,7 +99,7 @@ const valueColumn = reactive({
})
const actionColumn = {
key: 'action',
title: i18n.t('action'),
title: i18n.t('interface.action'),
width: 100,
align: 'center',
titleAlign: 'center',
Expand All @@ -123,7 +123,7 @@ const actionColumn = {
)
if (success) {
connectionStore.loadKeyValue(props.name, props.db, props.keyPath).then((r) => {})
$message.success(i18n.t('delete_key_succ', { key: row.key }))
$message.success(i18n.t('dialogue.delete_key_succ', { key: row.key }))
// update display value
// if (!isEmpty(removed)) {
// for (const elem of removed) {
Expand All @@ -149,7 +149,7 @@ const actionColumn = {
)
if (success) {
connectionStore.loadKeyValue(props.name, props.db, props.keyPath).then((r) => {})
$message.success(i18n.t('save_value_succ'))
$message.success(i18n.t('dialogue.save_value_succ'))
// update display value
// if (!isEmpty(updated)) {
// for (const key in updated) {
Expand Down Expand Up @@ -251,7 +251,7 @@ const onUpdateFilter = (filters, sourceColumn) => {
@update:value="onChangeFilterType" />
<n-input
v-model:value="filterValue"
:placeholder="$t('search')"
:placeholder="$t('interface.search')"
clearable
@clear="clearFilter"
@update:value="onFilterInput" />
Expand All @@ -262,7 +262,7 @@ const onUpdateFilter = (filters, sourceColumn) => {
<template #icon>
<n-icon :component="AddLink" size="18" />
</template>
{{ $t('add_row') }}
{{ $t('interface.add_row') }}
</n-button>
</div>
<div class="value-wrapper fill-height flex-box-h">
Expand Down
Loading

0 comments on commit 9152a32

Please sign in to comment.