1
0
mirror of https://github.com/1Panel-dev/1Panel.git synced 2025-01-31 14:08:06 +08:00

feat: 优化容器界面加载速度 (#1565)

This commit is contained in:
ssongliu 2023-07-06 18:04:22 +08:00 committed by GitHub
parent 695aacbe14
commit 0ac2b9df7a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
22 changed files with 1052 additions and 201 deletions

View File

@ -118,7 +118,7 @@ func (b *BaseApi) LoadConnInfo(c *gin.Context) {
// @Description 删除前检查 // @Description 删除前检查
// @Accept json // @Accept json
// @Param appInstallId path integer true "App install id" // @Param appInstallId path integer true "App install id"
// @Success 200 {anrry} dto.AppResource // @Success 200 {array} dto.AppResource
// @Security ApiKeyAuth // @Security ApiKeyAuth
// @Router /apps/installed/delete/check/:appInstallId [get] // @Router /apps/installed/delete/check/:appInstallId [get]
func (b *BaseApi) DeleteCheck(c *gin.Context) { func (b *BaseApi) DeleteCheck(c *gin.Context) {
@ -178,7 +178,7 @@ func (b *BaseApi) OperateInstalled(c *gin.Context) {
// @Description 通过 key 获取应用 service // @Description 通过 key 获取应用 service
// @Accept json // @Accept json
// @Param key path string true "request" // @Param key path string true "request"
// @Success 200 {anrry} response.AppService // @Success 200 {array} response.AppService
// @Security ApiKeyAuth // @Security ApiKeyAuth
// @Router /apps/services/:key [get] // @Router /apps/services/:key [get]
func (b *BaseApi) GetServices(c *gin.Context) { func (b *BaseApi) GetServices(c *gin.Context) {
@ -196,7 +196,7 @@ func (b *BaseApi) GetServices(c *gin.Context) {
// @Description 通过 install id 获取应用更新版本 // @Description 通过 install id 获取应用更新版本
// @Accept json // @Accept json
// @Param appInstallId path integer true "request" // @Param appInstallId path integer true "request"
// @Success 200 {anrry} dto.AppVersion // @Success 200 {array} dto.AppVersion
// @Security ApiKeyAuth // @Security ApiKeyAuth
// @Router /apps/installed/:appInstallId/versions [get] // @Router /apps/installed/:appInstallId/versions [get]
func (b *BaseApi) GetUpdateVersions(c *gin.Context) { func (b *BaseApi) GetUpdateVersions(c *gin.Context) {

View File

@ -60,7 +60,7 @@ func (b *BaseApi) CreateBackup(c *gin.Context) {
// @Description 获取 bucket 列表 // @Description 获取 bucket 列表
// @Accept json // @Accept json
// @Param request body dto.ForBuckets true "request" // @Param request body dto.ForBuckets true "request"
// @Success 200 {anrry} string // @Success 200 {array} string
// @Security ApiKeyAuth // @Security ApiKeyAuth
// @Router /settings/backup/search [post] // @Router /settings/backup/search [post]
func (b *BaseApi) ListBuckets(c *gin.Context) { func (b *BaseApi) ListBuckets(c *gin.Context) {
@ -269,7 +269,7 @@ func (b *BaseApi) UpdateBackup(c *gin.Context) {
// @Tags Backup Account // @Tags Backup Account
// @Summary List backup accounts // @Summary List backup accounts
// @Description 获取备份账号列表 // @Description 获取备份账号列表
// @Success 200 {anrry} dto.BackupInfo // @Success 200 {array} dto.BackupInfo
// @Security ApiKeyAuth // @Security ApiKeyAuth
// @Router /settings/backup/search [get] // @Router /settings/backup/search [get]
func (b *BaseApi) ListBackup(c *gin.Context) { func (b *BaseApi) ListBackup(c *gin.Context) {
@ -287,7 +287,7 @@ func (b *BaseApi) ListBackup(c *gin.Context) {
// @Description 获取备份账号内文件列表 // @Description 获取备份账号内文件列表
// @Accept json // @Accept json
// @Param request body dto.BackupSearchFile true "request" // @Param request body dto.BackupSearchFile true "request"
// @Success 200 {anrry} string // @Success 200 {array} string
// @Security ApiKeyAuth // @Security ApiKeyAuth
// @Router /settings/backup/search/files [post] // @Router /settings/backup/search/files [post]
func (b *BaseApi) LoadFilesFromBackup(c *gin.Context) { func (b *BaseApi) LoadFilesFromBackup(c *gin.Context) {

View File

@ -66,7 +66,7 @@ func (b *BaseApi) SearchComposeTemplate(c *gin.Context) {
// @Summary List compose templates // @Summary List compose templates
// @Description 获取容器编排模版列表 // @Description 获取容器编排模版列表
// @Produce json // @Produce json
// @Success 200 {anrry} dto.ComposeTemplateInfo // @Success 200 {array} dto.ComposeTemplateInfo
// @Security ApiKeyAuth // @Security ApiKeyAuth
// @Router /containers/template [get] // @Router /containers/template [get]
func (b *BaseApi) ListComposeTemplate(c *gin.Context) { func (b *BaseApi) ListComposeTemplate(c *gin.Context) {

View File

@ -236,6 +236,20 @@ func (b *BaseApi) LoadResouceLimit(c *gin.Context) {
helper.SuccessWithData(c, data) helper.SuccessWithData(c, data)
} }
// @Summary Load container stats
// @Description 获取容器列表资源占用
// @Success 200 {array} dto.ContainerListStats
// @Security ApiKeyAuth
// @Router /containers/list/stats [get]
func (b *BaseApi) ContainerListStats(c *gin.Context) {
datas, err := containerService.ContainerListStats()
if err != nil {
helper.ErrorWithDetail(c, constant.CodeErrInternalServer, constant.ErrTypeInternalServer, err)
return
}
helper.SuccessWithData(c, datas)
}
// @Tags Container // @Tags Container
// @Summary Create container // @Summary Create container
// @Description 创建容器 // @Description 创建容器
@ -371,7 +385,7 @@ func (b *BaseApi) ContainerOperation(c *gin.Context) {
// @Summary Container stats // @Summary Container stats
// @Description 容器监控信息 // @Description 容器监控信息
// @Param id path integer true "容器id" // @Param id path integer true "容器id"
// @Success 200 {object} dto.ContainterStats // @Success 200 {object} dto.ContainerStats
// @Security ApiKeyAuth // @Security ApiKeyAuth
// @Router /containers/stats/:id [get] // @Router /containers/stats/:id [get]
func (b *BaseApi) ContainerStats(c *gin.Context) { func (b *BaseApi) ContainerStats(c *gin.Context) {

View File

@ -216,7 +216,7 @@ func (b *BaseApi) SearchMysql(c *gin.Context) {
// @Description 获取 mysql 数据库列表 // @Description 获取 mysql 数据库列表
// @Accept json // @Accept json
// @Param request body dto.PageInfo true "request" // @Param request body dto.PageInfo true "request"
// @Success 200 {anrry} string // @Success 200 {array} string
// @Security ApiKeyAuth // @Security ApiKeyAuth
// @Router /databases/options [get] // @Router /databases/options [get]
func (b *BaseApi) ListDBName(c *gin.Context) { func (b *BaseApi) ListDBName(c *gin.Context) {
@ -234,7 +234,7 @@ func (b *BaseApi) ListDBName(c *gin.Context) {
// @Description Mysql 数据库删除前检查 // @Description Mysql 数据库删除前检查
// @Accept json // @Accept json
// @Param request body dto.OperateByID true "request" // @Param request body dto.OperateByID true "request"
// @Success 200 {anrry} string // @Success 200 {array} string
// @Security ApiKeyAuth // @Security ApiKeyAuth
// @Router /databases/del/check [post] // @Router /databases/del/check [post]
func (b *BaseApi) DeleteCheckMysql(c *gin.Context) { func (b *BaseApi) DeleteCheckMysql(c *gin.Context) {

View File

@ -52,7 +52,7 @@ func (b *BaseApi) ListFiles(c *gin.Context) {
// @Description 分页获取上传文件 // @Description 分页获取上传文件
// @Accept json // @Accept json
// @Param request body request.SearchUploadWithPage true "request" // @Param request body request.SearchUploadWithPage true "request"
// @Success 200 {anrry} response.FileInfo // @Success 200 {array} response.FileInfo
// @Security ApiKeyAuth // @Security ApiKeyAuth
// @Router /files/upload/search [post] // @Router /files/upload/search [post]
func (b *BaseApi) SearchUploadWithPage(c *gin.Context) { func (b *BaseApi) SearchUploadWithPage(c *gin.Context) {
@ -81,7 +81,7 @@ func (b *BaseApi) SearchUploadWithPage(c *gin.Context) {
// @Description 加载文件树 // @Description 加载文件树
// @Accept json // @Accept json
// @Param request body request.FileOption true "request" // @Param request body request.FileOption true "request"
// @Success 200 {anrry} response.FileTree // @Success 200 {array} response.FileTree
// @Security ApiKeyAuth // @Security ApiKeyAuth
// @Router /files/tree [post] // @Router /files/tree [post]
func (b *BaseApi) GetFileTree(c *gin.Context) { func (b *BaseApi) GetFileTree(c *gin.Context) {

View File

@ -124,7 +124,7 @@ func (b *BaseApi) TestByID(c *gin.Context) {
// @Description 加载主机树 // @Description 加载主机树
// @Accept json // @Accept json
// @Param request body dto.SearchForTree true "request" // @Param request body dto.SearchForTree true "request"
// @Success 200 {anrry} dto.HostTree // @Success 200 {array} dto.HostTree
// @Security ApiKeyAuth // @Security ApiKeyAuth
// @Router /hosts/tree [post] // @Router /hosts/tree [post]
func (b *BaseApi) HostTree(c *gin.Context) { func (b *BaseApi) HostTree(c *gin.Context) {
@ -148,7 +148,7 @@ func (b *BaseApi) HostTree(c *gin.Context) {
// @Description 获取主机列表分页 // @Description 获取主机列表分页
// @Accept json // @Accept json
// @Param request body dto.SearchHostWithPage true "request" // @Param request body dto.SearchHostWithPage true "request"
// @Success 200 {anrry} dto.HostTree // @Success 200 {array} dto.HostTree
// @Security ApiKeyAuth // @Security ApiKeyAuth
// @Router /hosts/search [post] // @Router /hosts/search [post]
func (b *BaseApi) SearchHost(c *gin.Context) { func (b *BaseApi) SearchHost(c *gin.Context) {

View File

@ -44,7 +44,7 @@ func (b *BaseApi) SearchImage(c *gin.Context) {
// @Summary List images // @Summary List images
// @Description 获取镜像列表 // @Description 获取镜像列表
// @Produce json // @Produce json
// @Success 200 {anrry} dto.Options // @Success 200 {array} dto.Options
// @Security ApiKeyAuth // @Security ApiKeyAuth
// @Router /containers/image [get] // @Router /containers/image [get]
func (b *BaseApi) ListImage(c *gin.Context) { func (b *BaseApi) ListImage(c *gin.Context) {

View File

@ -44,7 +44,7 @@ func (b *BaseApi) SearchRepo(c *gin.Context) {
// @Summary List image repos // @Summary List image repos
// @Description 获取镜像仓库列表 // @Description 获取镜像仓库列表
// @Produce json // @Produce json
// @Success 200 {anrry} dto.ImageRepoOption // @Success 200 {array} dto.ImageRepoOption
// @Security ApiKeyAuth // @Security ApiKeyAuth
// @Router /containers/repo [get] // @Router /containers/repo [get]
func (b *BaseApi) ListRepo(c *gin.Context) { func (b *BaseApi) ListRepo(c *gin.Context) {

View File

@ -27,7 +27,7 @@ func (b *BaseApi) GetNginx(c *gin.Context) {
// @Description 获取部分 OpenResty 配置信息 // @Description 获取部分 OpenResty 配置信息
// @Accept json // @Accept json
// @Param request body request.NginxScopeReq true "request" // @Param request body request.NginxScopeReq true "request"
// @Success 200 {anrry} response.NginxParam // @Success 200 {array} response.NginxParam
// @Security ApiKeyAuth // @Security ApiKeyAuth
// @Router /openResty/scope [post] // @Router /openResty/scope [post]
func (b *BaseApi) GetNginxConfigByScope(c *gin.Context) { func (b *BaseApi) GetNginxConfigByScope(c *gin.Context) {

View File

@ -36,7 +36,7 @@ func (b *BaseApi) PageWebsite(c *gin.Context) {
// @Tags Website // @Tags Website
// @Summary List websites // @Summary List websites
// @Description 获取网站列表 // @Description 获取网站列表
// @Success 200 {anrry} response.WebsiteDTO // @Success 200 {array} response.WebsiteDTO
// @Security ApiKeyAuth // @Security ApiKeyAuth
// @Router /websites/list [get] // @Router /websites/list [get]
func (b *BaseApi) GetWebsites(c *gin.Context) { func (b *BaseApi) GetWebsites(c *gin.Context) {
@ -51,7 +51,7 @@ func (b *BaseApi) GetWebsites(c *gin.Context) {
// @Tags Website // @Tags Website
// @Summary List website names // @Summary List website names
// @Description 获取网站列表 // @Description 获取网站列表
// @Success 200 {anrry} string // @Success 200 {array} string
// @Security ApiKeyAuth // @Security ApiKeyAuth
// @Router /websites/options [get] // @Router /websites/options [get]
func (b *BaseApi) GetWebsiteOptions(c *gin.Context) { func (b *BaseApi) GetWebsiteOptions(c *gin.Context) {
@ -207,7 +207,7 @@ func (b *BaseApi) GetWebsiteNginx(c *gin.Context) {
// @Description 通过网站 id 查询域名 // @Description 通过网站 id 查询域名
// @Accept json // @Accept json
// @Param websiteId path integer true "request" // @Param websiteId path integer true "request"
// @Success 200 {anrry} model.WebsiteDomain // @Success 200 {array} model.WebsiteDomain
// @Security ApiKeyAuth // @Security ApiKeyAuth
// @Router /websites/domains/:websiteId [get] // @Router /websites/domains/:websiteId [get]
func (b *BaseApi) GetWebDomains(c *gin.Context) { func (b *BaseApi) GetWebDomains(c *gin.Context) {
@ -367,7 +367,7 @@ func (b *BaseApi) UpdateHTTPSConfig(c *gin.Context) {
// @Description 网站创建前检查 // @Description 网站创建前检查
// @Accept json // @Accept json
// @Param request body request.WebsiteInstallCheckReq true "request" // @Param request body request.WebsiteInstallCheckReq true "request"
// @Success 200 {anrry} request.WebsitePreInstallCheck // @Success 200 {array} response.WebsitePreInstallCheck
// @Security ApiKeyAuth // @Security ApiKeyAuth
// @Router /websites/check [post] // @Router /websites/check [post]
func (b *BaseApi) CreateWebsiteCheck(c *gin.Context) { func (b *BaseApi) CreateWebsiteCheck(c *gin.Context) {

View File

@ -94,7 +94,7 @@ func (b *BaseApi) RenewWebsiteSSL(c *gin.Context) {
// @Description 解析网站 ssl // @Description 解析网站 ssl
// @Accept json // @Accept json
// @Param request body request.WebsiteDNSReq true "request" // @Param request body request.WebsiteDNSReq true "request"
// @Success 200 {anrry} response.WebsiteDNSRes // @Success 200 {array} response.WebsiteDNSRes
// @Security ApiKeyAuth // @Security ApiKeyAuth
// @Router /websites/ssl/resolve [post] // @Router /websites/ssl/resolve [post]
func (b *BaseApi) GetDNSResolve(c *gin.Context) { func (b *BaseApi) GetDNSResolve(c *gin.Context) {

View File

@ -24,9 +24,7 @@ type ContainerInfo struct {
State string `json:"state"` State string `json:"state"`
RunTime string `json:"runTime"` RunTime string `json:"runTime"`
CPUPercent float64 `json:"cpuPercent"` Ports []string `json:"ports"`
MemoryPercent float64 `json:"memoryPercent"`
Ports []string `json:"ports"`
IsFromApp bool `json:"isFromApp"` IsFromApp bool `json:"isFromApp"`
IsFromCompose bool `json:"isFromCompose"` IsFromCompose bool `json:"isFromCompose"`
@ -59,7 +57,13 @@ type ContainerUpgrade struct {
Image string `json:"image" validate:"required"` Image string `json:"image" validate:"required"`
} }
type ContainterStats struct { type ContainerListStats struct {
ContainerID string `json:"containerID"`
CPUPercent float64 `json:"cpuPercent"`
MemoryPercent float64 `json:"memoryPercent"`
}
type ContainerStats struct {
CPUPercent float64 `json:"cpuPercent"` CPUPercent float64 `json:"cpuPercent"`
Memory float64 `json:"memory"` Memory float64 `json:"memory"`
Cache float64 `json:"cache"` Cache float64 `json:"cache"`

View File

@ -46,11 +46,12 @@ type IContainerService interface {
ContainerUpdate(req dto.ContainerOperate) error ContainerUpdate(req dto.ContainerOperate) error
ContainerUpgrade(req dto.ContainerUpgrade) error ContainerUpgrade(req dto.ContainerUpgrade) error
ContainerInfo(req dto.OperationWithName) (*dto.ContainerOperate, error) ContainerInfo(req dto.OperationWithName) (*dto.ContainerOperate, error)
ContainerListStats() ([]dto.ContainerListStats, error)
LoadResouceLimit() (*dto.ResourceLimit, error) LoadResouceLimit() (*dto.ResourceLimit, error)
ContainerLogClean(req dto.OperationWithName) error ContainerLogClean(req dto.OperationWithName) error
ContainerOperation(req dto.ContainerOperation) error ContainerOperation(req dto.ContainerOperation) error
ContainerLogs(wsConn *websocket.Conn, container, since, tail string, follow bool) error ContainerLogs(wsConn *websocket.Conn, container, since, tail string, follow bool) error
ContainerStats(id string) (*dto.ContainterStats, error) ContainerStats(id string) (*dto.ContainerStats, error)
Inspect(req dto.InspectReq) (string, error) Inspect(req dto.InspectReq) (string, error)
DeleteNetwork(req dto.BatchDelete) error DeleteNetwork(req dto.BatchDelete) error
CreateNetwork(req dto.NetworkCreate) error CreateNetwork(req dto.NetworkCreate) error
@ -129,46 +130,38 @@ func (u *ContainerService) Page(req dto.PageContainer) (int64, interface{}, erro
} }
backDatas := make([]dto.ContainerInfo, len(records)) backDatas := make([]dto.ContainerInfo, len(records))
var wg sync.WaitGroup
wg.Add(len(records))
for i := 0; i < len(records); i++ { for i := 0; i < len(records); i++ {
go func(item types.Container, i int) { item := records[i]
IsFromCompose := false IsFromCompose := false
if _, ok := item.Labels[composeProjectLabel]; ok { if _, ok := item.Labels[composeProjectLabel]; ok {
IsFromCompose = true IsFromCompose = true
} }
IsFromApp := false IsFromApp := false
if created, ok := item.Labels[composeCreatedBy]; ok && created == "Apps" { if created, ok := item.Labels[composeCreatedBy]; ok && created == "Apps" {
IsFromApp = true IsFromApp = true
} }
var ports []string var ports []string
for _, port := range item.Ports { for _, port := range item.Ports {
itemPortStr := fmt.Sprintf("%v/%s", port.PrivatePort, port.Type) itemPortStr := fmt.Sprintf("%v/%s", port.PrivatePort, port.Type)
if port.PublicPort != 0 { if port.PublicPort != 0 {
itemPortStr = fmt.Sprintf("%s:%v->%v/%s", port.IP, port.PublicPort, port.PrivatePort, port.Type) itemPortStr = fmt.Sprintf("%s:%v->%v/%s", port.IP, port.PublicPort, port.PrivatePort, port.Type)
}
ports = append(ports, itemPortStr)
} }
cpu, mem := loadCpuAndMem(client, item.ID) ports = append(ports, itemPortStr)
backDatas[i] = dto.ContainerInfo{ }
ContainerID: item.ID, backDatas[i] = dto.ContainerInfo{
CreateTime: time.Unix(item.Created, 0).Format("2006-01-02 15:04:05"), ContainerID: item.ID,
Name: item.Names[0][1:], CreateTime: time.Unix(item.Created, 0).Format("2006-01-02 15:04:05"),
ImageId: strings.Split(item.ImageID, ":")[1], Name: item.Names[0][1:],
ImageName: item.Image, ImageId: strings.Split(item.ImageID, ":")[1],
State: item.State, ImageName: item.Image,
RunTime: item.Status, State: item.State,
CPUPercent: cpu, RunTime: item.Status,
MemoryPercent: mem, Ports: ports,
Ports: ports, IsFromApp: IsFromApp,
IsFromApp: IsFromApp, IsFromCompose: IsFromCompose,
IsFromCompose: IsFromCompose, }
}
wg.Done()
}(records[i], i)
} }
wg.Wait()
return int64(total), backDatas, nil return int64(total), backDatas, nil
} }
@ -194,6 +187,29 @@ func (u *ContainerService) List() ([]string, error) {
return datas, nil return datas, nil
} }
func (u *ContainerService) ContainerListStats() ([]dto.ContainerListStats, error) {
client, err := docker.NewDockerClient()
if err != nil {
return nil, err
}
list, err := client.ContainerList(context.Background(), types.ContainerListOptions{All: true})
if err != nil {
return nil, err
}
var datas []dto.ContainerListStats
var wg sync.WaitGroup
wg.Add(len(list))
for i := 0; i < len(list); i++ {
go func(item types.Container) {
cpu, mem := loadCpuAndMem(client, item.ID)
datas = append(datas, dto.ContainerListStats{CPUPercent: cpu, MemoryPercent: mem, ContainerID: item.ID})
wg.Done()
}(list[i])
}
wg.Wait()
return datas, nil
}
func (u *ContainerService) Inspect(req dto.InspectReq) (string, error) { func (u *ContainerService) Inspect(req dto.InspectReq) (string, error) {
client, err := docker.NewDockerClient() client, err := docker.NewDockerClient()
if err != nil { if err != nil {
@ -541,7 +557,7 @@ func (u *ContainerService) ContainerLogs(wsConn *websocket.Conn, container, sinc
return nil return nil
} }
func (u *ContainerService) ContainerStats(id string) (*dto.ContainterStats, error) { func (u *ContainerService) ContainerStats(id string) (*dto.ContainerStats, error) {
client, err := docker.NewDockerClient() client, err := docker.NewDockerClient()
if err != nil { if err != nil {
return nil, err return nil, err
@ -562,7 +578,7 @@ func (u *ContainerService) ContainerStats(id string) (*dto.ContainterStats, erro
if err := json.Unmarshal(body, &stats); err != nil { if err := json.Unmarshal(body, &stats); err != nil {
return nil, err return nil, err
} }
var data dto.ContainterStats var data dto.ContainerStats
data.CPUPercent = calculateCPUPercentUnix(stats) data.CPUPercent = calculateCPUPercentUnix(stats)
data.IORead, data.IOWrite = calculateBlockIO(stats.BlkioStats) data.IORead, data.IOWrite = calculateBlockIO(stats.BlkioStats)
data.Memory = float64(stats.MemoryStats.Usage) / 1024 / 1024 data.Memory = float64(stats.MemoryStats.Usage) / 1024 / 1024

View File

@ -24,6 +24,7 @@ func (s *ContainerRouter) InitContainerRouter(Router *gin.RouterGroup) {
baRouter.POST("/info", baseApi.ContainerInfo) baRouter.POST("/info", baseApi.ContainerInfo)
baRouter.POST("/search", baseApi.SearchContainer) baRouter.POST("/search", baseApi.SearchContainer)
baRouter.POST("/list", baseApi.ListContainer) baRouter.POST("/list", baseApi.ListContainer)
baRouter.GET("/list/stats", baseApi.ContainerListStats)
baRouter.GET("/search/log", baseApi.ContainerLogs) baRouter.GET("/search/log", baseApi.ContainerLogs)
baRouter.GET("/limit", baseApi.LoadResouceLimit) baRouter.GET("/limit", baseApi.LoadResouceLimit)
baRouter.POST("/clean/log", baseApi.CleanContainerLog) baRouter.POST("/clean/log", baseApi.CleanContainerLog)

View File

@ -252,7 +252,10 @@ var doc = `{
"200": { "200": {
"description": "OK", "description": "OK",
"schema": { "schema": {
"type": "anrry" "type": "array",
"items": {
"$ref": "#/definitions/dto.AppVersion"
}
} }
} }
} }
@ -388,7 +391,10 @@ var doc = `{
"200": { "200": {
"description": "OK", "description": "OK",
"schema": { "schema": {
"type": "anrry" "type": "array",
"items": {
"$ref": "#/definitions/dto.AppResource"
}
} }
} }
} }
@ -778,7 +784,10 @@ var doc = `{
"200": { "200": {
"description": "OK", "description": "OK",
"schema": { "schema": {
"type": "anrry" "type": "array",
"items": {
"$ref": "#/definitions/response.AppService"
}
} }
} }
} }
@ -1442,7 +1451,10 @@ var doc = `{
"200": { "200": {
"description": "OK", "description": "OK",
"schema": { "schema": {
"type": "anrry" "type": "array",
"items": {
"$ref": "#/definitions/dto.Options"
}
} }
} }
} }
@ -1939,6 +1951,28 @@ var doc = `{
} }
} }
}, },
"/containers/list/stats": {
"get": {
"security": [
{
"ApiKeyAuth": []
}
],
"description": "获取容器列表资源占用",
"summary": "Load container stats",
"responses": {
"200": {
"description": "OK",
"schema": {
"type": "array",
"items": {
"$ref": "#/definitions/dto.ContainerListStats"
}
}
}
}
}
},
"/containers/network": { "/containers/network": {
"post": { "post": {
"security": [ "security": [
@ -2170,7 +2204,10 @@ var doc = `{
"200": { "200": {
"description": "OK", "description": "OK",
"schema": { "schema": {
"type": "anrry" "type": "array",
"items": {
"$ref": "#/definitions/dto.ImageRepoOption"
}
} }
} }
} }
@ -2507,7 +2544,7 @@ var doc = `{
"200": { "200": {
"description": "OK", "description": "OK",
"schema": { "schema": {
"$ref": "#/definitions/dto.ContainterStats" "$ref": "#/definitions/dto.ContainerStats"
} }
} }
} }
@ -2532,7 +2569,10 @@ var doc = `{
"200": { "200": {
"description": "OK", "description": "OK",
"schema": { "schema": {
"type": "anrry" "type": "array",
"items": {
"$ref": "#/definitions/dto.ComposeTemplateInfo"
}
} }
} }
} }
@ -3756,7 +3796,10 @@ var doc = `{
"200": { "200": {
"description": "OK", "description": "OK",
"schema": { "schema": {
"type": "anrry" "type": "array",
"items": {
"type": "string"
}
} }
} }
} }
@ -3844,7 +3887,10 @@ var doc = `{
"200": { "200": {
"description": "OK", "description": "OK",
"schema": { "schema": {
"type": "anrry" "type": "array",
"items": {
"type": "string"
}
} }
} }
} }
@ -5064,7 +5110,10 @@ var doc = `{
"200": { "200": {
"description": "OK", "description": "OK",
"schema": { "schema": {
"type": "anrry" "type": "array",
"items": {
"$ref": "#/definitions/response.FileTree"
}
} }
} }
} }
@ -5137,7 +5186,10 @@ var doc = `{
"200": { "200": {
"description": "OK", "description": "OK",
"schema": { "schema": {
"type": "anrry" "type": "array",
"items": {
"$ref": "#/definitions/response.FileInfo"
}
} }
} }
} }
@ -6227,7 +6279,10 @@ var doc = `{
"200": { "200": {
"description": "OK", "description": "OK",
"schema": { "schema": {
"type": "anrry" "type": "array",
"items": {
"$ref": "#/definitions/dto.HostTree"
}
} }
} }
} }
@ -6330,7 +6385,10 @@ var doc = `{
"200": { "200": {
"description": "OK", "description": "OK",
"schema": { "schema": {
"type": "anrry" "type": "array",
"items": {
"$ref": "#/definitions/dto.HostTree"
}
} }
} }
} }
@ -6640,7 +6698,10 @@ var doc = `{
"200": { "200": {
"description": "OK", "description": "OK",
"schema": { "schema": {
"type": "anrry" "type": "array",
"items": {
"$ref": "#/definitions/response.NginxParam"
}
} }
} }
} }
@ -7343,7 +7404,10 @@ var doc = `{
"200": { "200": {
"description": "OK", "description": "OK",
"schema": { "schema": {
"type": "anrry" "type": "array",
"items": {
"$ref": "#/definitions/dto.BackupInfo"
}
} }
} }
} }
@ -7377,7 +7441,10 @@ var doc = `{
"200": { "200": {
"description": "OK", "description": "OK",
"schema": { "schema": {
"type": "anrry" "type": "array",
"items": {
"type": "string"
}
} }
} }
} }
@ -7413,7 +7480,10 @@ var doc = `{
"200": { "200": {
"description": "OK", "description": "OK",
"schema": { "schema": {
"type": "anrry" "type": "array",
"items": {
"type": "string"
}
} }
} }
} }
@ -8738,7 +8808,10 @@ var doc = `{
"200": { "200": {
"description": "OK", "description": "OK",
"schema": { "schema": {
"type": "anrry" "type": "array",
"items": {
"$ref": "#/definitions/response.WebsitePreInstallCheck"
}
} }
} }
} }
@ -9280,7 +9353,10 @@ var doc = `{
"200": { "200": {
"description": "OK", "description": "OK",
"schema": { "schema": {
"type": "anrry" "type": "array",
"items": {
"$ref": "#/definitions/model.WebsiteDomain"
}
} }
} }
} }
@ -9419,7 +9495,10 @@ var doc = `{
"200": { "200": {
"description": "OK", "description": "OK",
"schema": { "schema": {
"type": "anrry" "type": "array",
"items": {
"$ref": "#/definitions/response.WebsiteDTO"
}
} }
} }
} }
@ -9599,7 +9678,10 @@ var doc = `{
"200": { "200": {
"description": "OK", "description": "OK",
"schema": { "schema": {
"type": "anrry" "type": "array",
"items": {
"type": "string"
}
} }
} }
} }
@ -10204,7 +10286,10 @@ var doc = `{
"200": { "200": {
"description": "OK", "description": "OK",
"schema": { "schema": {
"type": "anrry" "type": "array",
"items": {
"$ref": "#/definitions/response.WebsiteDNSRes"
}
} }
} }
} }
@ -10494,6 +10579,51 @@ var doc = `{
} }
} }
}, },
"dto.AppResource": {
"type": "object",
"properties": {
"name": {
"type": "string"
},
"type": {
"type": "string"
}
}
},
"dto.AppVersion": {
"type": "object",
"properties": {
"detailId": {
"type": "integer"
},
"version": {
"type": "string"
}
}
},
"dto.BackupInfo": {
"type": "object",
"properties": {
"backupPath": {
"type": "string"
},
"bucket": {
"type": "string"
},
"createdAt": {
"type": "string"
},
"id": {
"type": "integer"
},
"type": {
"type": "string"
},
"vars": {
"type": "string"
}
}
},
"dto.BackupOperate": { "dto.BackupOperate": {
"type": "object", "type": "object",
"required": [ "required": [
@ -10801,6 +10931,26 @@ var doc = `{
} }
} }
}, },
"dto.ComposeTemplateInfo": {
"type": "object",
"properties": {
"content": {
"type": "string"
},
"createdAt": {
"type": "string"
},
"description": {
"type": "string"
},
"id": {
"type": "integer"
},
"name": {
"type": "string"
}
}
},
"dto.ComposeTemplateUpdate": { "dto.ComposeTemplateUpdate": {
"type": "object", "type": "object",
"properties": { "properties": {
@ -10834,6 +10984,20 @@ var doc = `{
} }
} }
}, },
"dto.ContainerListStats": {
"type": "object",
"properties": {
"containerID": {
"type": "string"
},
"cpuPercent": {
"type": "number"
},
"memoryPercent": {
"type": "number"
}
}
},
"dto.ContainerOperate": { "dto.ContainerOperate": {
"type": "object", "type": "object",
"properties": { "properties": {
@ -10846,6 +11010,9 @@ var doc = `{
"type": "string" "type": "string"
} }
}, },
"containerID": {
"type": "string"
},
"cpuShares": { "cpuShares": {
"type": "integer" "type": "integer"
}, },
@ -10952,22 +11119,7 @@ var doc = `{
} }
} }
}, },
"dto.ContainerUpgrade": { "dto.ContainerStats": {
"type": "object",
"required": [
"image",
"name"
],
"properties": {
"image": {
"type": "string"
},
"name": {
"type": "string"
}
}
},
"dto.ContainterStats": {
"type": "object", "type": "object",
"properties": { "properties": {
"cache": { "cache": {
@ -10996,6 +11148,21 @@ var doc = `{
} }
} }
}, },
"dto.ContainerUpgrade": {
"type": "object",
"required": [
"image",
"name"
],
"properties": {
"image": {
"type": "string"
},
"name": {
"type": "string"
}
}
},
"dto.CronjobBatchDelete": { "dto.CronjobBatchDelete": {
"type": "object", "type": "object",
"properties": { "properties": {
@ -11728,6 +11895,23 @@ var doc = `{
} }
} }
}, },
"dto.HostTree": {
"type": "object",
"properties": {
"children": {
"type": "array",
"items": {
"$ref": "#/definitions/dto.TreeChild"
}
},
"id": {
"type": "integer"
},
"label": {
"type": "string"
}
}
},
"dto.ImageBuild": { "dto.ImageBuild": {
"type": "object", "type": "object",
"required": [ "required": [
@ -11811,6 +11995,20 @@ var doc = `{
} }
} }
}, },
"dto.ImageRepoOption": {
"type": "object",
"properties": {
"downloadUrl": {
"type": "string"
},
"id": {
"type": "integer"
},
"name": {
"type": "string"
}
}
},
"dto.ImageRepoUpdate": { "dto.ImageRepoUpdate": {
"type": "object", "type": "object",
"properties": { "properties": {
@ -12257,6 +12455,14 @@ var doc = `{
} }
} }
}, },
"dto.Options": {
"type": "object",
"properties": {
"option": {
"type": "string"
}
}
},
"dto.PageContainer": { "dto.PageContainer": {
"type": "object", "type": "object",
"required": [ "required": [
@ -13028,6 +13234,17 @@ var doc = `{
} }
} }
}, },
"dto.TreeChild": {
"type": "object",
"properties": {
"id": {
"type": "integer"
},
"label": {
"type": "string"
}
}
},
"dto.UpdateDescription": { "dto.UpdateDescription": {
"type": "object", "type": "object",
"required": [ "required": [
@ -14580,14 +14797,6 @@ var doc = `{
"websiteId" "websiteId"
], ],
"properties": { "properties": {
"HttpConfig": {
"type": "string",
"enum": [
"HTTPSOnly",
"HTTPAlso",
"HTTPToHTTPS"
]
},
"SSLProtocol": { "SSLProtocol": {
"type": "array", "type": "array",
"items": { "items": {
@ -14600,12 +14809,29 @@ var doc = `{
"certificate": { "certificate": {
"type": "string" "type": "string"
}, },
"certificatePath": {
"type": "string"
},
"enable": { "enable": {
"type": "boolean" "type": "boolean"
}, },
"httpConfig": {
"type": "string",
"enum": [
"HTTPSOnly",
"HTTPAlso",
"HTTPToHTTPS"
]
},
"importType": {
"type": "string"
},
"privateKey": { "privateKey": {
"type": "string" "type": "string"
}, },
"privateKeyPath": {
"type": "string"
},
"type": { "type": {
"type": "string", "type": "string",
"enum": [ "enum": [
@ -14865,6 +15091,9 @@ var doc = `{
"pageSize" "pageSize"
], ],
"properties": { "properties": {
"acmeAccountId": {
"type": "integer"
},
"page": { "page": {
"type": "integer" "type": "integer"
}, },
@ -15215,6 +15444,18 @@ var doc = `{
"values": {} "values": {}
} }
}, },
"response.AppService": {
"type": "object",
"properties": {
"config": {},
"label": {
"type": "string"
},
"value": {
"type": "string"
}
}
},
"response.FileInfo": { "response.FileInfo": {
"type": "object", "type": "object",
"properties": { "properties": {
@ -15277,6 +15518,26 @@ var doc = `{
} }
} }
}, },
"response.FileTree": {
"type": "object",
"properties": {
"children": {
"type": "array",
"items": {
"$ref": "#/definitions/response.FileTree"
}
},
"id": {
"type": "string"
},
"name": {
"type": "string"
},
"path": {
"type": "string"
}
}
},
"response.NginxParam": { "response.NginxParam": {
"type": "object", "type": "object",
"properties": { "properties": {
@ -15357,6 +15618,23 @@ var doc = `{
} }
} }
}, },
"response.WebsiteDNSRes": {
"type": "object",
"properties": {
"domain": {
"type": "string"
},
"err": {
"type": "string"
},
"resolve": {
"type": "string"
},
"value": {
"type": "string"
}
}
},
"response.WebsiteDTO": { "response.WebsiteDTO": {
"type": "object", "type": "object",
"properties": { "properties": {
@ -15509,6 +15787,23 @@ var doc = `{
} }
} }
}, },
"response.WebsitePreInstallCheck": {
"type": "object",
"properties": {
"appName": {
"type": "string"
},
"name": {
"type": "string"
},
"status": {
"type": "string"
},
"version": {
"type": "string"
}
}
},
"response.WebsiteWafConfig": { "response.WebsiteWafConfig": {
"type": "object", "type": "object",
"properties": { "properties": {

View File

@ -238,7 +238,10 @@
"200": { "200": {
"description": "OK", "description": "OK",
"schema": { "schema": {
"type": "anrry" "type": "array",
"items": {
"$ref": "#/definitions/dto.AppVersion"
}
} }
} }
} }
@ -374,7 +377,10 @@
"200": { "200": {
"description": "OK", "description": "OK",
"schema": { "schema": {
"type": "anrry" "type": "array",
"items": {
"$ref": "#/definitions/dto.AppResource"
}
} }
} }
} }
@ -764,7 +770,10 @@
"200": { "200": {
"description": "OK", "description": "OK",
"schema": { "schema": {
"type": "anrry" "type": "array",
"items": {
"$ref": "#/definitions/response.AppService"
}
} }
} }
} }
@ -1428,7 +1437,10 @@
"200": { "200": {
"description": "OK", "description": "OK",
"schema": { "schema": {
"type": "anrry" "type": "array",
"items": {
"$ref": "#/definitions/dto.Options"
}
} }
} }
} }
@ -1925,6 +1937,28 @@
} }
} }
}, },
"/containers/list/stats": {
"get": {
"security": [
{
"ApiKeyAuth": []
}
],
"description": "获取容器列表资源占用",
"summary": "Load container stats",
"responses": {
"200": {
"description": "OK",
"schema": {
"type": "array",
"items": {
"$ref": "#/definitions/dto.ContainerListStats"
}
}
}
}
}
},
"/containers/network": { "/containers/network": {
"post": { "post": {
"security": [ "security": [
@ -2156,7 +2190,10 @@
"200": { "200": {
"description": "OK", "description": "OK",
"schema": { "schema": {
"type": "anrry" "type": "array",
"items": {
"$ref": "#/definitions/dto.ImageRepoOption"
}
} }
} }
} }
@ -2493,7 +2530,7 @@
"200": { "200": {
"description": "OK", "description": "OK",
"schema": { "schema": {
"$ref": "#/definitions/dto.ContainterStats" "$ref": "#/definitions/dto.ContainerStats"
} }
} }
} }
@ -2518,7 +2555,10 @@
"200": { "200": {
"description": "OK", "description": "OK",
"schema": { "schema": {
"type": "anrry" "type": "array",
"items": {
"$ref": "#/definitions/dto.ComposeTemplateInfo"
}
} }
} }
} }
@ -3742,7 +3782,10 @@
"200": { "200": {
"description": "OK", "description": "OK",
"schema": { "schema": {
"type": "anrry" "type": "array",
"items": {
"type": "string"
}
} }
} }
} }
@ -3830,7 +3873,10 @@
"200": { "200": {
"description": "OK", "description": "OK",
"schema": { "schema": {
"type": "anrry" "type": "array",
"items": {
"type": "string"
}
} }
} }
} }
@ -5050,7 +5096,10 @@
"200": { "200": {
"description": "OK", "description": "OK",
"schema": { "schema": {
"type": "anrry" "type": "array",
"items": {
"$ref": "#/definitions/response.FileTree"
}
} }
} }
} }
@ -5123,7 +5172,10 @@
"200": { "200": {
"description": "OK", "description": "OK",
"schema": { "schema": {
"type": "anrry" "type": "array",
"items": {
"$ref": "#/definitions/response.FileInfo"
}
} }
} }
} }
@ -6213,7 +6265,10 @@
"200": { "200": {
"description": "OK", "description": "OK",
"schema": { "schema": {
"type": "anrry" "type": "array",
"items": {
"$ref": "#/definitions/dto.HostTree"
}
} }
} }
} }
@ -6316,7 +6371,10 @@
"200": { "200": {
"description": "OK", "description": "OK",
"schema": { "schema": {
"type": "anrry" "type": "array",
"items": {
"$ref": "#/definitions/dto.HostTree"
}
} }
} }
} }
@ -6626,7 +6684,10 @@
"200": { "200": {
"description": "OK", "description": "OK",
"schema": { "schema": {
"type": "anrry" "type": "array",
"items": {
"$ref": "#/definitions/response.NginxParam"
}
} }
} }
} }
@ -7329,7 +7390,10 @@
"200": { "200": {
"description": "OK", "description": "OK",
"schema": { "schema": {
"type": "anrry" "type": "array",
"items": {
"$ref": "#/definitions/dto.BackupInfo"
}
} }
} }
} }
@ -7363,7 +7427,10 @@
"200": { "200": {
"description": "OK", "description": "OK",
"schema": { "schema": {
"type": "anrry" "type": "array",
"items": {
"type": "string"
}
} }
} }
} }
@ -7399,7 +7466,10 @@
"200": { "200": {
"description": "OK", "description": "OK",
"schema": { "schema": {
"type": "anrry" "type": "array",
"items": {
"type": "string"
}
} }
} }
} }
@ -8724,7 +8794,10 @@
"200": { "200": {
"description": "OK", "description": "OK",
"schema": { "schema": {
"type": "anrry" "type": "array",
"items": {
"$ref": "#/definitions/response.WebsitePreInstallCheck"
}
} }
} }
} }
@ -9266,7 +9339,10 @@
"200": { "200": {
"description": "OK", "description": "OK",
"schema": { "schema": {
"type": "anrry" "type": "array",
"items": {
"$ref": "#/definitions/model.WebsiteDomain"
}
} }
} }
} }
@ -9405,7 +9481,10 @@
"200": { "200": {
"description": "OK", "description": "OK",
"schema": { "schema": {
"type": "anrry" "type": "array",
"items": {
"$ref": "#/definitions/response.WebsiteDTO"
}
} }
} }
} }
@ -9585,7 +9664,10 @@
"200": { "200": {
"description": "OK", "description": "OK",
"schema": { "schema": {
"type": "anrry" "type": "array",
"items": {
"type": "string"
}
} }
} }
} }
@ -10190,7 +10272,10 @@
"200": { "200": {
"description": "OK", "description": "OK",
"schema": { "schema": {
"type": "anrry" "type": "array",
"items": {
"$ref": "#/definitions/response.WebsiteDNSRes"
}
} }
} }
} }
@ -10480,6 +10565,51 @@
} }
} }
}, },
"dto.AppResource": {
"type": "object",
"properties": {
"name": {
"type": "string"
},
"type": {
"type": "string"
}
}
},
"dto.AppVersion": {
"type": "object",
"properties": {
"detailId": {
"type": "integer"
},
"version": {
"type": "string"
}
}
},
"dto.BackupInfo": {
"type": "object",
"properties": {
"backupPath": {
"type": "string"
},
"bucket": {
"type": "string"
},
"createdAt": {
"type": "string"
},
"id": {
"type": "integer"
},
"type": {
"type": "string"
},
"vars": {
"type": "string"
}
}
},
"dto.BackupOperate": { "dto.BackupOperate": {
"type": "object", "type": "object",
"required": [ "required": [
@ -10787,6 +10917,26 @@
} }
} }
}, },
"dto.ComposeTemplateInfo": {
"type": "object",
"properties": {
"content": {
"type": "string"
},
"createdAt": {
"type": "string"
},
"description": {
"type": "string"
},
"id": {
"type": "integer"
},
"name": {
"type": "string"
}
}
},
"dto.ComposeTemplateUpdate": { "dto.ComposeTemplateUpdate": {
"type": "object", "type": "object",
"properties": { "properties": {
@ -10820,6 +10970,20 @@
} }
} }
}, },
"dto.ContainerListStats": {
"type": "object",
"properties": {
"containerID": {
"type": "string"
},
"cpuPercent": {
"type": "number"
},
"memoryPercent": {
"type": "number"
}
}
},
"dto.ContainerOperate": { "dto.ContainerOperate": {
"type": "object", "type": "object",
"properties": { "properties": {
@ -10832,6 +10996,9 @@
"type": "string" "type": "string"
} }
}, },
"containerID": {
"type": "string"
},
"cpuShares": { "cpuShares": {
"type": "integer" "type": "integer"
}, },
@ -10938,22 +11105,7 @@
} }
} }
}, },
"dto.ContainerUpgrade": { "dto.ContainerStats": {
"type": "object",
"required": [
"image",
"name"
],
"properties": {
"image": {
"type": "string"
},
"name": {
"type": "string"
}
}
},
"dto.ContainterStats": {
"type": "object", "type": "object",
"properties": { "properties": {
"cache": { "cache": {
@ -10982,6 +11134,21 @@
} }
} }
}, },
"dto.ContainerUpgrade": {
"type": "object",
"required": [
"image",
"name"
],
"properties": {
"image": {
"type": "string"
},
"name": {
"type": "string"
}
}
},
"dto.CronjobBatchDelete": { "dto.CronjobBatchDelete": {
"type": "object", "type": "object",
"properties": { "properties": {
@ -11714,6 +11881,23 @@
} }
} }
}, },
"dto.HostTree": {
"type": "object",
"properties": {
"children": {
"type": "array",
"items": {
"$ref": "#/definitions/dto.TreeChild"
}
},
"id": {
"type": "integer"
},
"label": {
"type": "string"
}
}
},
"dto.ImageBuild": { "dto.ImageBuild": {
"type": "object", "type": "object",
"required": [ "required": [
@ -11797,6 +11981,20 @@
} }
} }
}, },
"dto.ImageRepoOption": {
"type": "object",
"properties": {
"downloadUrl": {
"type": "string"
},
"id": {
"type": "integer"
},
"name": {
"type": "string"
}
}
},
"dto.ImageRepoUpdate": { "dto.ImageRepoUpdate": {
"type": "object", "type": "object",
"properties": { "properties": {
@ -12243,6 +12441,14 @@
} }
} }
}, },
"dto.Options": {
"type": "object",
"properties": {
"option": {
"type": "string"
}
}
},
"dto.PageContainer": { "dto.PageContainer": {
"type": "object", "type": "object",
"required": [ "required": [
@ -13014,6 +13220,17 @@
} }
} }
}, },
"dto.TreeChild": {
"type": "object",
"properties": {
"id": {
"type": "integer"
},
"label": {
"type": "string"
}
}
},
"dto.UpdateDescription": { "dto.UpdateDescription": {
"type": "object", "type": "object",
"required": [ "required": [
@ -14566,14 +14783,6 @@
"websiteId" "websiteId"
], ],
"properties": { "properties": {
"HttpConfig": {
"type": "string",
"enum": [
"HTTPSOnly",
"HTTPAlso",
"HTTPToHTTPS"
]
},
"SSLProtocol": { "SSLProtocol": {
"type": "array", "type": "array",
"items": { "items": {
@ -14586,12 +14795,29 @@
"certificate": { "certificate": {
"type": "string" "type": "string"
}, },
"certificatePath": {
"type": "string"
},
"enable": { "enable": {
"type": "boolean" "type": "boolean"
}, },
"httpConfig": {
"type": "string",
"enum": [
"HTTPSOnly",
"HTTPAlso",
"HTTPToHTTPS"
]
},
"importType": {
"type": "string"
},
"privateKey": { "privateKey": {
"type": "string" "type": "string"
}, },
"privateKeyPath": {
"type": "string"
},
"type": { "type": {
"type": "string", "type": "string",
"enum": [ "enum": [
@ -14851,6 +15077,9 @@
"pageSize" "pageSize"
], ],
"properties": { "properties": {
"acmeAccountId": {
"type": "integer"
},
"page": { "page": {
"type": "integer" "type": "integer"
}, },
@ -15201,6 +15430,18 @@
"values": {} "values": {}
} }
}, },
"response.AppService": {
"type": "object",
"properties": {
"config": {},
"label": {
"type": "string"
},
"value": {
"type": "string"
}
}
},
"response.FileInfo": { "response.FileInfo": {
"type": "object", "type": "object",
"properties": { "properties": {
@ -15263,6 +15504,26 @@
} }
} }
}, },
"response.FileTree": {
"type": "object",
"properties": {
"children": {
"type": "array",
"items": {
"$ref": "#/definitions/response.FileTree"
}
},
"id": {
"type": "string"
},
"name": {
"type": "string"
},
"path": {
"type": "string"
}
}
},
"response.NginxParam": { "response.NginxParam": {
"type": "object", "type": "object",
"properties": { "properties": {
@ -15343,6 +15604,23 @@
} }
} }
}, },
"response.WebsiteDNSRes": {
"type": "object",
"properties": {
"domain": {
"type": "string"
},
"err": {
"type": "string"
},
"resolve": {
"type": "string"
},
"value": {
"type": "string"
}
}
},
"response.WebsiteDTO": { "response.WebsiteDTO": {
"type": "object", "type": "object",
"properties": { "properties": {
@ -15495,6 +15773,23 @@
} }
} }
}, },
"response.WebsitePreInstallCheck": {
"type": "object",
"properties": {
"appName": {
"type": "string"
},
"name": {
"type": "string"
},
"status": {
"type": "string"
},
"version": {
"type": "string"
}
}
},
"response.WebsiteWafConfig": { "response.WebsiteWafConfig": {
"type": "object", "type": "object",
"properties": { "properties": {

View File

@ -26,6 +26,35 @@ definitions:
oldRule: oldRule:
$ref: '#/definitions/dto.AddrRuleOperate' $ref: '#/definitions/dto.AddrRuleOperate'
type: object type: object
dto.AppResource:
properties:
name:
type: string
type:
type: string
type: object
dto.AppVersion:
properties:
detailId:
type: integer
version:
type: string
type: object
dto.BackupInfo:
properties:
backupPath:
type: string
bucket:
type: string
createdAt:
type: string
id:
type: integer
type:
type: string
vars:
type: string
type: object
dto.BackupOperate: dto.BackupOperate:
properties: properties:
accessKey: accessKey:
@ -233,6 +262,19 @@ definitions:
required: required:
- name - name
type: object type: object
dto.ComposeTemplateInfo:
properties:
content:
type: string
createdAt:
type: string
description:
type: string
id:
type: integer
name:
type: string
type: object
dto.ComposeTemplateUpdate: dto.ComposeTemplateUpdate:
properties: properties:
content: content:
@ -255,6 +297,15 @@ definitions:
- name - name
- path - path
type: object type: object
dto.ContainerListStats:
properties:
containerID:
type: string
cpuPercent:
type: number
memoryPercent:
type: number
type: object
dto.ContainerOperate: dto.ContainerOperate:
properties: properties:
autoRemove: autoRemove:
@ -263,6 +314,8 @@ definitions:
items: items:
type: string type: string
type: array type: array
containerID:
type: string
cpuShares: cpuShares:
type: integer type: integer
env: env:
@ -336,17 +389,7 @@ definitions:
spaceReclaimed: spaceReclaimed:
type: integer type: integer
type: object type: object
dto.ContainerUpgrade: dto.ContainerStats:
properties:
image:
type: string
name:
type: string
required:
- image
- name
type: object
dto.ContainterStats:
properties: properties:
cache: cache:
type: number type: number
@ -365,6 +408,16 @@ definitions:
shotTime: shotTime:
type: string type: string
type: object type: object
dto.ContainerUpgrade:
properties:
image:
type: string
name:
type: string
required:
- image
- name
type: object
dto.CronjobBatchDelete: dto.CronjobBatchDelete:
properties: properties:
cleanData: cleanData:
@ -859,6 +912,17 @@ definitions:
- port - port
- user - user
type: object type: object
dto.HostTree:
properties:
children:
items:
$ref: '#/definitions/dto.TreeChild'
type: array
id:
type: integer
label:
type: string
type: object
dto.ImageBuild: dto.ImageBuild:
properties: properties:
dockerfile: dockerfile:
@ -914,6 +978,15 @@ definitions:
required: required:
- ids - ids
type: object type: object
dto.ImageRepoOption:
properties:
downloadUrl:
type: string
id:
type: integer
name:
type: string
type: object
dto.ImageRepoUpdate: dto.ImageRepoUpdate:
properties: properties:
auth: auth:
@ -1209,6 +1282,11 @@ definitions:
required: required:
- name - name
type: object type: object
dto.Options:
properties:
option:
type: string
type: object
dto.PageContainer: dto.PageContainer:
properties: properties:
filters: filters:
@ -1723,6 +1801,13 @@ definitions:
ntpSite: ntpSite:
type: string type: string
type: object type: object
dto.TreeChild:
properties:
id:
type: integer
label:
type: string
type: object
dto.UpdateDescription: dto.UpdateDescription:
properties: properties:
description: description:
@ -2754,12 +2839,6 @@ definitions:
type: object type: object
request.WebsiteHTTPSOp: request.WebsiteHTTPSOp:
properties: properties:
HttpConfig:
enum:
- HTTPSOnly
- HTTPAlso
- HTTPToHTTPS
type: string
SSLProtocol: SSLProtocol:
items: items:
type: string type: string
@ -2768,10 +2847,22 @@ definitions:
type: string type: string
certificate: certificate:
type: string type: string
certificatePath:
type: string
enable: enable:
type: boolean type: boolean
httpConfig:
enum:
- HTTPSOnly
- HTTPAlso
- HTTPToHTTPS
type: string
importType:
type: string
privateKey: privateKey:
type: string type: string
privateKeyPath:
type: string
type: type:
enum: enum:
- existed - existed
@ -2948,6 +3039,8 @@ definitions:
type: object type: object
request.WebsiteSSLSearch: request.WebsiteSSLSearch:
properties: properties:
acmeAccountId:
type: integer
page: page:
type: integer type: integer
pageSize: pageSize:
@ -3185,6 +3278,14 @@ definitions:
value: {} value: {}
values: {} values: {}
type: object type: object
response.AppService:
properties:
config: {}
label:
type: string
value:
type: string
type: object
response.FileInfo: response.FileInfo:
properties: properties:
content: content:
@ -3226,6 +3327,19 @@ definitions:
user: user:
type: string type: string
type: object type: object
response.FileTree:
properties:
children:
items:
$ref: '#/definitions/response.FileTree'
type: array
id:
type: string
name:
type: string
path:
type: string
type: object
response.NginxParam: response.NginxParam:
properties: properties:
name: name:
@ -3278,6 +3392,17 @@ definitions:
url: url:
type: string type: string
type: object type: object
response.WebsiteDNSRes:
properties:
domain:
type: string
err:
type: string
resolve:
type: string
value:
type: string
type: object
response.WebsiteDTO: response.WebsiteDTO:
properties: properties:
IPV6: IPV6:
@ -3378,6 +3503,17 @@ definitions:
$ref: '#/definitions/response.NginxParam' $ref: '#/definitions/response.NginxParam'
type: array type: array
type: object type: object
response.WebsitePreInstallCheck:
properties:
appName:
type: string
name:
type: string
status:
type: string
version:
type: string
type: object
response.WebsiteWafConfig: response.WebsiteWafConfig:
properties: properties:
content: content:
@ -3537,7 +3673,9 @@ paths:
"200": "200":
description: OK description: OK
schema: schema:
type: anrry items:
$ref: '#/definitions/dto.AppVersion'
type: array
security: security:
- ApiKeyAuth: [] - ApiKeyAuth: []
summary: Search app update version by install id summary: Search app update version by install id
@ -3621,7 +3759,9 @@ paths:
"200": "200":
description: OK description: OK
schema: schema:
type: anrry items:
$ref: '#/definitions/dto.AppResource'
type: array
security: security:
- ApiKeyAuth: [] - ApiKeyAuth: []
summary: Check before delete summary: Check before delete
@ -3870,7 +4010,9 @@ paths:
"200": "200":
description: OK description: OK
schema: schema:
type: anrry items:
$ref: '#/definitions/response.AppService'
type: array
security: security:
- ApiKeyAuth: [] - ApiKeyAuth: []
summary: Search app service by key summary: Search app service by key
@ -4292,7 +4434,9 @@ paths:
"200": "200":
description: OK description: OK
schema: schema:
type: anrry items:
$ref: '#/definitions/dto.Options'
type: array
security: security:
- ApiKeyAuth: [] - ApiKeyAuth: []
summary: List images summary: List images
@ -4611,6 +4755,19 @@ paths:
summary: List containers summary: List containers
tags: tags:
- Container - Container
/containers/list/stats:
get:
description: 获取容器列表资源占用
responses:
"200":
description: OK
schema:
items:
$ref: '#/definitions/dto.ContainerListStats'
type: array
security:
- ApiKeyAuth: []
summary: Load container stats
/containers/network: /containers/network:
post: post:
consumes: consumes:
@ -4756,7 +4913,9 @@ paths:
"200": "200":
description: OK description: OK
schema: schema:
type: anrry items:
$ref: '#/definitions/dto.ImageRepoOption'
type: array
security: security:
- ApiKeyAuth: [] - ApiKeyAuth: []
summary: List image repos summary: List image repos
@ -4969,7 +5128,7 @@ paths:
"200": "200":
description: OK description: OK
schema: schema:
$ref: '#/definitions/dto.ContainterStats' $ref: '#/definitions/dto.ContainerStats'
security: security:
- ApiKeyAuth: [] - ApiKeyAuth: []
summary: Container stats summary: Container stats
@ -4984,7 +5143,9 @@ paths:
"200": "200":
description: OK description: OK
schema: schema:
type: anrry items:
$ref: '#/definitions/dto.ComposeTemplateInfo'
type: array
security: security:
- ApiKeyAuth: [] - ApiKeyAuth: []
summary: List compose templates summary: List compose templates
@ -5767,7 +5928,9 @@ paths:
"200": "200":
description: OK description: OK
schema: schema:
type: anrry items:
type: string
type: array
security: security:
- ApiKeyAuth: [] - ApiKeyAuth: []
summary: Check before delete mysql database summary: Check before delete mysql database
@ -5823,7 +5986,9 @@ paths:
"200": "200":
description: OK description: OK
schema: schema:
type: anrry items:
type: string
type: array
security: security:
- ApiKeyAuth: [] - ApiKeyAuth: []
summary: List mysql database names summary: List mysql database names
@ -6597,7 +6762,9 @@ paths:
"200": "200":
description: OK description: OK
schema: schema:
type: anrry items:
$ref: '#/definitions/response.FileTree'
type: array
security: security:
- ApiKeyAuth: [] - ApiKeyAuth: []
summary: Load files tree summary: Load files tree
@ -6643,7 +6810,9 @@ paths:
"200": "200":
description: OK description: OK
schema: schema:
type: anrry items:
$ref: '#/definitions/response.FileInfo'
type: array
security: security:
- ApiKeyAuth: [] - ApiKeyAuth: []
summary: Page file summary: Page file
@ -7336,7 +7505,9 @@ paths:
"200": "200":
description: OK description: OK
schema: schema:
type: anrry items:
$ref: '#/definitions/dto.HostTree'
type: array
security: security:
- ApiKeyAuth: [] - ApiKeyAuth: []
summary: Page host summary: Page host
@ -7399,7 +7570,9 @@ paths:
"200": "200":
description: OK description: OK
schema: schema:
type: anrry items:
$ref: '#/definitions/dto.HostTree'
type: array
security: security:
- ApiKeyAuth: [] - ApiKeyAuth: []
summary: Load host tree summary: Load host tree
@ -7595,7 +7768,9 @@ paths:
"200": "200":
description: OK description: OK
schema: schema:
type: anrry items:
$ref: '#/definitions/response.NginxParam'
type: array
security: security:
- ApiKeyAuth: [] - ApiKeyAuth: []
summary: Load partial OpenResty conf summary: Load partial OpenResty conf
@ -8044,7 +8219,9 @@ paths:
"200": "200":
description: OK description: OK
schema: schema:
type: anrry items:
$ref: '#/definitions/dto.BackupInfo'
type: array
security: security:
- ApiKeyAuth: [] - ApiKeyAuth: []
summary: List backup accounts summary: List backup accounts
@ -8065,7 +8242,9 @@ paths:
"200": "200":
description: OK description: OK
schema: schema:
type: anrry items:
type: string
type: array
security: security:
- ApiKeyAuth: [] - ApiKeyAuth: []
summary: List buckets summary: List buckets
@ -8087,7 +8266,9 @@ paths:
"200": "200":
description: OK description: OK
schema: schema:
type: anrry items:
type: string
type: array
security: security:
- ApiKeyAuth: [] - ApiKeyAuth: []
summary: List files from backup accounts summary: List files from backup accounts
@ -8927,7 +9108,9 @@ paths:
"200": "200":
description: OK description: OK
schema: schema:
type: anrry items:
$ref: '#/definitions/response.WebsitePreInstallCheck'
type: array
security: security:
- ApiKeyAuth: [] - ApiKeyAuth: []
summary: Check before create website summary: Check before create website
@ -9274,7 +9457,9 @@ paths:
"200": "200":
description: OK description: OK
schema: schema:
type: anrry items:
$ref: '#/definitions/model.WebsiteDomain'
type: array
security: security:
- ApiKeyAuth: [] - ApiKeyAuth: []
summary: Search website domains by websiteId summary: Search website domains by websiteId
@ -9360,7 +9545,9 @@ paths:
"200": "200":
description: OK description: OK
schema: schema:
type: anrry items:
$ref: '#/definitions/response.WebsiteDTO'
type: array
security: security:
- ApiKeyAuth: [] - ApiKeyAuth: []
summary: List websites summary: List websites
@ -9476,7 +9663,9 @@ paths:
"200": "200":
description: OK description: OK
schema: schema:
type: anrry items:
type: string
type: array
security: security:
- ApiKeyAuth: [] - ApiKeyAuth: []
summary: List website names summary: List website names
@ -9860,7 +10049,9 @@ paths:
"200": "200":
description: OK description: OK
schema: schema:
type: anrry items:
$ref: '#/definitions/response.WebsiteDNSRes'
type: array
security: security:
- ApiKeyAuth: [] - ApiKeyAuth: []
summary: Resolve website ssl summary: Resolve website ssl

View File

@ -55,11 +55,18 @@ export namespace Container {
createTime: string; createTime: string;
state: string; state: string;
runTime: string; runTime: string;
cpuPercent: number;
memoryPercent: number;
ports: Array<string>; ports: Array<string>;
isFromApp: boolean; isFromApp: boolean;
isFromCompose: boolean; isFromCompose: boolean;
hasLoad: boolean;
cpuPercent: number;
memoryPercent: number;
}
export interface ContainerListStats {
containerID: string;
cpuPercent: number;
memoryPercent: number;
} }
export interface ContainerStats { export interface ContainerStats {
cpuPercent: number; cpuPercent: number;

View File

@ -26,6 +26,9 @@ export const loadContainerInfo = (name: string) => {
export const cleanContainerLog = (containerName: string) => { export const cleanContainerLog = (containerName: string) => {
return http.post(`/containers/clean/log`, { name: containerName }); return http.post(`/containers/clean/log`, { name: containerName });
}; };
export const containerListStats = () => {
return http.get<Array<Container.ContainerListStats>>(`/containers/list/stats`);
};
export const containerStats = (id: string) => { export const containerStats = (id: string) => {
return http.get<Container.ContainerStats>(`/containers/stats/${id}`); return http.get<Container.ContainerStats>(`/containers/stats/${id}`);
}; };

View File

@ -82,8 +82,13 @@
</el-table-column> </el-table-column>
<el-table-column :label="$t('container.source')" show-overflow-tooltip min-width="75" fix> <el-table-column :label="$t('container.source')" show-overflow-tooltip min-width="75" fix>
<template #default="{ row }"> <template #default="{ row }">
<div>CPU: {{ row.cpuPercent.toFixed(2) }}%</div> <div v-if="row.hasLoad">
<div>{{ $t('monitor.memory') }}: {{ row.memoryPercent.toFixed(2) }}%</div> <div>CPU: {{ row.cpuPercent.toFixed(2) }}%</div>
<div>{{ $t('monitor.memory') }}: {{ row.memoryPercent.toFixed(2) }}%</div>
</div>
<div v-if="!row.hasLoad">
<el-button link loading></el-button>
</div>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column :label="$t('commons.table.port')" min-width="120" prop="ports" fix> <el-table-column :label="$t('commons.table.port')" min-width="120" prop="ports" fix>
@ -160,6 +165,7 @@ import PortJumpDialog from '@/components/port-jump/index.vue';
import Status from '@/components/status/index.vue'; import Status from '@/components/status/index.vue';
import { reactive, onMounted, ref } from 'vue'; import { reactive, onMounted, ref } from 'vue';
import { import {
containerListStats,
containerOperator, containerOperator,
containerPrune, containerPrune,
inspect, inspect,
@ -244,6 +250,7 @@ const search = async (column?: any) => {
order: column?.order ? column.order : 'null', order: column?.order ? column.order : 'null',
}; };
loading.value = true; loading.value = true;
loadStats();
await searchContainer(params) await searchContainer(params)
.then((res) => { .then((res) => {
loading.value = false; loading.value = false;
@ -255,6 +262,24 @@ const search = async (column?: any) => {
}); });
}; };
const loadStats = async () => {
const res = await containerListStats();
let stats = res.data || [];
if (stats.length === 0) {
return;
}
for (const container of data.value) {
for (const item of stats) {
if (container.containerID === item.containerID) {
container.hasLoad = true;
container.cpuPercent = item.cpuPercent;
container.memoryPercent = item.memoryPercent;
break;
}
}
}
};
const dialogOperateRef = ref(); const dialogOperateRef = ref();
const onEdit = async (container: string) => { const onEdit = async (container: string) => {
const res = await loadContainerInfo(container); const res = await loadContainerInfo(container);

View File

@ -119,7 +119,7 @@
<el-tag>{{ $t('monitor.write') }}: {{ currentChartInfo.ioWriteBytes }} MB</el-tag> <el-tag>{{ $t('monitor.write') }}: {{ currentChartInfo.ioWriteBytes }} MB</el-tag>
<el-tag> <el-tag>
{{ $t('home.rwPerSecond') }}: {{ currentChartInfo.ioCount }} {{ $t('home.rwPerSecond') }}: {{ currentChartInfo.ioCount }}
{{ $t('commons.units.time') }} {{ $t('commons.units.time') }}/s
</el-tag> </el-tag>
<el-tag>{{ $t('home.ioDelay') }}: {{ currentChartInfo.ioTime }} ms</el-tag> <el-tag>{{ $t('home.ioDelay') }}: {{ currentChartInfo.ioTime }} ms</el-tag>
</div> </div>