fix: 请求路由根据前端目录调整

This commit is contained in:
ssongliu 2023-02-13 17:13:55 +08:00 committed by ssongliu
parent 2adbfa230c
commit 920b5b9452
25 changed files with 2025 additions and 2253 deletions

View File

@ -15,7 +15,7 @@ import (
// @Param request body dto.BackupOperate true "request"
// @Success 200
// @Security ApiKeyAuth
// @Router /backups [post]
// @Router /settings/backup [post]
// @x-panel-log {"bodyKeys":["type"],"paramKeys":[],"BeforeFuntions":[],"formatZH":"创建备份账号 [type]","formatEN":"create backup account [type]"}
func (b *BaseApi) CreateBackup(c *gin.Context) {
var req dto.BackupOperate
@ -41,7 +41,7 @@ func (b *BaseApi) CreateBackup(c *gin.Context) {
// @Param request body dto.ForBuckets true "request"
// @Success 200 {anrry} string
// @Security ApiKeyAuth
// @Router /backups/search [post]
// @Router /settings/backup/search [post]
func (b *BaseApi) ListBuckets(c *gin.Context) {
var req dto.ForBuckets
if err := c.ShouldBindJSON(&req); err != nil {
@ -67,7 +67,7 @@ func (b *BaseApi) ListBuckets(c *gin.Context) {
// @Param request body dto.BatchDeleteReq true "request"
// @Success 200
// @Security ApiKeyAuth
// @Router /backups/del [post]
// @Router /settings/backup/del [post]
// @x-panel-log {"bodyKeys":["ids"],"paramKeys":[],"BeforeFuntions":[{"input_colume":"id","input_value":"ids","isList":true,"db":"backup_accounts","output_colume":"type","output_value":"types"}],"formatZH":"删除备份账号 [types]","formatEN":"delete backup account [types]"}
func (b *BaseApi) DeleteBackup(c *gin.Context) {
var req dto.BatchDeleteReq
@ -94,7 +94,7 @@ func (b *BaseApi) DeleteBackup(c *gin.Context) {
// @Param request body dto.RecordSearch true "request"
// @Success 200
// @Security ApiKeyAuth
// @Router /backups/record/search [post]
// @Router /settings/backup/record/search [post]
func (b *BaseApi) SearchBackupRecords(c *gin.Context) {
var req dto.RecordSearch
if err := c.ShouldBindJSON(&req); err != nil {
@ -121,7 +121,7 @@ func (b *BaseApi) SearchBackupRecords(c *gin.Context) {
// @Param request body dto.DownloadRecord true "request"
// @Success 200
// @Security ApiKeyAuth
// @Router /backups/record/download [post]
// @Router /settings/backup/record/download [post]
// @x-panel-log {"bodyKeys":["source","fileName"],"paramKeys":[],"BeforeFuntions":[],"formatZH":"下载备份记录 [source][fileName]","formatEN":"download backup records [source][fileName]"}
func (b *BaseApi) DownloadRecord(c *gin.Context) {
var req dto.DownloadRecord
@ -149,7 +149,7 @@ func (b *BaseApi) DownloadRecord(c *gin.Context) {
// @Param request body dto.BatchDeleteReq true "request"
// @Success 200
// @Security ApiKeyAuth
// @Router /backups/record/del [post]
// @Router /settings/backup/record/del [post]
// @x-panel-log {"bodyKeys":["ids"],"paramKeys":[],"BeforeFuntions":[{"input_colume":"id","input_value":"ids","isList":true,"db":"backup_records","output_colume":"file_name","output_value":"files"}],"formatZH":"删除备份记录 [files]","formatEN":"delete backup records [files]"}
func (b *BaseApi) DeleteBackupRecord(c *gin.Context) {
var req dto.BatchDeleteReq
@ -176,7 +176,7 @@ func (b *BaseApi) DeleteBackupRecord(c *gin.Context) {
// @Param request body dto.BackupOperate true "request"
// @Success 200
// @Security ApiKeyAuth
// @Router /backups/update [post]
// @Router /settings/backup/update [post]
// @x-panel-log {"bodyKeys":["type"],"paramKeys":[],"BeforeFuntions":[],"formatZH":"更新备份账号 [types]","formatEN":"update backup account [types]"}
func (b *BaseApi) UpdateBackup(c *gin.Context) {
var req dto.BackupOperate
@ -200,7 +200,7 @@ func (b *BaseApi) UpdateBackup(c *gin.Context) {
// @Description 获取备份账号列表
// @Success 200 {anrry} dto.BackupInfo
// @Security ApiKeyAuth
// @Router /backups/search [get]
// @Router /settings/backup/search [get]
func (b *BaseApi) ListBackup(c *gin.Context) {
data, err := backupService.List()
if err != nil {
@ -218,7 +218,7 @@ func (b *BaseApi) ListBackup(c *gin.Context) {
// @Param request body dto.BackupSearchFile true "request"
// @Success 200 {anrry} string
// @Security ApiKeyAuth
// @Router /backups/search/files [post]
// @Router /settings/backup/search/files [post]
func (b *BaseApi) LoadFilesFromBackup(c *gin.Context) {
var req dto.BackupSearchFile
if err := c.ShouldBindJSON(&req); err != nil {

View File

@ -15,7 +15,7 @@ import (
// @Param request body dto.CommandOperate true "request"
// @Success 200
// @Security ApiKeyAuth
// @Router /commands [post]
// @Router /hosts/command [post]
// @x-panel-log {"bodyKeys":["name","command"],"paramKeys":[],"BeforeFuntions":[],"formatZH":"创建快捷命令 [name][command]","formatEN":"create quick command [name][command]"}
func (b *BaseApi) CreateCommand(c *gin.Context) {
var req dto.CommandOperate
@ -41,7 +41,7 @@ func (b *BaseApi) CreateCommand(c *gin.Context) {
// @Param request body dto.SearchWithPage true "request"
// @Success 200 {object} dto.PageResult
// @Security ApiKeyAuth
// @Router /commands/search [post]
// @Router /hosts/command/search [post]
func (b *BaseApi) SearchCommand(c *gin.Context) {
var req dto.SearchWithPage
if err := c.ShouldBindJSON(&req); err != nil {
@ -66,7 +66,7 @@ func (b *BaseApi) SearchCommand(c *gin.Context) {
// @Description 获取快速命令列表
// @Success 200 {object} dto.CommandInfo
// @Security ApiKeyAuth
// @Router /commands [get]
// @Router /hosts/command [get]
func (b *BaseApi) ListCommand(c *gin.Context) {
list, err := commandService.List()
if err != nil {
@ -84,7 +84,7 @@ func (b *BaseApi) ListCommand(c *gin.Context) {
// @Param request body dto.BatchDeleteReq true "request"
// @Success 200
// @Security ApiKeyAuth
// @Router /commands/del [post]
// @Router /hosts/command/del [post]
// @x-panel-log {"bodyKeys":["ids"],"paramKeys":[],"BeforeFuntions":[{"input_colume":"id","input_value":"ids","isList":true,"db":"commands","output_colume":"name","output_value":"names"}],"formatZH":"删除快捷命令 [names]","formatEN":"delete quick command [names]"}
func (b *BaseApi) DeleteCommand(c *gin.Context) {
var req dto.BatchDeleteReq
@ -111,7 +111,7 @@ func (b *BaseApi) DeleteCommand(c *gin.Context) {
// @Param request body dto.CommandOperate true "request"
// @Success 200
// @Security ApiKeyAuth
// @Router /commands/update [post]
// @Router /hosts/command/update [post]
// @x-panel-log {"bodyKeys":["name"],"paramKeys":[],"BeforeFuntions":[],"formatZH":"更新快捷命令 [name]","formatEN":"update quick command [name]"}
func (b *BaseApi) UpdateCommand(c *gin.Context) {
var req dto.CommandOperate

View File

@ -15,7 +15,7 @@ import (
// @Param request body dto.GroupOperate true "request"
// @Success 200
// @Security ApiKeyAuth
// @Router /groups [post]
// @Router /hosts/group [post]
// @x-panel-log {"bodyKeys":["name","type"],"paramKeys":[],"BeforeFuntions":[],"formatZH":"创建组 [name][type]","formatEN":"create group [name][type]"}
func (b *BaseApi) CreateGroup(c *gin.Context) {
var req dto.GroupOperate
@ -41,7 +41,7 @@ func (b *BaseApi) CreateGroup(c *gin.Context) {
// @Param request body dto.OperateByID true "request"
// @Success 200
// @Security ApiKeyAuth
// @Router /groups/del [post]
// @Router /hosts/group/del [post]
// @x-panel-log {"bodyKeys":["id"],"paramKeys":[],"BeforeFuntions":[{"input_colume":"id","input_value":"id","isList":false,"db":"groups","output_colume":"name","output_value":"name"}],"formatZH":"删除组 [name]","formatEN":"delete group [name]"}
func (b *BaseApi) DeleteGroup(c *gin.Context) {
var req dto.OperateByID
@ -68,7 +68,7 @@ func (b *BaseApi) DeleteGroup(c *gin.Context) {
// @Param request body dto.GroupOperate true "request"
// @Success 200
// @Security ApiKeyAuth
// @Router /groups/update [post]
// @Router /hosts/group/update [post]
// @x-panel-log {"bodyKeys":["name","type"],"paramKeys":[],"BeforeFuntions":[],"formatZH":"更新组 [name][type]","formatEN":"update group [name][type]"}
func (b *BaseApi) UpdateGroup(c *gin.Context) {
var req dto.GroupOperate
@ -88,28 +88,6 @@ func (b *BaseApi) UpdateGroup(c *gin.Context) {
helper.SuccessWithData(c, nil)
}
// @Tags System Group
// @Summary Search group info by id
// @Description 查询系统组
// @Accept json
// @Param id path integer true "request"
// @Success 200 {object} dto.GroupInfo
// @Security ApiKeyAuth
// @Router /groups/:id [get]
func (b *BaseApi) GetGroupInfo(c *gin.Context) {
id, err := helper.GetParamID(c)
if err != nil {
helper.ErrorWithDetail(c, constant.CodeErrBadRequest, constant.ErrTypeInvalidParams, err)
return
}
group, err := groupService.GetGroupInfo(id)
if err != nil {
helper.ErrorWithDetail(c, constant.CodeErrInternalServer, constant.ErrTypeInternalServer, err)
return
}
helper.SuccessWithData(c, group)
}
// @Tags System Group
// @Summary List groups
// @Description 查询系统组
@ -117,7 +95,7 @@ func (b *BaseApi) GetGroupInfo(c *gin.Context) {
// @Param request body dto.GroupSearch true "request"
// @Success 200 {anrry} dto.GroupInfo
// @Security ApiKeyAuth
// @Router /groups/search [post]
// @Router /hosts/group/search [post]
func (b *BaseApi) ListGroup(c *gin.Context) {
var req dto.GroupSearch
if err := c.ShouldBindJSON(&req); err != nil {

View File

@ -10,7 +10,6 @@ import (
type GroupService struct{}
type IGroupService interface {
GetGroupInfo(id uint) (*dto.GroupInfo, error)
List(req dto.GroupSearch) ([]dto.GroupInfo, error)
Create(groupDto dto.GroupOperate) error
Update(id uint, name string) error
@ -21,18 +20,6 @@ func NewIGroupService() IGroupService {
return &GroupService{}
}
func (u *GroupService) GetGroupInfo(id uint) (*dto.GroupInfo, error) {
group, err := groupRepo.Get(commonRepo.WithByID(id))
if err != nil {
return nil, constant.ErrRecordNotFound
}
var dtoGroup dto.GroupInfo
if err := copier.Copy(&dtoGroup, &group); err != nil {
return nil, errors.WithMessage(constant.ErrStructTransform, err.Error())
}
return &dtoGroup, err
}
func (u *GroupService) List(req dto.GroupSearch) ([]dto.GroupInfo, error) {
groups, err := groupRepo.GetList(groupRepo.WithByType(req.Type))
if err != nil {

View File

@ -73,10 +73,7 @@ func Routers() *gin.Engine {
systemRouter.InitBaseRouter(PrivateGroup)
systemRouter.InitDashboardRouter(PrivateGroup)
systemRouter.InitHostRouter(PrivateGroup)
systemRouter.InitBackupRouter(PrivateGroup)
systemRouter.InitGroupRouter(PrivateGroup)
systemRouter.InitContainerRouter(PrivateGroup)
systemRouter.InitCommandRouter(PrivateGroup)
systemRouter.InitTerminalRouter(PrivateGroup)
systemRouter.InitMonitorRouter(PrivateGroup)
systemRouter.InitLogRouter(PrivateGroup)

View File

@ -4,10 +4,7 @@ type RouterGroup struct {
BaseRouter
DashboardRouter
HostRouter
BackupRouter
GroupRouter
ContainerRouter
CommandRouter
MonitorRouter
LogRouter
FileRouter

View File

@ -1,29 +0,0 @@
package router
import (
v1 "github.com/1Panel-dev/1Panel/backend/app/api/v1"
"github.com/1Panel-dev/1Panel/backend/middleware"
"github.com/gin-gonic/gin"
)
type BackupRouter struct{}
func (s *BackupRouter) InitBackupRouter(Router *gin.RouterGroup) {
baRouter := Router.Group("backups").
Use(middleware.JwtAuth()).
Use(middleware.SessionAuth()).
Use(middleware.PasswordExpired())
baseApi := v1.ApiGroupApp.BaseApi
{
baRouter.GET("/search", baseApi.ListBackup)
baRouter.POST("/search/files", baseApi.LoadFilesFromBackup)
baRouter.POST("/buckets", baseApi.ListBuckets)
baRouter.POST("", baseApi.CreateBackup)
baRouter.POST("/del", baseApi.DeleteBackup)
baRouter.POST("/update", baseApi.UpdateBackup)
baRouter.POST("/record/search", baseApi.SearchBackupRecords)
baRouter.POST("/record/download", baseApi.DownloadRecord)
baRouter.POST("/record/del", baseApi.DeleteBackupRecord)
}
}

View File

@ -1,25 +0,0 @@
package router
import (
v1 "github.com/1Panel-dev/1Panel/backend/app/api/v1"
"github.com/1Panel-dev/1Panel/backend/middleware"
"github.com/gin-gonic/gin"
)
type CommandRouter struct{}
func (s *CommandRouter) InitCommandRouter(Router *gin.RouterGroup) {
cmdRouter := Router.Group("commands").
Use(middleware.JwtAuth()).
Use(middleware.SessionAuth()).
Use(middleware.PasswordExpired())
baseApi := v1.ApiGroupApp.BaseApi
{
cmdRouter.GET("", baseApi.ListCommand)
cmdRouter.POST("", baseApi.CreateCommand)
cmdRouter.POST("/del", baseApi.DeleteCommand)
cmdRouter.POST("/search", baseApi.SearchCommand)
cmdRouter.POST("/update", baseApi.UpdateCommand)
}
}

View File

@ -1,25 +0,0 @@
package router
import (
v1 "github.com/1Panel-dev/1Panel/backend/app/api/v1"
"github.com/1Panel-dev/1Panel/backend/middleware"
"github.com/gin-gonic/gin"
)
type GroupRouter struct{}
func (s *GroupRouter) InitGroupRouter(Router *gin.RouterGroup) {
groupRouter := Router.Group("groups").
Use(middleware.JwtAuth()).
Use(middleware.SessionAuth()).
Use(middleware.PasswordExpired())
baseApi := v1.ApiGroupApp.BaseApi
{
groupRouter.POST("", baseApi.CreateGroup)
groupRouter.POST("/del", baseApi.DeleteGroup)
groupRouter.POST("/update", baseApi.UpdateGroup)
groupRouter.POST("/search", baseApi.ListGroup)
groupRouter.GET(":id", baseApi.GetGroupInfo)
}
}

View File

@ -23,5 +23,16 @@ func (s *HostRouter) InitHostRouter(Router *gin.RouterGroup) {
hostRouter.POST("/test/byinfo", baseApi.TestByInfo)
hostRouter.POST("/test/byid/:id", baseApi.TestByID)
hostRouter.GET(":id", baseApi.GetHostInfo)
hostRouter.POST("/group", baseApi.CreateGroup)
hostRouter.POST("/group/del", baseApi.DeleteGroup)
hostRouter.POST("/group/update", baseApi.UpdateGroup)
hostRouter.POST("/group/search", baseApi.ListGroup)
hostRouter.GET("/command", baseApi.ListCommand)
hostRouter.POST("/command", baseApi.CreateCommand)
hostRouter.POST("/command/del", baseApi.DeleteCommand)
hostRouter.POST("/command/search", baseApi.SearchCommand)
hostRouter.POST("/command/update", baseApi.UpdateCommand)
}
}

View File

@ -25,6 +25,7 @@ func (s *SettingRouter) InitSettingRouter(Router *gin.RouterGroup) {
settingRouter.POST("/monitor/clean", baseApi.CleanMonitor)
settingRouter.GET("/mfa", baseApi.GetMFA)
settingRouter.POST("/mfa/bind", baseApi.MFABind)
settingRouter.POST("/snapshot", baseApi.CreateSnapshot)
settingRouter.POST("/snapshot/search", baseApi.SearchSnapshot)
settingRouter.POST("/snapshot/import", baseApi.ImportSnapshot)
@ -32,6 +33,17 @@ func (s *SettingRouter) InitSettingRouter(Router *gin.RouterGroup) {
settingRouter.POST("/snapshot/recover", baseApi.RecoverSnapshot)
settingRouter.POST("/snapshot/rollback", baseApi.RollbackSnapshot)
settingRouter.POST("/snapshot/description/update", baseApi.UpdateSnapDescription)
settingRouter.GET("/backup/search", baseApi.ListBackup)
settingRouter.POST("/backup/search/files", baseApi.LoadFilesFromBackup)
settingRouter.POST("/backup/buckets", baseApi.ListBuckets)
settingRouter.POST("/backup", baseApi.CreateBackup)
settingRouter.POST("/backup/del", baseApi.DeleteBackup)
settingRouter.POST("/backup/update", baseApi.UpdateBackup)
settingRouter.POST("/backup/record/search", baseApi.SearchBackupRecords)
settingRouter.POST("/backup/record/download", baseApi.DownloadRecord)
settingRouter.POST("/backup/record/del", baseApi.DeleteBackupRecord)
settingRouter.POST("/upgrade", baseApi.Upgrade)
settingRouter.GET("/upgrade", baseApi.GetUpgradeInfo)
settingRouter.GET("/basedir", baseApi.LoadBaseDir)

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -574,15 +574,6 @@ definitions:
- type
- vars
type: object
dto.GroupInfo:
properties:
id:
type: integer
name:
type: string
type:
type: string
type: object
dto.GroupOperate:
properties:
id:
@ -1284,6 +1275,8 @@ definitions:
type: object
dto.SettingInfo:
properties:
appStoreVersion:
type: string
complexityVerification:
type: string
dingVars:
@ -3201,352 +3194,6 @@ paths:
summary: Check is First login
tags:
- Auth
/backups:
post:
consumes:
- application/json
description: 创建备份账号
parameters:
- description: request
in: body
name: request
required: true
schema:
$ref: '#/definitions/dto.BackupOperate'
responses:
"200":
description: ""
security:
- ApiKeyAuth: []
summary: Create backup account
tags:
- Backup Account
x-panel-log:
BeforeFuntions: []
bodyKeys:
- type
formatEN: create backup account [type]
formatZH: 创建备份账号 [type]
paramKeys: []
/backups/del:
post:
consumes:
- application/json
description: 删除备份账号
parameters:
- description: request
in: body
name: request
required: true
schema:
$ref: '#/definitions/dto.BatchDeleteReq'
responses:
"200":
description: ""
security:
- ApiKeyAuth: []
summary: Delete backup account
tags:
- Backup Account
x-panel-log:
BeforeFuntions:
- db: backup_accounts
input_colume: id
input_value: ids
isList: true
output_colume: type
output_value: types
bodyKeys:
- ids
formatEN: delete backup account [types]
formatZH: 删除备份账号 [types]
paramKeys: []
/backups/record/del:
post:
consumes:
- application/json
description: 删除备份记录
parameters:
- description: request
in: body
name: request
required: true
schema:
$ref: '#/definitions/dto.BatchDeleteReq'
responses:
"200":
description: ""
security:
- ApiKeyAuth: []
summary: Delete backup record
tags:
- Backup Account
x-panel-log:
BeforeFuntions:
- db: backup_records
input_colume: id
input_value: ids
isList: true
output_colume: file_name
output_value: files
bodyKeys:
- ids
formatEN: delete backup records [files]
formatZH: 删除备份记录 [files]
paramKeys: []
/backups/record/download:
post:
consumes:
- application/json
description: 下载备份记录
parameters:
- description: request
in: body
name: request
required: true
schema:
$ref: '#/definitions/dto.DownloadRecord'
responses:
"200":
description: ""
security:
- ApiKeyAuth: []
summary: Download backup record
tags:
- Backup Account
x-panel-log:
BeforeFuntions: []
bodyKeys:
- source
- fileName
formatEN: download backup records [source][fileName]
formatZH: 下载备份记录 [source][fileName]
paramKeys: []
/backups/record/search:
post:
consumes:
- application/json
description: 获取备份记录列表分页
parameters:
- description: request
in: body
name: request
required: true
schema:
$ref: '#/definitions/dto.RecordSearch'
responses:
"200":
description: ""
security:
- ApiKeyAuth: []
summary: Page backup records
tags:
- Backup Account
/backups/search:
get:
description: 获取备份账号列表
responses:
"200":
description: OK
schema:
type: anrry
security:
- ApiKeyAuth: []
summary: List backup accounts
tags:
- Backup Account
post:
consumes:
- application/json
description: 获取 bucket 列表
parameters:
- description: request
in: body
name: request
required: true
schema:
$ref: '#/definitions/dto.ForBuckets'
responses:
"200":
description: OK
schema:
type: anrry
security:
- ApiKeyAuth: []
summary: List buckets
tags:
- Backup Account
/backups/search/files:
post:
consumes:
- application/json
description: 获取备份账号内文件列表
parameters:
- description: request
in: body
name: request
required: true
schema:
$ref: '#/definitions/dto.BackupSearchFile'
responses:
"200":
description: OK
schema:
type: anrry
security:
- ApiKeyAuth: []
summary: List files from backup accounts
tags:
- Backup Account
/backups/update:
post:
consumes:
- application/json
description: 更新备份账号信息
parameters:
- description: request
in: body
name: request
required: true
schema:
$ref: '#/definitions/dto.BackupOperate'
responses:
"200":
description: ""
security:
- ApiKeyAuth: []
summary: Update backup account
tags:
- Backup Account
x-panel-log:
BeforeFuntions: []
bodyKeys:
- type
formatEN: update backup account [types]
formatZH: 更新备份账号 [types]
paramKeys: []
/commands:
get:
description: 获取快速命令列表
responses:
"200":
description: OK
schema:
$ref: '#/definitions/dto.CommandInfo'
security:
- ApiKeyAuth: []
summary: List commands
tags:
- Command
post:
consumes:
- application/json
description: 创建快速命令
parameters:
- description: request
in: body
name: request
required: true
schema:
$ref: '#/definitions/dto.CommandOperate'
responses:
"200":
description: ""
security:
- ApiKeyAuth: []
summary: Create command
tags:
- Command
x-panel-log:
BeforeFuntions: []
bodyKeys:
- name
- command
formatEN: create quick command [name][command]
formatZH: 创建快捷命令 [name][command]
paramKeys: []
/commands/del:
post:
consumes:
- application/json
description: 删除快速命令
parameters:
- description: request
in: body
name: request
required: true
schema:
$ref: '#/definitions/dto.BatchDeleteReq'
responses:
"200":
description: ""
security:
- ApiKeyAuth: []
summary: Delete command
tags:
- Command
x-panel-log:
BeforeFuntions:
- db: commands
input_colume: id
input_value: ids
isList: true
output_colume: name
output_value: names
bodyKeys:
- ids
formatEN: delete quick command [names]
formatZH: 删除快捷命令 [names]
paramKeys: []
/commands/search:
post:
consumes:
- application/json
description: 获取快速命令列表分页
parameters:
- description: request
in: body
name: request
required: true
schema:
$ref: '#/definitions/dto.SearchWithPage'
responses:
"200":
description: OK
schema:
$ref: '#/definitions/dto.PageResult'
security:
- ApiKeyAuth: []
summary: Page commands
tags:
- Command
/commands/update:
post:
consumes:
- application/json
description: 更新快速命令
parameters:
- description: request
in: body
name: request
required: true
schema:
$ref: '#/definitions/dto.CommandOperate'
responses:
"200":
description: ""
security:
- ApiKeyAuth: []
summary: Update command
tags:
- Command
x-panel-log:
BeforeFuntions: []
bodyKeys:
- name
formatEN: update quick command [name]
formatZH: 更新快捷命令 [name]
paramKeys: []
/containers:
post:
consumes:
@ -5987,138 +5634,6 @@ paths:
formatEN: Download url => [path]/[name]
formatZH: 下载 url => [path]/[name]
paramKeys: []
/groups:
post:
consumes:
- application/json
description: 创建系统组
parameters:
- description: request
in: body
name: request
required: true
schema:
$ref: '#/definitions/dto.GroupOperate'
responses:
"200":
description: ""
security:
- ApiKeyAuth: []
summary: Create group
tags:
- System Group
x-panel-log:
BeforeFuntions: []
bodyKeys:
- name
- type
formatEN: create group [name][type]
formatZH: 创建组 [name][type]
paramKeys: []
/groups/:id:
get:
consumes:
- application/json
description: 查询系统组
parameters:
- description: request
in: path
name: id
required: true
type: integer
responses:
"200":
description: OK
schema:
$ref: '#/definitions/dto.GroupInfo'
security:
- ApiKeyAuth: []
summary: Search group info by id
tags:
- System Group
/groups/del:
post:
consumes:
- application/json
description: 删除系统组
parameters:
- description: request
in: body
name: request
required: true
schema:
$ref: '#/definitions/dto.OperateByID'
responses:
"200":
description: ""
security:
- ApiKeyAuth: []
summary: Delete group
tags:
- System Group
x-panel-log:
BeforeFuntions:
- db: groups
input_colume: id
input_value: id
isList: false
output_colume: name
output_value: name
bodyKeys:
- id
formatEN: delete group [name]
formatZH: 删除组 [name]
paramKeys: []
/groups/search:
post:
consumes:
- application/json
description: 查询系统组
parameters:
- description: request
in: body
name: request
required: true
schema:
$ref: '#/definitions/dto.GroupSearch'
responses:
"200":
description: OK
schema:
type: anrry
security:
- ApiKeyAuth: []
summary: List groups
tags:
- System Group
/groups/update:
post:
consumes:
- application/json
description: 更新系统组
parameters:
- description: request
in: body
name: request
required: true
schema:
$ref: '#/definitions/dto.GroupOperate'
responses:
"200":
description: ""
security:
- ApiKeyAuth: []
summary: Update group
tags:
- System Group
x-panel-log:
BeforeFuntions: []
bodyKeys:
- name
- type
formatEN: update group [name][type]
formatZH: 更新组 [name][type]
paramKeys: []
/hosts:
post:
consumes:
@ -6168,6 +5683,128 @@ paths:
summary: Load host info
tags:
- Host
/hosts/command:
get:
description: 获取快速命令列表
responses:
"200":
description: OK
schema:
$ref: '#/definitions/dto.CommandInfo'
security:
- ApiKeyAuth: []
summary: List commands
tags:
- Command
post:
consumes:
- application/json
description: 创建快速命令
parameters:
- description: request
in: body
name: request
required: true
schema:
$ref: '#/definitions/dto.CommandOperate'
responses:
"200":
description: ""
security:
- ApiKeyAuth: []
summary: Create command
tags:
- Command
x-panel-log:
BeforeFuntions: []
bodyKeys:
- name
- command
formatEN: create quick command [name][command]
formatZH: 创建快捷命令 [name][command]
paramKeys: []
/hosts/command/del:
post:
consumes:
- application/json
description: 删除快速命令
parameters:
- description: request
in: body
name: request
required: true
schema:
$ref: '#/definitions/dto.BatchDeleteReq'
responses:
"200":
description: ""
security:
- ApiKeyAuth: []
summary: Delete command
tags:
- Command
x-panel-log:
BeforeFuntions:
- db: commands
input_colume: id
input_value: ids
isList: true
output_colume: name
output_value: names
bodyKeys:
- ids
formatEN: delete quick command [names]
formatZH: 删除快捷命令 [names]
paramKeys: []
/hosts/command/search:
post:
consumes:
- application/json
description: 获取快速命令列表分页
parameters:
- description: request
in: body
name: request
required: true
schema:
$ref: '#/definitions/dto.SearchWithPage'
responses:
"200":
description: OK
schema:
$ref: '#/definitions/dto.PageResult'
security:
- ApiKeyAuth: []
summary: Page commands
tags:
- Command
/hosts/command/update:
post:
consumes:
- application/json
description: 更新快速命令
parameters:
- description: request
in: body
name: request
required: true
schema:
$ref: '#/definitions/dto.CommandOperate'
responses:
"200":
description: ""
security:
- ApiKeyAuth: []
summary: Update command
tags:
- Command
x-panel-log:
BeforeFuntions: []
bodyKeys:
- name
formatEN: update quick command [name]
formatZH: 更新快捷命令 [name]
paramKeys: []
/hosts/del:
post:
consumes:
@ -6201,6 +5838,117 @@ paths:
formatEN: delete host [addr]
formatZH: 删除主机 [addr]
paramKeys: []
/hosts/group:
post:
consumes:
- application/json
description: 创建系统组
parameters:
- description: request
in: body
name: request
required: true
schema:
$ref: '#/definitions/dto.GroupOperate'
responses:
"200":
description: ""
security:
- ApiKeyAuth: []
summary: Create group
tags:
- System Group
x-panel-log:
BeforeFuntions: []
bodyKeys:
- name
- type
formatEN: create group [name][type]
formatZH: 创建组 [name][type]
paramKeys: []
/hosts/group/del:
post:
consumes:
- application/json
description: 删除系统组
parameters:
- description: request
in: body
name: request
required: true
schema:
$ref: '#/definitions/dto.OperateByID'
responses:
"200":
description: ""
security:
- ApiKeyAuth: []
summary: Delete group
tags:
- System Group
x-panel-log:
BeforeFuntions:
- db: groups
input_colume: id
input_value: id
isList: false
output_colume: name
output_value: name
bodyKeys:
- id
formatEN: delete group [name]
formatZH: 删除组 [name]
paramKeys: []
/hosts/group/search:
post:
consumes:
- application/json
description: 查询系统组
parameters:
- description: request
in: body
name: request
required: true
schema:
$ref: '#/definitions/dto.GroupSearch'
responses:
"200":
description: OK
schema:
type: anrry
security:
- ApiKeyAuth: []
summary: List groups
tags:
- System Group
/hosts/group/update:
post:
consumes:
- application/json
description: 更新系统组
parameters:
- description: request
in: body
name: request
required: true
schema:
$ref: '#/definitions/dto.GroupOperate'
responses:
"200":
description: ""
security:
- ApiKeyAuth: []
summary: Update group
tags:
- System Group
x-panel-log:
BeforeFuntions: []
bodyKeys:
- name
- type
formatEN: update group [name][type]
formatZH: 更新组 [name][type]
paramKeys: []
/hosts/search:
post:
consumes:
@ -6472,6 +6220,230 @@ paths:
formatEN: Update nginx conf [domain]
formatZH: 更新 nginx 配置 [domain]
paramKeys: []
/settings/backup:
post:
consumes:
- application/json
description: 创建备份账号
parameters:
- description: request
in: body
name: request
required: true
schema:
$ref: '#/definitions/dto.BackupOperate'
responses:
"200":
description: ""
security:
- ApiKeyAuth: []
summary: Create backup account
tags:
- Backup Account
x-panel-log:
BeforeFuntions: []
bodyKeys:
- type
formatEN: create backup account [type]
formatZH: 创建备份账号 [type]
paramKeys: []
/settings/backup/del:
post:
consumes:
- application/json
description: 删除备份账号
parameters:
- description: request
in: body
name: request
required: true
schema:
$ref: '#/definitions/dto.BatchDeleteReq'
responses:
"200":
description: ""
security:
- ApiKeyAuth: []
summary: Delete backup account
tags:
- Backup Account
x-panel-log:
BeforeFuntions:
- db: backup_accounts
input_colume: id
input_value: ids
isList: true
output_colume: type
output_value: types
bodyKeys:
- ids
formatEN: delete backup account [types]
formatZH: 删除备份账号 [types]
paramKeys: []
/settings/backup/record/del:
post:
consumes:
- application/json
description: 删除备份记录
parameters:
- description: request
in: body
name: request
required: true
schema:
$ref: '#/definitions/dto.BatchDeleteReq'
responses:
"200":
description: ""
security:
- ApiKeyAuth: []
summary: Delete backup record
tags:
- Backup Account
x-panel-log:
BeforeFuntions:
- db: backup_records
input_colume: id
input_value: ids
isList: true
output_colume: file_name
output_value: files
bodyKeys:
- ids
formatEN: delete backup records [files]
formatZH: 删除备份记录 [files]
paramKeys: []
/settings/backup/record/download:
post:
consumes:
- application/json
description: 下载备份记录
parameters:
- description: request
in: body
name: request
required: true
schema:
$ref: '#/definitions/dto.DownloadRecord'
responses:
"200":
description: ""
security:
- ApiKeyAuth: []
summary: Download backup record
tags:
- Backup Account
x-panel-log:
BeforeFuntions: []
bodyKeys:
- source
- fileName
formatEN: download backup records [source][fileName]
formatZH: 下载备份记录 [source][fileName]
paramKeys: []
/settings/backup/record/search:
post:
consumes:
- application/json
description: 获取备份记录列表分页
parameters:
- description: request
in: body
name: request
required: true
schema:
$ref: '#/definitions/dto.RecordSearch'
responses:
"200":
description: ""
security:
- ApiKeyAuth: []
summary: Page backup records
tags:
- Backup Account
/settings/backup/search:
get:
description: 获取备份账号列表
responses:
"200":
description: OK
schema:
type: anrry
security:
- ApiKeyAuth: []
summary: List backup accounts
tags:
- Backup Account
post:
consumes:
- application/json
description: 获取 bucket 列表
parameters:
- description: request
in: body
name: request
required: true
schema:
$ref: '#/definitions/dto.ForBuckets'
responses:
"200":
description: OK
schema:
type: anrry
security:
- ApiKeyAuth: []
summary: List buckets
tags:
- Backup Account
/settings/backup/search/files:
post:
consumes:
- application/json
description: 获取备份账号内文件列表
parameters:
- description: request
in: body
name: request
required: true
schema:
$ref: '#/definitions/dto.BackupSearchFile'
responses:
"200":
description: OK
schema:
type: anrry
security:
- ApiKeyAuth: []
summary: List files from backup accounts
tags:
- Backup Account
/settings/backup/update:
post:
consumes:
- application/json
description: 更新备份账号信息
parameters:
- description: request
in: body
name: request
required: true
schema:
$ref: '#/definitions/dto.BackupOperate'
responses:
"200":
description: ""
security:
- ApiKeyAuth: []
summary: Update backup account
tags:
- Backup Account
x-panel-log:
BeforeFuntions: []
bodyKeys:
- type
formatEN: update backup account [types]
formatZH: 更新备份账号 [types]
paramKeys: []
/settings/basedir:
get:
description: 获取安装根目录

View File

@ -1,37 +0,0 @@
import http from '@/api';
import { Backup } from '../interface/backup';
import { ResPage } from '../interface';
export const getBackupList = () => {
return http.get<Array<Backup.BackupInfo>>(`/backups/search`);
};
export const getFilesFromBackup = (type: string) => {
return http.post<Array<any>>(`/backups/search/files`, { type: type });
};
export const addBackup = (params: Backup.BackupOperate) => {
return http.post<Backup.BackupOperate>(`/backups`, params);
};
export const editBackup = (params: Backup.BackupOperate) => {
return http.post(`/backups/update`, params);
};
export const deleteBackup = (params: { ids: number[] }) => {
return http.post(`/backups/del`, params);
};
export const downloadBackupRecord = (params: Backup.RecordDownload) => {
return http.download<BlobPart>(`/backups/record/download`, params, { responseType: 'blob' });
};
export const deleteBackupRecord = (params: { ids: number[] }) => {
return http.post(`/backups/record/del`, params);
};
export const searchBackupRecords = (params: Backup.SearchBackupRecord) => {
return http.post<ResPage<Backup.RecordInfo>>(`/backups/record/search`, params);
};
export const listBucket = (params: Backup.ForBucket) => {
return http.post(`/backups/buckets`, params);
};

View File

@ -1,23 +0,0 @@
import http from '@/api';
import { ResPage } from '../interface';
import { Command } from '../interface/command';
export const getCommandList = () => {
return http.get<Array<Command.CommandInfo>>(`/commands`, {});
};
export const getCommandPage = (params: Command.CommandSearch) => {
return http.post<ResPage<Command.CommandInfo>>(`/commands/search`, params);
};
export const addCommand = (params: Command.CommandOperate) => {
return http.post<Command.CommandOperate>(`/commands`, params);
};
export const editCommand = (params: Command.CommandOperate) => {
return http.post(`/commands/update`, params);
};
export const deleteCommand = (params: { ids: number[] }) => {
return http.post(`/commands/del`, params);
};

View File

@ -1,18 +0,0 @@
import http from '@/api';
import { Group } from '../interface/group';
export const getGroupList = (params: Group.GroupSearch) => {
return http.post<Array<Group.GroupInfo>>(`/groups/search`, params);
};
export const addGroup = (params: Group.GroupOperate) => {
return http.post<Group.GroupOperate>(`/groups`, params);
};
export const editGroup = (params: Group.GroupOperate) => {
return http.post(`/groups/update`, params);
};
export const deleteGroup = (id: number) => {
return http.post(`/groups/del`, { id: id });
};

View File

@ -1,30 +1,58 @@
import http from '@/api';
import { ResPage } from '../interface';
import { Command } from '../interface/command';
import { Group } from '../interface/group';
import { Host } from '../interface/host';
export const getHostTree = (params: Host.ReqSearch) => {
return http.post<Array<Host.HostTree>>(`/hosts/search`, params);
};
export const getHostInfo = (id: number) => {
return http.get<Host.Host>(`/hosts/` + id);
};
export const addHost = (params: Host.HostOperate) => {
return http.post<Host.HostOperate>(`/hosts`, params);
};
export const testByInfo = (params: Host.HostConnTest) => {
return http.post<boolean>(`/hosts/test/byinfo`, params);
};
export const testByID = (id: number) => {
return http.post<boolean>(`/hosts/test/byid/${id}`);
};
export const editHost = (params: Host.HostOperate) => {
return http.post(`/hosts/update`, params);
};
export const deleteHost = (id: number) => {
return http.post(`/hosts/del`, { id: id });
};
// group
export const getGroupList = (params: Group.GroupSearch) => {
return http.post<Array<Group.GroupInfo>>(`/hosts/group/search`, params);
};
export const addGroup = (params: Group.GroupOperate) => {
return http.post<Group.GroupOperate>(`/hosts/group`, params);
};
export const editGroup = (params: Group.GroupOperate) => {
return http.post(`/hosts/group/update`, params);
};
export const deleteGroup = (id: number) => {
return http.post(`/hosts/group/del`, { id: id });
};
// command
export const getCommandList = () => {
return http.get<Array<Command.CommandInfo>>(`/hosts/command`, {});
};
export const getCommandPage = (params: Command.CommandSearch) => {
return http.post<ResPage<Command.CommandInfo>>(`/hosts/command/search`, params);
};
export const addCommand = (params: Command.CommandOperate) => {
return http.post<Command.CommandOperate>(`/hosts/command`, params);
};
export const editCommand = (params: Command.CommandOperate) => {
return http.post(`/hosts/command/update`, params);
};
export const deleteCommand = (params: { ids: number[] }) => {
return http.post(`/hosts/command/del`, params);
};

View File

@ -1,5 +1,6 @@
import http from '@/api';
import { ResPage, SearchWithPage, DescriptionUpdate } from '../interface';
import { Backup } from '../interface/backup';
import { Setting } from '../interface/setting';
export const getSettingInfo = () => {
@ -49,6 +50,35 @@ export const loadBaseDir = () => {
return http.get<string>(`/settings/basedir`);
};
// backup
export const getBackupList = () => {
return http.get<Array<Backup.BackupInfo>>(`/settings/backup/search`);
};
export const getFilesFromBackup = (type: string) => {
return http.post<Array<any>>(`/settings/backup/search/files`, { type: type });
};
export const addBackup = (params: Backup.BackupOperate) => {
return http.post<Backup.BackupOperate>(`/settings/backup`, params);
};
export const editBackup = (params: Backup.BackupOperate) => {
return http.post(`/settings/backup/update`, params);
};
export const deleteBackup = (params: { ids: number[] }) => {
return http.post(`/settings/backup/del`, params);
};
export const downloadBackupRecord = (params: Backup.RecordDownload) => {
return http.download<BlobPart>(`/settings/backup/record/download`, params, { responseType: 'blob' });
};
export const deleteBackupRecord = (params: { ids: number[] }) => {
return http.post(`/settings/backup/record/del`, params);
};
export const searchBackupRecords = (params: Backup.SearchBackupRecord) => {
return http.post<ResPage<Backup.RecordInfo>>(`/settings/backup/record/search`, params);
};
export const listBucket = (params: Backup.ForBucket) => {
return http.post(`/settings/backup/buckets`, params);
};
// snapshot
export const snapshotCreate = (param: Setting.SnapshotCreate) => {
return http.post(`/settings/snapshot`, param);

View File

@ -69,7 +69,7 @@
import LayoutContent from '@/layout/layout-content.vue';
import ComplexTable from '@/components/complex-table/index.vue';
import { Command } from '@/api/interface/command';
import { addCommand, editCommand, deleteCommand, getCommandPage } from '@/api/modules/command';
import { addCommand, editCommand, deleteCommand, getCommandPage } from '@/api/modules/host';
import { reactive, ref } from 'vue';
import { useDeleteData } from '@/hooks/use-delete-data';
import type { ElForm } from 'element-plus';

View File

@ -156,8 +156,18 @@ import type { ElForm } from 'element-plus';
import { Rules } from '@/global/form-rules';
import { Host } from '@/api/interface/host';
import { Group } from '@/api/interface/group';
import { getHostTree, getHostInfo, addHost, editHost, deleteHost, testByInfo } from '@/api/modules/host';
import { getGroupList, addGroup, editGroup, deleteGroup } from '@/api/modules/group';
import {
getHostTree,
getHostInfo,
addHost,
editHost,
deleteHost,
testByInfo,
getGroupList,
addGroup,
editGroup,
deleteGroup,
} from '@/api/modules/host';
import { useDeleteData } from '@/hooks/use-delete-data';
import { ElMessage } from 'element-plus';
import i18n from '@/lang';
@ -309,7 +319,7 @@ const onDelete = async (node: Node, data: Tree) => {
return;
}
if (node.level === 1) {
await useDeleteData(deleteGroup, data.id - 10000, i18n.global.t('terminal.groupDeleteHelper'));
await useDeleteData(deleteGroup, data.id - 10000, 'terminal.groupDeleteHelper');
loadGroups();
} else {
await useDeleteData(deleteHost, data.id, 'commons.msg.delete');

View File

@ -119,7 +119,7 @@ import screenfull from 'screenfull';
import i18n from '@/lang';
import { Host } from '@/api/interface/host';
import { getHostTree, testByID } from '@/api/modules/host';
import { getCommandList } from '@/api/modules/command';
import { getCommandList } from '@/api/modules/host';
import { GlobalStore } from '@/store';
const dialogRef = ref();

View File

@ -35,11 +35,8 @@
<el-option :label="$t('logs.detail.cronjobs')" value="cronjobs"></el-option>
<el-option :label="$t('logs.detail.files')" value="files"></el-option>
<el-option :label="$t('logs.detail.hosts')" value="hosts"></el-option>
<el-option :label="$t('logs.detail.commands')" value="commands"></el-option>
<el-option :label="$t('logs.detail.logs')" value="logs"></el-option>
<el-option :label="$t('logs.detail.settings')" value="settings"></el-option>
<el-option :label="$t('logs.detail.backups')" value="backups"></el-option>
<el-option :label="$t('logs.detail.groups')" value="groups"></el-option>
</el-select>
<el-select v-model="searchStatus" @change="search()" clearable style="margin-left: 10px">
<template #prefix>{{ $t('commons.table.status') }}</template>

View File

@ -237,7 +237,7 @@
import { dateFormatSimple, dateFormat } from '@/utils/util';
import { onMounted, ref } from 'vue';
import LayoutContent from '@/layout/layout-content.vue';
import { getBackupList, deleteBackup } from '@/api/modules/backup';
import { getBackupList, deleteBackup } from '@/api/modules/setting';
import DialogOperate from '@/views/setting/backup-account/operate/index.vue';
import { Backup } from '@/api/interface/backup';
import { ElForm } from 'element-plus';

View File

@ -135,7 +135,7 @@ import i18n from '@/lang';
import { ElForm, ElMessage } from 'element-plus';
import { Backup } from '@/api/interface/backup';
import DrawerHeader from '@/components/drawer-header/index.vue';
import { addBackup, editBackup, listBucket } from '@/api/modules/backup';
import { addBackup, editBackup, listBucket } from '@/api/modules/setting';
import { deepCopy } from '@/utils/util';
const loading = ref(false);