mirror of
https://github.com/acepanel/panel.git
synced 2026-02-04 07:57:21 +08:00
feat: 移动工具箱和跑分为独立应用
This commit is contained in:
@@ -1,6 +0,0 @@
|
||||
import { http } from '@/utils'
|
||||
|
||||
export default {
|
||||
// 运行评分
|
||||
test: (name: string, multi: boolean): any => http.Post('/apps/benchmark/test', { name, multi })
|
||||
}
|
||||
@@ -1,31 +0,0 @@
|
||||
import { http } from '@/utils'
|
||||
|
||||
export default {
|
||||
// DNS
|
||||
dns: (): any => http.Get('/apps/toolbox/dns'),
|
||||
// 设置 DNS
|
||||
updateDns: (dns1: string, dns2: string): any => http.Post('/apps/toolbox/dns', { dns1, dns2 }),
|
||||
// SWAP
|
||||
swap: (): any => http.Get('/apps/toolbox/swap'),
|
||||
// 设置 SWAP
|
||||
updateSwap: (size: number): any => http.Post('/apps/toolbox/swap', { size }),
|
||||
// 时区
|
||||
timezone: (): any => http.Get('/apps/toolbox/timezone'),
|
||||
// 设置时区
|
||||
updateTimezone: (timezone: string): any => http.Post('/apps/toolbox/timezone', { timezone }),
|
||||
// 设置时间
|
||||
updateTime: (time: string): any => http.Post('/apps/toolbox/time', { time }),
|
||||
// 同步时间
|
||||
syncTime: (): any => http.Post('/apps/toolbox/sync_time'),
|
||||
// 主机名
|
||||
hostname: (): any => http.Get('/apps/toolbox/hostname'),
|
||||
// Hosts
|
||||
hosts: (): any => http.Get('/apps/toolbox/hosts'),
|
||||
// 设置主机名
|
||||
updateHostname: (hostname: string): any => http.Post('/apps/toolbox/hostname', { hostname }),
|
||||
// 设置 Hosts
|
||||
updateHosts: (hosts: string): any => http.Post('/apps/toolbox/hosts', { hosts }),
|
||||
// 设置 Root 密码
|
||||
updateRootPassword: (password: string): any =>
|
||||
http.Post('/apps/toolbox/root_password', { password })
|
||||
}
|
||||
6
web/src/api/panel/toolbox-benchmark/index.ts
Normal file
6
web/src/api/panel/toolbox-benchmark/index.ts
Normal file
@@ -0,0 +1,6 @@
|
||||
import { http } from '@/utils'
|
||||
|
||||
export default {
|
||||
// 运行评分
|
||||
test: (name: string, multi: boolean): any => http.Post('/toolbox_benchmark/test', { name, multi })
|
||||
}
|
||||
31
web/src/api/panel/toolbox-system/index.ts
Normal file
31
web/src/api/panel/toolbox-system/index.ts
Normal file
@@ -0,0 +1,31 @@
|
||||
import { http } from '@/utils'
|
||||
|
||||
export default {
|
||||
// DNS
|
||||
dns: (): any => http.Get('/toolbox_system/dns'),
|
||||
// 设置 DNS
|
||||
updateDns: (dns1: string, dns2: string): any => http.Post('/toolbox_system/dns', { dns1, dns2 }),
|
||||
// SWAP
|
||||
swap: (): any => http.Get('/toolbox_system/swap'),
|
||||
// 设置 SWAP
|
||||
updateSwap: (size: number): any => http.Post('/toolbox_system/swap', { size }),
|
||||
// 时区
|
||||
timezone: (): any => http.Get('/toolbox_system/timezone'),
|
||||
// 设置时区
|
||||
updateTimezone: (timezone: string): any => http.Post('/toolbox_system/timezone', { timezone }),
|
||||
// 设置时间
|
||||
updateTime: (time: string): any => http.Post('/toolbox_system/time', { time }),
|
||||
// 同步时间
|
||||
syncTime: (): any => http.Post('/toolbox_system/sync_time'),
|
||||
// 主机名
|
||||
hostname: (): any => http.Get('/toolbox_system/hostname'),
|
||||
// Hosts
|
||||
hosts: (): any => http.Get('/toolbox_system/hosts'),
|
||||
// 设置主机名
|
||||
updateHostname: (hostname: string): any => http.Post('/toolbox_system/hostname', { hostname }),
|
||||
// 设置 Hosts
|
||||
updateHosts: (hosts: string): any => http.Post('/toolbox_system/hosts', { hosts }),
|
||||
// 设置 Root 密码
|
||||
updateRootPassword: (password: string): any =>
|
||||
http.Post('/toolbox_system/root_password', { password })
|
||||
}
|
||||
@@ -17,6 +17,9 @@ export function translateTitle(key: string): string {
|
||||
Settings: $gettext('Settings'),
|
||||
Terminal: $gettext('Terminal'),
|
||||
Tasks: $gettext('Tasks'),
|
||||
Toolbox: $gettext('Toolbox'),
|
||||
System: $gettext('System'),
|
||||
Benchmark: $gettext('Benchmark'),
|
||||
Website: $gettext('Website'),
|
||||
'Website Edit': $gettext('Website Edit'),
|
||||
// 应用标题
|
||||
@@ -24,9 +27,7 @@ export function translateTitle(key: string): string {
|
||||
'S3fs Manager': $gettext('S3fs Manager'),
|
||||
'Supervisor Manager': $gettext('Supervisor Manager'),
|
||||
'Rsync Manager': $gettext('Rsync Manager'),
|
||||
'Frp Manager': $gettext('Frp Manager'),
|
||||
'Rat Benchmark': $gettext('Rat Benchmark'),
|
||||
'System Toolbox': $gettext('System Toolbox')
|
||||
'Frp Manager': $gettext('Frp Manager')
|
||||
}
|
||||
|
||||
return titles[key] || key
|
||||
|
||||
@@ -1,23 +0,0 @@
|
||||
import type { RouteType } from '~/types/router'
|
||||
|
||||
const Layout = () => import('@/layout/IndexView.vue')
|
||||
|
||||
export default {
|
||||
name: 'benchmark',
|
||||
path: '/apps/benchmark',
|
||||
component: Layout,
|
||||
isHidden: true,
|
||||
children: [
|
||||
{
|
||||
name: 'apps-benchmark-index',
|
||||
path: '',
|
||||
component: () => import('./IndexView.vue'),
|
||||
meta: {
|
||||
title: 'Rat Benchmark',
|
||||
icon: 'dashicons:performance',
|
||||
role: ['admin'],
|
||||
requireAuth: true
|
||||
}
|
||||
}
|
||||
]
|
||||
} as RouteType
|
||||
@@ -1,23 +0,0 @@
|
||||
import type { RouteType } from '~/types/router'
|
||||
|
||||
const Layout = () => import('@/layout/IndexView.vue')
|
||||
|
||||
export default {
|
||||
name: 'toolbox',
|
||||
path: '/apps/toolbox',
|
||||
component: Layout,
|
||||
isHidden: true,
|
||||
children: [
|
||||
{
|
||||
name: 'apps-toolbox-index',
|
||||
path: '',
|
||||
component: () => import('./IndexView.vue'),
|
||||
meta: {
|
||||
title: 'System Toolbox',
|
||||
icon: 'mdi:tools',
|
||||
role: ['admin'],
|
||||
requireAuth: true
|
||||
}
|
||||
}
|
||||
]
|
||||
} as RouteType
|
||||
@@ -1,9 +1,9 @@
|
||||
<script setup lang="ts">
|
||||
defineOptions({
|
||||
name: 'apps-benchmark-index'
|
||||
name: 'toolbox-benchmark'
|
||||
})
|
||||
|
||||
import benchmark from '@/api/apps/benchmark'
|
||||
import benchmark from '@/api/panel/toolbox-benchmark'
|
||||
import TheIcon from '@/components/custom/TheIcon.vue'
|
||||
import { useGettext } from 'vue3-gettext'
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<script setup lang="ts">
|
||||
defineOptions({
|
||||
name: 'apps-toolbox-index'
|
||||
name: 'toolbox-system'
|
||||
})
|
||||
|
||||
import Editor from '@guolao/vue-monaco-editor'
|
||||
@@ -8,7 +8,7 @@ import { DateTime } from 'luxon'
|
||||
import { NButton } from 'naive-ui'
|
||||
import { useGettext } from 'vue3-gettext'
|
||||
|
||||
import toolbox from '@/api/apps/toolbox'
|
||||
import system from '@/api/panel/toolbox-system'
|
||||
|
||||
const { $gettext } = useGettext()
|
||||
const currentTab = ref('dns')
|
||||
@@ -25,65 +25,65 @@ const timezones = ref<any[]>([])
|
||||
const time = ref(DateTime.now().toMillis())
|
||||
const rootPassword = ref('')
|
||||
|
||||
useRequest(toolbox.dns()).onSuccess(({ data }) => {
|
||||
useRequest(system.dns()).onSuccess(({ data }) => {
|
||||
dns1.value = data[0]
|
||||
dns2.value = data[1]
|
||||
})
|
||||
useRequest(toolbox.swap()).onSuccess(({ data }) => {
|
||||
useRequest(system.swap()).onSuccess(({ data }) => {
|
||||
swap.value = data.size
|
||||
swapFree.value = data.free
|
||||
swapUsed.value = data.used
|
||||
swapTotal.value = data.total
|
||||
})
|
||||
useRequest(toolbox.hostname()).onSuccess(({ data }) => {
|
||||
useRequest(system.hostname()).onSuccess(({ data }) => {
|
||||
hostname.value = data
|
||||
})
|
||||
useRequest(toolbox.hosts()).onSuccess(({ data }) => {
|
||||
useRequest(system.hosts()).onSuccess(({ data }) => {
|
||||
hosts.value = data
|
||||
})
|
||||
useRequest(toolbox.timezone()).onSuccess(({ data }) => {
|
||||
useRequest(system.timezone()).onSuccess(({ data }) => {
|
||||
timezone.value = data.timezone
|
||||
timezones.value = data.timezones
|
||||
})
|
||||
|
||||
const handleUpdateDNS = () => {
|
||||
useRequest(toolbox.updateDns(dns1.value, dns2.value)).onSuccess(() => {
|
||||
useRequest(system.updateDns(dns1.value, dns2.value)).onSuccess(() => {
|
||||
window.$message.success($gettext('Saved successfully'))
|
||||
})
|
||||
}
|
||||
|
||||
const handleUpdateSwap = () => {
|
||||
useRequest(toolbox.updateSwap(swap.value)).onSuccess(() => {
|
||||
useRequest(system.updateSwap(swap.value)).onSuccess(() => {
|
||||
window.$message.success($gettext('Saved successfully'))
|
||||
})
|
||||
}
|
||||
|
||||
const handleUpdateHost = async () => {
|
||||
await Promise.all([
|
||||
useRequest(toolbox.updateHostname(hostname.value)),
|
||||
useRequest(toolbox.updateHosts(hosts.value))
|
||||
useRequest(system.updateHostname(hostname.value)),
|
||||
useRequest(system.updateHosts(hosts.value))
|
||||
]).then(() => {
|
||||
window.$message.success($gettext('Saved successfully'))
|
||||
})
|
||||
}
|
||||
|
||||
const handleUpdateRootPassword = () => {
|
||||
useRequest(toolbox.updateRootPassword(rootPassword.value)).onSuccess(() => {
|
||||
useRequest(system.updateRootPassword(rootPassword.value)).onSuccess(() => {
|
||||
window.$message.success($gettext('Saved successfully'))
|
||||
})
|
||||
}
|
||||
|
||||
const handleUpdateTime = async () => {
|
||||
await Promise.all([
|
||||
useRequest(toolbox.updateTime(String(DateTime.fromMillis(time.value).toISO()))),
|
||||
useRequest(toolbox.updateTimezone(timezone.value))
|
||||
useRequest(system.updateTime(String(DateTime.fromMillis(time.value).toISO()))),
|
||||
useRequest(system.updateTimezone(timezone.value))
|
||||
]).then(() => {
|
||||
window.$message.success($gettext('Saved successfully'))
|
||||
})
|
||||
}
|
||||
|
||||
const handleSyncTime = () => {
|
||||
useRequest(toolbox.syncTime()).onSuccess(() => {
|
||||
useRequest(system.syncTime()).onSuccess(() => {
|
||||
window.$message.success($gettext('Synchronized successfully'))
|
||||
})
|
||||
}
|
||||
36
web/src/views/toolbox/route.ts
Normal file
36
web/src/views/toolbox/route.ts
Normal file
@@ -0,0 +1,36 @@
|
||||
import type { RouteType } from '~/types/router'
|
||||
|
||||
const Layout = () => import('@/layout/IndexView.vue')
|
||||
|
||||
export default {
|
||||
name: 'toolbox',
|
||||
path: '/toolbox',
|
||||
component: Layout,
|
||||
meta: {
|
||||
title: 'Toolbox',
|
||||
icon: 'mdi:tools',
|
||||
order: 80
|
||||
},
|
||||
children: [
|
||||
{
|
||||
name: 'toolbox-system',
|
||||
path: 'system',
|
||||
component: () => import('./SystemView.vue'),
|
||||
meta: {
|
||||
title: 'System',
|
||||
role: ['admin'],
|
||||
requireAuth: true
|
||||
}
|
||||
},
|
||||
{
|
||||
name: 'toolbox-benchmark',
|
||||
path: 'benchmark',
|
||||
component: () => import('./BenchmarkView.vue'),
|
||||
meta: {
|
||||
title: 'Benchmark',
|
||||
role: ['admin'],
|
||||
requireAuth: true
|
||||
}
|
||||
}
|
||||
]
|
||||
} as RouteType
|
||||
Reference in New Issue
Block a user