2
0
mirror of https://github.com/acepanel/panel.git synced 2026-02-07 05:47:21 +08:00

refactor: 重命名openresty为nginx

This commit is contained in:
耗子
2024-10-12 19:13:33 +08:00
parent 6072332e1a
commit 86e4cff989
19 changed files with 64 additions and 76 deletions

View File

@@ -4,14 +4,14 @@ import { request } from '@/utils'
export default {
// 负载状态
load: (): Promise<AxiosResponse<any>> => request.get('/apps/openresty/load'),
load: (): Promise<AxiosResponse<any>> => request.get('/apps/nginx/load'),
// 获取配置
config: (): Promise<AxiosResponse<any>> => request.get('/apps/openresty/config'),
config: (): Promise<AxiosResponse<any>> => request.get('/apps/nginx/config'),
// 保存配置
saveConfig: (config: string): Promise<AxiosResponse<any>> =>
request.post('/apps/openresty/config', { config }),
request.post('/apps/nginx/config', { config }),
// 获取错误日志
errorLog: (): Promise<AxiosResponse<any>> => request.get('/apps/openresty/errorLog'),
errorLog: (): Promise<AxiosResponse<any>> => request.get('/apps/nginx/errorLog'),
// 清空错误日志
clearErrorLog: (): Promise<AxiosResponse<any>> => request.post('/apps/openresty/clearErrorLog')
clearErrorLog: (): Promise<AxiosResponse<any>> => request.post('/apps/nginx/clearErrorLog')
}

View File

@@ -15,7 +15,7 @@ export function createAppInstallGuard(router: Router) {
// 网站
if (to.path.startsWith('/website')) {
await app.isInstalled('openresty').then((res) => {
await app.isInstalled('nginx').then((res) => {
if (!res.data.installed) {
window.$message.error(`Web 服务器 ${res.data.name} 未安装`)
return router.push({ name: 'app-index' })

View File

@@ -2,7 +2,7 @@
import Editor from '@guolao/vue-monaco-editor'
import { NButton, NDataTable, NPopconfirm } from 'naive-ui'
import openresty from '@/api/apps/openresty'
import nginx from '@/api/apps/nginx'
import systemctl from '@/api/panel/systemctl'
const currentTab = ref('status')
@@ -27,39 +27,39 @@ const columns: any = [
const load = ref<any[]>([])
const getLoad = async () => {
const { data } = await openresty.load()
const { data } = await nginx.load()
return data
}
const getStatus = async () => {
await systemctl.status('openresty').then((res: any) => {
await systemctl.status('nginx').then((res: any) => {
status.value = res.data
})
}
const getIsEnabled = async () => {
await systemctl.isEnabled('openresty').then((res: any) => {
await systemctl.isEnabled('nginx').then((res: any) => {
isEnabled.value = res.data
})
}
const getErrorLog = async () => {
const { data } = await openresty.errorLog()
const { data } = await nginx.errorLog()
return data
}
const getConfig = async () => {
const { data } = await openresty.config()
const { data } = await nginx.config()
return data
}
const handleSaveConfig = async () => {
await openresty.saveConfig(config.value)
await nginx.saveConfig(config.value)
window.$message.success('保存成功')
}
const handleClearErrorLog = async () => {
await openresty.clearErrorLog()
await nginx.clearErrorLog()
getErrorLog().then((res) => {
errorLog.value = res
})
@@ -68,35 +68,35 @@ const handleClearErrorLog = async () => {
const handleIsEnabled = async () => {
if (isEnabled.value) {
await systemctl.enable('openresty')
await systemctl.enable('nginx')
window.$message.success('开启自启动成功')
} else {
await systemctl.disable('openresty')
await systemctl.disable('nginx')
window.$message.success('禁用自启动成功')
}
await getIsEnabled()
}
const handleStart = async () => {
await systemctl.start('openresty')
await systemctl.start('nginx')
window.$message.success('启动成功')
await getStatus()
}
const handleStop = async () => {
await systemctl.stop('openresty')
await systemctl.stop('nginx')
window.$message.success('停止成功')
await getStatus()
}
const handleRestart = async () => {
await systemctl.restart('openresty')
await systemctl.restart('nginx')
window.$message.success('重启成功')
await getStatus()
}
const handleReload = async () => {
await systemctl.reload('openresty')
await systemctl.reload('nginx')
window.$message.success('重载成功')
await getStatus()
}

View File

@@ -3,17 +3,17 @@ import type { RouteType } from '~/types/router'
const Layout = () => import('@/layout/IndexView.vue')
export default {
name: 'openresty',
path: '/apps/openresty',
name: 'nginx',
path: '/apps/nginx',
component: Layout,
isHidden: true,
children: [
{
name: 'apps-openresty-index',
name: 'apps-nginx-index',
path: '',
component: () => import('./IndexView.vue'),
meta: {
title: 'OpenResty',
title: 'OpenRestyNginx',
icon: 'mdi:server-network',
role: ['admin'],
requireAuth: true