mirror of
https://github.com/acepanel/panel.git
synced 2026-02-07 11:57:17 +08:00
feat: 提交部分前端翻译
This commit is contained in:
@@ -1,7 +1,9 @@
|
||||
<script setup lang="ts">
|
||||
import database from '@/api/panel/database'
|
||||
import { NButton, NInput } from 'naive-ui'
|
||||
import { useGettext } from 'vue3-gettext'
|
||||
|
||||
const { $gettext } = useGettext()
|
||||
const show = defineModel<boolean>('show', { type: Boolean, required: true })
|
||||
const createModel = ref({
|
||||
server_id: null,
|
||||
@@ -15,15 +17,15 @@ const createModel = ref({
|
||||
const servers = ref<{ label: string; value: string }[]>([])
|
||||
|
||||
const hostType = [
|
||||
{ label: '本地(localhost)', value: 'localhost' },
|
||||
{ label: '所有(%)', value: '%' },
|
||||
{ label: '指定', value: '' }
|
||||
{ label: $gettext('Local (localhost)'), value: 'localhost' },
|
||||
{ label: $gettext('All (%)'), value: '%' },
|
||||
{ label: $gettext('Specific'), value: '' }
|
||||
]
|
||||
|
||||
const handleCreate = () => {
|
||||
useRequest(() => database.create(createModel.value)).onSuccess(() => {
|
||||
show.value = false
|
||||
window.$message.success('创建成功')
|
||||
window.$message.success($gettext('Created successfully'))
|
||||
window.$bus.emit('database:refresh')
|
||||
})
|
||||
}
|
||||
@@ -49,7 +51,7 @@ watch(
|
||||
<n-modal
|
||||
v-model:show="show"
|
||||
preset="card"
|
||||
title="创建数据库"
|
||||
:title="$gettext('Create Database')"
|
||||
style="width: 60vw"
|
||||
size="huge"
|
||||
:bordered="false"
|
||||
@@ -57,72 +59,72 @@ watch(
|
||||
@close="show = false"
|
||||
>
|
||||
<n-form :model="createModel">
|
||||
<n-form-item path="server_id" label="服务器">
|
||||
<n-form-item path="server_id" :label="$gettext('Server')">
|
||||
<n-select
|
||||
v-model:value="createModel.server_id"
|
||||
@keydown.enter.prevent
|
||||
placeholder="选择服务器"
|
||||
:placeholder="$gettext('Select server')"
|
||||
:options="servers"
|
||||
/>
|
||||
</n-form-item>
|
||||
<n-form-item path="database" label="数据库名">
|
||||
<n-form-item path="database" :label="$gettext('Database Name')">
|
||||
<n-input
|
||||
v-model:value="createModel.name"
|
||||
type="text"
|
||||
@keydown.enter.prevent
|
||||
placeholder="输入数据库名称"
|
||||
:placeholder="$gettext('Enter database name')"
|
||||
/>
|
||||
</n-form-item>
|
||||
<n-form-item path="create_user" label="创建用户">
|
||||
<n-form-item path="create_user" :label="$gettext('Create User')">
|
||||
<n-switch v-model:value="createModel.create_user" />
|
||||
</n-form-item>
|
||||
<n-form-item v-if="!createModel.create_user" path="username" label="授权用户">
|
||||
<n-form-item v-if="!createModel.create_user" path="username" :label="$gettext('Authorized User')">
|
||||
<n-input
|
||||
v-model:value="createModel.username"
|
||||
type="text"
|
||||
@keydown.enter.prevent
|
||||
placeholder="输入授权用户名(留空不授权)"
|
||||
:placeholder="$gettext('Enter authorized username (leave empty for no authorization)')"
|
||||
/>
|
||||
</n-form-item>
|
||||
<n-form-item v-if="createModel.create_user" path="username" label="用户名">
|
||||
<n-form-item v-if="createModel.create_user" path="username" :label="$gettext('Username')">
|
||||
<n-input
|
||||
v-model:value="createModel.username"
|
||||
type="text"
|
||||
@keydown.enter.prevent
|
||||
placeholder="输入用户名"
|
||||
:placeholder="$gettext('Enter username')"
|
||||
/>
|
||||
</n-form-item>
|
||||
<n-form-item v-if="createModel.create_user" path="password" label="密码">
|
||||
<n-form-item v-if="createModel.create_user" path="password" :label="$gettext('Password')">
|
||||
<n-input
|
||||
v-model:value="createModel.password"
|
||||
type="password"
|
||||
show-password-on="click"
|
||||
@keydown.enter.prevent
|
||||
placeholder="输入密码"
|
||||
:placeholder="$gettext('Enter password')"
|
||||
/>
|
||||
</n-form-item>
|
||||
<n-form-item v-if="createModel.create_user" path="host-select" label="主机">
|
||||
<n-form-item v-if="createModel.create_user" path="host-select" :label="$gettext('Host')">
|
||||
<n-select
|
||||
v-model:value="createModel.host"
|
||||
@keydown.enter.prevent
|
||||
placeholder="选择主机"
|
||||
:placeholder="$gettext('Select host')"
|
||||
:options="hostType"
|
||||
/>
|
||||
</n-form-item>
|
||||
<n-form-item
|
||||
v-if="createModel.create_user && createModel.host === ''"
|
||||
path="host"
|
||||
label="指定主机"
|
||||
:label="$gettext('Specific Host')"
|
||||
>
|
||||
<n-input
|
||||
v-model:value="createModel.host"
|
||||
type="text"
|
||||
@keydown.enter.prevent
|
||||
placeholder="输入受支持的主机地址"
|
||||
:placeholder="$gettext('Enter supported host address')"
|
||||
/>
|
||||
</n-form-item>
|
||||
</n-form>
|
||||
<n-button type="info" block @click="handleCreate">提交</n-button>
|
||||
<n-button type="info" block @click="handleCreate">{{ $gettext('Submit') }}</n-button>
|
||||
</n-modal>
|
||||
</template>
|
||||
|
||||
|
||||
@@ -1,12 +1,15 @@
|
||||
<script setup lang="ts">
|
||||
import { renderIcon } from '@/utils'
|
||||
import { NButton, NInput, NPopconfirm, NTag } from 'naive-ui'
|
||||
import { useGettext } from 'vue3-gettext'
|
||||
|
||||
import database from '@/api/panel/database'
|
||||
|
||||
const { $gettext } = useGettext()
|
||||
|
||||
const columns: any = [
|
||||
{
|
||||
title: '类型',
|
||||
title: $gettext('Type'),
|
||||
key: 'type',
|
||||
width: 150,
|
||||
render(row: any) {
|
||||
@@ -29,19 +32,19 @@ const columns: any = [
|
||||
}
|
||||
},
|
||||
{
|
||||
title: '数据库名',
|
||||
title: $gettext('Database Name'),
|
||||
key: 'name',
|
||||
minWidth: 100,
|
||||
resizable: true,
|
||||
ellipsis: { tooltip: true }
|
||||
},
|
||||
{
|
||||
title: '服务器',
|
||||
title: $gettext('Server'),
|
||||
key: 'server',
|
||||
width: 150
|
||||
},
|
||||
{
|
||||
title: '编码',
|
||||
title: $gettext('Encoding'),
|
||||
key: 'encoding',
|
||||
width: 150,
|
||||
render(row: any) {
|
||||
@@ -51,7 +54,7 @@ const columns: any = [
|
||||
}
|
||||
},
|
||||
{
|
||||
title: '备注',
|
||||
title: $gettext('Comment'),
|
||||
key: 'comment',
|
||||
minWidth: 250,
|
||||
resizable: true,
|
||||
@@ -68,7 +71,7 @@ const columns: any = [
|
||||
}
|
||||
},
|
||||
{
|
||||
title: '操作',
|
||||
title: $gettext('Actions'),
|
||||
key: 'actions',
|
||||
width: 200,
|
||||
align: 'center',
|
||||
@@ -82,7 +85,7 @@ const columns: any = [
|
||||
},
|
||||
{
|
||||
default: () => {
|
||||
return '确定删除数据库吗?'
|
||||
return $gettext('Are you sure you want to delete this database?')
|
||||
},
|
||||
trigger: () => {
|
||||
return h(
|
||||
@@ -93,7 +96,7 @@ const columns: any = [
|
||||
style: 'margin-left: 15px;'
|
||||
},
|
||||
{
|
||||
default: () => '删除',
|
||||
default: () => $gettext('Delete'),
|
||||
icon: renderIcon('material-symbols:delete-outline', { size: 14 })
|
||||
}
|
||||
)
|
||||
@@ -118,13 +121,13 @@ const { loading, data, page, total, pageSize, pageCount, refresh } = usePaginati
|
||||
const handleDelete = (serverID: number, name: string) => {
|
||||
useRequest(database.delete(serverID, name)).onSuccess(() => {
|
||||
refresh()
|
||||
window.$message.success('删除成功')
|
||||
window.$message.success($gettext('Deleted successfully'))
|
||||
})
|
||||
}
|
||||
|
||||
const handleComment = (row: any) => {
|
||||
useRequest(database.comment(row.server_id, row.name, row.comment)).onSuccess(() => {
|
||||
window.$message.success('修改成功')
|
||||
window.$message.success($gettext('Modified successfully'))
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
@@ -10,7 +10,9 @@ import DatabaseList from '@/views/database/DatabaseList.vue'
|
||||
import ServerList from '@/views/database/ServerList.vue'
|
||||
import UserList from '@/views/database/UserList.vue'
|
||||
import { NButton } from 'naive-ui'
|
||||
import { useGettext } from 'vue3-gettext'
|
||||
|
||||
const { $gettext } = useGettext()
|
||||
const currentTab = ref('database')
|
||||
|
||||
const createDatabaseModalShow = ref(false)
|
||||
@@ -27,26 +29,26 @@ const createServerModalShow = ref(false)
|
||||
@click="createDatabaseModalShow = true"
|
||||
>
|
||||
<TheIcon :size="18" icon="material-symbols:add" />
|
||||
创建数据库
|
||||
{{ $gettext('Create Database') }}
|
||||
</n-button>
|
||||
<n-button v-if="currentTab === 'user'" type="primary" @click="createUserModalShow = true">
|
||||
<TheIcon :size="18" icon="material-symbols:add" />
|
||||
创建用户
|
||||
{{ $gettext('Create User') }}
|
||||
</n-button>
|
||||
<n-button v-if="currentTab === 'server'" type="primary" @click="createServerModalShow = true">
|
||||
<TheIcon :size="18" icon="material-symbols:add" />
|
||||
添加服务器
|
||||
{{ $gettext('Add Server') }}
|
||||
</n-button>
|
||||
</template>
|
||||
<n-flex vertical>
|
||||
<n-tabs v-model:value="currentTab" type="line" animated>
|
||||
<n-tab-pane name="database" tab="数据库">
|
||||
<n-tab-pane name="database" :tab="$gettext('Database')">
|
||||
<database-list />
|
||||
</n-tab-pane>
|
||||
<n-tab-pane name="user" tab="用户">
|
||||
<n-tab-pane name="user" :tab="$gettext('User')">
|
||||
<user-list />
|
||||
</n-tab-pane>
|
||||
<n-tab-pane name="server" tab="服务器">
|
||||
<n-tab-pane name="server" :tab="$gettext('Server')">
|
||||
<server-list />
|
||||
</n-tab-pane>
|
||||
</n-tabs>
|
||||
|
||||
@@ -2,17 +2,19 @@
|
||||
import { renderIcon } from '@/utils'
|
||||
import copy2clipboard from '@vavt/copy2clipboard'
|
||||
import { NButton, NInput, NInputGroup, NPopconfirm, NTag } from 'naive-ui'
|
||||
import { useGettext } from 'vue3-gettext'
|
||||
|
||||
import database from '@/api/panel/database'
|
||||
import { formatDateTime } from '@/utils'
|
||||
import UpdateServerModal from '@/views/database/UpdateServerModal.vue'
|
||||
|
||||
const { $gettext } = useGettext()
|
||||
const updateModal = ref(false)
|
||||
const updateID = ref(0)
|
||||
|
||||
const columns: any = [
|
||||
{
|
||||
title: '类型',
|
||||
title: $gettext('Type'),
|
||||
key: 'type',
|
||||
width: 150,
|
||||
render(row: any) {
|
||||
@@ -35,23 +37,23 @@ const columns: any = [
|
||||
}
|
||||
},
|
||||
{
|
||||
title: '名称',
|
||||
title: $gettext('Name'),
|
||||
key: 'name',
|
||||
minWidth: 100,
|
||||
resizable: true,
|
||||
ellipsis: { tooltip: true }
|
||||
},
|
||||
{
|
||||
title: '用户名',
|
||||
title: $gettext('Username'),
|
||||
key: 'username',
|
||||
width: 150,
|
||||
ellipsis: { tooltip: true },
|
||||
render(row: any) {
|
||||
return row.username || '无'
|
||||
return row.username || $gettext('None')
|
||||
}
|
||||
},
|
||||
{
|
||||
title: '密码',
|
||||
title: $gettext('Password'),
|
||||
key: 'password',
|
||||
width: 250,
|
||||
render(row: any) {
|
||||
@@ -62,7 +64,7 @@ const columns: any = [
|
||||
type: 'password',
|
||||
showPasswordOn: 'click',
|
||||
readonly: true,
|
||||
placeholder: '无'
|
||||
placeholder: $gettext('None')
|
||||
}),
|
||||
h(
|
||||
NButton,
|
||||
@@ -71,18 +73,18 @@ const columns: any = [
|
||||
ghost: true,
|
||||
onClick: () => {
|
||||
copy2clipboard(row.password).then(() => {
|
||||
window.$message.success('复制成功')
|
||||
window.$message.success($gettext('Copied successfully'))
|
||||
})
|
||||
}
|
||||
},
|
||||
{ default: () => '复制' }
|
||||
{ default: () => $gettext('Copy') }
|
||||
)
|
||||
]
|
||||
})
|
||||
}
|
||||
},
|
||||
{
|
||||
title: '主机',
|
||||
title: $gettext('Host'),
|
||||
key: 'host',
|
||||
width: 150,
|
||||
render(row: any) {
|
||||
@@ -92,7 +94,7 @@ const columns: any = [
|
||||
}
|
||||
},
|
||||
{
|
||||
title: '备注',
|
||||
title: $gettext('Comment'),
|
||||
key: 'remark',
|
||||
minWidth: 250,
|
||||
resizable: true,
|
||||
@@ -109,19 +111,19 @@ const columns: any = [
|
||||
}
|
||||
},
|
||||
{
|
||||
title: '状态',
|
||||
title: $gettext('Status'),
|
||||
key: 'status',
|
||||
width: 100,
|
||||
render(row: any) {
|
||||
return h(
|
||||
NTag,
|
||||
{ type: row.status === 'valid' ? 'success' : 'error' },
|
||||
{ default: () => (row.status === 'valid' ? '有效' : '无效') }
|
||||
{ default: () => (row.status === 'valid' ? $gettext('Valid') : $gettext('Invalid')) }
|
||||
)
|
||||
}
|
||||
},
|
||||
{
|
||||
title: '更新日期',
|
||||
title: $gettext('Update Date'),
|
||||
key: 'updated_at',
|
||||
width: 200,
|
||||
ellipsis: { tooltip: true },
|
||||
@@ -130,7 +132,7 @@ const columns: any = [
|
||||
}
|
||||
},
|
||||
{
|
||||
title: '操作',
|
||||
title: $gettext('Actions'),
|
||||
key: 'actions',
|
||||
width: 300,
|
||||
align: 'center',
|
||||
@@ -143,13 +145,13 @@ const columns: any = [
|
||||
onPositiveClick: () => {
|
||||
useRequest(database.serverSync(row.id)).onSuccess(() => {
|
||||
refresh()
|
||||
window.$message.success('同步成功')
|
||||
window.$message.success($gettext('Synchronized successfully'))
|
||||
})
|
||||
}
|
||||
},
|
||||
{
|
||||
default: () => {
|
||||
return '确定同步数据库用户(不包括密码)到面板?'
|
||||
return $gettext('Are you sure you want to synchronize database users (excluding password) to the panel?')
|
||||
},
|
||||
trigger: () => {
|
||||
return h(
|
||||
@@ -159,7 +161,7 @@ const columns: any = [
|
||||
type: 'success'
|
||||
},
|
||||
{
|
||||
default: () => '同步',
|
||||
default: () => $gettext('Sync'),
|
||||
icon: renderIcon('material-symbols:sync', { size: 14 })
|
||||
}
|
||||
)
|
||||
@@ -178,7 +180,7 @@ const columns: any = [
|
||||
}
|
||||
},
|
||||
{
|
||||
default: () => '修改',
|
||||
default: () => $gettext('Modify'),
|
||||
icon: renderIcon('material-symbols:edit-outline', { size: 14 })
|
||||
}
|
||||
),
|
||||
@@ -188,7 +190,7 @@ const columns: any = [
|
||||
onPositiveClick: () => {
|
||||
// 防手贱
|
||||
if (['local_mysql', 'local_postgresql'].includes(row.name)) {
|
||||
window.$message.error('内置服务器不能删除,如需删除请卸载对应应用')
|
||||
window.$message.error($gettext('Built-in servers cannot be deleted. If you need to delete them, please uninstall the corresponding application'))
|
||||
return
|
||||
}
|
||||
handleDelete(row.id)
|
||||
@@ -196,7 +198,7 @@ const columns: any = [
|
||||
},
|
||||
{
|
||||
default: () => {
|
||||
return '确定删除服务器吗?'
|
||||
return $gettext('Are you sure you want to delete the server?')
|
||||
},
|
||||
trigger: () => {
|
||||
return h(
|
||||
@@ -207,7 +209,7 @@ const columns: any = [
|
||||
style: 'margin-left: 15px;'
|
||||
},
|
||||
{
|
||||
default: () => '删除',
|
||||
default: () => $gettext('Delete'),
|
||||
icon: renderIcon('material-symbols:delete-outline', { size: 14 })
|
||||
}
|
||||
)
|
||||
@@ -232,13 +234,13 @@ const { loading, data, page, total, pageSize, pageCount, refresh } = usePaginati
|
||||
const handleDelete = (id: number) => {
|
||||
useRequest(database.serverDelete(id)).onSuccess(() => {
|
||||
refresh()
|
||||
window.$message.success('删除成功')
|
||||
window.$message.success($gettext('Deleted successfully'))
|
||||
})
|
||||
}
|
||||
|
||||
const handleRemark = (row: any) => {
|
||||
useRequest(database.serverRemark(row.id, row.remark)).onSuccess(() => {
|
||||
window.$message.success('修改成功')
|
||||
window.$message.success($gettext('Modified successfully'))
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user