2
0
mirror of https://github.com/acepanel/panel.git synced 2026-02-07 10:37:14 +08:00

feat: alova.js替换axios

This commit is contained in:
耗子
2025-02-06 00:01:22 +08:00
parent 9a81c77167
commit 0b6eed5fed
15 changed files with 262 additions and 386 deletions

View File

@@ -1,11 +1,11 @@
import { request } from '@/utils'
import { http } from '@/utils'
export default {
// 列表
list: (page: number, limit: number): any =>
request.get('/apps/s3fs/mounts', { params: { page, limit } }),
mounts: (page: number, limit: number): any =>
http.Get('/apps/s3fs/mounts', { params: { page, limit } }),
// 添加
add: (data: any): any => request.post('/apps/s3fs/mounts', data),
add: (data: any): any => http.Post('/apps/s3fs/mounts', data),
// 删除
delete: (id: number): any => request.delete('/apps/s3fs/mounts', { data: { id } })
delete: (id: number): any => http.Delete('/apps/s3fs/mounts', { data: { id } })
}

View File

@@ -1,39 +1,38 @@
import { request } from '@/utils'
import { http } from '@/utils'
export default {
// 服务名称
service: (): any => request.get('/apps/supervisor/service'),
service: (): any => http.Get('/apps/supervisor/service'),
// 获取错误日志
log: (): any => request.get('/apps/supervisor/log'),
log: (): any => http.Get('/apps/supervisor/log'),
// 清空错误日志
clearLog: (): any => request.post('/apps/supervisor/clearLog'),
clearLog: (): any => http.Post('/apps/supervisor/clearLog'),
// 获取配置
config: (): any => request.get('/apps/supervisor/config'),
config: (): any => http.Get('/apps/supervisor/config'),
// 保存配置
saveConfig: (config: string): any => request.post('/apps/supervisor/config', { config }),
saveConfig: (config: string): any => http.Post('/apps/supervisor/config', { config }),
// 进程列表
processes: (page: number, limit: number): any =>
request.get('/apps/supervisor/processes', { params: { page, limit } }),
http.Get('/apps/supervisor/processes', { params: { page, limit } }),
// 进程启动
startProcess: (process: string): any =>
request.post(`/apps/supervisor/processes/${process}/start`),
startProcess: (process: string): any => http.Post(`/apps/supervisor/processes/${process}/start`),
// 进程停止
stopProcess: (process: string): any => request.post(`/apps/supervisor/processes/${process}/stop`),
stopProcess: (process: string): any => http.Post(`/apps/supervisor/processes/${process}/stop`),
// 进程重启
restartProcess: (process: string): any =>
request.post(`/apps/supervisor/processes/${process}/restart`),
http.Post(`/apps/supervisor/processes/${process}/restart`),
// 进程日志
processLog: (process: string): any => request.get(`/apps/supervisor/processes/${process}/log`),
processLog: (process: string): any => http.Get(`/apps/supervisor/processes/${process}/log`),
// 清空进程日志
clearProcessLog: (process: string): any =>
request.post(`/apps/supervisor/processes/${process}/clearLog`),
http.Post(`/apps/supervisor/processes/${process}/clearLog`),
// 进程配置
processConfig: (process: string): any => request.get(`/apps/supervisor/processes/${process}`),
processConfig: (process: string): any => http.Get(`/apps/supervisor/processes/${process}`),
// 保存进程配置
saveProcessConfig: (process: string, config: string): any =>
request.post(`/apps/supervisor/processes/${process}`, { config }),
http.Post(`/apps/supervisor/processes/${process}`, { config }),
// 创建进程
createProcess: (process: any): any => request.post('/apps/supervisor/processes', process),
createProcess: (process: any): any => http.Post('/apps/supervisor/processes', process),
// 删除进程
deleteProcess: (process: string): any => request.delete(`/apps/supervisor/processes/${process}`)
deleteProcess: (process: string): any => http.Delete(`/apps/supervisor/processes/${process}`)
}

View File

@@ -1,31 +1,31 @@
import { request } from '@/utils'
import { http } from '@/utils'
export default {
// DNS
dns: (): any => request.get('/apps/toolbox/dns'),
dns: (): any => http.Get('/apps/toolbox/dns'),
// 设置 DNS
updateDns: (dns1: string, dns2: string): any => request.post('/apps/toolbox/dns', { dns1, dns2 }),
updateDns: (dns1: string, dns2: string): any => http.Post('/apps/toolbox/dns', { dns1, dns2 }),
// SWAP
swap: (): any => request.get('/apps/toolbox/swap'),
swap: (): any => http.Get('/apps/toolbox/swap'),
// 设置 SWAP
updateSwap: (size: number): any => request.post('/apps/toolbox/swap', { size }),
updateSwap: (size: number): any => http.Post('/apps/toolbox/swap', { size }),
// 时区
timezone: (): any => request.get('/apps/toolbox/timezone'),
timezone: (): any => http.Get('/apps/toolbox/timezone'),
// 设置时区
updateTimezone: (timezone: string): any => request.post('/apps/toolbox/timezone', { timezone }),
updateTimezone: (timezone: string): any => http.Post('/apps/toolbox/timezone', { timezone }),
// 设置时间
updateTime: (time: string): any => request.post('/apps/toolbox/time', { time }),
updateTime: (time: string): any => http.Post('/apps/toolbox/time', { time }),
// 同步时间
syncTime: (): any => request.post('/apps/toolbox/syncTime'),
syncTime: (): any => http.Post('/apps/toolbox/syncTime'),
// 主机名
hostname: (): any => request.get('/apps/toolbox/hostname'),
hostname: (): any => http.Get('/apps/toolbox/hostname'),
// Hosts
hosts: (): any => request.get('/apps/toolbox/hosts'),
hosts: (): any => http.Get('/apps/toolbox/hosts'),
// 设置主机名
updateHostname: (hostname: string): any => request.post('/apps/toolbox/hostname', { hostname }),
updateHostname: (hostname: string): any => http.Post('/apps/toolbox/hostname', { hostname }),
// 设置 Hosts
updateHosts: (hosts: string): any => request.post('/apps/toolbox/hosts', { hosts }),
updateHosts: (hosts: string): any => http.Post('/apps/toolbox/hosts', { hosts }),
// 设置 Root 密码
updateRootPassword: (password: string): any =>
request.post('/apps/toolbox/rootPassword', { password })
http.Post('/apps/toolbox/rootPassword', { password })
}

View File

@@ -1,33 +1,33 @@
import { http, request } from '@/utils'
import { http } from '@/utils'
export default {
// 列表
list: (page: number, limit: number): any => request.get('/website', { params: { page, limit } }),
list: (page: number, limit: number): any => http.Get('/website', { params: { page, limit } }),
// 创建
create: (data: any): any => request.post('/website', data),
create: (data: any): any => http.Post('/website', data),
// 删除
delete: (id: number, path: boolean, db: boolean): any =>
request.delete(`/website/${id}`, { data: { path, db } }),
http.Delete(`/website/${id}`, { data: { path, db } }),
// 伪静态
rewrites: () => http.Get(`/website/rewrites`),
rewrites: (): any => http.Get(`/website/rewrites`),
// 获取默认配置
defaultConfig: (): any => request.get('/website/defaultConfig'),
defaultConfig: (): any => http.Get('/website/defaultConfig'),
// 保存默认配置
saveDefaultConfig: (index: string, stop: string): any =>
request.post('/website/defaultConfig', { index, stop }),
http.Post('/website/defaultConfig', { index, stop }),
// 网站配置
config: (id: number): any => request.get('/website/' + id),
config: (id: number): any => http.Get('/website/' + id),
// 保存网站配置
saveConfig: (id: number, data: any): any => request.put(`/website/${id}`, data),
saveConfig: (id: number, data: any): any => http.Put(`/website/${id}`, data),
// 清空日志
clearLog: (id: number): any => request.delete('/website/' + id + '/log'),
clearLog: (id: number): any => http.Delete('/website/' + id + '/log'),
// 更新备注
updateRemark: (id: number, remark: string): any =>
request.post(`/website/${id}` + '/updateRemark', { remark }),
http.Post(`/website/${id}` + '/updateRemark', { remark }),
// 重置配置
resetConfig: (id: number): any => request.post(`/website/${id}/resetConfig`),
resetConfig: (id: number): any => http.Post(`/website/${id}/resetConfig`),
// 修改状态
status: (id: number, status: boolean): any => request.post(`/website/${id}/status`, { status }),
status: (id: number, status: boolean): any => http.Post(`/website/${id}/status`, { status }),
// 签发证书
obtainCert: (id: number): any => request.post(`/website/${id}/obtainCert`)
obtainCert: (id: number): any => http.Post(`/website/${id}/obtainCert`)
}