mirror of
https://github.com/acepanel/panel.git
synced 2026-02-04 09:13:49 +08:00
feat: 前端重构1
This commit is contained in:
@@ -76,7 +76,7 @@ HAOZI_DL_URL="https://dl.cdn.haozi.net/panel"; curl -sSL -O ${HAOZI_DL_URL}/inst
|
||||
HAOZI_DL_URL="https://dl.cdn.haozi.net/panel"; curl -sSL -O ${HAOZI_DL_URL}/uninstall_panel.sh && curl -sSL -O ${HAOZI_DL_URL}/uninstall_panel.sh.checksum.txt && sha256sum -c uninstall_panel.sh.checksum.txt && bash uninstall_panel.sh || echo "Checksum 验证失败,文件可能被篡改,已终止操作"
|
||||
```
|
||||
|
||||
卸载面板前请务必备份好所有数据,提前卸载面板全部插件。卸载后数据将**无法恢复**!
|
||||
卸载面板前请务必备份好所有数据,提前卸载面板全部应用。卸载后数据将**无法恢复**!
|
||||
|
||||
## 日常维护
|
||||
|
||||
|
||||
@@ -76,7 +76,7 @@ const docTemplate = `{
|
||||
"tags": [
|
||||
"信息服务"
|
||||
],
|
||||
"summary": "首页插件",
|
||||
"summary": "首页应用",
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "OK",
|
||||
|
||||
@@ -69,7 +69,7 @@
|
||||
"tags": [
|
||||
"信息服务"
|
||||
],
|
||||
"summary": "首页插件",
|
||||
"summary": "首页应用",
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "OK",
|
||||
|
||||
@@ -69,7 +69,7 @@ paths:
|
||||
description: OK
|
||||
schema:
|
||||
$ref: '#/definitions/service.SuccessResponse'
|
||||
summary: 首页插件
|
||||
summary: 首页应用
|
||||
tags:
|
||||
- 信息服务
|
||||
/info/installedDbAndPhp:
|
||||
|
||||
@@ -20,7 +20,7 @@ func NewService() *Service {
|
||||
//
|
||||
// @Summary 获取配置
|
||||
// @Description 获取 Frp 配置
|
||||
// @Tags 插件-Frp
|
||||
// @Tags 应用-Frp
|
||||
// @Produce json
|
||||
// @Security BearerToken
|
||||
// @Param service query string false "服务"
|
||||
@@ -46,7 +46,7 @@ func (s *Service) GetConfig(w http.ResponseWriter, r *http.Request) {
|
||||
//
|
||||
// @Summary 更新配置
|
||||
// @Description 更新 Frp 配置
|
||||
// @Tags 插件-Frp
|
||||
// @Tags 应用-Frp
|
||||
// @Produce json
|
||||
// @Security BearerToken
|
||||
// @Param data body requests.UpdateConfig true "request"
|
||||
|
||||
@@ -19,7 +19,7 @@ func NewService() *Service {
|
||||
// GetConfig
|
||||
//
|
||||
// @Summary 获取配置
|
||||
// @Tags 插件-Gitea
|
||||
// @Tags 应用-Gitea
|
||||
// @Produce json
|
||||
// @Security BearerToken
|
||||
// @Success 200 {object} controllers.SuccessResponse
|
||||
@@ -37,7 +37,7 @@ func (s *Service) GetConfig(w http.ResponseWriter, r *http.Request) {
|
||||
// UpdateConfig
|
||||
//
|
||||
// @Summary 更新配置
|
||||
// @Tags 插件-Gitea
|
||||
// @Tags 应用-Gitea
|
||||
// @Produce json
|
||||
// @Security BearerToken
|
||||
// @Param data body requests.UpdateConfig true "request"
|
||||
|
||||
@@ -29,7 +29,7 @@ func NewService() *Service {
|
||||
// GetConfig
|
||||
//
|
||||
// @Summary 获取配置
|
||||
// @Tags 插件-OpenResty
|
||||
// @Tags 应用-OpenResty
|
||||
// @Produce json
|
||||
// @Security BearerToken
|
||||
// @Success 200 {object} h.SuccessResponse
|
||||
@@ -47,7 +47,7 @@ func (s *Service) GetConfig(w http.ResponseWriter, r *http.Request) {
|
||||
// SaveConfig
|
||||
//
|
||||
// @Summary 保存配置
|
||||
// @Tags 插件-OpenResty
|
||||
// @Tags 应用-OpenResty
|
||||
// @Produce json
|
||||
// @Security BearerToken
|
||||
// @Param config body string true "配置"
|
||||
@@ -74,7 +74,7 @@ func (s *Service) SaveConfig(w http.ResponseWriter, r *http.Request) {
|
||||
// ErrorLog
|
||||
//
|
||||
// @Summary 获取错误日志
|
||||
// @Tags 插件-OpenResty
|
||||
// @Tags 应用-OpenResty
|
||||
// @Produce json
|
||||
// @Security BearerToken
|
||||
// @Success 200 {object} h.SuccessResponse
|
||||
@@ -95,7 +95,7 @@ func (s *Service) ErrorLog(w http.ResponseWriter, r *http.Request) {
|
||||
// ClearErrorLog
|
||||
//
|
||||
// @Summary 清空错误日志
|
||||
// @Tags 插件-OpenResty
|
||||
// @Tags 应用-OpenResty
|
||||
// @Produce json
|
||||
// @Security BearerToken
|
||||
// @Success 200 {object} h.SuccessResponse
|
||||
@@ -111,7 +111,7 @@ func (s *Service) ClearErrorLog(w http.ResponseWriter, r *http.Request) {
|
||||
// Load
|
||||
//
|
||||
// @Summary 获取负载状态
|
||||
// @Tags 插件-OpenResty
|
||||
// @Tags 应用-OpenResty
|
||||
// @Produce json
|
||||
// @Security BearerToken
|
||||
// @Success 200 {object} h.SuccessResponse
|
||||
|
||||
@@ -35,7 +35,7 @@ func NewService(version uint) *Service {
|
||||
// GetConfig
|
||||
//
|
||||
// @Summary 获取配置
|
||||
// @Tags 插件-PHP
|
||||
// @Tags 应用-PHP
|
||||
// @Produce json
|
||||
// @Security BearerToken
|
||||
// @Param version path int true "PHP 版本"
|
||||
@@ -54,7 +54,7 @@ func (s *Service) GetConfig(w http.ResponseWriter, r *http.Request) {
|
||||
// UpdateConfig
|
||||
//
|
||||
// @Summary 保存配置
|
||||
// @Tags 插件-PHP
|
||||
// @Tags 应用-PHP
|
||||
// @Produce json
|
||||
// @Security BearerToken
|
||||
// @Param version path int true "PHP 版本"
|
||||
@@ -79,7 +79,7 @@ func (s *Service) UpdateConfig(w http.ResponseWriter, r *http.Request) {
|
||||
// GetFPMConfig
|
||||
//
|
||||
// @Summary 获取 FPM 配置
|
||||
// @Tags 插件-PHP
|
||||
// @Tags 应用-PHP
|
||||
// @Produce json
|
||||
// @Security BearerToken
|
||||
// @Param version path int true "PHP 版本"
|
||||
@@ -98,7 +98,7 @@ func (s *Service) GetFPMConfig(w http.ResponseWriter, r *http.Request) {
|
||||
// UpdateFPMConfig
|
||||
//
|
||||
// @Summary 保存 FPM 配置
|
||||
// @Tags 插件-PHP
|
||||
// @Tags 应用-PHP
|
||||
// @Produce json
|
||||
// @Security BearerToken
|
||||
// @Param version path int true "PHP 版本"
|
||||
@@ -123,7 +123,7 @@ func (s *Service) UpdateFPMConfig(w http.ResponseWriter, r *http.Request) {
|
||||
// Load
|
||||
//
|
||||
// @Summary 获取负载状态
|
||||
// @Tags 插件-PHP
|
||||
// @Tags 应用-PHP
|
||||
// @Produce json
|
||||
// @Security BearerToken
|
||||
// @Param version path int true "PHP 版本"
|
||||
@@ -159,7 +159,7 @@ func (s *Service) Load(w http.ResponseWriter, r *http.Request) {
|
||||
// ErrorLog
|
||||
//
|
||||
// @Summary 获取错误日志
|
||||
// @Tags 插件-PHP
|
||||
// @Tags 应用-PHP
|
||||
// @Produce json
|
||||
// @Security BearerToken
|
||||
// @Param version path int true "PHP 版本"
|
||||
@@ -173,7 +173,7 @@ func (s *Service) ErrorLog(w http.ResponseWriter, r *http.Request) {
|
||||
// SlowLog
|
||||
//
|
||||
// @Summary 获取慢日志
|
||||
// @Tags 插件-PHP
|
||||
// @Tags 应用-PHP
|
||||
// @Produce json
|
||||
// @Security BearerToken
|
||||
// @Param version path int true "PHP 版本"
|
||||
@@ -187,7 +187,7 @@ func (s *Service) SlowLog(w http.ResponseWriter, r *http.Request) {
|
||||
// ClearErrorLog
|
||||
//
|
||||
// @Summary 清空错误日志
|
||||
// @Tags 插件-PHP
|
||||
// @Tags 应用-PHP
|
||||
// @Produce json
|
||||
// @Security BearerToken
|
||||
// @Param version path int true "PHP 版本"
|
||||
@@ -205,7 +205,7 @@ func (s *Service) ClearErrorLog(w http.ResponseWriter, r *http.Request) {
|
||||
// ClearSlowLog
|
||||
//
|
||||
// @Summary 清空慢日志
|
||||
// @Tags 插件-PHP
|
||||
// @Tags 应用-PHP
|
||||
// @Produce json
|
||||
// @Security BearerToken
|
||||
// @Param version path int true "PHP 版本"
|
||||
@@ -223,7 +223,7 @@ func (s *Service) ClearSlowLog(w http.ResponseWriter, r *http.Request) {
|
||||
// ExtensionList
|
||||
//
|
||||
// @Summary 获取扩展列表
|
||||
// @Tags 插件-PHP
|
||||
// @Tags 应用-PHP
|
||||
// @Produce json
|
||||
// @Security BearerToken
|
||||
// @Param version path int true "PHP 版本"
|
||||
@@ -266,7 +266,7 @@ func (s *Service) ExtensionList(w http.ResponseWriter, r *http.Request) {
|
||||
// InstallExtension
|
||||
//
|
||||
// @Summary 安装扩展
|
||||
// @Tags 插件-PHP
|
||||
// @Tags 应用-PHP
|
||||
// @Produce json
|
||||
// @Security BearerToken
|
||||
// @Param version path int true "PHP 版本"
|
||||
@@ -307,7 +307,7 @@ func (s *Service) InstallExtension(w http.ResponseWriter, r *http.Request) {
|
||||
// UninstallExtension
|
||||
//
|
||||
// @Summary 卸载扩展
|
||||
// @Tags 插件-PHP
|
||||
// @Tags 应用-PHP
|
||||
// @Produce json
|
||||
// @Security BearerToken
|
||||
// @Param version path int true "PHP 版本"
|
||||
|
||||
@@ -25,7 +25,7 @@ func NewService() *Service {
|
||||
//
|
||||
// @Summary 列出模块
|
||||
// @Description 列出所有 Rsync 模块
|
||||
// @Tags 插件-Rsync
|
||||
// @Tags 应用-Rsync
|
||||
// @Produce json
|
||||
// @Security BearerToken
|
||||
// @Param data query commonrequests.Paginate true "request"
|
||||
@@ -100,7 +100,7 @@ func (s *Service) List(w http.ResponseWriter, r *http.Request) {
|
||||
//
|
||||
// @Summary 添加模块
|
||||
// @Description 添加 Rsync 模块
|
||||
// @Tags 插件-Rsync
|
||||
// @Tags 应用-Rsync
|
||||
// @Produce json
|
||||
// @Security BearerToken
|
||||
// @Param data body requests.Create true "request"
|
||||
@@ -155,7 +155,7 @@ secrets file = /etc/rsyncd.secrets
|
||||
//
|
||||
// @Summary 删除模块
|
||||
// @Description 删除 Rsync 模块
|
||||
// @Tags 插件-Rsync
|
||||
// @Tags 应用-Rsync
|
||||
// @Produce json
|
||||
// @Security BearerToken
|
||||
// @Param name path string true "模块名称"
|
||||
@@ -207,7 +207,7 @@ func (s *Service) Delete(w http.ResponseWriter, r *http.Request) {
|
||||
//
|
||||
// @Summary 更新模块
|
||||
// @Description 更新 Rsync 模块
|
||||
// @Tags 插件-Rsync
|
||||
// @Tags 应用-Rsync
|
||||
// @Produce json
|
||||
// @Security BearerToken
|
||||
// @Param name path string true "模块名称"
|
||||
@@ -274,7 +274,7 @@ secrets file = /etc/rsyncd.secrets
|
||||
//
|
||||
// @Summary 获取配置
|
||||
// @Description 获取 Rsync 配置
|
||||
// @Tags 插件-Rsync
|
||||
// @Tags 应用-Rsync
|
||||
// @Produce json
|
||||
// @Security BearerToken
|
||||
// @Success 200 {object} controllers.SuccessResponse
|
||||
@@ -293,7 +293,7 @@ func (s *Service) GetConfig(w http.ResponseWriter, r *http.Request) {
|
||||
//
|
||||
// @Summary 更新配置
|
||||
// @Description 更新 Rsync 配置
|
||||
// @Tags 插件-Rsync
|
||||
// @Tags 应用-Rsync
|
||||
// @Produce json
|
||||
// @Security BearerToken
|
||||
// @Param data body requests.UpdateConfig true "request"
|
||||
|
||||
@@ -266,16 +266,16 @@ func (r *appRepo) preCheck(app *api.App) error {
|
||||
var apps []string
|
||||
var installed []string
|
||||
|
||||
allPlugins := r.All()
|
||||
for _, p := range allPlugins {
|
||||
apps = append(apps, p.Slug)
|
||||
all := r.All()
|
||||
for _, item := range all {
|
||||
apps = append(apps, item.Slug)
|
||||
}
|
||||
installedPlugins, err := r.Installed()
|
||||
installedApps, err := r.Installed()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
for _, p := range installedPlugins {
|
||||
installed = append(installed, p.Slug)
|
||||
for _, item := range installedApps {
|
||||
installed = append(installed, item.Slug)
|
||||
}
|
||||
|
||||
env := map[string]any{
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
package request
|
||||
|
||||
type PluginSlug struct {
|
||||
type AppSlug struct {
|
||||
Slug string `json:"slug" form:"slug"`
|
||||
}
|
||||
|
||||
type PluginUpdateShow struct {
|
||||
type AppUpdateShow struct {
|
||||
Slug string `json:"slug" form:"slug"`
|
||||
Show bool `json:"show" form:"show"`
|
||||
}
|
||||
@@ -6,14 +6,14 @@ import (
|
||||
|
||||
type Paginate struct {
|
||||
Page uint `json:"page" form:"page" query:"page" validate:"required,number,gte=1"`
|
||||
Limit uint `json:"limit" form:"limit" query:"limit" validate:"required,number,gte=1,lte=1000"`
|
||||
Limit uint `json:"limit" form:"limit" query:"limit" validate:"required,number,gte=1,lte=10000"`
|
||||
}
|
||||
|
||||
func (r *Paginate) Messages(_ *http.Request) map[string]string {
|
||||
return map[string]string{
|
||||
"Page.gte": "页码必须大于或等于1",
|
||||
"Limit.gte": "每页数量必须大于或等于1",
|
||||
"Limit.lte": "每页数量必须小于或等于1000",
|
||||
"Limit.lte": "每页数量必须小于或等于10000",
|
||||
"Page.number": "页码必须是数字",
|
||||
"Limit.number": "每页数量必须是数字",
|
||||
"Page.required": "页码不能为空",
|
||||
|
||||
@@ -27,8 +27,8 @@ func Http(r chi.Router) {
|
||||
r.Route("/info", func(r chi.Router) {
|
||||
info := service.NewInfoService()
|
||||
r.Get("/panel", info.Panel)
|
||||
r.With(middleware.MustLogin).Get("/homePlugins", info.HomePlugins)
|
||||
r.With(middleware.MustLogin).Get("/nowMonitor", info.NowMonitor)
|
||||
r.With(middleware.MustLogin).Get("/homeApps", info.HomeApps)
|
||||
r.With(middleware.MustLogin).Get("/realtime", info.Realtime)
|
||||
r.With(middleware.MustLogin).Get("/systemInfo", info.SystemInfo)
|
||||
r.With(middleware.MustLogin).Get("/countInfo", info.CountInfo)
|
||||
r.With(middleware.MustLogin).Get("/installedDbAndPhp", info.InstalledDbAndPhp)
|
||||
|
||||
@@ -66,7 +66,7 @@ func (s *AppService) List(w http.ResponseWriter, r *http.Request) {
|
||||
}
|
||||
|
||||
func (s *AppService) Install(w http.ResponseWriter, r *http.Request) {
|
||||
req, err := Bind[request.PluginSlug](r)
|
||||
req, err := Bind[request.AppSlug](r)
|
||||
if err != nil {
|
||||
Error(w, http.StatusUnprocessableEntity, err.Error())
|
||||
return
|
||||
@@ -81,7 +81,7 @@ func (s *AppService) Install(w http.ResponseWriter, r *http.Request) {
|
||||
}
|
||||
|
||||
func (s *AppService) Uninstall(w http.ResponseWriter, r *http.Request) {
|
||||
req, err := Bind[request.PluginSlug](r)
|
||||
req, err := Bind[request.AppSlug](r)
|
||||
if err != nil {
|
||||
Error(w, http.StatusUnprocessableEntity, err.Error())
|
||||
return
|
||||
@@ -96,7 +96,7 @@ func (s *AppService) Uninstall(w http.ResponseWriter, r *http.Request) {
|
||||
}
|
||||
|
||||
func (s *AppService) Update(w http.ResponseWriter, r *http.Request) {
|
||||
req, err := Bind[request.PluginSlug](r)
|
||||
req, err := Bind[request.AppSlug](r)
|
||||
if err != nil {
|
||||
Error(w, http.StatusUnprocessableEntity, err.Error())
|
||||
return
|
||||
@@ -111,7 +111,7 @@ func (s *AppService) Update(w http.ResponseWriter, r *http.Request) {
|
||||
}
|
||||
|
||||
func (s *AppService) UpdateShow(w http.ResponseWriter, r *http.Request) {
|
||||
req, err := Bind[request.PluginUpdateShow](r)
|
||||
req, err := Bind[request.AppUpdateShow](r)
|
||||
if err != nil {
|
||||
Error(w, http.StatusUnprocessableEntity, err.Error())
|
||||
return
|
||||
@@ -126,7 +126,7 @@ func (s *AppService) UpdateShow(w http.ResponseWriter, r *http.Request) {
|
||||
}
|
||||
|
||||
func (s *AppService) IsInstalled(w http.ResponseWriter, r *http.Request) {
|
||||
req, err := Bind[request.PluginSlug](r)
|
||||
req, err := Bind[request.AppSlug](r)
|
||||
if err != nil {
|
||||
Error(w, http.StatusUnprocessableEntity, err.Error())
|
||||
return
|
||||
|
||||
@@ -56,33 +56,33 @@ func (s *InfoService) Panel(w http.ResponseWriter, r *http.Request) {
|
||||
})
|
||||
}
|
||||
|
||||
// HomePlugins
|
||||
// HomeApps
|
||||
//
|
||||
// @Summary 首页插件
|
||||
// @Summary 首页应用
|
||||
// @Tags 信息服务
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Success 200 {object} SuccessResponse
|
||||
// @Router /info/homePlugins [get]
|
||||
func (s *InfoService) HomePlugins(w http.ResponseWriter, r *http.Request) {
|
||||
// @Router /info/homeApps [get]
|
||||
func (s *InfoService) HomeApps(w http.ResponseWriter, r *http.Request) {
|
||||
apps, err := s.appRepo.GetHomeShow()
|
||||
if err != nil {
|
||||
Error(w, http.StatusInternalServerError, "获取首页插件失败")
|
||||
Error(w, http.StatusInternalServerError, "获取首页应用失败")
|
||||
return
|
||||
}
|
||||
|
||||
Success(w, apps)
|
||||
}
|
||||
|
||||
// NowMonitor
|
||||
// Realtime
|
||||
//
|
||||
// @Summary 实时监控
|
||||
// @Tags 信息服务
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Success 200 {object} SuccessResponse
|
||||
// @Router /info/nowMonitor [get]
|
||||
func (s *InfoService) NowMonitor(w http.ResponseWriter, r *http.Request) {
|
||||
// @Router /info/realtime [get]
|
||||
func (s *InfoService) Realtime(w http.ResponseWriter, r *http.Request) {
|
||||
Success(w, tools.GetMonitoringInfo())
|
||||
}
|
||||
|
||||
|
||||
@@ -46,7 +46,7 @@ func All() []*types.App {
|
||||
func Boot(r chi.Router) {
|
||||
apps.Range(func(_, app any) bool {
|
||||
if p, ok := app.(*types.App); ok {
|
||||
r.Route(fmt.Sprintf("/api/app/%s", p.Slug), p.Route)
|
||||
r.Route(fmt.Sprintf("/api/apps/%s", p.Slug), p.Route)
|
||||
}
|
||||
return true
|
||||
})
|
||||
|
||||
@@ -4,7 +4,7 @@ import "github.com/go-chi/chi/v5"
|
||||
|
||||
// App 应用元数据结构
|
||||
type App struct {
|
||||
Slug string `json:"slug"` // 插件标识
|
||||
Slug string `json:"slug"` // 应用标识
|
||||
Route func(r chi.Router) `json:"-"` // 路由
|
||||
}
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@ import Components from 'unplugin-vue-components/vite'
|
||||
import { NaiveUiResolver } from 'unplugin-vue-components/resolvers'
|
||||
|
||||
/**
|
||||
* * unplugin-icons插件,自动引入iconify图标
|
||||
* * unplugin-icons应用,自动引入iconify图标
|
||||
* usage: https://github.com/antfu/unplugin-icons
|
||||
* 图标库: https://icones.js.org/
|
||||
*/
|
||||
|
||||
@@ -4,21 +4,20 @@ import type { AxiosResponse } from 'axios'
|
||||
export default {
|
||||
// 保护列表
|
||||
jails: (page: number, limit: number): Promise<AxiosResponse<any>> =>
|
||||
request.get('/plugins/fail2ban/jails', { params: { page, limit } }),
|
||||
request.get('/apps/fail2ban/jails', { params: { page, limit } }),
|
||||
// 添加保护
|
||||
add: (data: any): Promise<AxiosResponse<any>> => request.post('/plugins/fail2ban/jails', data),
|
||||
add: (data: any): Promise<AxiosResponse<any>> => request.post('/apps/fail2ban/jails', data),
|
||||
// 删除保护
|
||||
delete: (name: string): Promise<AxiosResponse<any>> =>
|
||||
request.delete('/plugins/fail2ban/jails', { params: { name } }),
|
||||
request.delete('/apps/fail2ban/jails', { params: { name } }),
|
||||
// 封禁列表
|
||||
jail: (name: string): Promise<AxiosResponse<any>> =>
|
||||
request.get('/plugins/fail2ban/jails/' + name),
|
||||
jail: (name: string): Promise<AxiosResponse<any>> => request.get('/apps/fail2ban/jails/' + name),
|
||||
// 解封 IP
|
||||
unban: (name: string, ip: string): Promise<AxiosResponse<any>> =>
|
||||
request.post('/plugins/fail2ban/unban', { name, ip }),
|
||||
request.post('/apps/fail2ban/unban', { name, ip }),
|
||||
// 获取白名单
|
||||
whitelist: (): Promise<AxiosResponse<any>> => request.get('/plugins/fail2ban/whiteList'),
|
||||
whitelist: (): Promise<AxiosResponse<any>> => request.get('/apps/fail2ban/whiteList'),
|
||||
// 设置白名单
|
||||
setWhitelist: (ip: string): Promise<AxiosResponse<any>> =>
|
||||
request.post('/plugins/fail2ban/whiteList', { ip })
|
||||
request.post('/apps/fail2ban/whiteList', { ip })
|
||||
}
|
||||
@@ -4,8 +4,8 @@ import type { AxiosResponse } from 'axios'
|
||||
export default {
|
||||
// 获取配置
|
||||
config: (service: string): Promise<AxiosResponse<any>> =>
|
||||
request.get('/plugins/frp/config', { params: { service } }),
|
||||
request.get('/apps/frp/config', { params: { service } }),
|
||||
// 保存配置
|
||||
saveConfig: (service: string, config: string): Promise<AxiosResponse<any>> =>
|
||||
request.post('/plugins/frp/config', { service, config })
|
||||
request.post('/apps/frp/config', { service, config })
|
||||
}
|
||||
@@ -3,8 +3,8 @@ import type { AxiosResponse } from 'axios'
|
||||
|
||||
export default {
|
||||
// 获取配置
|
||||
config: (): Promise<AxiosResponse<any>> => request.get('/plugins/gitea/config'),
|
||||
config: (): Promise<AxiosResponse<any>> => request.get('/apps/gitea/config'),
|
||||
// 保存配置
|
||||
saveConfig: (config: string): Promise<AxiosResponse<any>> =>
|
||||
request.post('/plugins/gitea/config', { config })
|
||||
request.post('/apps/gitea/config', { config })
|
||||
}
|
||||
@@ -3,61 +3,61 @@ import type { AxiosResponse } from 'axios'
|
||||
|
||||
export default {
|
||||
// 负载状态
|
||||
load: (): Promise<AxiosResponse<any>> => request.get('/plugins/mysql/load'),
|
||||
load: (): Promise<AxiosResponse<any>> => request.get('/apps/mysql/load'),
|
||||
// 获取配置
|
||||
config: (): Promise<AxiosResponse<any>> => request.get('/plugins/mysql/config'),
|
||||
config: (): Promise<AxiosResponse<any>> => request.get('/apps/mysql/config'),
|
||||
// 保存配置
|
||||
saveConfig: (config: string): Promise<AxiosResponse<any>> =>
|
||||
request.post('/plugins/mysql/config', { config }),
|
||||
request.post('/apps/mysql/config', { config }),
|
||||
// 获取错误日志
|
||||
errorLog: (): Promise<AxiosResponse<any>> => request.get('/plugins/mysql/errorLog'),
|
||||
errorLog: (): Promise<AxiosResponse<any>> => request.get('/apps/mysql/errorLog'),
|
||||
// 清空错误日志
|
||||
clearErrorLog: (): Promise<AxiosResponse<any>> => request.post('/plugins/mysql/clearErrorLog'),
|
||||
clearErrorLog: (): Promise<AxiosResponse<any>> => request.post('/apps/mysql/clearErrorLog'),
|
||||
// 获取慢查询日志
|
||||
slowLog: (): Promise<AxiosResponse<any>> => request.get('/plugins/mysql/slowLog'),
|
||||
slowLog: (): Promise<AxiosResponse<any>> => request.get('/apps/mysql/slowLog'),
|
||||
// 清空慢查询日志
|
||||
clearSlowLog: (): Promise<AxiosResponse<any>> => request.post('/plugins/mysql/clearSlowLog'),
|
||||
clearSlowLog: (): Promise<AxiosResponse<any>> => request.post('/apps/mysql/clearSlowLog'),
|
||||
// 获取 root 密码
|
||||
rootPassword: (): Promise<AxiosResponse<any>> => request.get('/plugins/mysql/rootPassword'),
|
||||
rootPassword: (): Promise<AxiosResponse<any>> => request.get('/apps/mysql/rootPassword'),
|
||||
// 修改 root 密码
|
||||
setRootPassword: (password: string): Promise<AxiosResponse<any>> =>
|
||||
request.post('/plugins/mysql/rootPassword', { password }),
|
||||
request.post('/apps/mysql/rootPassword', { password }),
|
||||
// 数据库列表
|
||||
databases: (page: number, limit: number): Promise<AxiosResponse<any>> =>
|
||||
request.get('/plugins/mysql/databases', { params: { page, limit } }),
|
||||
request.get('/apps/mysql/databases', { params: { page, limit } }),
|
||||
// 创建数据库
|
||||
addDatabase: (database: any): Promise<AxiosResponse<any>> =>
|
||||
request.post('/plugins/mysql/databases', database),
|
||||
request.post('/apps/mysql/databases', database),
|
||||
// 删除数据库
|
||||
deleteDatabase: (database: string): Promise<AxiosResponse<any>> =>
|
||||
request.delete('/plugins/mysql/databases', { params: { database } }),
|
||||
request.delete('/apps/mysql/databases', { params: { database } }),
|
||||
// 备份列表
|
||||
backups: (page: number, limit: number): Promise<AxiosResponse<any>> =>
|
||||
request.get('/plugins/mysql/backups', { params: { page, limit } }),
|
||||
request.get('/apps/mysql/backups', { params: { page, limit } }),
|
||||
// 创建备份
|
||||
createBackup: (database: string): Promise<AxiosResponse<any>> =>
|
||||
request.post('/plugins/mysql/backups', { database }),
|
||||
request.post('/apps/mysql/backups', { database }),
|
||||
// 上传备份
|
||||
uploadBackup: (backup: any): Promise<AxiosResponse<any>> =>
|
||||
request.put('/plugins/mysql/backups', backup),
|
||||
request.put('/apps/mysql/backups', backup),
|
||||
// 删除备份
|
||||
deleteBackup: (name: string): Promise<AxiosResponse<any>> =>
|
||||
request.delete('/plugins/mysql/backups', { params: { name } }),
|
||||
request.delete('/apps/mysql/backups', { params: { name } }),
|
||||
// 还原备份
|
||||
restoreBackup: (backup: string, database: string): Promise<AxiosResponse<any>> =>
|
||||
request.post('/plugins/mysql/backups/restore', { backup, database }),
|
||||
request.post('/apps/mysql/backups/restore', { backup, database }),
|
||||
// 用户列表
|
||||
users: (page: number, limit: number): Promise<AxiosResponse<any>> =>
|
||||
request.get('/plugins/mysql/users', { params: { page, limit } }),
|
||||
request.get('/apps/mysql/users', { params: { page, limit } }),
|
||||
// 创建用户
|
||||
addUser: (user: any): Promise<AxiosResponse<any>> => request.post('/plugins/mysql/users', user),
|
||||
addUser: (user: any): Promise<AxiosResponse<any>> => request.post('/apps/mysql/users', user),
|
||||
// 删除用户
|
||||
deleteUser: (user: string): Promise<AxiosResponse<any>> =>
|
||||
request.delete('/plugins/mysql/users', { params: { user } }),
|
||||
request.delete('/apps/mysql/users', { params: { user } }),
|
||||
// 设置用户密码
|
||||
setUserPassword: (user: string, password: string): Promise<AxiosResponse<any>> =>
|
||||
request.post('/plugins/mysql/users/password', { user, password }),
|
||||
request.post('/apps/mysql/users/password', { user, password }),
|
||||
// 设置用户权限
|
||||
setUserPrivileges: (user: string, database: string): Promise<AxiosResponse<any>> =>
|
||||
request.post('/plugins/mysql/users/privileges', { user, database })
|
||||
request.post('/apps/mysql/users/privileges', { user, database })
|
||||
}
|
||||
16
web/src/api/apps/openresty/index.ts
Normal file
16
web/src/api/apps/openresty/index.ts
Normal file
@@ -0,0 +1,16 @@
|
||||
import { request } from '@/utils'
|
||||
import type { AxiosResponse } from 'axios'
|
||||
|
||||
export default {
|
||||
// 负载状态
|
||||
load: (): Promise<AxiosResponse<any>> => request.get('/apps/openresty/load'),
|
||||
// 获取配置
|
||||
config: (): Promise<AxiosResponse<any>> => request.get('/apps/openresty/config'),
|
||||
// 保存配置
|
||||
saveConfig: (config: string): Promise<AxiosResponse<any>> =>
|
||||
request.post('/apps/openresty/config', { config }),
|
||||
// 获取错误日志
|
||||
errorLog: (): Promise<AxiosResponse<any>> => request.get('/apps/openresty/errorLog'),
|
||||
// 清空错误日志
|
||||
clearErrorLog: (): Promise<AxiosResponse<any>> => request.post('/apps/openresty/clearErrorLog')
|
||||
}
|
||||
@@ -3,39 +3,38 @@ import type { AxiosResponse } from 'axios'
|
||||
|
||||
export default {
|
||||
// 负载状态
|
||||
load: (version: number): Promise<AxiosResponse<any>> =>
|
||||
request.get(`/plugins/php/${version}/load`),
|
||||
load: (version: number): Promise<AxiosResponse<any>> => request.get(`/apps/php/${version}/load`),
|
||||
// 获取配置
|
||||
config: (version: number): Promise<AxiosResponse<any>> =>
|
||||
request.get(`/plugins/php/${version}/config`),
|
||||
request.get(`/apps/php/${version}/config`),
|
||||
// 保存配置
|
||||
saveConfig: (version: number, config: string): Promise<AxiosResponse<any>> =>
|
||||
request.post(`/plugins/php/${version}/config`, { config }),
|
||||
request.post(`/apps/php/${version}/config`, { config }),
|
||||
// 获取FPM配置
|
||||
fpmConfig: (version: number): Promise<AxiosResponse<any>> =>
|
||||
request.get(`/plugins/php/${version}/fpmConfig`),
|
||||
request.get(`/apps/php/${version}/fpmConfig`),
|
||||
// 保存FPM配置
|
||||
saveFPMConfig: (version: number, config: string): Promise<AxiosResponse<any>> =>
|
||||
request.post(`/plugins/php/${version}/fpmConfig`, { config }),
|
||||
request.post(`/apps/php/${version}/fpmConfig`, { config }),
|
||||
// 获取错误日志
|
||||
errorLog: (version: number): Promise<AxiosResponse<any>> =>
|
||||
request.get(`/plugins/php/${version}/errorLog`),
|
||||
request.get(`/apps/php/${version}/errorLog`),
|
||||
// 清空错误日志
|
||||
clearErrorLog: (version: number): Promise<AxiosResponse<any>> =>
|
||||
request.post(`/plugins/php/${version}/clearErrorLog`),
|
||||
request.post(`/apps/php/${version}/clearErrorLog`),
|
||||
// 获取慢日志
|
||||
slowLog: (version: number): Promise<AxiosResponse<any>> =>
|
||||
request.get(`/plugins/php/${version}/slowLog`),
|
||||
request.get(`/apps/php/${version}/slowLog`),
|
||||
// 清空慢日志
|
||||
clearSlowLog: (version: number): Promise<AxiosResponse<any>> =>
|
||||
request.post(`/plugins/php/${version}/clearSlowLog`),
|
||||
request.post(`/apps/php/${version}/clearSlowLog`),
|
||||
// 拓展列表
|
||||
extensions: (version: number): Promise<AxiosResponse<any>> =>
|
||||
request.get(`/plugins/php/${version}/extensions`),
|
||||
request.get(`/apps/php/${version}/extensions`),
|
||||
// 安装拓展
|
||||
installExtension: (version: number, slug: string): Promise<AxiosResponse<any>> =>
|
||||
request.post(`/plugins/php/${version}/extensions`, { slug }),
|
||||
request.post(`/apps/php/${version}/extensions`, { slug }),
|
||||
// 卸载拓展
|
||||
uninstallExtension: (version: number, slug: string): Promise<AxiosResponse<any>> =>
|
||||
request.delete(`/plugins/php/${version}/extensions`, { params: { slug } })
|
||||
request.delete(`/apps/php/${version}/extensions`, { params: { slug } })
|
||||
}
|
||||
15
web/src/api/apps/phpmyadmin/index.ts
Normal file
15
web/src/api/apps/phpmyadmin/index.ts
Normal file
@@ -0,0 +1,15 @@
|
||||
import { request } from '@/utils'
|
||||
import type { AxiosResponse } from 'axios'
|
||||
|
||||
export default {
|
||||
// 获取信息
|
||||
info: (): Promise<AxiosResponse<any>> => request.get('/apps/phpmyadmin/info'),
|
||||
// 设置端口
|
||||
port: (port: number): Promise<AxiosResponse<any>> =>
|
||||
request.post('/apps/phpmyadmin/port', { port }),
|
||||
// 获取配置
|
||||
getConfig: (): Promise<AxiosResponse<any>> => request.get('/apps/phpmyadmin/config'),
|
||||
// 保存配置
|
||||
saveConfig: (config: string): Promise<AxiosResponse<any>> =>
|
||||
request.post('/apps/phpmyadmin/config', { config })
|
||||
}
|
||||
@@ -3,13 +3,13 @@ import type { AxiosResponse } from 'axios'
|
||||
|
||||
export default {
|
||||
// 获取注册表配置
|
||||
registryConfig: (): Promise<AxiosResponse<any>> => request.get('/plugins/podman/registryConfig'),
|
||||
registryConfig: (): Promise<AxiosResponse<any>> => request.get('/apps/podman/registryConfig'),
|
||||
// 保存注册表配置
|
||||
saveRegistryConfig: (config: string): Promise<AxiosResponse<any>> =>
|
||||
request.post('/plugins/podman/registryConfig', { config }),
|
||||
request.post('/apps/podman/registryConfig', { config }),
|
||||
// 获取存储配置
|
||||
storageConfig: (): Promise<AxiosResponse<any>> => request.get('/plugins/podman/storageConfig'),
|
||||
storageConfig: (): Promise<AxiosResponse<any>> => request.get('/apps/podman/storageConfig'),
|
||||
// 保存存储配置
|
||||
saveStorageConfig: (config: string): Promise<AxiosResponse<any>> =>
|
||||
request.post('/plugins/podman/storageConfig', { config })
|
||||
request.post('/apps/podman/storageConfig', { config })
|
||||
}
|
||||
56
web/src/api/apps/postgresql/index.ts
Normal file
56
web/src/api/apps/postgresql/index.ts
Normal file
@@ -0,0 +1,56 @@
|
||||
import { request } from '@/utils'
|
||||
import type { AxiosResponse } from 'axios'
|
||||
|
||||
export default {
|
||||
// 负载状态
|
||||
load: (): Promise<AxiosResponse<any>> => request.get('/apps/postgresql/load'),
|
||||
// 获取配置
|
||||
config: (): Promise<AxiosResponse<any>> => request.get('/apps/postgresql/config'),
|
||||
// 保存配置
|
||||
saveConfig: (config: string): Promise<AxiosResponse<any>> =>
|
||||
request.post('/apps/postgresql/config', { config }),
|
||||
// 获取用户配置
|
||||
userConfig: (): Promise<AxiosResponse<any>> => request.get('/apps/postgresql/userConfig'),
|
||||
// 保存配置
|
||||
saveUserConfig: (config: string): Promise<AxiosResponse<any>> =>
|
||||
request.post('/apps/postgresql/userConfig', { config }),
|
||||
// 获取日志
|
||||
log: (): Promise<AxiosResponse<any>> => request.get('/apps/postgresql/log'),
|
||||
// 清空错误日志
|
||||
clearLog: (): Promise<AxiosResponse<any>> => request.post('/apps/postgresql/clearLog'),
|
||||
// 数据库列表
|
||||
databases: (page: number, limit: number): Promise<AxiosResponse<any>> =>
|
||||
request.get('/apps/postgresql/databases', { params: { page, limit } }),
|
||||
// 创建数据库
|
||||
addDatabase: (database: any): Promise<AxiosResponse<any>> =>
|
||||
request.post('/apps/postgresql/databases', database),
|
||||
// 删除数据库
|
||||
deleteDatabase: (database: string): Promise<AxiosResponse<any>> =>
|
||||
request.delete('/apps/postgresql/databases', { params: { database } }),
|
||||
// 备份列表
|
||||
backups: (page: number, limit: number): Promise<AxiosResponse<any>> =>
|
||||
request.get('/apps/postgresql/backups', { params: { page, limit } }),
|
||||
// 创建备份
|
||||
createBackup: (database: string): Promise<AxiosResponse<any>> =>
|
||||
request.post('/apps/postgresql/backups', { database }),
|
||||
// 上传备份
|
||||
uploadBackup: (backup: any): Promise<AxiosResponse<any>> =>
|
||||
request.put('/apps/postgresql/backups', backup),
|
||||
// 删除备份
|
||||
deleteBackup: (name: string): Promise<AxiosResponse<any>> =>
|
||||
request.delete('/apps/postgresql/backups', { params: { name } }),
|
||||
// 还原备份
|
||||
restoreBackup: (backup: string, database: string): Promise<AxiosResponse<any>> =>
|
||||
request.post('/apps/postgresql/backups/restore', { backup, database }),
|
||||
// 角色列表
|
||||
roles: (page: number, limit: number): Promise<AxiosResponse<any>> =>
|
||||
request.get('/apps/postgresql/roles', { params: { page, limit } }),
|
||||
// 创建角色
|
||||
addRole: (user: any): Promise<AxiosResponse<any>> => request.post('/apps/postgresql/roles', user),
|
||||
// 删除角色
|
||||
deleteRole: (user: string): Promise<AxiosResponse<any>> =>
|
||||
request.delete('/apps/postgresql/roles', { params: { user } }),
|
||||
// 设置角色密码
|
||||
setRolePassword: (user: string, password: string): Promise<AxiosResponse<any>> =>
|
||||
request.post('/apps/postgresql/roles/password', { user, password })
|
||||
}
|
||||
@@ -4,19 +4,19 @@ import type { AxiosResponse } from 'axios'
|
||||
export default {
|
||||
// 列表
|
||||
list: (page: number, limit: number): Promise<AxiosResponse<any>> =>
|
||||
request.get('/plugins/pureftpd/list', { params: { page, limit } }),
|
||||
request.get('/apps/pureftpd/list', { params: { page, limit } }),
|
||||
// 添加
|
||||
add: (username: string, password: string, path: string): Promise<AxiosResponse<any>> =>
|
||||
request.post('/plugins/pureftpd/add', { username, password, path }),
|
||||
request.post('/apps/pureftpd/add', { username, password, path }),
|
||||
// 删除
|
||||
delete: (username: string): Promise<AxiosResponse<any>> =>
|
||||
request.delete('/plugins/pureftpd/delete', { params: { username } }),
|
||||
request.delete('/apps/pureftpd/delete', { params: { username } }),
|
||||
// 修改密码
|
||||
changePassword: (username: string, password: string): Promise<AxiosResponse<any>> =>
|
||||
request.post('/plugins/pureftpd/changePassword', { username, password }),
|
||||
request.post('/apps/pureftpd/changePassword', { username, password }),
|
||||
// 获取端口
|
||||
port: (): Promise<AxiosResponse<any>> => request.get('/plugins/pureftpd/port'),
|
||||
port: (): Promise<AxiosResponse<any>> => request.get('/apps/pureftpd/port'),
|
||||
// 修改端口
|
||||
setPort: (port: number): Promise<AxiosResponse<any>> =>
|
||||
request.post('/plugins/pureftpd/port', { port })
|
||||
request.post('/apps/pureftpd/port', { port })
|
||||
}
|
||||
12
web/src/api/apps/redis/index.ts
Normal file
12
web/src/api/apps/redis/index.ts
Normal file
@@ -0,0 +1,12 @@
|
||||
import { request } from '@/utils'
|
||||
import type { AxiosResponse } from 'axios'
|
||||
|
||||
export default {
|
||||
// 负载状态
|
||||
load: (): Promise<AxiosResponse<any>> => request.get('/apps/redis/load'),
|
||||
// 获取配置
|
||||
config: (): Promise<AxiosResponse<any>> => request.get('/apps/redis/config'),
|
||||
// 保存配置
|
||||
saveConfig: (config: string): Promise<AxiosResponse<any>> =>
|
||||
request.post('/apps/redis/config', { config })
|
||||
}
|
||||
@@ -3,20 +3,20 @@ import type { AxiosResponse } from 'axios'
|
||||
|
||||
export default {
|
||||
// 获取配置
|
||||
config: (): Promise<AxiosResponse<any>> => request.get('/plugins/rsync/config'),
|
||||
config: (): Promise<AxiosResponse<any>> => request.get('/apps/rsync/config'),
|
||||
// 保存配置
|
||||
saveConfig: (config: string): Promise<AxiosResponse<any>> =>
|
||||
request.post('/plugins/rsync/config', { config }),
|
||||
request.post('/apps/rsync/config', { config }),
|
||||
// 模块列表
|
||||
modules: (page: number, limit: number): Promise<AxiosResponse<any>> =>
|
||||
request.get('/plugins/rsync/modules', { params: { page, limit } }),
|
||||
request.get('/apps/rsync/modules', { params: { page, limit } }),
|
||||
// 添加模块
|
||||
addModule: (module: any): Promise<AxiosResponse<any>> =>
|
||||
request.post('/plugins/rsync/modules', module),
|
||||
request.post('/apps/rsync/modules', module),
|
||||
// 删除模块
|
||||
deleteModule: (name: string): Promise<AxiosResponse<any>> =>
|
||||
request.delete('/plugins/rsync/modules/' + name),
|
||||
request.delete('/apps/rsync/modules/' + name),
|
||||
// 更新模块
|
||||
updateModule: (name: string, module: any): Promise<AxiosResponse<any>> =>
|
||||
request.post('/plugins/rsync/modules/' + name, module)
|
||||
request.post('/apps/rsync/modules/' + name, module)
|
||||
}
|
||||
@@ -4,9 +4,9 @@ import type { AxiosResponse } from 'axios'
|
||||
export default {
|
||||
// 列表
|
||||
list: (page: number, limit: number): Promise<AxiosResponse<any>> =>
|
||||
request.get('/plugins/s3fs/list', { params: { page, limit } }),
|
||||
request.get('/apps/s3fs/list', { params: { page, limit } }),
|
||||
// 添加
|
||||
add: (data: any): Promise<AxiosResponse<any>> => request.post('/plugins/s3fs/add', data),
|
||||
add: (data: any): Promise<AxiosResponse<any>> => request.post('/apps/s3fs/add', data),
|
||||
// 删除
|
||||
delete: (id: number): Promise<AxiosResponse<any>> => request.post('/plugins/s3fs/delete', { id })
|
||||
delete: (id: number): Promise<AxiosResponse<any>> => request.post('/apps/s3fs/delete', { id })
|
||||
}
|
||||
48
web/src/api/apps/supervisor/index.ts
Normal file
48
web/src/api/apps/supervisor/index.ts
Normal file
@@ -0,0 +1,48 @@
|
||||
import { request } from '@/utils'
|
||||
import type { AxiosResponse } from 'axios'
|
||||
|
||||
export default {
|
||||
// 服务名称
|
||||
service: (): Promise<AxiosResponse<any>> => request.get('/apps/supervisor/service'),
|
||||
// 负载状态
|
||||
load: (): Promise<AxiosResponse<any>> => request.get('/apps/supervisor/load'),
|
||||
// 获取错误日志
|
||||
log: (): Promise<AxiosResponse<any>> => request.get('/apps/supervisor/log'),
|
||||
// 清空错误日志
|
||||
clearLog: (): Promise<AxiosResponse<any>> => request.post('/apps/supervisor/clearLog'),
|
||||
// 获取配置
|
||||
config: (): Promise<AxiosResponse<any>> => request.get('/apps/supervisor/config'),
|
||||
// 保存配置
|
||||
saveConfig: (config: string): Promise<AxiosResponse<any>> =>
|
||||
request.post('/apps/supervisor/config', { config }),
|
||||
// 进程列表
|
||||
processes: (page: number, limit: number): Promise<AxiosResponse<any>> =>
|
||||
request.get('/apps/supervisor/processes', { params: { page, limit } }),
|
||||
// 进程启动
|
||||
startProcess: (process: string): Promise<AxiosResponse<any>> =>
|
||||
request.post('/apps/supervisor/startProcess', { process }),
|
||||
// 进程停止
|
||||
stopProcess: (process: string): Promise<AxiosResponse<any>> =>
|
||||
request.post('/apps/supervisor/stopProcess', { process }),
|
||||
// 进程重启
|
||||
restartProcess: (process: string): Promise<AxiosResponse<any>> =>
|
||||
request.post('/apps/supervisor/restartProcess', { process }),
|
||||
// 进程日志
|
||||
processLog: (process: string): Promise<AxiosResponse<any>> =>
|
||||
request.get('/apps/supervisor/processLog', { params: { process } }),
|
||||
// 清空进程日志
|
||||
clearProcessLog: (process: string): Promise<AxiosResponse<any>> =>
|
||||
request.post('/apps/supervisor/clearProcessLog', { process }),
|
||||
// 进程配置
|
||||
processConfig: (process: string): Promise<AxiosResponse<any>> =>
|
||||
request.get('/apps/supervisor/processConfig', { params: { process } }),
|
||||
// 保存进程配置
|
||||
saveProcessConfig: (process: string, config: string): Promise<AxiosResponse<any>> =>
|
||||
request.post('/apps/supervisor/processConfig', { process, config }),
|
||||
// 添加进程
|
||||
addProcess: (process: any): Promise<AxiosResponse<any>> =>
|
||||
request.post('/apps/supervisor/addProcess', process),
|
||||
// 删除进程
|
||||
deleteProcess: (process: string): Promise<AxiosResponse<any>> =>
|
||||
request.post('/apps/supervisor/deleteProcess', { process })
|
||||
}
|
||||
28
web/src/api/apps/toolbox/index.ts
Normal file
28
web/src/api/apps/toolbox/index.ts
Normal file
@@ -0,0 +1,28 @@
|
||||
import { request } from '@/utils'
|
||||
import type { AxiosResponse } from 'axios'
|
||||
|
||||
export default {
|
||||
// DNS
|
||||
dns: (): Promise<AxiosResponse<any>> => request.get('/apps/toolbox/dns'),
|
||||
// 设置 DNS
|
||||
setDns: (dns1: string, dns2: string): Promise<AxiosResponse<any>> =>
|
||||
request.post('/apps/toolbox/dns', { dns1, dns2 }),
|
||||
// SWAP
|
||||
swap: (): Promise<AxiosResponse<any>> => request.get('/apps/toolbox/swap'),
|
||||
// 设置 SWAP
|
||||
setSwap: (size: number): Promise<AxiosResponse<any>> =>
|
||||
request.post('/apps/toolbox/swap', { size }),
|
||||
// 时区
|
||||
timezone: (): Promise<AxiosResponse<any>> => request.get('/apps/toolbox/timezone'),
|
||||
// 设置时区
|
||||
setTimezone: (timezone: string): Promise<AxiosResponse<any>> =>
|
||||
request.post('/apps/toolbox/timezone', { timezone }),
|
||||
// Hosts
|
||||
hosts: (): Promise<AxiosResponse<any>> => request.get('/apps/toolbox/hosts'),
|
||||
// 设置 Hosts
|
||||
setHosts: (hosts: string): Promise<AxiosResponse<any>> =>
|
||||
request.post('/apps/toolbox/hosts', { hosts }),
|
||||
// 设置 Root 密码
|
||||
setRootPassword: (password: string): Promise<AxiosResponse<any>> =>
|
||||
request.post('/apps/toolbox/rootPassword', { password })
|
||||
}
|
||||
@@ -2,22 +2,22 @@ import { request } from '@/utils'
|
||||
import type { AxiosResponse } from 'axios'
|
||||
|
||||
export default {
|
||||
// 获取插件列表
|
||||
// 获取应用列表
|
||||
list: (page: number, limit: number): Promise<AxiosResponse<any>> =>
|
||||
request.get('/plugin/list', { params: { page, limit } }),
|
||||
// 安装插件
|
||||
request.get('/app/list', { params: { page, limit } }),
|
||||
// 安装应用
|
||||
install: (slug: string): Promise<AxiosResponse<any>> =>
|
||||
request.post('/plugin/install', { slug }),
|
||||
// 卸载插件
|
||||
request.post('/app/install', { slug }),
|
||||
// 卸载应用
|
||||
uninstall: (slug: string): Promise<AxiosResponse<any>> =>
|
||||
request.post('/plugin/uninstall', { slug }),
|
||||
// 更新插件
|
||||
request.post('/app/uninstall', { slug }),
|
||||
// 更新应用
|
||||
update: (slug: string): Promise<AxiosResponse<any>> =>
|
||||
request.post('/plugin/update', { slug }),
|
||||
request.post('/app/update', { slug }),
|
||||
// 设置首页显示
|
||||
updateShow: (slug: string, show: boolean): Promise<AxiosResponse<any>> =>
|
||||
request.post('/plugin/updateShow', { slug, show }),
|
||||
// 插件是否已安装
|
||||
request.post('/app/updateShow', { slug, show }),
|
||||
// 应用是否已安装
|
||||
isInstalled: (slug: string): Promise<AxiosResponse<any>> =>
|
||||
request.get('/plugin/isInstalled', { params: { slug } })
|
||||
request.get('/app/isInstalled', { params: { slug } })
|
||||
}
|
||||
@@ -6,17 +6,16 @@ export default {
|
||||
panel: (): Promise<Response> => fetch('/api/info/panel'),
|
||||
// 面板菜单
|
||||
menu: (): Promise<AxiosResponse<any>> => request.get('/info/menu'),
|
||||
// 首页插件
|
||||
homePlugins: (): Promise<AxiosResponse<any>> => request.get('/info/homePlugins'),
|
||||
// 首页应用
|
||||
homeApps: (): Promise<AxiosResponse<any>> => request.get('/info/homeApps'),
|
||||
// 实时监控
|
||||
nowMonitor: (): Promise<AxiosResponse<any>> => request.get('/info/nowMonitor'),
|
||||
realtime: (): Promise<AxiosResponse<any>> => request.get('/info/realtime'),
|
||||
// 系统信息
|
||||
systemInfo: (): Promise<AxiosResponse<any>> => request.get('/info/systemInfo'),
|
||||
// 统计信息
|
||||
countInfo: (): Promise<AxiosResponse<any>> => request.get('/info/countInfo'),
|
||||
// 已安装的数据库和PHP
|
||||
installedDbAndPhp: (): Promise<AxiosResponse<any>> =>
|
||||
request.get('/info/installedDbAndPhp'),
|
||||
installedDbAndPhp: (): Promise<AxiosResponse<any>> => request.get('/info/installedDbAndPhp'),
|
||||
// 检查更新
|
||||
checkUpdate: (): Promise<AxiosResponse<any>> => request.get('/info/checkUpdate'),
|
||||
// 更新日志
|
||||
|
||||
@@ -4,25 +4,23 @@ import type { AxiosResponse } from 'axios'
|
||||
export default {
|
||||
// 列表
|
||||
list: (page: number, limit: number): Promise<AxiosResponse<any>> =>
|
||||
request.get('/websites', { params: { page, limit } }),
|
||||
request.get('/website', { params: { page, limit } }),
|
||||
// 添加
|
||||
add: (data: any): Promise<AxiosResponse<any>> => request.post('/websites', data),
|
||||
add: (data: any): Promise<AxiosResponse<any>> => request.post('/website', data),
|
||||
// 删除
|
||||
delete: (data: any): Promise<AxiosResponse<any>> => request.post('/websites/delete', data),
|
||||
delete: (data: any): Promise<AxiosResponse<any>> => request.post('/website/' + data.id, data),
|
||||
// 获取默认配置
|
||||
defaultConfig: (): Promise<AxiosResponse<any>> => request.get('/website/defaultConfig'),
|
||||
// 保存默认配置
|
||||
saveDefaultConfig: (index: string, stop: string): Promise<AxiosResponse<any>> =>
|
||||
request.post('/website/defaultConfig', { index, stop }),
|
||||
// 网站配置
|
||||
config: (id: number): Promise<AxiosResponse<any>> =>
|
||||
request.get('/websites/' + id + '/config'),
|
||||
config: (id: number): Promise<AxiosResponse<any>> => request.get('/websites/' + id + '/config'),
|
||||
// 保存网站配置
|
||||
saveConfig: (id: number, data: any): Promise<AxiosResponse<any>> =>
|
||||
request.post('/websites/' + id + '/config', data),
|
||||
// 清空日志
|
||||
clearLog: (id: number): Promise<AxiosResponse<any>> =>
|
||||
request.delete('/websites/' + id + '/log'),
|
||||
clearLog: (id: number): Promise<AxiosResponse<any>> => request.delete('/websites/' + id + '/log'),
|
||||
// 更新备注
|
||||
updateRemark: (id: number, remark: string): Promise<AxiosResponse<any>> =>
|
||||
request.post('/websites/' + id + '/updateRemark', { remark }),
|
||||
|
||||
@@ -1,16 +0,0 @@
|
||||
import { request } from '@/utils'
|
||||
import type { AxiosResponse } from 'axios'
|
||||
|
||||
export default {
|
||||
// 负载状态
|
||||
load: (): Promise<AxiosResponse<any>> => request.get('/plugins/openresty/load'),
|
||||
// 获取配置
|
||||
config: (): Promise<AxiosResponse<any>> => request.get('/plugins/openresty/config'),
|
||||
// 保存配置
|
||||
saveConfig: (config: string): Promise<AxiosResponse<any>> =>
|
||||
request.post('/plugins/openresty/config', { config }),
|
||||
// 获取错误日志
|
||||
errorLog: (): Promise<AxiosResponse<any>> => request.get('/plugins/openresty/errorLog'),
|
||||
// 清空错误日志
|
||||
clearErrorLog: (): Promise<AxiosResponse<any>> => request.post('/plugins/openresty/clearErrorLog')
|
||||
}
|
||||
@@ -1,15 +0,0 @@
|
||||
import { request } from '@/utils'
|
||||
import type { AxiosResponse } from 'axios'
|
||||
|
||||
export default {
|
||||
// 获取信息
|
||||
info: (): Promise<AxiosResponse<any>> => request.get('/plugins/phpmyadmin/info'),
|
||||
// 设置端口
|
||||
port: (port: number): Promise<AxiosResponse<any>> =>
|
||||
request.post('/plugins/phpmyadmin/port', { port }),
|
||||
// 获取配置
|
||||
getConfig: (): Promise<AxiosResponse<any>> => request.get('/plugins/phpmyadmin/config'),
|
||||
// 保存配置
|
||||
saveConfig: (config: string): Promise<AxiosResponse<any>> =>
|
||||
request.post('/plugins/phpmyadmin/config', { config })
|
||||
}
|
||||
@@ -1,57 +0,0 @@
|
||||
import { request } from '@/utils'
|
||||
import type { AxiosResponse } from 'axios'
|
||||
|
||||
export default {
|
||||
// 负载状态
|
||||
load: (): Promise<AxiosResponse<any>> => request.get('/plugins/postgresql/load'),
|
||||
// 获取配置
|
||||
config: (): Promise<AxiosResponse<any>> => request.get('/plugins/postgresql/config'),
|
||||
// 保存配置
|
||||
saveConfig: (config: string): Promise<AxiosResponse<any>> =>
|
||||
request.post('/plugins/postgresql/config', { config }),
|
||||
// 获取用户配置
|
||||
userConfig: (): Promise<AxiosResponse<any>> => request.get('/plugins/postgresql/userConfig'),
|
||||
// 保存配置
|
||||
saveUserConfig: (config: string): Promise<AxiosResponse<any>> =>
|
||||
request.post('/plugins/postgresql/userConfig', { config }),
|
||||
// 获取日志
|
||||
log: (): Promise<AxiosResponse<any>> => request.get('/plugins/postgresql/log'),
|
||||
// 清空错误日志
|
||||
clearLog: (): Promise<AxiosResponse<any>> => request.post('/plugins/postgresql/clearLog'),
|
||||
// 数据库列表
|
||||
databases: (page: number, limit: number): Promise<AxiosResponse<any>> =>
|
||||
request.get('/plugins/postgresql/databases', { params: { page, limit } }),
|
||||
// 创建数据库
|
||||
addDatabase: (database: any): Promise<AxiosResponse<any>> =>
|
||||
request.post('/plugins/postgresql/databases', database),
|
||||
// 删除数据库
|
||||
deleteDatabase: (database: string): Promise<AxiosResponse<any>> =>
|
||||
request.delete('/plugins/postgresql/databases', { params: { database } }),
|
||||
// 备份列表
|
||||
backups: (page: number, limit: number): Promise<AxiosResponse<any>> =>
|
||||
request.get('/plugins/postgresql/backups', { params: { page, limit } }),
|
||||
// 创建备份
|
||||
createBackup: (database: string): Promise<AxiosResponse<any>> =>
|
||||
request.post('/plugins/postgresql/backups', { database }),
|
||||
// 上传备份
|
||||
uploadBackup: (backup: any): Promise<AxiosResponse<any>> =>
|
||||
request.put('/plugins/postgresql/backups', backup),
|
||||
// 删除备份
|
||||
deleteBackup: (name: string): Promise<AxiosResponse<any>> =>
|
||||
request.delete('/plugins/postgresql/backups', { params: { name } }),
|
||||
// 还原备份
|
||||
restoreBackup: (backup: string, database: string): Promise<AxiosResponse<any>> =>
|
||||
request.post('/plugins/postgresql/backups/restore', { backup, database }),
|
||||
// 角色列表
|
||||
roles: (page: number, limit: number): Promise<AxiosResponse<any>> =>
|
||||
request.get('/plugins/postgresql/roles', { params: { page, limit } }),
|
||||
// 创建角色
|
||||
addRole: (user: any): Promise<AxiosResponse<any>> =>
|
||||
request.post('/plugins/postgresql/roles', user),
|
||||
// 删除角色
|
||||
deleteRole: (user: string): Promise<AxiosResponse<any>> =>
|
||||
request.delete('/plugins/postgresql/roles', { params: { user } }),
|
||||
// 设置角色密码
|
||||
setRolePassword: (user: string, password: string): Promise<AxiosResponse<any>> =>
|
||||
request.post('/plugins/postgresql/roles/password', { user, password })
|
||||
}
|
||||
@@ -1,12 +0,0 @@
|
||||
import { request } from '@/utils'
|
||||
import type { AxiosResponse } from 'axios'
|
||||
|
||||
export default {
|
||||
// 负载状态
|
||||
load: (): Promise<AxiosResponse<any>> => request.get('/plugins/redis/load'),
|
||||
// 获取配置
|
||||
config: (): Promise<AxiosResponse<any>> => request.get('/plugins/redis/config'),
|
||||
// 保存配置
|
||||
saveConfig: (config: string): Promise<AxiosResponse<any>> =>
|
||||
request.post('/plugins/redis/config', { config })
|
||||
}
|
||||
@@ -1,48 +0,0 @@
|
||||
import { request } from '@/utils'
|
||||
import type { AxiosResponse } from 'axios'
|
||||
|
||||
export default {
|
||||
// 服务名称
|
||||
service: (): Promise<AxiosResponse<any>> => request.get('/plugins/supervisor/service'),
|
||||
// 负载状态
|
||||
load: (): Promise<AxiosResponse<any>> => request.get('/plugins/supervisor/load'),
|
||||
// 获取错误日志
|
||||
log: (): Promise<AxiosResponse<any>> => request.get('/plugins/supervisor/log'),
|
||||
// 清空错误日志
|
||||
clearLog: (): Promise<AxiosResponse<any>> => request.post('/plugins/supervisor/clearLog'),
|
||||
// 获取配置
|
||||
config: (): Promise<AxiosResponse<any>> => request.get('/plugins/supervisor/config'),
|
||||
// 保存配置
|
||||
saveConfig: (config: string): Promise<AxiosResponse<any>> =>
|
||||
request.post('/plugins/supervisor/config', { config }),
|
||||
// 进程列表
|
||||
processes: (page: number, limit: number): Promise<AxiosResponse<any>> =>
|
||||
request.get('/plugins/supervisor/processes', { params: { page, limit } }),
|
||||
// 进程启动
|
||||
startProcess: (process: string): Promise<AxiosResponse<any>> =>
|
||||
request.post('/plugins/supervisor/startProcess', { process }),
|
||||
// 进程停止
|
||||
stopProcess: (process: string): Promise<AxiosResponse<any>> =>
|
||||
request.post('/plugins/supervisor/stopProcess', { process }),
|
||||
// 进程重启
|
||||
restartProcess: (process: string): Promise<AxiosResponse<any>> =>
|
||||
request.post('/plugins/supervisor/restartProcess', { process }),
|
||||
// 进程日志
|
||||
processLog: (process: string): Promise<AxiosResponse<any>> =>
|
||||
request.get('/plugins/supervisor/processLog', { params: { process } }),
|
||||
// 清空进程日志
|
||||
clearProcessLog: (process: string): Promise<AxiosResponse<any>> =>
|
||||
request.post('/plugins/supervisor/clearProcessLog', { process }),
|
||||
// 进程配置
|
||||
processConfig: (process: string): Promise<AxiosResponse<any>> =>
|
||||
request.get('/plugins/supervisor/processConfig', { params: { process } }),
|
||||
// 保存进程配置
|
||||
saveProcessConfig: (process: string, config: string): Promise<AxiosResponse<any>> =>
|
||||
request.post('/plugins/supervisor/processConfig', { process, config }),
|
||||
// 添加进程
|
||||
addProcess: (process: any): Promise<AxiosResponse<any>> =>
|
||||
request.post('/plugins/supervisor/addProcess', process),
|
||||
// 删除进程
|
||||
deleteProcess: (process: string): Promise<AxiosResponse<any>> =>
|
||||
request.post('/plugins/supervisor/deleteProcess', { process })
|
||||
}
|
||||
@@ -1,28 +0,0 @@
|
||||
import { request } from '@/utils'
|
||||
import type { AxiosResponse } from 'axios'
|
||||
|
||||
export default {
|
||||
// DNS
|
||||
dns: (): Promise<AxiosResponse<any>> => request.get('/plugins/toolbox/dns'),
|
||||
// 设置 DNS
|
||||
setDns: (dns1: string, dns2: string): Promise<AxiosResponse<any>> =>
|
||||
request.post('/plugins/toolbox/dns', { dns1, dns2 }),
|
||||
// SWAP
|
||||
swap: (): Promise<AxiosResponse<any>> => request.get('/plugins/toolbox/swap'),
|
||||
// 设置 SWAP
|
||||
setSwap: (size: number): Promise<AxiosResponse<any>> =>
|
||||
request.post('/plugins/toolbox/swap', { size }),
|
||||
// 时区
|
||||
timezone: (): Promise<AxiosResponse<any>> => request.get('/plugins/toolbox/timezone'),
|
||||
// 设置时区
|
||||
setTimezone: (timezone: string): Promise<AxiosResponse<any>> =>
|
||||
request.post('/plugins/toolbox/timezone', { timezone }),
|
||||
// Hosts
|
||||
hosts: (): Promise<AxiosResponse<any>> => request.get('/plugins/toolbox/hosts'),
|
||||
// 设置 Hosts
|
||||
setHosts: (hosts: string): Promise<AxiosResponse<any>> =>
|
||||
request.post('/plugins/toolbox/hosts', { hosts }),
|
||||
// 设置 Root 密码
|
||||
setRootPassword: (password: string): Promise<AxiosResponse<any>> =>
|
||||
request.post('/plugins/toolbox/rootPassword', { password })
|
||||
}
|
||||
@@ -100,8 +100,8 @@
|
||||
"supporter": ""
|
||||
}
|
||||
},
|
||||
"plugins": {
|
||||
"title": "Quick Plugin"
|
||||
"apps": {
|
||||
"title": "Quick App"
|
||||
}
|
||||
},
|
||||
"homeUpdate": {
|
||||
@@ -127,8 +127,8 @@
|
||||
"monitorIndex": {
|
||||
"title": "Monitoring"
|
||||
},
|
||||
"pluginIndex": {
|
||||
"title": "Plugins",
|
||||
"appIndex": {
|
||||
"title": "Apps",
|
||||
"alerts": {
|
||||
"info": "Click the button once, please do not click it repeatedly to avoid repeated execution!",
|
||||
"warning": "It is strongly recommended to take a backup/snapshot before upgrading the plug-in to avoid being unable to roll back if problems arise!",
|
||||
@@ -144,9 +144,9 @@
|
||||
"uninstall": "Uninstall"
|
||||
},
|
||||
"confirm": {
|
||||
"install": "Are you sure you want to install the plugin {plugin}?",
|
||||
"update": "Upgrading the {plugin} plug-in may reset related configurations to the default state. Are you sure you want to continue?",
|
||||
"uninstall": "Are you sure you want to uninstall the plugin {plugin}?"
|
||||
"install": "Are you sure you want to install the app {app}?",
|
||||
"update": "Upgrading the {app} plug-in may reset related configurations to the default state. Are you sure you want to continue?",
|
||||
"uninstall": "Are you sure you want to uninstall the app {app}?"
|
||||
},
|
||||
"columns": {
|
||||
"name": "Name",
|
||||
|
||||
@@ -100,8 +100,8 @@
|
||||
"supporter": ""
|
||||
}
|
||||
},
|
||||
"plugins": {
|
||||
"title": "快捷插件"
|
||||
"apps": {
|
||||
"title": "快捷应用"
|
||||
}
|
||||
},
|
||||
"homeUpdate": {
|
||||
@@ -127,11 +127,11 @@
|
||||
"monitorIndex": {
|
||||
"title": "资源监控"
|
||||
},
|
||||
"pluginIndex": {
|
||||
"title": "插件市场",
|
||||
"appIndex": {
|
||||
"title": "应用市场",
|
||||
"alerts": {
|
||||
"info": "按钮点击一次即可,请勿重复点击以免重复执行!",
|
||||
"warning": "升级插件前强烈建议先备份/快照,以免出现问题时无法回滚!",
|
||||
"warning": "升级应用前强烈建议先备份/快照,以免出现问题时无法回滚!",
|
||||
"setup": "设置成功",
|
||||
"install": "任务已提交,请稍后查看任务进度",
|
||||
"update": "任务已提交,请前往任务中心查看任务进度",
|
||||
@@ -144,12 +144,12 @@
|
||||
"uninstall": "卸载"
|
||||
},
|
||||
"confirm": {
|
||||
"install": "确定安装插件 {plugin} 吗?",
|
||||
"update": "升级 {plugin} 插件可能会重置相关配置到默认状态,确定继续吗?",
|
||||
"uninstall": "确定卸载插件 {plugin} 吗?"
|
||||
"install": "确定安装应用 {app} 吗?",
|
||||
"update": "升级 {app} 应用可能会重置相关配置到默认状态,确定继续吗?",
|
||||
"uninstall": "确定卸载应用 {app} 吗?"
|
||||
},
|
||||
"columns": {
|
||||
"name": "插件名",
|
||||
"name": "应用名",
|
||||
"description": "描述",
|
||||
"installedVersion": "已装版本",
|
||||
"version": "最新版本",
|
||||
|
||||
@@ -1,33 +1,33 @@
|
||||
import type { Router } from 'vue-router'
|
||||
import plugin from '@/api/panel/plugin'
|
||||
import app from '@/api/panel/app'
|
||||
|
||||
export function createPluginInstallGuard(router: Router) {
|
||||
export function createAppInstallGuard(router: Router) {
|
||||
router.beforeEach(async (to) => {
|
||||
const slug = to.path.split('/').pop()
|
||||
if (to.path.startsWith('/plugins/') && slug) {
|
||||
await plugin.isInstalled(slug).then((res) => {
|
||||
if (to.path.startsWith('/apps/') && slug) {
|
||||
await app.isInstalled(slug).then((res) => {
|
||||
if (!res.data.installed) {
|
||||
window.$message.error(`插件 ${res.data.name} 未安装`)
|
||||
return router.push({ name: 'plugin-index' })
|
||||
window.$message.error(`应用 ${res.data.name} 未安装`)
|
||||
return router.push({ name: 'app-index' })
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
// 网站
|
||||
if (to.path.startsWith('/website')) {
|
||||
await plugin.isInstalled('openresty').then((res) => {
|
||||
await app.isInstalled('openresty').then((res) => {
|
||||
if (!res.data.installed) {
|
||||
window.$message.error(`Web 服务器 ${res.data.name} 未安装`)
|
||||
return router.push({ name: 'plugin-index' })
|
||||
return router.push({ name: 'app-index' })
|
||||
}
|
||||
})
|
||||
}
|
||||
// 容器
|
||||
if (to.path.startsWith('/container')) {
|
||||
await plugin.isInstalled('podman').then((res) => {
|
||||
await app.isInstalled('podman').then((res) => {
|
||||
if (!res.data.installed) {
|
||||
window.$message.error(`容器引擎 ${res.data.name} 未安装`)
|
||||
return router.push({ name: 'plugin-index' })
|
||||
return router.push({ name: 'app-index' })
|
||||
}
|
||||
})
|
||||
}
|
||||
@@ -1,10 +1,10 @@
|
||||
import type { Router } from 'vue-router'
|
||||
import { createPageLoadingGuard } from './page-loading-guard'
|
||||
import { createPageTitleGuard } from './page-title-guard'
|
||||
import { createPluginInstallGuard } from './plugin-install-guard'
|
||||
import { createAppInstallGuard } from './app-install-guard'
|
||||
|
||||
export function setupRouterGuard(router: Router) {
|
||||
createPageLoadingGuard(router)
|
||||
createPageTitleGuard(router)
|
||||
createPluginInstallGuard(router)
|
||||
createAppInstallGuard(router)
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<script setup lang="ts">
|
||||
import type { Plugin } from '@/views/plugin/types'
|
||||
import type { App } from '@/views/app/types'
|
||||
import { NButton, NDataTable, NPopconfirm, NSwitch } from 'naive-ui'
|
||||
import plugin from '@/api/panel/plugin'
|
||||
import app from '../../api/panel/app'
|
||||
import { renderIcon } from '@/utils'
|
||||
import { router } from '@/router'
|
||||
import { useI18n } from 'vue-i18n'
|
||||
@@ -11,32 +11,32 @@ const { t } = useI18n()
|
||||
const columns: any = [
|
||||
{ type: 'selection', fixed: 'left' },
|
||||
{
|
||||
title: t('pluginIndex.columns.name'),
|
||||
title: t('appIndex.columns.name'),
|
||||
key: 'name',
|
||||
width: 150,
|
||||
width: 200,
|
||||
resizable: true,
|
||||
ellipsis: { tooltip: true }
|
||||
},
|
||||
{
|
||||
title: t('pluginIndex.columns.description'),
|
||||
title: t('appIndex.columns.description'),
|
||||
key: 'description',
|
||||
resizable: true,
|
||||
ellipsis: { tooltip: true }
|
||||
},
|
||||
{
|
||||
title: t('pluginIndex.columns.installedVersion'),
|
||||
title: t('appIndex.columns.installedVersion'),
|
||||
key: 'installed_version',
|
||||
width: 100,
|
||||
ellipsis: { tooltip: true }
|
||||
},
|
||||
{
|
||||
title: t('pluginIndex.columns.version'),
|
||||
title: t('appIndex.columns.version'),
|
||||
key: 'version',
|
||||
width: 100,
|
||||
ellipsis: { tooltip: true }
|
||||
},
|
||||
{
|
||||
title: t('pluginIndex.columns.show'),
|
||||
title: t('appIndex.columns.show'),
|
||||
key: 'show',
|
||||
width: 100,
|
||||
align: 'center',
|
||||
@@ -50,7 +50,7 @@ const columns: any = [
|
||||
}
|
||||
},
|
||||
{
|
||||
title: t('pluginIndex.columns.actions'),
|
||||
title: t('appIndex.columns.actions'),
|
||||
key: 'actions',
|
||||
width: 280,
|
||||
align: 'center',
|
||||
@@ -66,7 +66,7 @@ const columns: any = [
|
||||
},
|
||||
{
|
||||
default: () => {
|
||||
return t('pluginIndex.confirm.update', { plugin: row.name })
|
||||
return t('appIndex.confirm.update', { app: row.name })
|
||||
},
|
||||
trigger: () => {
|
||||
return h(
|
||||
@@ -76,7 +76,7 @@ const columns: any = [
|
||||
type: 'warning'
|
||||
},
|
||||
{
|
||||
default: () => t('pluginIndex.buttons.update'),
|
||||
default: () => t('appIndex.buttons.update'),
|
||||
icon: renderIcon('material-symbols:arrow-circle-up-outline-rounded', {
|
||||
size: 14
|
||||
})
|
||||
@@ -95,7 +95,7 @@ const columns: any = [
|
||||
onClick: () => handleManage(row.slug)
|
||||
},
|
||||
{
|
||||
default: () => t('pluginIndex.buttons.manage'),
|
||||
default: () => t('appIndex.buttons.manage'),
|
||||
icon: renderIcon('material-symbols:settings-outline', { size: 14 })
|
||||
}
|
||||
)
|
||||
@@ -108,7 +108,7 @@ const columns: any = [
|
||||
},
|
||||
{
|
||||
default: () => {
|
||||
return t('pluginIndex.confirm.uninstall', { plugin: row.name })
|
||||
return t('appIndex.confirm.uninstall', { app: row.name })
|
||||
},
|
||||
trigger: () => {
|
||||
return h(
|
||||
@@ -119,7 +119,7 @@ const columns: any = [
|
||||
style: 'margin-left: 15px;'
|
||||
},
|
||||
{
|
||||
default: () => t('pluginIndex.buttons.uninstall'),
|
||||
default: () => t('appIndex.buttons.uninstall'),
|
||||
icon: renderIcon('material-symbols:delete-outline', { size: 14 })
|
||||
}
|
||||
)
|
||||
@@ -135,7 +135,7 @@ const columns: any = [
|
||||
},
|
||||
{
|
||||
default: () => {
|
||||
return t('pluginIndex.confirm.install', { plugin: row.name })
|
||||
return t('appIndex.confirm.install', { app: row.name })
|
||||
},
|
||||
trigger: () => {
|
||||
return h(
|
||||
@@ -145,7 +145,7 @@ const columns: any = [
|
||||
type: 'info'
|
||||
},
|
||||
{
|
||||
default: () => t('pluginIndex.buttons.install'),
|
||||
default: () => t('appIndex.buttons.install'),
|
||||
icon: renderIcon('material-symbols:download-rounded', { size: 14 })
|
||||
}
|
||||
)
|
||||
@@ -158,7 +158,7 @@ const columns: any = [
|
||||
}
|
||||
]
|
||||
|
||||
const plugins = ref<Plugin[]>([] as Plugin[])
|
||||
const apps = ref<App[]>([] as App[])
|
||||
|
||||
const selectedRowKeys = ref<any>([])
|
||||
|
||||
@@ -173,36 +173,36 @@ const pagination = reactive({
|
||||
})
|
||||
|
||||
const handleShowChange = (row: any) => {
|
||||
plugin.updateShow(row.slug, !row.show).then(() => {
|
||||
window.$message.success(t('pluginIndex.alerts.setup'))
|
||||
app.updateShow(row.slug, !row.show).then(() => {
|
||||
window.$message.success(t('appIndex.alerts.setup'))
|
||||
row.show = !row.show
|
||||
})
|
||||
}
|
||||
|
||||
const handleInstall = (slug: string) => {
|
||||
plugin.install(slug).then(() => {
|
||||
window.$message.success(t('pluginIndex.alerts.install'))
|
||||
app.install(slug).then(() => {
|
||||
window.$message.success(t('appIndex.alerts.install'))
|
||||
})
|
||||
}
|
||||
|
||||
const handleUpdate = (slug: string) => {
|
||||
plugin.update(slug).then(() => {
|
||||
window.$message.success(t('pluginIndex.alerts.update'))
|
||||
app.update(slug).then(() => {
|
||||
window.$message.success(t('appIndex.alerts.update'))
|
||||
})
|
||||
}
|
||||
|
||||
const handleUninstall = (slug: string) => {
|
||||
plugin.uninstall(slug).then(() => {
|
||||
window.$message.success(t('pluginIndex.alerts.uninstall'))
|
||||
app.uninstall(slug).then(() => {
|
||||
window.$message.success(t('appIndex.alerts.uninstall'))
|
||||
})
|
||||
}
|
||||
|
||||
const handleManage = (slug: string) => {
|
||||
router.push({ name: 'plugins-' + slug + '-index' })
|
||||
router.push({ name: 'apps-' + slug + '-index' })
|
||||
}
|
||||
|
||||
const getPluginList = async (page: number, limit: number) => {
|
||||
const { data } = await plugin.list(page, limit)
|
||||
const getAppList = async (page: number, limit: number) => {
|
||||
const { data } = await app.list(page, limit)
|
||||
return data
|
||||
}
|
||||
|
||||
@@ -212,8 +212,8 @@ const onChecked = (rowKeys: any) => {
|
||||
|
||||
const onPageChange = (page: number) => {
|
||||
pagination.page = page
|
||||
getPluginList(page, pagination.pageSize).then((res) => {
|
||||
plugins.value = res.items
|
||||
getAppList(page, pagination.pageSize).then((res) => {
|
||||
apps.value = res.items
|
||||
pagination.itemCount = res.total
|
||||
pagination.pageCount = res.total / pagination.pageSize + 1
|
||||
})
|
||||
@@ -232,14 +232,14 @@ onMounted(() => {
|
||||
<template>
|
||||
<common-page show-footer>
|
||||
<n-space vertical>
|
||||
<n-alert type="info">{{ $t('pluginIndex.alerts.info') }}</n-alert>
|
||||
<n-alert type="warning">{{ $t('pluginIndex.alerts.warning') }}</n-alert>
|
||||
<n-alert type="info">{{ $t('appIndex.alerts.info') }}</n-alert>
|
||||
<n-alert type="warning">{{ $t('appIndex.alerts.warning') }}</n-alert>
|
||||
<n-data-table
|
||||
striped
|
||||
remote
|
||||
:loading="false"
|
||||
:columns="columns"
|
||||
:data="plugins"
|
||||
:data="apps"
|
||||
:row-key="(row: any) => row.slug"
|
||||
:pagination="pagination"
|
||||
@update:checked-row-keys="onChecked"
|
||||
@@ -3,19 +3,19 @@ import type { RouteType } from '~/types/router'
|
||||
const Layout = () => import('@/layout/IndexView.vue')
|
||||
|
||||
export default {
|
||||
name: 'plugin',
|
||||
path: '/plugin',
|
||||
name: 'app',
|
||||
path: '/app',
|
||||
component: Layout,
|
||||
meta: {
|
||||
order: 8
|
||||
},
|
||||
children: [
|
||||
{
|
||||
name: 'plugin-index',
|
||||
name: 'app-index',
|
||||
path: '',
|
||||
component: () => import('./IndexView.vue'),
|
||||
meta: {
|
||||
title: 'pluginIndex.title',
|
||||
title: 'appIndex.title',
|
||||
icon: 'mdi:puzzle-outline',
|
||||
role: ['admin'],
|
||||
requireAuth: true
|
||||
@@ -1,4 +1,4 @@
|
||||
export interface Plugin {
|
||||
export interface App {
|
||||
name: string
|
||||
description: string
|
||||
slug: string
|
||||
@@ -1,9 +1,9 @@
|
||||
<script setup lang="ts">
|
||||
import { NButton, NDataTable, NInput, NPopconfirm, NSwitch } from 'naive-ui'
|
||||
import fail2ban from '@/api/plugins/fail2ban'
|
||||
import fail2ban from '@/api/apps/fail2ban'
|
||||
import service from '@/api/panel/system/service'
|
||||
import { renderIcon } from '@/utils'
|
||||
import type { Jail } from '@/views/plugins/fail2ban/types'
|
||||
import type { Jail } from '@/views/apps/fail2ban/types'
|
||||
import website from '@/api/panel/website'
|
||||
|
||||
const currentTab = ref('status')
|
||||
@@ -4,12 +4,12 @@ const Layout = () => import('@/layout/IndexView.vue')
|
||||
|
||||
export default {
|
||||
name: 'fail2ban',
|
||||
path: '/plugins/fail2ban',
|
||||
path: '/apps/fail2ban',
|
||||
component: Layout,
|
||||
isHidden: true,
|
||||
children: [
|
||||
{
|
||||
name: 'plugins-fail2ban-index',
|
||||
name: 'apps-fail2ban-index',
|
||||
path: '',
|
||||
component: () => import('./IndexView.vue'),
|
||||
meta: {
|
||||
@@ -1,7 +1,7 @@
|
||||
<script setup lang="ts">
|
||||
import { NButton, NPopconfirm } from 'naive-ui'
|
||||
import Editor from '@guolao/vue-monaco-editor'
|
||||
import frp from '@/api/plugins/frp'
|
||||
import frp from '@/api/apps/frp'
|
||||
import service from '@/api/panel/system/service'
|
||||
|
||||
const currentTab = ref('frps')
|
||||
@@ -4,12 +4,12 @@ const Layout = () => import('@/layout/IndexView.vue')
|
||||
|
||||
export default {
|
||||
name: 'frp',
|
||||
path: '/plugins/frp',
|
||||
path: '/apps/frp',
|
||||
component: Layout,
|
||||
isHidden: true,
|
||||
children: [
|
||||
{
|
||||
name: 'plugins-frp-index',
|
||||
name: 'apps-frp-index',
|
||||
path: '',
|
||||
component: () => import('./IndexView.vue'),
|
||||
meta: {
|
||||
@@ -1,7 +1,7 @@
|
||||
<script setup lang="ts">
|
||||
import { NButton, NPopconfirm } from 'naive-ui'
|
||||
import Editor from '@guolao/vue-monaco-editor'
|
||||
import gitea from '@/api/plugins/gitea'
|
||||
import gitea from '@/api/apps/gitea'
|
||||
import service from '@/api/panel/system/service'
|
||||
|
||||
const currentTab = ref('status')
|
||||
@@ -4,12 +4,12 @@ const Layout = () => import('@/layout/IndexView.vue')
|
||||
|
||||
export default {
|
||||
name: 'gitea',
|
||||
path: '/plugins/gitea',
|
||||
path: '/apps/gitea',
|
||||
component: Layout,
|
||||
isHidden: true,
|
||||
children: [
|
||||
{
|
||||
name: 'plugins-gitea-index',
|
||||
name: 'apps-gitea-index',
|
||||
path: '',
|
||||
component: () => import('./IndexView.vue'),
|
||||
meta: {
|
||||
@@ -1,9 +1,9 @@
|
||||
<script setup lang="ts">
|
||||
import { NButton, NDataTable, NInput, NPopconfirm } from 'naive-ui'
|
||||
import mysql from '@/api/plugins/mysql'
|
||||
import mysql from '@/api/apps/mysql'
|
||||
import service from '@/api/panel/system/service'
|
||||
import { generateRandomString, renderIcon } from '@/utils'
|
||||
import type { Backup, Database, User } from '@/views/plugins/mysql/types'
|
||||
import type { Backup, Database, User } from '@/views/apps/mysql/types'
|
||||
import type { UploadFileInfo, MessageReactive } from 'naive-ui'
|
||||
import Editor from '@guolao/vue-monaco-editor'
|
||||
|
||||
@@ -4,12 +4,12 @@ const Layout = () => import('@/layout/IndexView.vue')
|
||||
|
||||
export default {
|
||||
name: 'mysql57',
|
||||
path: '/plugins/mysql57',
|
||||
path: '/apps/mysql57',
|
||||
component: Layout,
|
||||
isHidden: true,
|
||||
children: [
|
||||
{
|
||||
name: 'plugins-mysql57-index',
|
||||
name: 'apps-mysql57-index',
|
||||
path: '',
|
||||
component: () => import('../mysql/IndexView.vue'),
|
||||
meta: {
|
||||
@@ -4,12 +4,12 @@ const Layout = () => import('@/layout/IndexView.vue')
|
||||
|
||||
export default {
|
||||
name: 'mysql80',
|
||||
path: '/plugins/mysql80',
|
||||
path: '/apps/mysql80',
|
||||
component: Layout,
|
||||
isHidden: true,
|
||||
children: [
|
||||
{
|
||||
name: 'plugins-mysql80-index',
|
||||
name: 'apps-mysql80-index',
|
||||
path: '',
|
||||
component: () => import('../mysql/IndexView.vue'),
|
||||
meta: {
|
||||
@@ -4,12 +4,12 @@ const Layout = () => import('@/layout/IndexView.vue')
|
||||
|
||||
export default {
|
||||
name: 'mysql84',
|
||||
path: '/plugins/mysql84',
|
||||
path: '/apps/mysql84',
|
||||
component: Layout,
|
||||
isHidden: true,
|
||||
children: [
|
||||
{
|
||||
name: 'plugins-mysql84-index',
|
||||
name: 'apps-mysql84-index',
|
||||
path: '',
|
||||
component: () => import('../mysql/IndexView.vue'),
|
||||
meta: {
|
||||
@@ -1,6 +1,6 @@
|
||||
<script setup lang="ts">
|
||||
import { NButton, NDataTable, NPopconfirm } from 'naive-ui'
|
||||
import openresty from '@/api/plugins/openresty'
|
||||
import openresty from '@/api/apps/openresty'
|
||||
import service from '@/api/panel/system/service'
|
||||
import Editor from '@guolao/vue-monaco-editor'
|
||||
import { themeConfig, themeDarkConfig, tokenConf } from 'monaco-editor-nginx/cjs/conf'
|
||||
@@ -4,12 +4,12 @@ const Layout = () => import('@/layout/IndexView.vue')
|
||||
|
||||
export default {
|
||||
name: 'openresty',
|
||||
path: '/plugins/openresty',
|
||||
path: '/apps/openresty',
|
||||
component: Layout,
|
||||
isHidden: true,
|
||||
children: [
|
||||
{
|
||||
name: 'plugins-openresty-index',
|
||||
name: 'apps-openresty-index',
|
||||
path: '',
|
||||
component: () => import('./IndexView.vue'),
|
||||
meta: {
|
||||
@@ -1,6 +1,6 @@
|
||||
<script setup lang="ts">
|
||||
import { NButton, NDataTable, NPopconfirm } from 'naive-ui'
|
||||
import php from '@/api/plugins/php'
|
||||
import php from '@/api/apps/php'
|
||||
import service from '@/api/panel/system/service'
|
||||
import { renderIcon } from '@/utils'
|
||||
import Editor from '@guolao/vue-monaco-editor'
|
||||
@@ -4,12 +4,12 @@ const Layout = () => import('@/layout/IndexView.vue')
|
||||
|
||||
export default {
|
||||
name: 'php74',
|
||||
path: '/plugins/php74',
|
||||
path: '/apps/php74',
|
||||
component: Layout,
|
||||
isHidden: true,
|
||||
children: [
|
||||
{
|
||||
name: 'plugins-php74-index',
|
||||
name: 'apps-php74-index',
|
||||
path: '',
|
||||
component: () => import('../php/IndexView.vue'),
|
||||
meta: {
|
||||
@@ -4,12 +4,12 @@ const Layout = () => import('@/layout/IndexView.vue')
|
||||
|
||||
export default {
|
||||
name: 'php80',
|
||||
path: '/plugins/php80',
|
||||
path: '/apps/php80',
|
||||
component: Layout,
|
||||
isHidden: true,
|
||||
children: [
|
||||
{
|
||||
name: 'plugins-php80-index',
|
||||
name: 'apps-php80-index',
|
||||
path: '',
|
||||
component: () => import('../php/IndexView.vue'),
|
||||
meta: {
|
||||
@@ -4,12 +4,12 @@ const Layout = () => import('@/layout/IndexView.vue')
|
||||
|
||||
export default {
|
||||
name: 'php81',
|
||||
path: '/plugins/php81',
|
||||
path: '/apps/php81',
|
||||
component: Layout,
|
||||
isHidden: true,
|
||||
children: [
|
||||
{
|
||||
name: 'plugins-php81-index',
|
||||
name: 'apps-php81-index',
|
||||
path: '',
|
||||
component: () => import('../php/IndexView.vue'),
|
||||
meta: {
|
||||
@@ -4,12 +4,12 @@ const Layout = () => import('@/layout/IndexView.vue')
|
||||
|
||||
export default {
|
||||
name: 'php82',
|
||||
path: '/plugins/php82',
|
||||
path: '/apps/php82',
|
||||
component: Layout,
|
||||
isHidden: true,
|
||||
children: [
|
||||
{
|
||||
name: 'plugins-php82-index',
|
||||
name: 'apps-php82-index',
|
||||
path: '',
|
||||
component: () => import('../php/IndexView.vue'),
|
||||
meta: {
|
||||
@@ -4,12 +4,12 @@ const Layout = () => import('@/layout/IndexView.vue')
|
||||
|
||||
export default {
|
||||
name: 'php83',
|
||||
path: '/plugins/php83',
|
||||
path: '/apps/php83',
|
||||
component: Layout,
|
||||
isHidden: true,
|
||||
children: [
|
||||
{
|
||||
name: 'plugins-php83-index',
|
||||
name: 'apps-php83-index',
|
||||
path: '',
|
||||
component: () => import('../php/IndexView.vue'),
|
||||
meta: {
|
||||
@@ -1,6 +1,6 @@
|
||||
<script setup lang="ts">
|
||||
import { NButton } from 'naive-ui'
|
||||
import phpmyadmin from '@/api/plugins/phpmyadmin'
|
||||
import phpmyadmin from '@/api/apps/phpmyadmin'
|
||||
import Editor from '@guolao/vue-monaco-editor'
|
||||
import { themeConfig, themeDarkConfig, tokenConf } from 'monaco-editor-nginx/cjs/conf'
|
||||
import suggestions from 'monaco-editor-nginx/cjs/suggestions'
|
||||
@@ -4,12 +4,12 @@ const Layout = () => import('@/layout/IndexView.vue')
|
||||
|
||||
export default {
|
||||
name: 'phpmyadmin',
|
||||
path: '/plugins/phpmyadmin',
|
||||
path: '/apps/phpmyadmin',
|
||||
component: Layout,
|
||||
isHidden: true,
|
||||
children: [
|
||||
{
|
||||
name: 'plugins-phpmyadmin-index',
|
||||
name: 'apps-phpmyadmin-index',
|
||||
path: '',
|
||||
component: () => import('./IndexView.vue'),
|
||||
meta: {
|
||||
@@ -1,7 +1,7 @@
|
||||
<script setup lang="ts">
|
||||
import { NButton, NPopconfirm } from 'naive-ui'
|
||||
import Editor from '@guolao/vue-monaco-editor'
|
||||
import podman from '@/api/plugins/podman'
|
||||
import podman from '@/api/apps/podman'
|
||||
import service from '@/api/panel/system/service'
|
||||
|
||||
const currentTab = ref('status')
|
||||
@@ -4,12 +4,12 @@ const Layout = () => import('@/layout/IndexView.vue')
|
||||
|
||||
export default {
|
||||
name: 'podman',
|
||||
path: '/plugins/podman',
|
||||
path: '/apps/podman',
|
||||
component: Layout,
|
||||
isHidden: true,
|
||||
children: [
|
||||
{
|
||||
name: 'plugins-podman-index',
|
||||
name: 'apps-podman-index',
|
||||
path: '',
|
||||
component: () => import('./IndexView.vue'),
|
||||
meta: {
|
||||
@@ -1,9 +1,9 @@
|
||||
<script setup lang="ts">
|
||||
import { NButton, NDataTable, NFlex, NInput, NPopconfirm, NTag } from 'naive-ui'
|
||||
import postgresql from '@/api/plugins/postgresql'
|
||||
import postgresql from '@/api/apps/postgresql'
|
||||
import service from '@/api/panel/system/service'
|
||||
import { generateRandomString, renderIcon } from '@/utils'
|
||||
import type { Backup, Database, Role } from '@/views/plugins/postgresql/types'
|
||||
import type { Backup, Database, Role } from '@/views/apps/postgresql/types'
|
||||
import type { UploadFileInfo, MessageReactive } from 'naive-ui'
|
||||
import Editor from '@guolao/vue-monaco-editor'
|
||||
|
||||
@@ -4,12 +4,12 @@ const Layout = () => import('@/layout/IndexView.vue')
|
||||
|
||||
export default {
|
||||
name: 'postgresql15',
|
||||
path: '/plugins/postgresql15',
|
||||
path: '/apps/postgresql15',
|
||||
component: Layout,
|
||||
isHidden: true,
|
||||
children: [
|
||||
{
|
||||
name: 'plugins-postgresql15-index',
|
||||
name: 'apps-postgresql15-index',
|
||||
path: '',
|
||||
component: () => import('../postgresql/IndexView.vue'),
|
||||
meta: {
|
||||
@@ -4,12 +4,12 @@ const Layout = () => import('@/layout/IndexView.vue')
|
||||
|
||||
export default {
|
||||
name: 'postgresql16',
|
||||
path: '/plugins/postgresql16',
|
||||
path: '/apps/postgresql16',
|
||||
component: Layout,
|
||||
isHidden: true,
|
||||
children: [
|
||||
{
|
||||
name: 'plugins-postgresql16-index',
|
||||
name: 'apps-postgresql16-index',
|
||||
path: '',
|
||||
component: () => import('../postgresql/IndexView.vue'),
|
||||
meta: {
|
||||
@@ -1,8 +1,8 @@
|
||||
<script setup lang="ts">
|
||||
import { NButton, NDataTable, NInput, NPopconfirm } from 'naive-ui'
|
||||
import { generateRandomString, renderIcon } from '@/utils'
|
||||
import type { User } from '@/views/plugins/pureftpd/types'
|
||||
import pureftpd from '@/api/plugins/pureftpd'
|
||||
import type { User } from '@/views/apps/pureftpd/types'
|
||||
import pureftpd from '@/api/apps/pureftpd'
|
||||
import service from '@/api/panel/system/service'
|
||||
|
||||
const currentTab = ref('status')
|
||||
@@ -4,12 +4,12 @@ const Layout = () => import('@/layout/IndexView.vue')
|
||||
|
||||
export default {
|
||||
name: 'pureftpd',
|
||||
path: '/plugins/pureftpd',
|
||||
path: '/apps/pureftpd',
|
||||
component: Layout,
|
||||
isHidden: true,
|
||||
children: [
|
||||
{
|
||||
name: 'plugins-pureftpd-index',
|
||||
name: 'apps-pureftpd-index',
|
||||
path: '',
|
||||
component: () => import('./IndexView.vue'),
|
||||
meta: {
|
||||
@@ -1,7 +1,7 @@
|
||||
<script setup lang="ts">
|
||||
import { NButton, NDataTable, NPopconfirm } from 'naive-ui'
|
||||
import Editor from '@guolao/vue-monaco-editor'
|
||||
import redis from '@/api/plugins/redis'
|
||||
import redis from '@/api/apps/redis'
|
||||
import service from '@/api/panel/system/service'
|
||||
|
||||
const currentTab = ref('status')
|
||||
@@ -4,12 +4,12 @@ const Layout = () => import('@/layout/IndexView.vue')
|
||||
|
||||
export default {
|
||||
name: 'redis',
|
||||
path: '/plugins/redis',
|
||||
path: '/apps/redis',
|
||||
component: Layout,
|
||||
isHidden: true,
|
||||
children: [
|
||||
{
|
||||
name: 'plugins-redis-index',
|
||||
name: 'apps-redis-index',
|
||||
path: '',
|
||||
component: () => import('./IndexView.vue'),
|
||||
meta: {
|
||||
@@ -2,8 +2,8 @@
|
||||
import { NButton, NDataTable, NInput, NPopconfirm } from 'naive-ui'
|
||||
import { generateRandomString, renderIcon } from '@/utils'
|
||||
import Editor from '@guolao/vue-monaco-editor'
|
||||
import type { Module } from '@/views/plugins/rsync/types'
|
||||
import rsync from '@/api/plugins/rsync'
|
||||
import type { Module } from '@/views/apps/rsync/types'
|
||||
import rsync from '@/api/apps/rsync'
|
||||
import service from '@/api/panel/system/service'
|
||||
|
||||
const currentTab = ref('status')
|
||||
@@ -4,12 +4,12 @@ const Layout = () => import('@/layout/IndexView.vue')
|
||||
|
||||
export default {
|
||||
name: 'rsync',
|
||||
path: '/plugins/rsync',
|
||||
path: '/apps/rsync',
|
||||
component: Layout,
|
||||
isHidden: true,
|
||||
children: [
|
||||
{
|
||||
name: 'plugins-rsync-index',
|
||||
name: 'apps-rsync-index',
|
||||
path: '',
|
||||
component: () => import('./IndexView.vue'),
|
||||
meta: {
|
||||
@@ -1,8 +1,8 @@
|
||||
<script setup lang="ts">
|
||||
import { NButton, NDataTable, NInput, NPopconfirm } from 'naive-ui'
|
||||
import s3fs from '@/api/plugins/s3fs'
|
||||
import s3fs from '@/api/apps/s3fs'
|
||||
import { renderIcon } from '@/utils'
|
||||
import type { S3fs } from '@/views/plugins/s3fs/types'
|
||||
import type { S3fs } from '@/views/apps/s3fs/types'
|
||||
|
||||
const addMountModal = ref(false)
|
||||
|
||||
@@ -4,12 +4,12 @@ const Layout = () => import('@/layout/IndexView.vue')
|
||||
|
||||
export default {
|
||||
name: 's3fs',
|
||||
path: '/plugins/s3fs',
|
||||
path: '/apps/s3fs',
|
||||
component: Layout,
|
||||
isHidden: true,
|
||||
children: [
|
||||
{
|
||||
name: 'plugins-s3fs-index',
|
||||
name: 'apps-s3fs-index',
|
||||
path: '',
|
||||
component: () => import('./IndexView.vue'),
|
||||
meta: {
|
||||
@@ -1,9 +1,9 @@
|
||||
<script setup lang="ts">
|
||||
import { NButton, NDataTable, NInput, NPopconfirm } from 'naive-ui'
|
||||
import supervisor from '@/api/plugins/supervisor'
|
||||
import supervisor from '@/api/apps/supervisor'
|
||||
import service from '@/api/panel/system/service'
|
||||
import { renderIcon } from '@/utils'
|
||||
import type { Process } from '@/views/plugins/supervisor/types'
|
||||
import type { Process } from '@/views/apps/supervisor/types'
|
||||
import Editor from '@guolao/vue-monaco-editor'
|
||||
|
||||
const currentTab = ref('status')
|
||||
@@ -4,12 +4,12 @@ const Layout = () => import('@/layout/IndexView.vue')
|
||||
|
||||
export default {
|
||||
name: 'supervisor',
|
||||
path: '/plugins/supervisor',
|
||||
path: '/apps/supervisor',
|
||||
component: Layout,
|
||||
isHidden: true,
|
||||
children: [
|
||||
{
|
||||
name: 'plugins-supervisor-index',
|
||||
name: 'apps-supervisor-index',
|
||||
path: '',
|
||||
component: () => import('./IndexView.vue'),
|
||||
meta: {
|
||||
@@ -1,6 +1,6 @@
|
||||
<script setup lang="ts">
|
||||
import { NButton } from 'naive-ui'
|
||||
import toolbox from '@/api/plugins/toolbox'
|
||||
import toolbox from '@/api/apps/toolbox'
|
||||
import Editor from '@guolao/vue-monaco-editor'
|
||||
|
||||
const currentTab = ref('dns')
|
||||
@@ -4,12 +4,12 @@ const Layout = () => import('@/layout/IndexView.vue')
|
||||
|
||||
export default {
|
||||
name: 'toolbox',
|
||||
path: '/plugins/toolbox',
|
||||
path: '/apps/toolbox',
|
||||
component: Layout,
|
||||
isHidden: true,
|
||||
children: [
|
||||
{
|
||||
name: 'plugins-toolbox-index',
|
||||
name: 'apps-toolbox-index',
|
||||
path: '',
|
||||
component: () => import('./IndexView.vue'),
|
||||
meta: {
|
||||
@@ -1,6 +1,6 @@
|
||||
<script lang="ts" setup>
|
||||
import info from '@/api/panel/info'
|
||||
import type { CountInfo, HomePlugin, NowMonitor, SystemInfo } from './types'
|
||||
import type { CountInfo, HomeApp, Realtime, SystemInfo } from './types'
|
||||
import { router } from '@/router'
|
||||
import { NButton, NPopconfirm } from 'naive-ui'
|
||||
import { useAppStore } from '@/store'
|
||||
@@ -9,9 +9,9 @@ import { formatBytes, formatPercent } from '@/utils/file'
|
||||
|
||||
const { t, locale } = useI18n()
|
||||
const appStore = useAppStore()
|
||||
const nowMonitor = ref<NowMonitor | null>(null)
|
||||
const realtime = ref<Realtime | null>(null)
|
||||
const systemInfo = ref<SystemInfo | null>(null)
|
||||
const homePlugins = ref<HomePlugin[] | null>(null)
|
||||
const homeApps = ref<HomeApp[] | null>(null)
|
||||
const countInfo = ref<CountInfo>({
|
||||
website: 0,
|
||||
database: 0,
|
||||
@@ -29,8 +29,8 @@ const diskTotalWrite = ref(0)
|
||||
const diskCurrentRead = ref(0)
|
||||
const diskCurrentWrite = ref(0)
|
||||
|
||||
const getNowMonitor = async () => {
|
||||
info.nowMonitor().then((res) => {
|
||||
const getRealtime = async () => {
|
||||
info.realtime().then((res) => {
|
||||
res.data.percent[0] = formatPercent(res.data.percent[0])
|
||||
res.data.mem.usedPercent = formatPercent(res.data.mem.usedPercent)
|
||||
// 计算 CPU 核心数
|
||||
@@ -69,7 +69,7 @@ const getNowMonitor = async () => {
|
||||
diskCurrentRead.value = (diskTotalRead.value - diskTotalReadOld) / 3
|
||||
diskCurrentWrite.value = (diskTotalWrite.value - diskTotalWriteOld) / 3
|
||||
|
||||
nowMonitor.value = res.data
|
||||
realtime.value = res.data
|
||||
})
|
||||
}
|
||||
|
||||
@@ -84,9 +84,9 @@ const getCountInfo = async () => {
|
||||
})
|
||||
}
|
||||
|
||||
const getHomePlugins = async () => {
|
||||
info.homePlugins().then((res) => {
|
||||
homePlugins.value = res.data
|
||||
const getHomeApps = async () => {
|
||||
info.homeApps().then((res) => {
|
||||
homeApps.value = res.data
|
||||
})
|
||||
}
|
||||
|
||||
@@ -135,8 +135,8 @@ const toGit = () => {
|
||||
window.open('https://github.com/TheTNB/panel')
|
||||
}
|
||||
|
||||
const handleManagePlugin = (slug: string) => {
|
||||
router.push({ name: 'plugins-' + slug + '-index' })
|
||||
const handleManageApp = (slug: string) => {
|
||||
router.push({ name: 'apps-' + slug + '-index' })
|
||||
}
|
||||
|
||||
const quantifier = computed(() => {
|
||||
@@ -146,12 +146,12 @@ const quantifier = computed(() => {
|
||||
let homeInterval: any = null
|
||||
|
||||
onMounted(() => {
|
||||
getNowMonitor()
|
||||
getRealtime()
|
||||
getSystemInfo()
|
||||
getCountInfo()
|
||||
getHomePlugins()
|
||||
getHomeApps()
|
||||
homeInterval = setInterval(() => {
|
||||
getNowMonitor()
|
||||
getRealtime()
|
||||
}, 3000)
|
||||
})
|
||||
|
||||
@@ -213,7 +213,7 @@ onUnmounted(() => {
|
||||
size="small"
|
||||
:title="$t('homeIndex.resources.title')"
|
||||
>
|
||||
<n-space v-if="nowMonitor" vertical :size="30">
|
||||
<n-space v-if="realtime" vertical :size="30">
|
||||
<n-thing>
|
||||
<template #avatar>
|
||||
<n-avatar>
|
||||
@@ -226,21 +226,21 @@ onUnmounted(() => {
|
||||
<template #description>
|
||||
<n-progress
|
||||
type="line"
|
||||
:percentage="nowMonitor.percent[0]"
|
||||
:percentage="realtime.percent[0]"
|
||||
:indicator-placement="'inside'"
|
||||
/>
|
||||
</template>
|
||||
<p>
|
||||
{{
|
||||
$t('homeIndex.resources.cpu.used', {
|
||||
used: nowMonitor.cpus.length,
|
||||
used: realtime.cpus.length,
|
||||
total: cores
|
||||
})
|
||||
}}
|
||||
</p>
|
||||
<p>{{ nowMonitor.cpus[0].modelName }}</p>
|
||||
<p>{{ realtime.cpus[0].modelName }}</p>
|
||||
</n-thing>
|
||||
<n-thing v-if="nowMonitor">
|
||||
<n-thing v-if="realtime">
|
||||
<template #avatar>
|
||||
<n-avatar>
|
||||
<n-icon>
|
||||
@@ -253,23 +253,23 @@ onUnmounted(() => {
|
||||
<n-progress
|
||||
type="line"
|
||||
status="info"
|
||||
:percentage="nowMonitor.mem.usedPercent"
|
||||
:percentage="realtime.mem.usedPercent"
|
||||
:indicator-placement="'inside'"
|
||||
/>
|
||||
</template>
|
||||
<p>
|
||||
{{
|
||||
$t('homeIndex.resources.memory.physical.used', {
|
||||
used: formatBytes(nowMonitor.mem.used),
|
||||
total: formatBytes(nowMonitor.mem.total)
|
||||
used: formatBytes(realtime.mem.used),
|
||||
total: formatBytes(realtime.mem.total)
|
||||
})
|
||||
}}
|
||||
</p>
|
||||
<p>
|
||||
{{
|
||||
$t('homeIndex.resources.memory.swap.used', {
|
||||
used: formatBytes(nowMonitor.swap.used),
|
||||
total: formatBytes(nowMonitor.swap.total)
|
||||
used: formatBytes(realtime.swap.used),
|
||||
total: formatBytes(realtime.swap.total)
|
||||
})
|
||||
}}
|
||||
</p>
|
||||
@@ -280,7 +280,7 @@ onUnmounted(() => {
|
||||
</n-gi>
|
||||
<n-gi>
|
||||
<n-card :segmented="true" rounded-10 size="small" :title="$t('homeIndex.loads.title')">
|
||||
<n-space v-if="nowMonitor" vertical size="large">
|
||||
<n-space v-if="realtime" vertical size="large">
|
||||
<n-thing>
|
||||
<template #avatar>
|
||||
<n-avatar>
|
||||
@@ -296,13 +296,13 @@ onUnmounted(() => {
|
||||
<template #trigger>
|
||||
<n-progress
|
||||
type="line"
|
||||
:percentage="formatPercent((nowMonitor.load.load1 / cores) * 100)"
|
||||
:percentage="formatPercent((realtime.load.load1 / cores) * 100)"
|
||||
:indicator-placement="'inside'"
|
||||
/>
|
||||
</template>
|
||||
<span>
|
||||
{{ $t('homeIndex.loads.load', { load: '1' }) }}
|
||||
<n-tag type="primary">{{ nowMonitor.load.load1 }}</n-tag>
|
||||
<n-tag type="primary">{{ realtime.load.load1 }}</n-tag>
|
||||
</span>
|
||||
</n-popover>
|
||||
</n-thing>
|
||||
@@ -322,13 +322,13 @@ onUnmounted(() => {
|
||||
<template #trigger>
|
||||
<n-progress
|
||||
type="line"
|
||||
:percentage="formatPercent((nowMonitor.load.load5 / cores) * 100)"
|
||||
:percentage="formatPercent((realtime.load.load5 / cores) * 100)"
|
||||
:indicator-placement="'inside'"
|
||||
/>
|
||||
</template>
|
||||
<span>
|
||||
{{ $t('homeIndex.loads.load', { load: '5' }) }}
|
||||
<n-tag type="primary">{{ nowMonitor.load.load5 }}</n-tag>
|
||||
<n-tag type="primary">{{ realtime.load.load5 }}</n-tag>
|
||||
</span>
|
||||
</n-popover>
|
||||
</n-thing>
|
||||
@@ -347,13 +347,13 @@ onUnmounted(() => {
|
||||
<template #trigger>
|
||||
<n-progress
|
||||
type="line"
|
||||
:percentage="formatPercent((nowMonitor.load.load15 / cores) * 100)"
|
||||
:percentage="formatPercent((realtime.load.load15 / cores) * 100)"
|
||||
:indicator-placement="'inside'"
|
||||
/>
|
||||
</template>
|
||||
<span>
|
||||
{{ $t('homeIndex.loads.load', { load: '15' }) }}
|
||||
<n-tag type="primary">{{ nowMonitor.load.load15 }}</n-tag>
|
||||
<n-tag type="primary">{{ realtime.load.load15 }}</n-tag>
|
||||
</span>
|
||||
</n-popover>
|
||||
</n-thing>
|
||||
@@ -368,7 +368,7 @@ onUnmounted(() => {
|
||||
size="small"
|
||||
:title="$t('homeIndex.traffic.title')"
|
||||
>
|
||||
<n-space v-if="nowMonitor" vertical :size="36">
|
||||
<n-space v-if="realtime" vertical :size="36">
|
||||
<n-thing>
|
||||
<template #avatar>
|
||||
<n-avatar>
|
||||
@@ -441,8 +441,8 @@ onUnmounted(() => {
|
||||
size="small"
|
||||
:title="$t('homeIndex.store.title')"
|
||||
>
|
||||
<n-space v-if="nowMonitor" class="pb-10 pt-10">
|
||||
<div v-for="item in nowMonitor?.disk_usage" :key="item.path">
|
||||
<n-space v-if="realtime" class="pb-10 pt-10">
|
||||
<div v-for="item in realtime?.disk_usage" :key="item.path">
|
||||
<n-popover trigger="hover">
|
||||
<template #trigger>
|
||||
<n-space vertical class="flex items-center">
|
||||
@@ -548,28 +548,23 @@ onUnmounted(() => {
|
||||
>
|
||||
<n-gi span="2 s:1 m:1 l:2">
|
||||
<div min-w-375 flex-1>
|
||||
<n-card
|
||||
:segmented="true"
|
||||
rounded-10
|
||||
size="small"
|
||||
:title="$t('homeIndex.plugins.title')"
|
||||
>
|
||||
<n-card :segmented="true" rounded-10 size="small" :title="$t('homeIndex.apps.title')">
|
||||
<n-grid
|
||||
v-if="homePlugins"
|
||||
v-if="homeApps"
|
||||
x-gap="12"
|
||||
y-gap="12"
|
||||
cols="3 s:1 m:2 l:3"
|
||||
item-responsive
|
||||
responsive="screen"
|
||||
>
|
||||
<n-gi v-for="item in homePlugins" :key="item.name">
|
||||
<n-gi v-for="item in homeApps" :key="item.name">
|
||||
<n-card
|
||||
:segmented="true"
|
||||
size="small"
|
||||
cursor-pointer
|
||||
rounded-10
|
||||
hover:card-shadow
|
||||
@click="handleManagePlugin(item.slug)"
|
||||
@click="handleManageApp(item.slug)"
|
||||
>
|
||||
<n-space>
|
||||
<n-thing>
|
||||
|
||||
@@ -138,7 +138,7 @@ interface DiskUsageStat {
|
||||
inodesUsedPercent: number
|
||||
}
|
||||
|
||||
export interface NowMonitor {
|
||||
export interface Realtime {
|
||||
cpus: CpuInfoStat[]
|
||||
percent: number[]
|
||||
load: LoadAvgStat
|
||||
@@ -164,7 +164,7 @@ export interface CountInfo {
|
||||
cron: number
|
||||
}
|
||||
|
||||
export interface HomePlugin {
|
||||
export interface HomeApp {
|
||||
id: number
|
||||
slug: string
|
||||
version: string
|
||||
|
||||
@@ -197,7 +197,7 @@ onUnmounted(() => {
|
||||
<template>
|
||||
<common-page show-footer>
|
||||
<n-flex vertical>
|
||||
<n-alert type="info">若日志无法加载,请关闭广告拦截插件!</n-alert>
|
||||
<n-alert type="info">若日志无法加载,请关闭广告拦截应用!</n-alert>
|
||||
<n-data-table
|
||||
striped
|
||||
remote
|
||||
|
||||
@@ -12,14 +12,12 @@ import {
|
||||
import website from '@/api/panel/website'
|
||||
import info from '@/api/panel/info'
|
||||
import { generateRandomString, isNullOrUndef, renderIcon } from '@/utils'
|
||||
import type { Backup, Website } from './types'
|
||||
import type { UploadFileInfo, MessageReactive } from 'naive-ui'
|
||||
import type { Website } from './types'
|
||||
import Editor from '@guolao/vue-monaco-editor'
|
||||
import { useI18n } from 'vue-i18n'
|
||||
|
||||
const { t } = useI18n()
|
||||
const router = useRouter()
|
||||
let messageReactive: MessageReactive | null = null
|
||||
const selectedRowKeys = ref<any>([])
|
||||
|
||||
const columns: any = [
|
||||
@@ -101,22 +99,6 @@ const columns: any = [
|
||||
hideInExcel: true,
|
||||
render(row: any) {
|
||||
return [
|
||||
h(
|
||||
NButton,
|
||||
{
|
||||
size: 'small',
|
||||
type: 'warning',
|
||||
secondary: true,
|
||||
onClick: () => {
|
||||
currentWebsite.value = row.id
|
||||
backupModal.value = true
|
||||
}
|
||||
},
|
||||
{
|
||||
default: () => '备份',
|
||||
icon: renderIcon('majesticons:eye-line', { size: 14 })
|
||||
}
|
||||
),
|
||||
h(
|
||||
NButton,
|
||||
{
|
||||
@@ -186,63 +168,8 @@ const columns: any = [
|
||||
}
|
||||
}
|
||||
]
|
||||
const backupColumns: any = [
|
||||
{ title: '文件名', key: 'name', fixed: 'left', resizable: true, ellipsis: { tooltip: true } },
|
||||
{ title: '大小', key: 'size', width: 200, ellipsis: { tooltip: true } },
|
||||
{
|
||||
title: '操作',
|
||||
key: 'actions',
|
||||
width: 200,
|
||||
align: 'center',
|
||||
fixed: 'right',
|
||||
hideInExcel: true,
|
||||
render(row: any) {
|
||||
return [
|
||||
h(
|
||||
NButton,
|
||||
{
|
||||
size: 'small',
|
||||
type: 'warning',
|
||||
secondary: true,
|
||||
onClick: () => handleRestoreBackup(row)
|
||||
},
|
||||
{
|
||||
default: () => '恢复',
|
||||
icon: renderIcon('material-symbols:settings-backup-restore-rounded', { size: 14 })
|
||||
}
|
||||
),
|
||||
h(
|
||||
NPopconfirm,
|
||||
{
|
||||
onPositiveClick: () => handleDeleteBackup(row.name)
|
||||
},
|
||||
{
|
||||
default: () => {
|
||||
return '确定删除备份吗?'
|
||||
},
|
||||
trigger: () => {
|
||||
return h(
|
||||
NButton,
|
||||
{
|
||||
size: 'small',
|
||||
type: 'error',
|
||||
style: 'margin-left: 15px;'
|
||||
},
|
||||
{
|
||||
default: () => '删除',
|
||||
icon: renderIcon('material-symbols:delete-outline', { size: 14 })
|
||||
}
|
||||
)
|
||||
}
|
||||
}
|
||||
)
|
||||
]
|
||||
}
|
||||
}
|
||||
]
|
||||
|
||||
const data = ref<Website[]>([] as Website[])
|
||||
const backup = ref<Backup[]>([])
|
||||
|
||||
const pagination = reactive({
|
||||
page: 1,
|
||||
@@ -253,20 +180,9 @@ const pagination = reactive({
|
||||
showSizePicker: true,
|
||||
pageSizes: [15, 30, 50, 100]
|
||||
})
|
||||
const backupPagination = reactive({
|
||||
page: 1,
|
||||
pageCount: 1,
|
||||
pageSize: 10,
|
||||
itemCount: 0,
|
||||
showQuickJumper: true,
|
||||
showSizePicker: true,
|
||||
pageSizes: [10, 20, 50, 100]
|
||||
})
|
||||
|
||||
const currentWebsite = ref(0)
|
||||
const addModal = ref(false)
|
||||
const editDefaultPageModal = ref(false)
|
||||
const backupModal = ref(false)
|
||||
|
||||
const buttonLoading = ref(false)
|
||||
const buttonDisabled = ref(false)
|
||||
@@ -336,10 +252,6 @@ const getDefaultPage = async () => {
|
||||
const { data } = await website.defaultConfig()
|
||||
editDefaultPageModel.value = data
|
||||
}
|
||||
const getBackupList = async (page: number, limit: number) => {
|
||||
const { data } = await website.backupList(page, limit)
|
||||
return data
|
||||
}
|
||||
|
||||
const onPageChange = (page: number) => {
|
||||
pagination.page = page
|
||||
@@ -349,23 +261,11 @@ const onPageChange = (page: number) => {
|
||||
pagination.pageCount = res.total / pagination.pageSize + 1
|
||||
})
|
||||
}
|
||||
const onBackupPageChange = (page: number) => {
|
||||
backupPagination.page = page
|
||||
getBackupList(page, backupPagination.pageSize).then((res) => {
|
||||
backup.value = res.items
|
||||
backupPagination.itemCount = res.total
|
||||
backupPagination.pageCount = res.total / backupPagination.pageSize + 1
|
||||
})
|
||||
}
|
||||
|
||||
const onPageSizeChange = (pageSize: number) => {
|
||||
pagination.pageSize = pageSize
|
||||
onPageChange(1)
|
||||
}
|
||||
const onBackupPageSizeChange = (pageSize: number) => {
|
||||
backupPagination.pageSize = pageSize
|
||||
onBackupPageChange(1)
|
||||
}
|
||||
|
||||
const handleRemark = (row: any) => {
|
||||
website.updateRemark(row.id, row.remark).then(() => {
|
||||
@@ -463,51 +363,6 @@ const batchDelete = async () => {
|
||||
onPageChange(pagination.page)
|
||||
}
|
||||
|
||||
const handleUploadBackup = async (files: UploadFileInfo[]) => {
|
||||
messageReactive = window.$message.loading('上传中...', {
|
||||
duration: 0
|
||||
})
|
||||
for (let i = 0; i < files.length; i++) {
|
||||
const file = files[i]
|
||||
const formData = new FormData()
|
||||
formData.append('file', file.file as Blob, file.name)
|
||||
await website.uploadBackup(formData).then(() => {
|
||||
messageReactive?.destroy()
|
||||
window.$message.success('上传成功')
|
||||
onBackupPageChange(backupPagination.page)
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
const handleCreateBackup = async () => {
|
||||
messageReactive = window.$message.loading('创建中...', {
|
||||
duration: 0
|
||||
})
|
||||
await website.createBackup(currentWebsite.value).then(() => {
|
||||
messageReactive?.destroy()
|
||||
window.$message.success('创建成功')
|
||||
onBackupPageChange(backupPagination.page)
|
||||
})
|
||||
}
|
||||
|
||||
const handleRestoreBackup = async (row: any) => {
|
||||
messageReactive = window.$message.loading('恢复中...', {
|
||||
duration: 0
|
||||
})
|
||||
await website.restoreBackup(currentWebsite.value, row.name).then(() => {
|
||||
messageReactive?.destroy()
|
||||
window.$message.success('恢复成功')
|
||||
onBackupPageChange(backupPagination.page)
|
||||
})
|
||||
}
|
||||
|
||||
const handleDeleteBackup = async (name: string) => {
|
||||
await website.deleteBackup(name).then(() => {
|
||||
window.$message.success('删除成功')
|
||||
onBackupPageChange(backupPagination.page)
|
||||
})
|
||||
}
|
||||
|
||||
const formatDbValue = (value: string) => {
|
||||
value = value.replace(/\./g, '_')
|
||||
value = value.replace(/-/g, '_')
|
||||
@@ -522,7 +377,6 @@ onMounted(() => {
|
||||
onPageChange(pagination.page)
|
||||
getPhpAndDb()
|
||||
getDefaultPage()
|
||||
onBackupPageChange(backupPagination.page)
|
||||
})
|
||||
</script>
|
||||
|
||||
@@ -753,31 +607,4 @@ onMounted(() => {
|
||||
</n-tab-pane>
|
||||
</n-tabs>
|
||||
</n-modal>
|
||||
<n-modal v-model:show="backupModal">
|
||||
<n-card closable @close="() => (backupModal = false)" title="备份管理" style="width: 60vw">
|
||||
<n-space vertical>
|
||||
<n-space>
|
||||
<n-button type="primary" @click="handleCreateBackup">创建备份</n-button>
|
||||
<n-upload
|
||||
accept=".zip,tar.gz,.tar,.rar,.bz2"
|
||||
:default-upload="false"
|
||||
:show-file-list="false"
|
||||
@update:file-list="handleUploadBackup"
|
||||
>
|
||||
<n-button>上传备份</n-button>
|
||||
</n-upload>
|
||||
</n-space>
|
||||
<n-data-table
|
||||
striped
|
||||
remote
|
||||
:loading="false"
|
||||
:columns="backupColumns"
|
||||
:data="backup"
|
||||
:row-key="(row: any) => row.name"
|
||||
@update:page="onBackupPageChange"
|
||||
@update:page-size="onBackupPageSizeChange"
|
||||
/>
|
||||
</n-space>
|
||||
</n-card>
|
||||
</n-modal>
|
||||
</template>
|
||||
|
||||
Reference in New Issue
Block a user