2
0
mirror of https://github.com/acepanel/panel.git synced 2026-02-04 13:47:15 +08:00

feat: apache

This commit is contained in:
2026-01-13 00:39:34 +08:00
parent cd85032ecb
commit 02e0aef265
10 changed files with 317 additions and 4 deletions

View File

@@ -0,0 +1,14 @@
import { http } from '@/utils'
export default {
// 负载状态
load: (): any => http.Get('/apps/apache/load'),
// 获取配置
config: (): any => http.Get('/apps/apache/config'),
// 保存配置
saveConfig: (config: string): any => http.Post('/apps/apache/config', { config }),
// 获取错误日志
errorLog: (): any => http.Get('/apps/apache/error_log'),
// 清空错误日志
clearErrorLog: (): any => http.Post('/apps/apache/clear_error_log')
}

View File

@@ -0,0 +1,102 @@
<script setup lang="ts">
defineOptions({
name: 'apps-apache-index'
})
import { useGettext } from 'vue3-gettext'
import apache from '@/api/apps/apache'
import ServiceStatus from '@/components/common/ServiceStatus.vue'
const { $gettext } = useGettext()
const currentTab = ref('status')
const { data: config } = useRequest(apache.config, {
initialData: ''
})
const { data: errorLog } = useRequest(apache.errorLog, {
initialData: ''
})
const { data: load } = useRequest(apache.load, {
initialData: []
})
const columns: any = [
{
title: $gettext('Property'),
key: 'name',
minWidth: 200,
resizable: true,
ellipsis: { tooltip: true }
},
{
title: $gettext('Current Value'),
key: 'value',
minWidth: 200,
ellipsis: { tooltip: true }
}
]
const handleSaveConfig = () => {
useRequest(apache.saveConfig(config.value)).onSuccess(() => {
window.$message.success($gettext('Saved successfully'))
})
}
const handleClearErrorLog = () => {
useRequest(apache.clearErrorLog()).onSuccess(() => {
window.$message.success($gettext('Cleared successfully'))
})
}
</script>
<template>
<common-page show-footer>
<n-tabs v-model:value="currentTab" type="line" animated>
<n-tab-pane name="status" :tab="$gettext('Running Status')">
<service-status service="apache" show-reload />
</n-tab-pane>
<n-tab-pane name="config" :tab="$gettext('Modify Configuration')">
<n-flex vertical>
<n-alert type="warning">
{{
$gettext(
'This modifies the %{name} main configuration file. If you do not understand the meaning of each parameter, please do not modify it randomly!',
{ name: 'Apache' }
)
}}
</n-alert>
<common-editor v-model:value="config" lang="apache" height="60vh" />
<n-flex>
<n-button type="primary" @click="handleSaveConfig">
{{ $gettext('Save') }}
</n-button>
</n-flex>
</n-flex>
</n-tab-pane>
<n-tab-pane name="load" :tab="$gettext('Load Status')">
<n-data-table
striped
remote
:scroll-x="400"
:loading="false"
:columns="columns"
:data="load"
/>
</n-tab-pane>
<n-tab-pane name="run-log" :tab="$gettext('Runtime Logs')">
<realtime-log service="apache" />
</n-tab-pane>
<n-tab-pane name="error-log" :tab="$gettext('Error Logs')">
<n-flex vertical>
<n-flex>
<n-button type="primary" @click="handleClearErrorLog">
{{ $gettext('Clear Log') }}
</n-button>
</n-flex>
<realtime-log :path="errorLog" />
</n-flex>
</n-tab-pane>
</n-tabs>
</common-page>
</template>

View File

@@ -0,0 +1,22 @@
import type { RouteType } from '~/types/router'
const Layout = () => import('@/layout/IndexView.vue')
export default {
name: 'apache',
path: '/apps/apache',
component: Layout,
isHidden: true,
children: [
{
name: 'apps-apache-index',
path: '',
component: () => import('./IndexView.vue'),
meta: {
title: 'Apache',
role: ['admin'],
requireAuth: true
}
}
]
} as RouteType