mirror of
https://github.com/1Panel-dev/1Panel.git
synced 2025-12-12 05:15:59 +08:00
fix: 统一删除提示信息及样式 (#2690)
This commit is contained in:
parent
3f6ea63d73
commit
8857d97dd7
31 changed files with 720 additions and 423 deletions
|
|
@ -373,6 +373,32 @@ func (b *BaseApi) LoadContainerLog(c *gin.Context) {
|
||||||
helper.SuccessWithData(c, content)
|
helper.SuccessWithData(c, content)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// @Tags Container
|
||||||
|
// @Summary Rename Container
|
||||||
|
// @Description 容器重命名
|
||||||
|
// @Accept json
|
||||||
|
// @Param request body dto.ContainerRename true "request"
|
||||||
|
// @Success 200
|
||||||
|
// @Security ApiKeyAuth
|
||||||
|
// @Router /containers/rename [post]
|
||||||
|
// @x-panel-log {"bodyKeys":["name","newName"],"paramKeys":[],"BeforeFunctions":[],"formatZH":"容器重命名 [name] => [newName]","formatEN":"rename container [name] => [newName]"}
|
||||||
|
func (b *BaseApi) ContainerRename(c *gin.Context) {
|
||||||
|
var req dto.ContainerRename
|
||||||
|
if err := c.ShouldBindJSON(&req); err != nil {
|
||||||
|
helper.ErrorWithDetail(c, constant.CodeErrBadRequest, constant.ErrTypeInvalidParams, err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if err := global.VALID.Struct(req); err != nil {
|
||||||
|
helper.ErrorWithDetail(c, constant.CodeErrBadRequest, constant.ErrTypeInvalidParams, err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if err := containerService.ContainerRename(req); err != nil {
|
||||||
|
helper.ErrorWithDetail(c, constant.CodeErrInternalServer, constant.ErrTypeInternalServer, err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
helper.SuccessWithData(c, nil)
|
||||||
|
}
|
||||||
|
|
||||||
// @Tags Container
|
// @Tags Container
|
||||||
// @Summary Operate Container
|
// @Summary Operate Container
|
||||||
// @Description 容器操作
|
// @Description 容器操作
|
||||||
|
|
@ -381,7 +407,7 @@ func (b *BaseApi) LoadContainerLog(c *gin.Context) {
|
||||||
// @Success 200
|
// @Success 200
|
||||||
// @Security ApiKeyAuth
|
// @Security ApiKeyAuth
|
||||||
// @Router /containers/operate [post]
|
// @Router /containers/operate [post]
|
||||||
// @x-panel-log {"bodyKeys":["name","operation","newName"],"paramKeys":[],"BeforeFunctions":[],"formatZH":"容器 [name] 执行 [operation] [newName]","formatEN":"container [operation] [name] [newName]"}
|
// @x-panel-log {"bodyKeys":["names","operation"],"paramKeys":[],"BeforeFunctions":[],"formatZH":"容器 [names] 执行 [operation]","formatEN":"container [operation] [names]"}
|
||||||
func (b *BaseApi) ContainerOperation(c *gin.Context) {
|
func (b *BaseApi) ContainerOperation(c *gin.Context) {
|
||||||
var req dto.ContainerOperation
|
var req dto.ContainerOperation
|
||||||
if err := c.ShouldBindJSON(&req); err != nil {
|
if err := c.ShouldBindJSON(&req); err != nil {
|
||||||
|
|
|
||||||
|
|
@ -104,9 +104,13 @@ type PortHelper struct {
|
||||||
}
|
}
|
||||||
|
|
||||||
type ContainerOperation struct {
|
type ContainerOperation struct {
|
||||||
Name string `json:"name" validate:"required"`
|
Names []string `json:"names" validate:"required"`
|
||||||
Operation string `json:"operation" validate:"required,oneof=start stop restart kill pause unpause rename remove"`
|
Operation string `json:"operation" validate:"required,oneof=start stop restart kill pause unpause remove"`
|
||||||
NewName string `json:"newName"`
|
}
|
||||||
|
|
||||||
|
type ContainerRename struct {
|
||||||
|
Name string `json:"name" validate:"required"`
|
||||||
|
NewName string `json:"newName"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type ContainerPrune struct {
|
type ContainerPrune struct {
|
||||||
|
|
|
||||||
|
|
@ -52,6 +52,7 @@ type IContainerService interface {
|
||||||
ContainerInfo(req dto.OperationWithName) (*dto.ContainerOperate, error)
|
ContainerInfo(req dto.OperationWithName) (*dto.ContainerOperate, error)
|
||||||
ContainerListStats() ([]dto.ContainerListStats, error)
|
ContainerListStats() ([]dto.ContainerListStats, error)
|
||||||
LoadResourceLimit() (*dto.ResourceLimit, error)
|
LoadResourceLimit() (*dto.ResourceLimit, error)
|
||||||
|
ContainerRename(req dto.ContainerRename) 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
|
||||||
|
|
@ -514,6 +515,20 @@ func (u *ContainerService) ContainerUpgrade(req dto.ContainerUpgrade) error {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (u *ContainerService) ContainerRename(req dto.ContainerRename) error {
|
||||||
|
ctx := context.Background()
|
||||||
|
client, err := docker.NewDockerClient()
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
newContainer, _ := client.ContainerInspect(ctx, req.NewName)
|
||||||
|
if newContainer.ContainerJSONBase != nil {
|
||||||
|
return buserr.New(constant.ErrContainerName)
|
||||||
|
}
|
||||||
|
return client.ContainerRename(ctx, req.Name, req.NewName)
|
||||||
|
}
|
||||||
|
|
||||||
func (u *ContainerService) ContainerOperation(req dto.ContainerOperation) error {
|
func (u *ContainerService) ContainerOperation(req dto.ContainerOperation) error {
|
||||||
var err error
|
var err error
|
||||||
ctx := context.Background()
|
ctx := context.Background()
|
||||||
|
|
@ -521,28 +536,24 @@ func (u *ContainerService) ContainerOperation(req dto.ContainerOperation) error
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
global.LOG.Infof("start container %s operation %s", req.Name, req.Operation)
|
for _, item := range req.Names {
|
||||||
switch req.Operation {
|
global.LOG.Infof("start container %s operation %s", item, req.Operation)
|
||||||
case constant.ContainerOpStart:
|
switch req.Operation {
|
||||||
err = client.ContainerStart(ctx, req.Name, types.ContainerStartOptions{})
|
case constant.ContainerOpStart:
|
||||||
case constant.ContainerOpStop:
|
err = client.ContainerStart(ctx, item, types.ContainerStartOptions{})
|
||||||
err = client.ContainerStop(ctx, req.Name, container.StopOptions{})
|
case constant.ContainerOpStop:
|
||||||
case constant.ContainerOpRestart:
|
err = client.ContainerStop(ctx, item, container.StopOptions{})
|
||||||
err = client.ContainerRestart(ctx, req.Name, container.StopOptions{})
|
case constant.ContainerOpRestart:
|
||||||
case constant.ContainerOpKill:
|
err = client.ContainerRestart(ctx, item, container.StopOptions{})
|
||||||
err = client.ContainerKill(ctx, req.Name, "SIGKILL")
|
case constant.ContainerOpKill:
|
||||||
case constant.ContainerOpPause:
|
err = client.ContainerKill(ctx, item, "SIGKILL")
|
||||||
err = client.ContainerPause(ctx, req.Name)
|
case constant.ContainerOpPause:
|
||||||
case constant.ContainerOpUnpause:
|
err = client.ContainerPause(ctx, item)
|
||||||
err = client.ContainerUnpause(ctx, req.Name)
|
case constant.ContainerOpUnpause:
|
||||||
case constant.ContainerOpRename:
|
err = client.ContainerUnpause(ctx, item)
|
||||||
newContainer, _ := client.ContainerInspect(ctx, req.NewName)
|
case constant.ContainerOpRemove:
|
||||||
if newContainer.ContainerJSONBase != nil {
|
err = client.ContainerRemove(ctx, item, types.ContainerRemoveOptions{RemoveVolumes: true, Force: true})
|
||||||
return buserr.New(constant.ErrContainerName)
|
|
||||||
}
|
}
|
||||||
err = client.ContainerRename(ctx, req.Name, req.NewName)
|
|
||||||
case constant.ContainerOpRemove:
|
|
||||||
err = client.ContainerRemove(ctx, req.Name, types.ContainerRemoveOptions{RemoveVolumes: true, Force: true})
|
|
||||||
}
|
}
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -30,6 +30,7 @@ func (s *ContainerRouter) InitContainerRouter(Router *gin.RouterGroup) {
|
||||||
baRouter.POST("/clean/log", baseApi.CleanContainerLog)
|
baRouter.POST("/clean/log", baseApi.CleanContainerLog)
|
||||||
baRouter.POST("/load/log", baseApi.LoadContainerLog)
|
baRouter.POST("/load/log", baseApi.LoadContainerLog)
|
||||||
baRouter.POST("/inspect", baseApi.Inspect)
|
baRouter.POST("/inspect", baseApi.Inspect)
|
||||||
|
baRouter.POST("/rename", baseApi.ContainerRename)
|
||||||
baRouter.POST("/operate", baseApi.ContainerOperation)
|
baRouter.POST("/operate", baseApi.ContainerOperation)
|
||||||
baRouter.POST("/prune", baseApi.ContainerPrune)
|
baRouter.POST("/prune", baseApi.ContainerPrune)
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -2314,12 +2314,11 @@ const docTemplate = `{
|
||||||
"x-panel-log": {
|
"x-panel-log": {
|
||||||
"BeforeFunctions": [],
|
"BeforeFunctions": [],
|
||||||
"bodyKeys": [
|
"bodyKeys": [
|
||||||
"name",
|
"names",
|
||||||
"operation",
|
"operation"
|
||||||
"newName"
|
|
||||||
],
|
],
|
||||||
"formatEN": "container [operation] [name] [newName]",
|
"formatEN": "container [operation] [names]",
|
||||||
"formatZH": "容器 [name] 执行 [operation] [newName]",
|
"formatZH": "容器 [names] 执行 [operation]",
|
||||||
"paramKeys": []
|
"paramKeys": []
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -2369,6 +2368,49 @@ const docTemplate = `{
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"/containers/rename": {
|
||||||
|
"post": {
|
||||||
|
"security": [
|
||||||
|
{
|
||||||
|
"ApiKeyAuth": []
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"description": "容器重命名",
|
||||||
|
"consumes": [
|
||||||
|
"application/json"
|
||||||
|
],
|
||||||
|
"tags": [
|
||||||
|
"Container"
|
||||||
|
],
|
||||||
|
"summary": "Rename Container",
|
||||||
|
"parameters": [
|
||||||
|
{
|
||||||
|
"description": "request",
|
||||||
|
"name": "request",
|
||||||
|
"in": "body",
|
||||||
|
"required": true,
|
||||||
|
"schema": {
|
||||||
|
"$ref": "#/definitions/dto.ContainerRename"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"responses": {
|
||||||
|
"200": {
|
||||||
|
"description": "OK"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"x-panel-log": {
|
||||||
|
"BeforeFunctions": [],
|
||||||
|
"bodyKeys": [
|
||||||
|
"name",
|
||||||
|
"newName"
|
||||||
|
],
|
||||||
|
"formatEN": "rename container [name] =\u003e [newName]",
|
||||||
|
"formatZH": "容器重命名 [name] =\u003e [newName]",
|
||||||
|
"paramKeys": []
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
"/containers/repo": {
|
"/containers/repo": {
|
||||||
"get": {
|
"get": {
|
||||||
"security": [
|
"security": [
|
||||||
|
|
@ -13022,15 +13064,15 @@ const docTemplate = `{
|
||||||
"dto.ContainerOperation": {
|
"dto.ContainerOperation": {
|
||||||
"type": "object",
|
"type": "object",
|
||||||
"required": [
|
"required": [
|
||||||
"name",
|
"names",
|
||||||
"operation"
|
"operation"
|
||||||
],
|
],
|
||||||
"properties": {
|
"properties": {
|
||||||
"name": {
|
"names": {
|
||||||
"type": "string"
|
"type": "array",
|
||||||
},
|
"items": {
|
||||||
"newName": {
|
"type": "string"
|
||||||
"type": "string"
|
}
|
||||||
},
|
},
|
||||||
"operation": {
|
"operation": {
|
||||||
"type": "string",
|
"type": "string",
|
||||||
|
|
@ -13041,7 +13083,6 @@ const docTemplate = `{
|
||||||
"kill",
|
"kill",
|
||||||
"pause",
|
"pause",
|
||||||
"unpause",
|
"unpause",
|
||||||
"rename",
|
|
||||||
"remove"
|
"remove"
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
@ -13078,6 +13119,20 @@ const docTemplate = `{
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"dto.ContainerRename": {
|
||||||
|
"type": "object",
|
||||||
|
"required": [
|
||||||
|
"name"
|
||||||
|
],
|
||||||
|
"properties": {
|
||||||
|
"name": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"newName": {
|
||||||
|
"type": "string"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
"dto.ContainerStats": {
|
"dto.ContainerStats": {
|
||||||
"type": "object",
|
"type": "object",
|
||||||
"properties": {
|
"properties": {
|
||||||
|
|
|
||||||
|
|
@ -2307,12 +2307,11 @@
|
||||||
"x-panel-log": {
|
"x-panel-log": {
|
||||||
"BeforeFunctions": [],
|
"BeforeFunctions": [],
|
||||||
"bodyKeys": [
|
"bodyKeys": [
|
||||||
"name",
|
"names",
|
||||||
"operation",
|
"operation"
|
||||||
"newName"
|
|
||||||
],
|
],
|
||||||
"formatEN": "container [operation] [name] [newName]",
|
"formatEN": "container [operation] [names]",
|
||||||
"formatZH": "容器 [name] 执行 [operation] [newName]",
|
"formatZH": "容器 [names] 执行 [operation]",
|
||||||
"paramKeys": []
|
"paramKeys": []
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -2362,6 +2361,49 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"/containers/rename": {
|
||||||
|
"post": {
|
||||||
|
"security": [
|
||||||
|
{
|
||||||
|
"ApiKeyAuth": []
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"description": "容器重命名",
|
||||||
|
"consumes": [
|
||||||
|
"application/json"
|
||||||
|
],
|
||||||
|
"tags": [
|
||||||
|
"Container"
|
||||||
|
],
|
||||||
|
"summary": "Rename Container",
|
||||||
|
"parameters": [
|
||||||
|
{
|
||||||
|
"description": "request",
|
||||||
|
"name": "request",
|
||||||
|
"in": "body",
|
||||||
|
"required": true,
|
||||||
|
"schema": {
|
||||||
|
"$ref": "#/definitions/dto.ContainerRename"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"responses": {
|
||||||
|
"200": {
|
||||||
|
"description": "OK"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"x-panel-log": {
|
||||||
|
"BeforeFunctions": [],
|
||||||
|
"bodyKeys": [
|
||||||
|
"name",
|
||||||
|
"newName"
|
||||||
|
],
|
||||||
|
"formatEN": "rename container [name] =\u003e [newName]",
|
||||||
|
"formatZH": "容器重命名 [name] =\u003e [newName]",
|
||||||
|
"paramKeys": []
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
"/containers/repo": {
|
"/containers/repo": {
|
||||||
"get": {
|
"get": {
|
||||||
"security": [
|
"security": [
|
||||||
|
|
@ -13015,15 +13057,15 @@
|
||||||
"dto.ContainerOperation": {
|
"dto.ContainerOperation": {
|
||||||
"type": "object",
|
"type": "object",
|
||||||
"required": [
|
"required": [
|
||||||
"name",
|
"names",
|
||||||
"operation"
|
"operation"
|
||||||
],
|
],
|
||||||
"properties": {
|
"properties": {
|
||||||
"name": {
|
"names": {
|
||||||
"type": "string"
|
"type": "array",
|
||||||
},
|
"items": {
|
||||||
"newName": {
|
"type": "string"
|
||||||
"type": "string"
|
}
|
||||||
},
|
},
|
||||||
"operation": {
|
"operation": {
|
||||||
"type": "string",
|
"type": "string",
|
||||||
|
|
@ -13034,7 +13076,6 @@
|
||||||
"kill",
|
"kill",
|
||||||
"pause",
|
"pause",
|
||||||
"unpause",
|
"unpause",
|
||||||
"rename",
|
|
||||||
"remove"
|
"remove"
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
@ -13071,6 +13112,20 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"dto.ContainerRename": {
|
||||||
|
"type": "object",
|
||||||
|
"required": [
|
||||||
|
"name"
|
||||||
|
],
|
||||||
|
"properties": {
|
||||||
|
"name": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"newName": {
|
||||||
|
"type": "string"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
"dto.ContainerStats": {
|
"dto.ContainerStats": {
|
||||||
"type": "object",
|
"type": "object",
|
||||||
"properties": {
|
"properties": {
|
||||||
|
|
|
||||||
|
|
@ -431,10 +431,10 @@ definitions:
|
||||||
type: object
|
type: object
|
||||||
dto.ContainerOperation:
|
dto.ContainerOperation:
|
||||||
properties:
|
properties:
|
||||||
name:
|
names:
|
||||||
type: string
|
items:
|
||||||
newName:
|
type: string
|
||||||
type: string
|
type: array
|
||||||
operation:
|
operation:
|
||||||
enum:
|
enum:
|
||||||
- start
|
- start
|
||||||
|
|
@ -443,11 +443,10 @@ definitions:
|
||||||
- kill
|
- kill
|
||||||
- pause
|
- pause
|
||||||
- unpause
|
- unpause
|
||||||
- rename
|
|
||||||
- remove
|
- remove
|
||||||
type: string
|
type: string
|
||||||
required:
|
required:
|
||||||
- name
|
- names
|
||||||
- operation
|
- operation
|
||||||
type: object
|
type: object
|
||||||
dto.ContainerPrune:
|
dto.ContainerPrune:
|
||||||
|
|
@ -471,6 +470,15 @@ definitions:
|
||||||
spaceReclaimed:
|
spaceReclaimed:
|
||||||
type: integer
|
type: integer
|
||||||
type: object
|
type: object
|
||||||
|
dto.ContainerRename:
|
||||||
|
properties:
|
||||||
|
name:
|
||||||
|
type: string
|
||||||
|
newName:
|
||||||
|
type: string
|
||||||
|
required:
|
||||||
|
- name
|
||||||
|
type: object
|
||||||
dto.ContainerStats:
|
dto.ContainerStats:
|
||||||
properties:
|
properties:
|
||||||
cache:
|
cache:
|
||||||
|
|
@ -5704,11 +5712,10 @@ paths:
|
||||||
x-panel-log:
|
x-panel-log:
|
||||||
BeforeFunctions: []
|
BeforeFunctions: []
|
||||||
bodyKeys:
|
bodyKeys:
|
||||||
- name
|
- names
|
||||||
- operation
|
- operation
|
||||||
- newName
|
formatEN: container [operation] [names]
|
||||||
formatEN: container [operation] [name] [newName]
|
formatZH: 容器 [names] 执行 [operation]
|
||||||
formatZH: 容器 [name] 执行 [operation] [newName]
|
|
||||||
paramKeys: []
|
paramKeys: []
|
||||||
/containers/prune:
|
/containers/prune:
|
||||||
post:
|
post:
|
||||||
|
|
@ -5739,6 +5746,34 @@ paths:
|
||||||
formatEN: clean container [pruneType]
|
formatEN: clean container [pruneType]
|
||||||
formatZH: 清理容器 [pruneType]
|
formatZH: 清理容器 [pruneType]
|
||||||
paramKeys: []
|
paramKeys: []
|
||||||
|
/containers/rename:
|
||||||
|
post:
|
||||||
|
consumes:
|
||||||
|
- application/json
|
||||||
|
description: 容器重命名
|
||||||
|
parameters:
|
||||||
|
- description: request
|
||||||
|
in: body
|
||||||
|
name: request
|
||||||
|
required: true
|
||||||
|
schema:
|
||||||
|
$ref: '#/definitions/dto.ContainerRename'
|
||||||
|
responses:
|
||||||
|
"200":
|
||||||
|
description: OK
|
||||||
|
security:
|
||||||
|
- ApiKeyAuth: []
|
||||||
|
summary: Rename Container
|
||||||
|
tags:
|
||||||
|
- Container
|
||||||
|
x-panel-log:
|
||||||
|
BeforeFunctions: []
|
||||||
|
bodyKeys:
|
||||||
|
- name
|
||||||
|
- newName
|
||||||
|
formatEN: rename container [name] => [newName]
|
||||||
|
formatZH: 容器重命名 [name] => [newName]
|
||||||
|
paramKeys: []
|
||||||
/containers/repo:
|
/containers/repo:
|
||||||
get:
|
get:
|
||||||
description: 获取镜像仓库列表
|
description: 获取镜像仓库列表
|
||||||
|
|
|
||||||
|
|
@ -2,8 +2,11 @@ import { ReqPage } from '.';
|
||||||
|
|
||||||
export namespace Container {
|
export namespace Container {
|
||||||
export interface ContainerOperate {
|
export interface ContainerOperate {
|
||||||
name: string;
|
names: Array<string>;
|
||||||
operation: string;
|
operation: string;
|
||||||
|
}
|
||||||
|
export interface ContainerRename {
|
||||||
|
name: string;
|
||||||
newName: string;
|
newName: string;
|
||||||
}
|
}
|
||||||
export interface ContainerSearch extends ReqPage {
|
export interface ContainerSearch extends ReqPage {
|
||||||
|
|
|
||||||
|
|
@ -66,6 +66,10 @@ export namespace Cronjob {
|
||||||
targetDirID: number;
|
targetDirID: number;
|
||||||
retainCopies: number;
|
retainCopies: number;
|
||||||
}
|
}
|
||||||
|
export interface CronjobDelete {
|
||||||
|
ids: Array<number>;
|
||||||
|
cleanData: boolean;
|
||||||
|
}
|
||||||
export interface UpdateStatus {
|
export interface UpdateStatus {
|
||||||
id: number;
|
id: number;
|
||||||
status: string;
|
status: string;
|
||||||
|
|
|
||||||
|
|
@ -36,6 +36,9 @@ export const containerListStats = () => {
|
||||||
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}`);
|
||||||
};
|
};
|
||||||
|
export const containerRename = (params: Container.ContainerRename) => {
|
||||||
|
return http.post(`/containers/rename`, params);
|
||||||
|
};
|
||||||
export const containerOperator = (params: Container.ContainerOperate) => {
|
export const containerOperator = (params: Container.ContainerOperate) => {
|
||||||
return http.post(`/containers/operate`, params);
|
return http.post(`/containers/operate`, params);
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -19,8 +19,8 @@ export const editCronjob = (params: Cronjob.CronjobUpdate) => {
|
||||||
return http.post(`/cronjobs/update`, params);
|
return http.post(`/cronjobs/update`, params);
|
||||||
};
|
};
|
||||||
|
|
||||||
export const deleteCronjob = (ids: number[], cleanData: boolean) => {
|
export const deleteCronjob = (params: Cronjob.CronjobDelete) => {
|
||||||
return http.post(`/cronjobs/del`, { ids: ids, cleanData: cleanData });
|
return http.post(`/cronjobs/del`, params);
|
||||||
};
|
};
|
||||||
|
|
||||||
export const searchRecords = (params: Cronjob.SearchRecord) => {
|
export const searchRecords = (params: Cronjob.SearchRecord) => {
|
||||||
|
|
|
||||||
91
frontend/src/components/del-dialog/index.vue
Normal file
91
frontend/src/components/del-dialog/index.vue
Normal file
|
|
@ -0,0 +1,91 @@
|
||||||
|
<template>
|
||||||
|
<div>
|
||||||
|
<el-dialog v-model="open" :title="form.title" width="30%" :close-on-click-modal="false">
|
||||||
|
<div v-loading="loading">
|
||||||
|
<el-row type="flex" justify="center">
|
||||||
|
<el-col :span="22">
|
||||||
|
<el-alert class="mt-2" :show-icon="true" type="warning" :closable="false">
|
||||||
|
<div v-for="(item, index) in form.msgs" :key="index">
|
||||||
|
<div style="line-height: 20px; word-wrap: break-word">
|
||||||
|
<span>{{ item }}</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</el-alert>
|
||||||
|
<slot name="content"></slot>
|
||||||
|
<ul v-for="(item, index) in form.names" :key="index">
|
||||||
|
<div style="word-wrap: break-word">
|
||||||
|
<li>{{ item }}</li>
|
||||||
|
</div>
|
||||||
|
</ul>
|
||||||
|
</el-col>
|
||||||
|
</el-row>
|
||||||
|
</div>
|
||||||
|
<template #footer>
|
||||||
|
<span class="dialog-footer">
|
||||||
|
<el-button @click="open = false" :disabled="loading">
|
||||||
|
{{ $t('commons.button.cancel') }}
|
||||||
|
</el-button>
|
||||||
|
<el-button type="primary" @click="onConfirm" :disabled="loading">
|
||||||
|
{{ $t('commons.button.confirm') }}
|
||||||
|
</el-button>
|
||||||
|
</span>
|
||||||
|
</template>
|
||||||
|
</el-dialog>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script setup lang="ts">
|
||||||
|
import { onMounted, reactive, ref } from 'vue';
|
||||||
|
|
||||||
|
const form = reactive({
|
||||||
|
msgs: [],
|
||||||
|
title: '',
|
||||||
|
names: [],
|
||||||
|
api: null as Function,
|
||||||
|
params: {},
|
||||||
|
});
|
||||||
|
const loading = ref();
|
||||||
|
const open = ref();
|
||||||
|
|
||||||
|
interface DialogProps {
|
||||||
|
title: string;
|
||||||
|
msg: string;
|
||||||
|
names: Array<string>;
|
||||||
|
|
||||||
|
api: Function;
|
||||||
|
params: Object;
|
||||||
|
}
|
||||||
|
const acceptParams = (props: DialogProps): void => {
|
||||||
|
form.title = props.title;
|
||||||
|
form.names = props.names;
|
||||||
|
form.msgs = props.msg.split('\n');
|
||||||
|
form.api = props.api;
|
||||||
|
form.params = props.params;
|
||||||
|
open.value = true;
|
||||||
|
};
|
||||||
|
|
||||||
|
const emit = defineEmits(['search', 'cancel']);
|
||||||
|
|
||||||
|
const onConfirm = async () => {
|
||||||
|
if (form.api) {
|
||||||
|
loading.value = true;
|
||||||
|
await form
|
||||||
|
.api(form.params)
|
||||||
|
.then(() => {
|
||||||
|
emit('cancel');
|
||||||
|
emit('search');
|
||||||
|
open.value = false;
|
||||||
|
loading.value = false;
|
||||||
|
})
|
||||||
|
.catch(() => {
|
||||||
|
loading.value = false;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
onMounted(() => {});
|
||||||
|
|
||||||
|
defineExpose({
|
||||||
|
acceptParams,
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
|
@ -114,6 +114,7 @@ const message = {
|
||||||
operateConfirm: 'If you are sure about the operation, please input it manually',
|
operateConfirm: 'If you are sure about the operation, please input it manually',
|
||||||
inputOrSelect: 'Please select or enter',
|
inputOrSelect: 'Please select or enter',
|
||||||
copyFailed: 'Copy failed',
|
copyFailed: 'Copy failed',
|
||||||
|
operatorHelper: 'Would you like to continue performing {1} operation on {0}?',
|
||||||
notFound: 'Sorry, the page you requested does not exist.',
|
notFound: 'Sorry, the page you requested does not exist.',
|
||||||
unSupportType: 'Current file type is not supported!',
|
unSupportType: 'Current file type is not supported!',
|
||||||
unSupportSize: 'The uploaded file exceeds {0}M, please confirm!',
|
unSupportSize: 'The uploaded file exceeds {0}M, please confirm!',
|
||||||
|
|
@ -502,7 +503,7 @@ const message = {
|
||||||
containerList: 'Container list',
|
containerList: 'Container list',
|
||||||
operatorHelper: '{0} will be performed on the following container, Do you want to continue?',
|
operatorHelper: '{0} will be performed on the following container, Do you want to continue?',
|
||||||
operatorAppHelper:
|
operatorAppHelper:
|
||||||
'The {0} operation will be performed on the following containers, some of which are from the App Store. This operation may affect the normal use of the service, Do you want to continue?',
|
'The {0} operation will be performed on the following containers,\n some of which are from the App Store. This operation may affect the normal use of the service. \nDo you want to continue?',
|
||||||
start: 'Start',
|
start: 'Start',
|
||||||
stop: 'Stop',
|
stop: 'Stop',
|
||||||
restart: 'Restart',
|
restart: 'Restart',
|
||||||
|
|
@ -845,7 +846,7 @@ const message = {
|
||||||
quickCommand: 'Quick command',
|
quickCommand: 'Quick command',
|
||||||
quickCommandHelper: 'Frequently used command list for quick selection at the bottom of the terminal interface',
|
quickCommandHelper: 'Frequently used command list for quick selection at the bottom of the terminal interface',
|
||||||
groupDeleteHelper:
|
groupDeleteHelper:
|
||||||
'After the group is removed, all connections in the group will be migrated to the default group. Confirm the information',
|
'After the group is removed, all connections in the group will be migrated to the default group. Do you want to continue?',
|
||||||
command: 'Command',
|
command: 'Command',
|
||||||
quickCmd: 'Quick command',
|
quickCmd: 'Quick command',
|
||||||
addHost: 'Add Host',
|
addHost: 'Add Host',
|
||||||
|
|
|
||||||
|
|
@ -114,6 +114,7 @@ const message = {
|
||||||
operateConfirm: '如果確認操作,請手動輸入',
|
operateConfirm: '如果確認操作,請手動輸入',
|
||||||
inputOrSelect: '請選擇或輸入',
|
inputOrSelect: '請選擇或輸入',
|
||||||
copyFailed: '復製失敗',
|
copyFailed: '復製失敗',
|
||||||
|
operatorHelper: '將對以下{0}進行{1}操作,是否繼續?',
|
||||||
backupSuccess: '備份成功',
|
backupSuccess: '備份成功',
|
||||||
restoreSuccess: '備份成功',
|
restoreSuccess: '備份成功',
|
||||||
notFound: '抱歉,您訪問的頁面不存在',
|
notFound: '抱歉,您訪問的頁面不存在',
|
||||||
|
|
@ -489,7 +490,7 @@ const message = {
|
||||||
containerList: '容器列表',
|
containerList: '容器列表',
|
||||||
operatorHelper: '將對以下容器進行 {0} 操作,是否繼續?',
|
operatorHelper: '將對以下容器進行 {0} 操作,是否繼續?',
|
||||||
operatorAppHelper:
|
operatorAppHelper:
|
||||||
'將對以下容器進行 {0} 操作,其中部分來源於應用商店,該操作可能會影響到該服務的正常使用,是否確認?',
|
'將對以下容器進行 {0} 操作,\n其中部分來源於應用商店,該操作可能會影響到該服務的正常使用。\n是否確認?',
|
||||||
start: '啟動',
|
start: '啟動',
|
||||||
stop: '停止',
|
stop: '停止',
|
||||||
restart: '重啟',
|
restart: '重啟',
|
||||||
|
|
@ -809,7 +810,7 @@ const message = {
|
||||||
batchInput: '批量輸入',
|
batchInput: '批量輸入',
|
||||||
quickCommand: '快速命令',
|
quickCommand: '快速命令',
|
||||||
quickCommandHelper: '常用命令列表,用於在終端界面底部快速選擇',
|
quickCommandHelper: '常用命令列表,用於在終端界面底部快速選擇',
|
||||||
groupDeleteHelper: '移除組後,組內所有連接將遷移到 default 組內,是否確認',
|
groupDeleteHelper: '移除組後,組內所有連接將遷移到 default 組內,是否繼續?',
|
||||||
command: '命令',
|
command: '命令',
|
||||||
addHost: '添加主機',
|
addHost: '添加主機',
|
||||||
localhost: '本地服務器',
|
localhost: '本地服務器',
|
||||||
|
|
|
||||||
|
|
@ -114,6 +114,7 @@ const message = {
|
||||||
operateConfirm: '如果确认操作,请手动输入',
|
operateConfirm: '如果确认操作,请手动输入',
|
||||||
inputOrSelect: '请选择或输入',
|
inputOrSelect: '请选择或输入',
|
||||||
copyFailed: '复制失败',
|
copyFailed: '复制失败',
|
||||||
|
operatorHelper: '将对以下{0}进行 {1} 操作,是否继续?',
|
||||||
backupSuccess: '备份成功',
|
backupSuccess: '备份成功',
|
||||||
restoreSuccess: '备份成功',
|
restoreSuccess: '备份成功',
|
||||||
notFound: '抱歉,您访问的页面不存在',
|
notFound: '抱歉,您访问的页面不存在',
|
||||||
|
|
@ -489,7 +490,7 @@ const message = {
|
||||||
containerList: '容器列表',
|
containerList: '容器列表',
|
||||||
operatorHelper: '将对以下容器进行 {0} 操作,是否继续?',
|
operatorHelper: '将对以下容器进行 {0} 操作,是否继续?',
|
||||||
operatorAppHelper:
|
operatorAppHelper:
|
||||||
'将对以下容器进行 {0} 操作,其中部分来源于应用商店,该操作可能会影响到该服务的正常使用,是否确认?',
|
'将对以下容器进行 {0} 操作,\n其中部分来源于应用商店,该操作可能会影响到该服务的正常使用。\n是否继续?',
|
||||||
dead: '',
|
dead: '',
|
||||||
start: '启动',
|
start: '启动',
|
||||||
stop: '停止',
|
stop: '停止',
|
||||||
|
|
@ -810,7 +811,7 @@ const message = {
|
||||||
batchInput: '批量输入',
|
batchInput: '批量输入',
|
||||||
quickCommand: '快速命令',
|
quickCommand: '快速命令',
|
||||||
quickCommandHelper: '常用命令列表,用于在终端界面底部快速选择',
|
quickCommandHelper: '常用命令列表,用于在终端界面底部快速选择',
|
||||||
groupDeleteHelper: '移除组后,组内所有连接将迁移到 default 组内,是否确认',
|
groupDeleteHelper: '移除组后,组内所有连接将迁移到 default 组内,是否继续?',
|
||||||
command: '命令',
|
command: '命令',
|
||||||
addHost: '添加主机',
|
addHost: '添加主机',
|
||||||
localhost: '本地服务器',
|
localhost: '本地服务器',
|
||||||
|
|
|
||||||
|
|
@ -102,11 +102,11 @@
|
||||||
</ComplexTable>
|
</ComplexTable>
|
||||||
|
|
||||||
<CodemirrorDialog ref="mydetail" />
|
<CodemirrorDialog ref="mydetail" />
|
||||||
|
<OpDialog ref="opRef" @search="search" />
|
||||||
|
|
||||||
<ContainerLogDialog ref="dialogContainerLogRef" />
|
<ContainerLogDialog ref="dialogContainerLogRef" />
|
||||||
<MonitorDialog ref="dialogMonitorRef" />
|
<MonitorDialog ref="dialogMonitorRef" />
|
||||||
<TerminalDialog ref="dialogTerminalRef" />
|
<TerminalDialog ref="dialogTerminalRef" />
|
||||||
<HandleDialog @search="search" ref="handleRef" />
|
|
||||||
</template>
|
</template>
|
||||||
</LayoutContent>
|
</LayoutContent>
|
||||||
</div>
|
</div>
|
||||||
|
|
@ -115,14 +115,14 @@
|
||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
import { reactive, ref } from 'vue';
|
import { reactive, ref } from 'vue';
|
||||||
import Tooltip from '@/components/tooltip/index.vue';
|
import Tooltip from '@/components/tooltip/index.vue';
|
||||||
|
import OpDialog from '@/components/del-dialog/index.vue';
|
||||||
import MonitorDialog from '@/views/container/container/monitor/index.vue';
|
import MonitorDialog from '@/views/container/container/monitor/index.vue';
|
||||||
import ContainerLogDialog from '@/views/container/container/log/index.vue';
|
import ContainerLogDialog from '@/views/container/container/log/index.vue';
|
||||||
import TerminalDialog from '@/views/container/container/terminal/index.vue';
|
import TerminalDialog from '@/views/container/container/terminal/index.vue';
|
||||||
import HandleDialog from '@/views/container/container/handle/index.vue';
|
|
||||||
import CodemirrorDialog from '@/components/codemirror-dialog/index.vue';
|
import CodemirrorDialog from '@/components/codemirror-dialog/index.vue';
|
||||||
import Status from '@/components/status/index.vue';
|
import Status from '@/components/status/index.vue';
|
||||||
import { dateFormat } from '@/utils/util';
|
import { dateFormat } from '@/utils/util';
|
||||||
import { composeOperator, inspect, searchContainer } from '@/api/modules/container';
|
import { composeOperator, containerOperator, inspect, searchContainer } from '@/api/modules/container';
|
||||||
import { ElMessageBox } from 'element-plus';
|
import { ElMessageBox } from 'element-plus';
|
||||||
import i18n from '@/lang';
|
import i18n from '@/lang';
|
||||||
import { Container } from '@/api/interface/container';
|
import { Container } from '@/api/interface/container';
|
||||||
|
|
@ -134,7 +134,8 @@ const filters = ref();
|
||||||
const createdBy = ref();
|
const createdBy = ref();
|
||||||
|
|
||||||
const dialogContainerLogRef = ref();
|
const dialogContainerLogRef = ref();
|
||||||
const handleRef = ref();
|
|
||||||
|
const opRef = ref();
|
||||||
|
|
||||||
const emit = defineEmits<{ (e: 'back'): void }>();
|
const emit = defineEmits<{ (e: 'back'): void }>();
|
||||||
interface DialogProps {
|
interface DialogProps {
|
||||||
|
|
@ -233,16 +234,22 @@ const checkStatus = (operation: string) => {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
const onOperate = async (operation: string) => {
|
const onOperate = async (op: string) => {
|
||||||
let msg = i18n.global.t('container.operatorHelper', [i18n.global.t('container.' + operation)]);
|
let msg = i18n.global.t('container.operatorHelper', [i18n.global.t('container.' + op)]);
|
||||||
let containers = [];
|
let names = [];
|
||||||
for (const item of selects.value) {
|
for (const item of selects.value) {
|
||||||
containers.push(item.name);
|
names.push(item.name);
|
||||||
if (item.isFromApp) {
|
if (item.isFromApp) {
|
||||||
msg = i18n.global.t('container.operatorAppHelper', [i18n.global.t('container.' + operation)]);
|
msg = i18n.global.t('container.operatorAppHelper', [i18n.global.t('container.' + op)]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
handleRef.value.acceptParams({ containers: containers, operation: operation, msg: msg });
|
opRef.value.acceptParams({
|
||||||
|
title: i18n.global.t('container.' + op),
|
||||||
|
names: names,
|
||||||
|
msg: msg,
|
||||||
|
api: containerOperator,
|
||||||
|
params: { names: names, operation: op },
|
||||||
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
const onComposeOperate = async (operation: string) => {
|
const onComposeOperate = async (operation: string) => {
|
||||||
|
|
|
||||||
|
|
@ -1,87 +0,0 @@
|
||||||
<template>
|
|
||||||
<el-dialog v-model="open" :title="$t('container.' + operation)" width="30%" :close-on-click-modal="false">
|
|
||||||
<el-row>
|
|
||||||
<el-col :span="20" :offset="2">
|
|
||||||
<el-alert :title="msg" show-icon type="error" :closable="false"></el-alert>
|
|
||||||
<div class="resource">
|
|
||||||
<table>
|
|
||||||
<tr v-for="(row, index) in containers" :key="index">
|
|
||||||
<td>
|
|
||||||
<span>{{ row }}</span>
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
</table>
|
|
||||||
</div>
|
|
||||||
</el-col>
|
|
||||||
</el-row>
|
|
||||||
|
|
||||||
<template #footer>
|
|
||||||
<span class="dialog-footer">
|
|
||||||
<el-button @click="open = false" :disabled="loading">
|
|
||||||
{{ $t('commons.button.cancel') }}
|
|
||||||
</el-button>
|
|
||||||
<el-button type="primary" @click="onConfirm" v-loading="loading">
|
|
||||||
{{ $t('commons.button.confirm') }}
|
|
||||||
</el-button>
|
|
||||||
</span>
|
|
||||||
</template>
|
|
||||||
</el-dialog>
|
|
||||||
</template>
|
|
||||||
<script lang="ts" setup>
|
|
||||||
import i18n from '@/lang';
|
|
||||||
import { ref } from 'vue';
|
|
||||||
import { containerOperator } from '@/api/modules/container';
|
|
||||||
import { MsgSuccess } from '@/utils/message';
|
|
||||||
|
|
||||||
const open = ref(false);
|
|
||||||
const containers = ref();
|
|
||||||
const msg = ref();
|
|
||||||
const operation = ref();
|
|
||||||
const loading = ref(false);
|
|
||||||
const em = defineEmits(['search']);
|
|
||||||
|
|
||||||
interface DialogProps {
|
|
||||||
containers: Array<string>;
|
|
||||||
operation: string;
|
|
||||||
msg: string;
|
|
||||||
}
|
|
||||||
|
|
||||||
const acceptParams = (props: DialogProps) => {
|
|
||||||
containers.value = props.containers;
|
|
||||||
operation.value = props.operation;
|
|
||||||
msg.value = props.msg;
|
|
||||||
open.value = true;
|
|
||||||
};
|
|
||||||
|
|
||||||
const onConfirm = () => {
|
|
||||||
const pros = [];
|
|
||||||
for (const item of containers.value) {
|
|
||||||
pros.push(containerOperator({ name: item, operation: operation.value, newName: '' }));
|
|
||||||
}
|
|
||||||
loading.value = true;
|
|
||||||
Promise.all(pros)
|
|
||||||
.then(() => {
|
|
||||||
open.value = false;
|
|
||||||
loading.value = false;
|
|
||||||
em('search');
|
|
||||||
MsgSuccess(i18n.global.t('commons.msg.operationSuccess'));
|
|
||||||
})
|
|
||||||
.finally(() => {
|
|
||||||
open.value = false;
|
|
||||||
loading.value = false;
|
|
||||||
em('search');
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
defineExpose({
|
|
||||||
acceptParams,
|
|
||||||
});
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<style scoped>
|
|
||||||
.resource {
|
|
||||||
margin-top: 10px;
|
|
||||||
max-height: 400px;
|
|
||||||
overflow: auto;
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
|
|
@ -15,7 +15,7 @@
|
||||||
<el-button type="primary" plain @click="onClean()">
|
<el-button type="primary" plain @click="onClean()">
|
||||||
{{ $t('container.containerPrune') }}
|
{{ $t('container.containerPrune') }}
|
||||||
</el-button>
|
</el-button>
|
||||||
<el-button-group style="margin-left: 10px">
|
<el-button-group class="ml-4">
|
||||||
<el-button :disabled="checkStatus('start', null)" @click="onOperate('start', null)">
|
<el-button :disabled="checkStatus('start', null)" @click="onOperate('start', null)">
|
||||||
{{ $t('container.start') }}
|
{{ $t('container.start') }}
|
||||||
</el-button>
|
</el-button>
|
||||||
|
|
@ -241,10 +241,12 @@
|
||||||
</template>
|
</template>
|
||||||
</LayoutContent>
|
</LayoutContent>
|
||||||
|
|
||||||
<CodemirrorDialog ref="mydetail" />
|
<OpDialog ref="opRef" @search="search" />
|
||||||
|
|
||||||
|
<CodemirrorDialog ref="myDetail" />
|
||||||
<PruneDialog @search="search" ref="dialogPruneRef" />
|
<PruneDialog @search="search" ref="dialogPruneRef" />
|
||||||
|
|
||||||
<ReNameDialog @search="search" ref="dialogReNameRef" />
|
<RenameDialog @search="search" ref="dialogRenameRef" />
|
||||||
<ContainerLogDialog ref="dialogContainerLogRef" />
|
<ContainerLogDialog ref="dialogContainerLogRef" />
|
||||||
<OperateDialog @search="search" ref="dialogOperateRef" />
|
<OperateDialog @search="search" ref="dialogOperateRef" />
|
||||||
<UpgradeDialog @search="search" ref="dialogUpgradeRef" />
|
<UpgradeDialog @search="search" ref="dialogUpgradeRef" />
|
||||||
|
|
@ -252,27 +254,27 @@
|
||||||
<TerminalDialog ref="dialogTerminalRef" />
|
<TerminalDialog ref="dialogTerminalRef" />
|
||||||
|
|
||||||
<PortJumpDialog ref="dialogPortJumpRef" />
|
<PortJumpDialog ref="dialogPortJumpRef" />
|
||||||
<HandleDialog @search="search" ref="handleRef" />
|
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
|
import OpDialog from '@/components/del-dialog/index.vue';
|
||||||
import Tooltip from '@/components/tooltip/index.vue';
|
import Tooltip from '@/components/tooltip/index.vue';
|
||||||
import TableSetting from '@/components/table-setting/index.vue';
|
import TableSetting from '@/components/table-setting/index.vue';
|
||||||
import PruneDialog from '@/views/container/container/prune/index.vue';
|
import PruneDialog from '@/views/container/container/prune/index.vue';
|
||||||
import ReNameDialog from '@/views/container/container/rename/index.vue';
|
import RenameDialog from '@/views/container/container/rename/index.vue';
|
||||||
import OperateDialog from '@/views/container/container/operate/index.vue';
|
import OperateDialog from '@/views/container/container/operate/index.vue';
|
||||||
import UpgradeDialog from '@/views/container/container/upgrade/index.vue';
|
import UpgradeDialog from '@/views/container/container/upgrade/index.vue';
|
||||||
import MonitorDialog from '@/views/container/container/monitor/index.vue';
|
import MonitorDialog from '@/views/container/container/monitor/index.vue';
|
||||||
import ContainerLogDialog from '@/views/container/container/log/index.vue';
|
import ContainerLogDialog from '@/views/container/container/log/index.vue';
|
||||||
import TerminalDialog from '@/views/container/container/terminal/index.vue';
|
import TerminalDialog from '@/views/container/container/terminal/index.vue';
|
||||||
import HandleDialog from '@/views/container/container/handle/index.vue';
|
|
||||||
import CodemirrorDialog from '@/components/codemirror-dialog/index.vue';
|
import CodemirrorDialog from '@/components/codemirror-dialog/index.vue';
|
||||||
import PortJumpDialog from '@/components/port-jump/index.vue';
|
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, computed } from 'vue';
|
import { reactive, onMounted, ref, computed } from 'vue';
|
||||||
import {
|
import {
|
||||||
containerListStats,
|
containerListStats,
|
||||||
|
containerOperator,
|
||||||
inspect,
|
inspect,
|
||||||
loadContainerInfo,
|
loadContainerInfo,
|
||||||
loadDockerStatus,
|
loadDockerStatus,
|
||||||
|
|
@ -289,7 +291,7 @@ const mobile = computed(() => {
|
||||||
return globalStore.isMobile();
|
return globalStore.isMobile();
|
||||||
});
|
});
|
||||||
|
|
||||||
const loading = ref();
|
const loading = ref(false);
|
||||||
const data = ref();
|
const data = ref();
|
||||||
const selects = ref<any>([]);
|
const selects = ref<any>([]);
|
||||||
const paginationConfig = reactive({
|
const paginationConfig = reactive({
|
||||||
|
|
@ -304,7 +306,7 @@ const searchName = ref();
|
||||||
const searchState = ref('all');
|
const searchState = ref('all');
|
||||||
const dialogUpgradeRef = ref();
|
const dialogUpgradeRef = ref();
|
||||||
const dialogPortJumpRef = ref();
|
const dialogPortJumpRef = ref();
|
||||||
const handleRef = ref();
|
const opRef = ref();
|
||||||
|
|
||||||
const dockerStatus = ref('Running');
|
const dockerStatus = ref('Running');
|
||||||
const loadStatus = async () => {
|
const loadStatus = async () => {
|
||||||
|
|
@ -347,10 +349,10 @@ const props = withDefaults(defineProps<Filters>(), {
|
||||||
filters: '',
|
filters: '',
|
||||||
});
|
});
|
||||||
|
|
||||||
const mydetail = ref();
|
const myDetail = ref();
|
||||||
|
|
||||||
const dialogContainerLogRef = ref();
|
const dialogContainerLogRef = ref();
|
||||||
const dialogReNameRef = ref();
|
const dialogRenameRef = ref();
|
||||||
const dialogPruneRef = ref();
|
const dialogPruneRef = ref();
|
||||||
|
|
||||||
const search = async (column?: any) => {
|
const search = async (column?: any) => {
|
||||||
|
|
@ -511,7 +513,7 @@ const onInspect = async (id: string) => {
|
||||||
header: i18n.global.t('commons.button.view'),
|
header: i18n.global.t('commons.button.view'),
|
||||||
detailInfo: detailInfo,
|
detailInfo: detailInfo,
|
||||||
};
|
};
|
||||||
mydetail.value!.acceptParams(param);
|
myDetail.value!.acceptParams(param);
|
||||||
};
|
};
|
||||||
|
|
||||||
const onClean = () => {
|
const onClean = () => {
|
||||||
|
|
@ -554,17 +556,24 @@ const checkStatus = (operation: string, row: Container.ContainerInfo | null) =>
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
const onOperate = async (operation: string, row: Container.ContainerInfo | null) => {
|
|
||||||
|
const onOperate = async (op: string, row: Container.ContainerInfo | null) => {
|
||||||
let opList = row ? [row] : selects.value;
|
let opList = row ? [row] : selects.value;
|
||||||
let msg = i18n.global.t('container.operatorHelper', [i18n.global.t('container.' + operation)]);
|
let msg = i18n.global.t('container.operatorHelper', [i18n.global.t('container.' + op)]);
|
||||||
let containers = [];
|
let names = [];
|
||||||
for (const item of opList) {
|
for (const item of opList) {
|
||||||
containers.push(item.name);
|
names.push(item.name);
|
||||||
if (item.isFromApp) {
|
if (item.isFromApp) {
|
||||||
msg = i18n.global.t('container.operatorAppHelper', [i18n.global.t('container.' + operation)]);
|
msg = i18n.global.t('container.operatorAppHelper', [i18n.global.t('container.' + op)]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
handleRef.value.acceptParams({ containers: containers, operation: operation, msg: msg });
|
opRef.value.acceptParams({
|
||||||
|
title: i18n.global.t('container.' + op),
|
||||||
|
names: names,
|
||||||
|
msg: msg,
|
||||||
|
api: containerOperator,
|
||||||
|
params: { names: names, operation: op },
|
||||||
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
const buttons = [
|
const buttons = [
|
||||||
|
|
@ -607,7 +616,7 @@ const buttons = [
|
||||||
{
|
{
|
||||||
label: i18n.global.t('container.rename'),
|
label: i18n.global.t('container.rename'),
|
||||||
click: (row: Container.ContainerInfo) => {
|
click: (row: Container.ContainerInfo) => {
|
||||||
dialogReNameRef.value!.acceptParams({ container: row.name });
|
dialogRenameRef.value!.acceptParams({ container: row.name });
|
||||||
},
|
},
|
||||||
disabled: (row: any) => {
|
disabled: (row: any) => {
|
||||||
return row.isFromCompose;
|
return row.isFromCompose;
|
||||||
|
|
|
||||||
|
|
@ -26,7 +26,7 @@
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
import { containerOperator } from '@/api/modules/container';
|
import { containerRename } from '@/api/modules/container';
|
||||||
import { Rules } from '@/global/form-rules';
|
import { Rules } from '@/global/form-rules';
|
||||||
import i18n from '@/lang';
|
import i18n from '@/lang';
|
||||||
import { MsgSuccess } from '@/utils/message';
|
import { MsgSuccess } from '@/utils/message';
|
||||||
|
|
@ -38,7 +38,6 @@ const loading = ref(false);
|
||||||
|
|
||||||
const renameForm = reactive({
|
const renameForm = reactive({
|
||||||
name: '',
|
name: '',
|
||||||
operation: 'rename',
|
|
||||||
newName: '',
|
newName: '',
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
@ -54,7 +53,7 @@ const onSubmitName = async (formEl: FormInstance | undefined) => {
|
||||||
formEl.validate(async (valid) => {
|
formEl.validate(async (valid) => {
|
||||||
if (!valid) return;
|
if (!valid) return;
|
||||||
loading.value = true;
|
loading.value = true;
|
||||||
await containerOperator(renameForm)
|
await containerRename(renameForm)
|
||||||
.then(() => {
|
.then(() => {
|
||||||
loading.value = false;
|
loading.value = false;
|
||||||
emit('search');
|
emit('search');
|
||||||
|
|
|
||||||
|
|
@ -1,43 +1,48 @@
|
||||||
<template>
|
<template>
|
||||||
<el-drawer v-model="deleteVisible" :destroy-on-close="true" :close-on-click-modal="false" size="30%">
|
<div>
|
||||||
<template #header>
|
<el-drawer v-model="deleteVisible" :destroy-on-close="true" :close-on-click-modal="false" size="30%">
|
||||||
<DrawerHeader :header="$t('container.imageDelete')" :back="handleClose" />
|
<template #header>
|
||||||
</template>
|
<DrawerHeader :header="$t('container.imageDelete')" :back="handleClose" />
|
||||||
<el-form @submit.prevent :model="deleteForm" label-position="top">
|
</template>
|
||||||
<el-row type="flex" justify="center">
|
<el-form @submit.prevent :model="deleteForm" label-position="top">
|
||||||
<el-col :span="22">
|
<el-row type="flex" justify="center">
|
||||||
<el-form-item :label="$t('container.tag')" prop="tagName">
|
<el-col :span="22">
|
||||||
<el-checkbox-group v-model="deleteForm.deleteTags">
|
<el-form-item :label="$t('container.tag')" prop="tagName">
|
||||||
<div>
|
<el-checkbox-group v-model="deleteForm.deleteTags">
|
||||||
<el-checkbox
|
<div>
|
||||||
style="width: 100%"
|
<el-checkbox
|
||||||
v-for="item in deleteForm.tags"
|
style="width: 100%"
|
||||||
:key="item"
|
v-for="item in deleteForm.tags"
|
||||||
:value="item"
|
:key="item"
|
||||||
:label="item"
|
:value="item"
|
||||||
/>
|
:label="item"
|
||||||
</div>
|
/>
|
||||||
</el-checkbox-group>
|
</div>
|
||||||
</el-form-item>
|
</el-checkbox-group>
|
||||||
</el-col>
|
</el-form-item>
|
||||||
</el-row>
|
</el-col>
|
||||||
</el-form>
|
</el-row>
|
||||||
<template #footer>
|
</el-form>
|
||||||
<span class="dialog-footer">
|
<template #footer>
|
||||||
<el-button @click="deleteVisible = false">{{ $t('commons.button.cancel') }}</el-button>
|
<span class="dialog-footer">
|
||||||
<el-button type="primary" :disabled="deleteForm.deleteTags.length === 0" @click="batchDelete()">
|
<el-button @click="deleteVisible = false">{{ $t('commons.button.cancel') }}</el-button>
|
||||||
{{ $t('commons.button.delete') }}
|
<el-button type="primary" :disabled="deleteForm.deleteTags.length === 0" @click="batchDelete()">
|
||||||
</el-button>
|
{{ $t('commons.button.delete') }}
|
||||||
</span>
|
</el-button>
|
||||||
</template>
|
</span>
|
||||||
</el-drawer>
|
</template>
|
||||||
|
</el-drawer>
|
||||||
|
|
||||||
|
<OpDialog ref="opRef" @search="onSearch" @cancel="handleClose" />
|
||||||
|
</div>
|
||||||
</template>
|
</template>
|
||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
import { reactive, ref } from 'vue';
|
import { reactive, ref } from 'vue';
|
||||||
import { ElForm } from 'element-plus';
|
import { ElForm } from 'element-plus';
|
||||||
|
import OpDialog from '@/components/del-dialog/index.vue';
|
||||||
import { imageRemove } from '@/api/modules/container';
|
import { imageRemove } from '@/api/modules/container';
|
||||||
import { useDeleteData } from '@/hooks/use-delete-data';
|
|
||||||
import DrawerHeader from '@/components/drawer-header/index.vue';
|
import DrawerHeader from '@/components/drawer-header/index.vue';
|
||||||
|
import i18n from '@/lang';
|
||||||
|
|
||||||
const deleteVisible = ref(false);
|
const deleteVisible = ref(false);
|
||||||
const deleteForm = reactive({
|
const deleteForm = reactive({
|
||||||
|
|
@ -45,6 +50,8 @@ const deleteForm = reactive({
|
||||||
deleteTags: [] as Array<string>,
|
deleteTags: [] as Array<string>,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
const opRef = ref();
|
||||||
|
|
||||||
interface DialogProps {
|
interface DialogProps {
|
||||||
tags: Array<string>;
|
tags: Array<string>;
|
||||||
}
|
}
|
||||||
|
|
@ -58,14 +65,25 @@ const handleClose = () => {
|
||||||
};
|
};
|
||||||
const emit = defineEmits<{ (e: 'search'): void }>();
|
const emit = defineEmits<{ (e: 'search'): void }>();
|
||||||
|
|
||||||
|
const onSearch = () => {
|
||||||
|
emit('search');
|
||||||
|
};
|
||||||
|
|
||||||
const batchDelete = async () => {
|
const batchDelete = async () => {
|
||||||
let names: Array<string> = [];
|
let names = [];
|
||||||
for (const item of deleteForm.deleteTags) {
|
for (const item of deleteForm.deleteTags) {
|
||||||
names.push(item);
|
names.push(item);
|
||||||
}
|
}
|
||||||
await useDeleteData(imageRemove, { names: names }, 'commons.msg.delete');
|
opRef.value.acceptParams({
|
||||||
deleteVisible.value = false;
|
title: i18n.global.t('commons.button.delete'),
|
||||||
emit('search');
|
names: names,
|
||||||
|
msg: i18n.global.t('commons.msg.operatorHelper', [
|
||||||
|
i18n.global.t('container.image'),
|
||||||
|
i18n.global.t('commons.button.delete'),
|
||||||
|
]),
|
||||||
|
api: imageRemove,
|
||||||
|
params: { names: names },
|
||||||
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
defineExpose({
|
defineExpose({
|
||||||
|
|
|
||||||
|
|
@ -95,6 +95,8 @@
|
||||||
</LayoutContent>
|
</LayoutContent>
|
||||||
|
|
||||||
<CodemirrorDialog ref="mydetail" />
|
<CodemirrorDialog ref="mydetail" />
|
||||||
|
|
||||||
|
<OpDialog ref="opRef" @search="search" />
|
||||||
<Pull ref="dialogPullRef" @search="search" />
|
<Pull ref="dialogPullRef" @search="search" />
|
||||||
<Tag ref="dialogTagRef" @search="search" />
|
<Tag ref="dialogTagRef" @search="search" />
|
||||||
<Push ref="dialogPushRef" @search="search" />
|
<Push ref="dialogPushRef" @search="search" />
|
||||||
|
|
@ -107,6 +109,7 @@
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
|
import OpDialog from '@/components/del-dialog/index.vue';
|
||||||
import TableSetting from '@/components/table-setting/index.vue';
|
import TableSetting from '@/components/table-setting/index.vue';
|
||||||
import Tooltip from '@/components/tooltip/index.vue';
|
import Tooltip from '@/components/tooltip/index.vue';
|
||||||
import { reactive, onMounted, ref, computed } from 'vue';
|
import { reactive, onMounted, ref, computed } from 'vue';
|
||||||
|
|
@ -124,7 +127,6 @@ import CodemirrorDialog from '@/components/codemirror-dialog/index.vue';
|
||||||
import { searchImage, listImageRepo, loadDockerStatus, imageRemove, inspect } from '@/api/modules/container';
|
import { searchImage, listImageRepo, loadDockerStatus, imageRemove, inspect } from '@/api/modules/container';
|
||||||
import i18n from '@/lang';
|
import i18n from '@/lang';
|
||||||
import router from '@/routers';
|
import router from '@/routers';
|
||||||
import { useDeleteData } from '@/hooks/use-delete-data';
|
|
||||||
import { GlobalStore } from '@/store';
|
import { GlobalStore } from '@/store';
|
||||||
const globalStore = GlobalStore();
|
const globalStore = GlobalStore();
|
||||||
|
|
||||||
|
|
@ -134,6 +136,8 @@ const mobile = computed(() => {
|
||||||
|
|
||||||
const loading = ref(false);
|
const loading = ref(false);
|
||||||
|
|
||||||
|
const opRef = ref();
|
||||||
|
|
||||||
const data = ref();
|
const data = ref();
|
||||||
const repos = ref();
|
const repos = ref();
|
||||||
const paginationConfig = reactive({
|
const paginationConfig = reactive({
|
||||||
|
|
@ -191,6 +195,20 @@ const loadRepos = async () => {
|
||||||
repos.value = res.data || [];
|
repos.value = res.data || [];
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const onDelete = (row: Container.ImageInfo) => {
|
||||||
|
let names = row.tags;
|
||||||
|
opRef.value.acceptParams({
|
||||||
|
title: i18n.global.t('commons.button.delete'),
|
||||||
|
names: names,
|
||||||
|
msg: i18n.global.t('commons.msg.operatorHelper', [
|
||||||
|
i18n.global.t('container.image'),
|
||||||
|
i18n.global.t('commons.button.delete'),
|
||||||
|
]),
|
||||||
|
api: imageRemove,
|
||||||
|
params: { names: names },
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
const onInspect = async (id: string) => {
|
const onInspect = async (id: string) => {
|
||||||
const res = await inspect({ id: id, type: 'image' });
|
const res = await inspect({ id: id, type: 'image' });
|
||||||
let detailInfo = JSON.stringify(JSON.parse(res.data), null, 2);
|
let detailInfo = JSON.stringify(JSON.parse(res.data), null, 2);
|
||||||
|
|
@ -256,8 +274,7 @@ const buttons = [
|
||||||
label: i18n.global.t('commons.button.delete'),
|
label: i18n.global.t('commons.button.delete'),
|
||||||
click: async (row: Container.ImageInfo) => {
|
click: async (row: Container.ImageInfo) => {
|
||||||
if (!row.tags?.length || row.tags.length <= 1) {
|
if (!row.tags?.length || row.tags.length <= 1) {
|
||||||
await useDeleteData(imageRemove, { names: [row.id] }, 'commons.msg.delete');
|
onDelete(row);
|
||||||
search();
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
let params = {
|
let params = {
|
||||||
|
|
|
||||||
|
|
@ -90,6 +90,7 @@
|
||||||
</template>
|
</template>
|
||||||
</LayoutContent>
|
</LayoutContent>
|
||||||
|
|
||||||
|
<OpDialog ref="opRef" @search="search" />
|
||||||
<CodemirrorDialog ref="codemirror" />
|
<CodemirrorDialog ref="codemirror" />
|
||||||
<CreateDialog @search="search" ref="dialogCreateRef" />
|
<CreateDialog @search="search" ref="dialogCreateRef" />
|
||||||
</div>
|
</div>
|
||||||
|
|
@ -97,6 +98,7 @@
|
||||||
|
|
||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
import Tooltip from '@/components/tooltip/index.vue';
|
import Tooltip from '@/components/tooltip/index.vue';
|
||||||
|
import OpDialog from '@/components/del-dialog/index.vue';
|
||||||
import TableSetting from '@/components/table-setting/index.vue';
|
import TableSetting from '@/components/table-setting/index.vue';
|
||||||
import CreateDialog from '@/views/container/network/create/index.vue';
|
import CreateDialog from '@/views/container/network/create/index.vue';
|
||||||
import CodemirrorDialog from '@/components/codemirror-dialog/index.vue';
|
import CodemirrorDialog from '@/components/codemirror-dialog/index.vue';
|
||||||
|
|
@ -105,7 +107,6 @@ import { dateFormat } from '@/utils/util';
|
||||||
import { deleteNetwork, searchNetwork, inspect, loadDockerStatus, containerPrune } from '@/api/modules/container';
|
import { deleteNetwork, searchNetwork, inspect, loadDockerStatus, containerPrune } from '@/api/modules/container';
|
||||||
import { Container } from '@/api/interface/container';
|
import { Container } from '@/api/interface/container';
|
||||||
import i18n from '@/lang';
|
import i18n from '@/lang';
|
||||||
import { useDeleteData } from '@/hooks/use-delete-data';
|
|
||||||
import router from '@/routers';
|
import router from '@/routers';
|
||||||
import { ElMessageBox } from 'element-plus';
|
import { ElMessageBox } from 'element-plus';
|
||||||
import { MsgSuccess } from '@/utils/message';
|
import { MsgSuccess } from '@/utils/message';
|
||||||
|
|
@ -123,6 +124,8 @@ const paginationConfig = reactive({
|
||||||
});
|
});
|
||||||
const searchName = ref();
|
const searchName = ref();
|
||||||
|
|
||||||
|
const opRef = ref();
|
||||||
|
|
||||||
const dockerStatus = ref('Running');
|
const dockerStatus = ref('Running');
|
||||||
const loadStatus = async () => {
|
const loadStatus = async () => {
|
||||||
loading.value = true;
|
loading.value = true;
|
||||||
|
|
@ -209,8 +212,16 @@ const batchDelete = async (row: Container.NetworkInfo | null) => {
|
||||||
} else {
|
} else {
|
||||||
names.push(row.name);
|
names.push(row.name);
|
||||||
}
|
}
|
||||||
await useDeleteData(deleteNetwork, { names: names }, 'commons.msg.delete');
|
opRef.value.acceptParams({
|
||||||
search();
|
title: i18n.global.t('commons.button.delete'),
|
||||||
|
names: names,
|
||||||
|
msg: i18n.global.t('commons.msg.operatorHelper', [
|
||||||
|
i18n.global.t('container.network'),
|
||||||
|
i18n.global.t('commons.button.delete'),
|
||||||
|
]),
|
||||||
|
api: deleteNetwork,
|
||||||
|
params: { names: names },
|
||||||
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
const onInspect = async (id: string) => {
|
const onInspect = async (id: string) => {
|
||||||
|
|
|
||||||
|
|
@ -70,11 +70,14 @@
|
||||||
</ComplexTable>
|
</ComplexTable>
|
||||||
</template>
|
</template>
|
||||||
</LayoutContent>
|
</LayoutContent>
|
||||||
|
|
||||||
|
<OpDialog ref="opRef" @search="search" />
|
||||||
<OperatorDialog @search="search" ref="dialogRef" />
|
<OperatorDialog @search="search" ref="dialogRef" />
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
|
import OpDialog from '@/components/del-dialog/index.vue';
|
||||||
import TableSetting from '@/components/table-setting/index.vue';
|
import TableSetting from '@/components/table-setting/index.vue';
|
||||||
import OperatorDialog from '@/views/container/repo/operator/index.vue';
|
import OperatorDialog from '@/views/container/repo/operator/index.vue';
|
||||||
import { reactive, onMounted, ref } from 'vue';
|
import { reactive, onMounted, ref } from 'vue';
|
||||||
|
|
@ -83,7 +86,6 @@ import { Container } from '@/api/interface/container';
|
||||||
import { checkRepoStatus, deleteImageRepo, loadDockerStatus, searchImageRepo } from '@/api/modules/container';
|
import { checkRepoStatus, deleteImageRepo, loadDockerStatus, searchImageRepo } from '@/api/modules/container';
|
||||||
import i18n from '@/lang';
|
import i18n from '@/lang';
|
||||||
import router from '@/routers';
|
import router from '@/routers';
|
||||||
import { ElMessageBox } from 'element-plus';
|
|
||||||
|
|
||||||
const loading = ref();
|
const loading = ref();
|
||||||
const data = ref();
|
const data = ref();
|
||||||
|
|
@ -96,6 +98,8 @@ const paginationConfig = reactive({
|
||||||
});
|
});
|
||||||
const searchName = ref();
|
const searchName = ref();
|
||||||
|
|
||||||
|
const opRef = ref();
|
||||||
|
|
||||||
const dockerStatus = ref('Running');
|
const dockerStatus = ref('Running');
|
||||||
const loadStatus = async () => {
|
const loadStatus = async () => {
|
||||||
loading.value = true;
|
loading.value = true;
|
||||||
|
|
@ -149,12 +153,16 @@ const onOpenDialog = async (
|
||||||
};
|
};
|
||||||
|
|
||||||
const onDelete = async (row: Container.RepoInfo) => {
|
const onDelete = async (row: Container.RepoInfo) => {
|
||||||
ElMessageBox.confirm(i18n.global.t('commons.msg.delete'), i18n.global.t('commons.button.delete'), {
|
let ids = [row.id];
|
||||||
confirmButtonText: i18n.global.t('commons.button.confirm'),
|
opRef.value.acceptParams({
|
||||||
cancelButtonText: i18n.global.t('commons.button.cancel'),
|
title: i18n.global.t('commons.button.delete'),
|
||||||
}).then(async () => {
|
names: [row.name],
|
||||||
await deleteImageRepo({ ids: [row.id] });
|
msg: i18n.global.t('commons.msg.operatorHelper', [
|
||||||
search();
|
i18n.global.t('container.repo'),
|
||||||
|
i18n.global.t('commons.button.delete'),
|
||||||
|
]),
|
||||||
|
api: deleteImageRepo,
|
||||||
|
params: { ids: ids },
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -57,6 +57,7 @@
|
||||||
</template>
|
</template>
|
||||||
</LayoutContent>
|
</LayoutContent>
|
||||||
|
|
||||||
|
<OpDialog ref="opRef" @search="search" />
|
||||||
<DetailDialog ref="detailRef" />
|
<DetailDialog ref="detailRef" />
|
||||||
<OperatorDialog @search="search" ref="dialogRef" />
|
<OperatorDialog @search="search" ref="dialogRef" />
|
||||||
</div>
|
</div>
|
||||||
|
|
@ -64,6 +65,7 @@
|
||||||
|
|
||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
import Tooltip from '@/components/tooltip/index.vue';
|
import Tooltip from '@/components/tooltip/index.vue';
|
||||||
|
import OpDialog from '@/components/del-dialog/index.vue';
|
||||||
import TableSetting from '@/components/table-setting/index.vue';
|
import TableSetting from '@/components/table-setting/index.vue';
|
||||||
import { reactive, onMounted, ref } from 'vue';
|
import { reactive, onMounted, ref } from 'vue';
|
||||||
import { dateFormatSimple } from '@/utils/util';
|
import { dateFormatSimple } from '@/utils/util';
|
||||||
|
|
@ -71,7 +73,6 @@ import { Container } from '@/api/interface/container';
|
||||||
import DetailDialog from '@/views/container/template/detail/index.vue';
|
import DetailDialog from '@/views/container/template/detail/index.vue';
|
||||||
import OperatorDialog from '@/views/container/template/operator/index.vue';
|
import OperatorDialog from '@/views/container/template/operator/index.vue';
|
||||||
import { deleteComposeTemplate, loadDockerStatus, searchComposeTemplate } from '@/api/modules/container';
|
import { deleteComposeTemplate, loadDockerStatus, searchComposeTemplate } from '@/api/modules/container';
|
||||||
import { useDeleteData } from '@/hooks/use-delete-data';
|
|
||||||
import i18n from '@/lang';
|
import i18n from '@/lang';
|
||||||
import router from '@/routers';
|
import router from '@/routers';
|
||||||
|
|
||||||
|
|
@ -88,6 +89,7 @@ const paginationConfig = reactive({
|
||||||
const searchName = ref();
|
const searchName = ref();
|
||||||
|
|
||||||
const detailRef = ref();
|
const detailRef = ref();
|
||||||
|
const opRef = ref();
|
||||||
|
|
||||||
const dockerStatus = ref('Running');
|
const dockerStatus = ref('Running');
|
||||||
const loadStatus = async () => {
|
const loadStatus = async () => {
|
||||||
|
|
@ -148,16 +150,27 @@ const onOpenDialog = async (
|
||||||
};
|
};
|
||||||
|
|
||||||
const onBatchDelete = async (row: Container.RepoInfo | null) => {
|
const onBatchDelete = async (row: Container.RepoInfo | null) => {
|
||||||
let ids: Array<number> = [];
|
let ids = [];
|
||||||
|
let names = [];
|
||||||
if (row) {
|
if (row) {
|
||||||
|
names.push(row.name);
|
||||||
ids.push(row.id);
|
ids.push(row.id);
|
||||||
} else {
|
} else {
|
||||||
selects.value.forEach((item: Container.RepoInfo) => {
|
selects.value.forEach((item: Container.RepoInfo) => {
|
||||||
|
names.push(item.name);
|
||||||
ids.push(item.id);
|
ids.push(item.id);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
await useDeleteData(deleteComposeTemplate, { ids: ids }, 'commons.msg.delete');
|
opRef.value.acceptParams({
|
||||||
search();
|
title: i18n.global.t('commons.button.delete'),
|
||||||
|
names: names,
|
||||||
|
msg: i18n.global.t('commons.msg.operatorHelper', [
|
||||||
|
i18n.global.t('container.composeTemplate'),
|
||||||
|
i18n.global.t('commons.button.delete'),
|
||||||
|
]),
|
||||||
|
api: deleteComposeTemplate,
|
||||||
|
params: { ids: ids },
|
||||||
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
const buttons = [
|
const buttons = [
|
||||||
|
|
|
||||||
|
|
@ -87,6 +87,8 @@
|
||||||
</template>
|
</template>
|
||||||
</LayoutContent>
|
</LayoutContent>
|
||||||
|
|
||||||
|
<OpDialog ref="opRef" @search="search" />
|
||||||
|
|
||||||
<CodemirrorDialog ref="codemirror" />
|
<CodemirrorDialog ref="codemirror" />
|
||||||
<CreateDialog @search="search" ref="dialogCreateRef" />
|
<CreateDialog @search="search" ref="dialogCreateRef" />
|
||||||
</div>
|
</div>
|
||||||
|
|
@ -94,6 +96,7 @@
|
||||||
|
|
||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
import Tooltip from '@/components/tooltip/index.vue';
|
import Tooltip from '@/components/tooltip/index.vue';
|
||||||
|
import OpDialog from '@/components/del-dialog/index.vue';
|
||||||
import TableSetting from '@/components/table-setting/index.vue';
|
import TableSetting from '@/components/table-setting/index.vue';
|
||||||
import CreateDialog from '@/views/container/volume/create/index.vue';
|
import CreateDialog from '@/views/container/volume/create/index.vue';
|
||||||
import CodemirrorDialog from '@/components/codemirror-dialog/index.vue';
|
import CodemirrorDialog from '@/components/codemirror-dialog/index.vue';
|
||||||
|
|
@ -102,7 +105,6 @@ import { computeSize, dateFormat } from '@/utils/util';
|
||||||
import { deleteVolume, searchVolume, inspect, loadDockerStatus, containerPrune } from '@/api/modules/container';
|
import { deleteVolume, searchVolume, inspect, loadDockerStatus, containerPrune } from '@/api/modules/container';
|
||||||
import { Container } from '@/api/interface/container';
|
import { Container } from '@/api/interface/container';
|
||||||
import i18n from '@/lang';
|
import i18n from '@/lang';
|
||||||
import { useDeleteData } from '@/hooks/use-delete-data';
|
|
||||||
import router from '@/routers';
|
import router from '@/routers';
|
||||||
import { MsgSuccess } from '@/utils/message';
|
import { MsgSuccess } from '@/utils/message';
|
||||||
import { ElMessageBox } from 'element-plus';
|
import { ElMessageBox } from 'element-plus';
|
||||||
|
|
@ -116,6 +118,8 @@ const mobile = computed(() => {
|
||||||
const loading = ref();
|
const loading = ref();
|
||||||
const codemirror = ref();
|
const codemirror = ref();
|
||||||
|
|
||||||
|
const opRef = ref();
|
||||||
|
|
||||||
const data = ref();
|
const data = ref();
|
||||||
const selects = ref<any>([]);
|
const selects = ref<any>([]);
|
||||||
const paginationConfig = reactive({
|
const paginationConfig = reactive({
|
||||||
|
|
@ -214,16 +218,24 @@ const onClean = () => {
|
||||||
};
|
};
|
||||||
|
|
||||||
const batchDelete = async (row: Container.VolumeInfo | null) => {
|
const batchDelete = async (row: Container.VolumeInfo | null) => {
|
||||||
let names: Array<string> = [];
|
let names = [];
|
||||||
if (row === null) {
|
if (row) {
|
||||||
|
names.push(row.name);
|
||||||
|
} else {
|
||||||
selects.value.forEach((item: Container.VolumeInfo) => {
|
selects.value.forEach((item: Container.VolumeInfo) => {
|
||||||
names.push(item.name);
|
names.push(item.name);
|
||||||
});
|
});
|
||||||
} else {
|
|
||||||
names.push(row.name);
|
|
||||||
}
|
}
|
||||||
await useDeleteData(deleteVolume, { names: names }, 'commons.msg.delete');
|
opRef.value.acceptParams({
|
||||||
search();
|
title: i18n.global.t('commons.button.delete'),
|
||||||
|
names: names,
|
||||||
|
msg: i18n.global.t('commons.msg.operatorHelper', [
|
||||||
|
i18n.global.t('container.volume'),
|
||||||
|
i18n.global.t('commons.button.delete'),
|
||||||
|
]),
|
||||||
|
api: deleteVolume,
|
||||||
|
params: { names: names },
|
||||||
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
const buttons = [
|
const buttons = [
|
||||||
|
|
|
||||||
|
|
@ -15,15 +15,17 @@
|
||||||
<el-button type="primary" @click="onOpenDialog('create')">
|
<el-button type="primary" @click="onOpenDialog('create')">
|
||||||
{{ $t('commons.button.create') }}{{ $t('cronjob.cronTask') }}
|
{{ $t('commons.button.create') }}{{ $t('cronjob.cronTask') }}
|
||||||
</el-button>
|
</el-button>
|
||||||
<el-button plain :disabled="selects.length === 0" @click="onBatchChangeStatus('enable')">
|
<el-button-group class="ml-4">
|
||||||
{{ $t('commons.button.enable') }}
|
<el-button plain :disabled="selects.length === 0" @click="onBatchChangeStatus('enable')">
|
||||||
</el-button>
|
{{ $t('commons.button.enable') }}
|
||||||
<el-button plain :disabled="selects.length === 0" @click="onBatchChangeStatus('disable')">
|
</el-button>
|
||||||
{{ $t('commons.button.disable') }}
|
<el-button plain :disabled="selects.length === 0" @click="onBatchChangeStatus('disable')">
|
||||||
</el-button>
|
{{ $t('commons.button.disable') }}
|
||||||
<el-button plain :disabled="selects.length === 0" @click="onDelete(null)">
|
</el-button>
|
||||||
{{ $t('commons.button.delete') }}
|
<el-button plain :disabled="selects.length === 0" @click="onDelete(null)">
|
||||||
</el-button>
|
{{ $t('commons.button.delete') }}
|
||||||
|
</el-button>
|
||||||
|
</el-button-group>
|
||||||
</el-col>
|
</el-col>
|
||||||
<el-col :xs="24" :sm="8" :md="8" :lg="8" :xl="8">
|
<el-col :xs="24" :sm="8" :md="8" :lg="8" :xl="8">
|
||||||
<TableSetting @search="search()" />
|
<TableSetting @search="search()" />
|
||||||
|
|
@ -133,38 +135,25 @@
|
||||||
</template>
|
</template>
|
||||||
</LayoutContent>
|
</LayoutContent>
|
||||||
|
|
||||||
<el-dialog
|
<OpDialog ref="opRef" @search="search">
|
||||||
v-model="deleteVisible"
|
<template #content>
|
||||||
:title="$t('commons.button.clean')"
|
<el-form class="mt-4 mb-1" v-if="showClean" ref="deleteForm" label-position="left">
|
||||||
width="30%"
|
<el-form-item>
|
||||||
:close-on-click-modal="false"
|
<el-checkbox v-model="cleanData" :label="$t('cronjob.cleanData')" />
|
||||||
>
|
<span class="input-help">
|
||||||
<el-form ref="deleteForm" label-position="left" v-loading="delLoading">
|
{{ $t('cronjob.cleanDataHelper') }}
|
||||||
<el-form-item>
|
</span>
|
||||||
<el-checkbox v-model="cleanData" :label="$t('cronjob.cleanData')" />
|
</el-form-item>
|
||||||
<span class="input-help">
|
</el-form>
|
||||||
{{ $t('cronjob.cleanDataHelper') }}
|
|
||||||
</span>
|
|
||||||
</el-form-item>
|
|
||||||
</el-form>
|
|
||||||
<template #footer>
|
|
||||||
<span class="dialog-footer">
|
|
||||||
<el-button @click="deleteVisible = false" :disabled="delLoading">
|
|
||||||
{{ $t('commons.button.cancel') }}
|
|
||||||
</el-button>
|
|
||||||
<el-button type="primary" @click="onSubmitDelete">
|
|
||||||
{{ $t('commons.button.confirm') }}
|
|
||||||
</el-button>
|
|
||||||
</span>
|
|
||||||
</template>
|
</template>
|
||||||
</el-dialog>
|
</OpDialog>
|
||||||
|
|
||||||
<OperateDialog @search="search" ref="dialogRef" />
|
<OperateDialog @search="search" ref="dialogRef" />
|
||||||
<Records @search="search" ref="dialogRecordRef" />
|
<Records @search="search" ref="dialogRecordRef" />
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
|
import OpDialog from '@/components/del-dialog/index.vue';
|
||||||
import TableSetting from '@/components/table-setting/index.vue';
|
import TableSetting from '@/components/table-setting/index.vue';
|
||||||
import Tooltip from '@/components/tooltip/index.vue';
|
import Tooltip from '@/components/tooltip/index.vue';
|
||||||
import OperateDialog from '@/views/cronjob/operate/index.vue';
|
import OperateDialog from '@/views/cronjob/operate/index.vue';
|
||||||
|
|
@ -181,6 +170,10 @@ const loading = ref();
|
||||||
const selects = ref<any>([]);
|
const selects = ref<any>([]);
|
||||||
const isRecordShow = ref();
|
const isRecordShow = ref();
|
||||||
|
|
||||||
|
const opRef = ref();
|
||||||
|
const showClean = ref();
|
||||||
|
const cleanData = ref();
|
||||||
|
|
||||||
const data = ref();
|
const data = ref();
|
||||||
const paginationConfig = reactive({
|
const paginationConfig = reactive({
|
||||||
cacheSizeKey: 'cronjob-page-size',
|
cacheSizeKey: 'cronjob-page-size',
|
||||||
|
|
@ -192,11 +185,6 @@ const paginationConfig = reactive({
|
||||||
});
|
});
|
||||||
const searchName = ref();
|
const searchName = ref();
|
||||||
|
|
||||||
const deleteVisible = ref();
|
|
||||||
const deleteCronjobID = ref();
|
|
||||||
const delLoading = ref();
|
|
||||||
const cleanData = ref();
|
|
||||||
|
|
||||||
const weekOptions = [
|
const weekOptions = [
|
||||||
{ label: i18n.global.t('cronjob.monday'), value: 1 },
|
{ label: i18n.global.t('cronjob.monday'), value: 1 },
|
||||||
{ label: i18n.global.t('cronjob.tuesday'), value: 2 },
|
{ label: i18n.global.t('cronjob.tuesday'), value: 2 },
|
||||||
|
|
@ -259,73 +247,37 @@ const onOpenDialog = async (
|
||||||
};
|
};
|
||||||
|
|
||||||
const onDelete = async (row: Cronjob.CronjobInfo | null) => {
|
const onDelete = async (row: Cronjob.CronjobInfo | null) => {
|
||||||
|
let names = [];
|
||||||
|
let ids = [];
|
||||||
|
showClean.value = false;
|
||||||
|
cleanData.value = false;
|
||||||
if (row) {
|
if (row) {
|
||||||
deleteCronjobID.value = row.id;
|
ids = [row.id];
|
||||||
if (row.type !== 'database' && row.type !== 'website' && row.type !== 'directory') {
|
names = [row.name];
|
||||||
deleteMessageBox();
|
if (row.type === 'database' || row.type === 'website' || row.type === 'directory') {
|
||||||
return;
|
showClean.value = true;
|
||||||
}
|
}
|
||||||
deleteVisible.value = true;
|
|
||||||
} else {
|
} else {
|
||||||
deleteCronjobID.value = 0;
|
|
||||||
for (const item of selects.value) {
|
for (const item of selects.value) {
|
||||||
|
names.push(item.name);
|
||||||
|
ids.push(item.id);
|
||||||
if (item.type === 'database' || item.type === 'website' || item.type === 'directory') {
|
if (item.type === 'database' || item.type === 'website' || item.type === 'directory') {
|
||||||
deleteVisible.value = true;
|
showClean.value = true;
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
deleteMessageBox();
|
|
||||||
}
|
}
|
||||||
};
|
opRef.value.acceptParams({
|
||||||
|
title: i18n.global.t('commons.button.delete'),
|
||||||
const deleteMessageBox = async () => {
|
names: names,
|
||||||
let ids: Array<number> = [];
|
msg: i18n.global.t('commons.msg.operatorHelper', [
|
||||||
if (deleteCronjobID.value) {
|
i18n.global.t('cronjob.cronTask'),
|
||||||
ids.push(deleteCronjobID.value);
|
i18n.global.t('commons.button.delete'),
|
||||||
} else {
|
]),
|
||||||
selects.value.forEach((item: Cronjob.CronjobInfo) => {
|
api: deleteCronjob,
|
||||||
ids.push(item.id);
|
params: { ids: ids, cleanData: cleanData.value },
|
||||||
});
|
|
||||||
}
|
|
||||||
ElMessageBox.confirm(i18n.global.t('commons.msg.delete'), i18n.global.t('commons.msg.deleteTitle'), {
|
|
||||||
confirmButtonText: i18n.global.t('commons.button.confirm'),
|
|
||||||
cancelButtonText: i18n.global.t('commons.button.cancel'),
|
|
||||||
type: 'info',
|
|
||||||
}).then(async () => {
|
|
||||||
await deleteCronjob(ids, false)
|
|
||||||
.then(() => {
|
|
||||||
delLoading.value = false;
|
|
||||||
MsgSuccess(i18n.global.t('commons.msg.operationSuccess'));
|
|
||||||
search();
|
|
||||||
})
|
|
||||||
.catch(() => {
|
|
||||||
delLoading.value = false;
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
const onSubmitDelete = async () => {
|
|
||||||
let ids: Array<number> = [];
|
|
||||||
if (deleteCronjobID.value) {
|
|
||||||
ids.push(deleteCronjobID.value);
|
|
||||||
} else {
|
|
||||||
selects.value.forEach((item: Cronjob.CronjobInfo) => {
|
|
||||||
ids.push(item.id);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
delLoading.value = true;
|
|
||||||
await deleteCronjob(ids, cleanData.value)
|
|
||||||
.then(() => {
|
|
||||||
delLoading.value = false;
|
|
||||||
deleteVisible.value = false;
|
|
||||||
MsgSuccess(i18n.global.t('commons.msg.operationSuccess'));
|
|
||||||
search();
|
|
||||||
})
|
|
||||||
.catch(() => {
|
|
||||||
delLoading.value = false;
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
const onChangeStatus = async (id: number, status: string) => {
|
const onChangeStatus = async (id: number, status: string) => {
|
||||||
ElMessageBox.confirm(i18n.global.t('cronjob.' + status + 'Msg'), i18n.global.t('cronjob.changeStatus'), {
|
ElMessageBox.confirm(i18n.global.t('cronjob.' + status + 'Msg'), i18n.global.t('cronjob.changeStatus'), {
|
||||||
confirmButtonText: i18n.global.t('commons.button.confirm'),
|
confirmButtonText: i18n.global.t('commons.button.confirm'),
|
||||||
|
|
|
||||||
|
|
@ -126,11 +126,14 @@
|
||||||
</LayoutContent>
|
</LayoutContent>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<OpDialog ref="opRef" @search="search" />
|
||||||
<OperateDialog @search="search" ref="dialogRef" />
|
<OperateDialog @search="search" ref="dialogRef" />
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
|
import OpDialog from '@/components/del-dialog/index.vue';
|
||||||
import OperateDialog from '@/views/host/firewall/ip/operate/index.vue';
|
import OperateDialog from '@/views/host/firewall/ip/operate/index.vue';
|
||||||
import FireRouter from '@/views/host/firewall/index.vue';
|
import FireRouter from '@/views/host/firewall/index.vue';
|
||||||
import TableSetting from '@/components/table-setting/index.vue';
|
import TableSetting from '@/components/table-setting/index.vue';
|
||||||
|
|
@ -153,6 +156,8 @@ const maskShow = ref(true);
|
||||||
const fireStatus = ref('running');
|
const fireStatus = ref('running');
|
||||||
const fireStatusRef = ref();
|
const fireStatusRef = ref();
|
||||||
|
|
||||||
|
const opRef = ref();
|
||||||
|
|
||||||
const data = ref();
|
const data = ref();
|
||||||
const paginationConfig = reactive({
|
const paginationConfig = reactive({
|
||||||
cacheSizeKey: 'firewall-ip-page-size',
|
cacheSizeKey: 'firewall-ip-page-size',
|
||||||
|
|
@ -249,43 +254,40 @@ const onChangeStatus = async (row: Host.RuleInfo, status: string) => {
|
||||||
};
|
};
|
||||||
|
|
||||||
const onDelete = async (row: Host.RuleIP | null) => {
|
const onDelete = async (row: Host.RuleIP | null) => {
|
||||||
ElMessageBox.confirm(i18n.global.t('commons.msg.delete'), i18n.global.t('commons.msg.deleteTitle'), {
|
let names = [];
|
||||||
confirmButtonText: i18n.global.t('commons.button.confirm'),
|
let rules = [];
|
||||||
cancelButtonText: i18n.global.t('commons.button.cancel'),
|
if (row) {
|
||||||
type: 'warning',
|
rules.push({
|
||||||
}).then(async () => {
|
operation: 'remove',
|
||||||
let rules = [];
|
address: row.address,
|
||||||
if (row) {
|
port: '',
|
||||||
|
source: '',
|
||||||
|
protocol: '',
|
||||||
|
strategy: row.strategy,
|
||||||
|
});
|
||||||
|
names = [row.address];
|
||||||
|
} else {
|
||||||
|
for (const item of selects.value) {
|
||||||
rules.push({
|
rules.push({
|
||||||
operation: 'remove',
|
operation: 'remove',
|
||||||
address: row.address,
|
address: item.address,
|
||||||
port: '',
|
port: '',
|
||||||
source: '',
|
source: '',
|
||||||
protocol: '',
|
protocol: '',
|
||||||
strategy: row.strategy,
|
strategy: item.strategy,
|
||||||
});
|
});
|
||||||
} else {
|
names.push(item.address);
|
||||||
for (const item of selects.value) {
|
|
||||||
rules.push({
|
|
||||||
operation: 'remove',
|
|
||||||
address: item.address,
|
|
||||||
port: '',
|
|
||||||
source: '',
|
|
||||||
protocol: '',
|
|
||||||
strategy: item.strategy,
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
loading.value = true;
|
}
|
||||||
await batchOperateRule({ type: 'address', rules: rules })
|
opRef.value.acceptParams({
|
||||||
.then(() => {
|
title: i18n.global.t('commons.button.delete'),
|
||||||
loading.value = false;
|
names: names,
|
||||||
MsgSuccess(i18n.global.t('commons.msg.operationSuccess'));
|
msg: i18n.global.t('commons.msg.operatorHelper', [
|
||||||
search();
|
i18n.global.t('firewall.ipRule'),
|
||||||
})
|
i18n.global.t('commons.button.delete'),
|
||||||
.catch(() => {
|
]),
|
||||||
loading.value = false;
|
api: batchOperateRule,
|
||||||
});
|
params: { type: 'address', rules: rules },
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -177,12 +177,14 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<OpDialog ref="opRef" @search="search" />
|
||||||
<OperateDialog @search="search" ref="dialogRef" />
|
<OperateDialog @search="search" ref="dialogRef" />
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
import FireRouter from '@/views/host/firewall/index.vue';
|
import FireRouter from '@/views/host/firewall/index.vue';
|
||||||
|
import OpDialog from '@/components/del-dialog/index.vue';
|
||||||
import TableSetting from '@/components/table-setting/index.vue';
|
import TableSetting from '@/components/table-setting/index.vue';
|
||||||
import OperateDialog from '@/views/host/firewall/port/operate/index.vue';
|
import OperateDialog from '@/views/host/firewall/port/operate/index.vue';
|
||||||
import FireStatus from '@/views/host/firewall/status/index.vue';
|
import FireStatus from '@/views/host/firewall/status/index.vue';
|
||||||
|
|
@ -206,6 +208,8 @@ const fireStatus = ref('running');
|
||||||
const fireName = ref();
|
const fireName = ref();
|
||||||
const fireStatusRef = ref();
|
const fireStatusRef = ref();
|
||||||
|
|
||||||
|
const opRef = ref();
|
||||||
|
|
||||||
const data = ref();
|
const data = ref();
|
||||||
const paginationConfig = reactive({
|
const paginationConfig = reactive({
|
||||||
cacheSizeKey: 'firewall-port-page-size',
|
cacheSizeKey: 'firewall-port-page-size',
|
||||||
|
|
@ -316,43 +320,40 @@ const onChange = async (info: any) => {
|
||||||
};
|
};
|
||||||
|
|
||||||
const onDelete = async (row: Host.RuleInfo | null) => {
|
const onDelete = async (row: Host.RuleInfo | null) => {
|
||||||
ElMessageBox.confirm(i18n.global.t('commons.msg.delete'), i18n.global.t('commons.msg.deleteTitle'), {
|
let names = [];
|
||||||
confirmButtonText: i18n.global.t('commons.button.confirm'),
|
let rules = [];
|
||||||
cancelButtonText: i18n.global.t('commons.button.cancel'),
|
if (row) {
|
||||||
type: 'warning',
|
rules.push({
|
||||||
}).then(async () => {
|
operation: 'remove',
|
||||||
let rules = [];
|
address: row.address,
|
||||||
if (row) {
|
port: row.port,
|
||||||
|
source: '',
|
||||||
|
protocol: row.protocol,
|
||||||
|
strategy: row.strategy,
|
||||||
|
});
|
||||||
|
names = [row.port + ' (' + row.protocol + ')'];
|
||||||
|
} else {
|
||||||
|
for (const item of selects.value) {
|
||||||
|
names.push(item.port + ' (' + item.protocol + ')');
|
||||||
rules.push({
|
rules.push({
|
||||||
operation: 'remove',
|
operation: 'remove',
|
||||||
address: row.address,
|
address: item.address,
|
||||||
port: row.port,
|
port: item.port,
|
||||||
source: '',
|
source: '',
|
||||||
protocol: row.protocol,
|
protocol: item.protocol,
|
||||||
strategy: row.strategy,
|
strategy: item.strategy,
|
||||||
});
|
});
|
||||||
} else {
|
|
||||||
for (const item of selects.value) {
|
|
||||||
rules.push({
|
|
||||||
operation: 'remove',
|
|
||||||
address: item.address,
|
|
||||||
port: item.port,
|
|
||||||
source: '',
|
|
||||||
protocol: item.protocol,
|
|
||||||
strategy: item.strategy,
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
loading.value = true;
|
}
|
||||||
await batchOperateRule({ type: 'port', rules: rules })
|
opRef.value.acceptParams({
|
||||||
.then(() => {
|
title: i18n.global.t('commons.button.delete'),
|
||||||
loading.value = false;
|
names: names,
|
||||||
MsgSuccess(i18n.global.t('commons.msg.operationSuccess'));
|
msg: i18n.global.t('commons.msg.operatorHelper', [
|
||||||
search();
|
i18n.global.t('firewall.portRule'),
|
||||||
})
|
i18n.global.t('commons.button.delete'),
|
||||||
.catch(() => {
|
]),
|
||||||
loading.value = false;
|
api: batchOperateRule,
|
||||||
});
|
params: { type: 'port', rules: rules },
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -72,14 +72,16 @@
|
||||||
</span>
|
</span>
|
||||||
</template>
|
</template>
|
||||||
</el-drawer>
|
</el-drawer>
|
||||||
|
|
||||||
|
<OpDialog ref="opRef" @search="search" />
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { Command } from '@/api/interface/command';
|
import { Command } from '@/api/interface/command';
|
||||||
|
import OpDialog from '@/components/del-dialog/index.vue';
|
||||||
import { addCommand, editCommand, deleteCommand, getCommandPage } from '@/api/modules/host';
|
import { addCommand, editCommand, deleteCommand, getCommandPage } from '@/api/modules/host';
|
||||||
import { reactive, ref } from 'vue';
|
import { reactive, ref } from 'vue';
|
||||||
import { useDeleteData } from '@/hooks/use-delete-data';
|
|
||||||
import type { ElForm } from 'element-plus';
|
import type { ElForm } from 'element-plus';
|
||||||
import { Rules } from '@/global/form-rules';
|
import { Rules } from '@/global/form-rules';
|
||||||
import i18n from '@/lang';
|
import i18n from '@/lang';
|
||||||
|
|
@ -97,6 +99,8 @@ const paginationConfig = reactive({
|
||||||
});
|
});
|
||||||
const info = ref();
|
const info = ref();
|
||||||
|
|
||||||
|
const opRef = ref();
|
||||||
|
|
||||||
type FormInstance = InstanceType<typeof ElForm>;
|
type FormInstance = InstanceType<typeof ElForm>;
|
||||||
const commandInfoRef = ref<FormInstance>();
|
const commandInfoRef = ref<FormInstance>();
|
||||||
const rules = reactive({
|
const rules = reactive({
|
||||||
|
|
@ -155,16 +159,27 @@ const onEdit = async (row: Command.CommandInfo | null) => {
|
||||||
};
|
};
|
||||||
|
|
||||||
const batchDelete = async (row: Command.CommandInfo | null) => {
|
const batchDelete = async (row: Command.CommandInfo | null) => {
|
||||||
let ids: Array<number> = [];
|
let names = [];
|
||||||
if (row === null) {
|
let ids = [];
|
||||||
|
if (row) {
|
||||||
|
ids = [row.id];
|
||||||
|
names = [row.name];
|
||||||
|
} else {
|
||||||
selects.value.forEach((item: Command.CommandInfo) => {
|
selects.value.forEach((item: Command.CommandInfo) => {
|
||||||
ids.push(item.id);
|
ids.push(item.id);
|
||||||
|
names.push(item.name);
|
||||||
});
|
});
|
||||||
} else {
|
|
||||||
ids.push(row.id);
|
|
||||||
}
|
}
|
||||||
await useDeleteData(deleteCommand, { ids: ids }, 'commons.msg.delete');
|
opRef.value.acceptParams({
|
||||||
search();
|
title: i18n.global.t('commons.button.delete'),
|
||||||
|
names: names,
|
||||||
|
msg: i18n.global.t('commons.msg.operatorHelper', [
|
||||||
|
i18n.global.t('terminal.quickCommand'),
|
||||||
|
i18n.global.t('commons.button.delete'),
|
||||||
|
]),
|
||||||
|
api: deleteCommand,
|
||||||
|
params: { ids: ids },
|
||||||
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
const buttons = [
|
const buttons = [
|
||||||
|
|
|
||||||
|
|
@ -71,6 +71,7 @@
|
||||||
</template>
|
</template>
|
||||||
</LayoutContent>
|
</LayoutContent>
|
||||||
|
|
||||||
|
<OpDialog ref="opRef" @search="search" />
|
||||||
<OperateDialog @search="search" ref="dialogRef" />
|
<OperateDialog @search="search" ref="dialogRef" />
|
||||||
<GroupDialog @search="search" ref="dialogGroupRef" />
|
<GroupDialog @search="search" ref="dialogGroupRef" />
|
||||||
<GroupChangeDialog @search="search" ref="dialogGroupChangeRef" />
|
<GroupChangeDialog @search="search" ref="dialogGroupChangeRef" />
|
||||||
|
|
@ -79,6 +80,7 @@
|
||||||
|
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import GroupDialog from '@/components/group/index.vue';
|
import GroupDialog from '@/components/group/index.vue';
|
||||||
|
import OpDialog from '@/components/del-dialog/index.vue';
|
||||||
import GroupChangeDialog from '@/views/host/terminal/host/change-group/index.vue';
|
import GroupChangeDialog from '@/views/host/terminal/host/change-group/index.vue';
|
||||||
import OperateDialog from '@/views/host/terminal/host/operate/index.vue';
|
import OperateDialog from '@/views/host/terminal/host/operate/index.vue';
|
||||||
import { deleteHost, searchHosts } from '@/api/modules/host';
|
import { deleteHost, searchHosts } from '@/api/modules/host';
|
||||||
|
|
@ -86,7 +88,6 @@ import { GetGroupList } from '@/api/modules/group';
|
||||||
import { reactive, ref } from 'vue';
|
import { reactive, ref } from 'vue';
|
||||||
import i18n from '@/lang';
|
import i18n from '@/lang';
|
||||||
import { Host } from '@/api/interface/host';
|
import { Host } from '@/api/interface/host';
|
||||||
import { useDeleteData } from '@/hooks/use-delete-data';
|
|
||||||
|
|
||||||
const loading = ref();
|
const loading = ref();
|
||||||
const data = ref();
|
const data = ref();
|
||||||
|
|
@ -102,6 +103,8 @@ const info = ref();
|
||||||
const group = ref<string>('');
|
const group = ref<string>('');
|
||||||
const dialogGroupChangeRef = ref();
|
const dialogGroupChangeRef = ref();
|
||||||
|
|
||||||
|
const opRef = ref();
|
||||||
|
|
||||||
const acceptParams = () => {
|
const acceptParams = () => {
|
||||||
search();
|
search();
|
||||||
};
|
};
|
||||||
|
|
@ -131,16 +134,27 @@ const onOpenGroupDialog = () => {
|
||||||
};
|
};
|
||||||
|
|
||||||
const onBatchDelete = async (row: Host.Host | null) => {
|
const onBatchDelete = async (row: Host.Host | null) => {
|
||||||
let ids: Array<number> = [];
|
let names = [];
|
||||||
|
let ids = [];
|
||||||
if (row) {
|
if (row) {
|
||||||
ids.push(row.id);
|
names = [row.name + '[' + row.addr + ']'];
|
||||||
|
ids = [row.id];
|
||||||
} else {
|
} else {
|
||||||
selects.value.forEach((item: Host.Host) => {
|
selects.value.forEach((item: Host.Host) => {
|
||||||
|
names.push(item.name + '[' + item.addr + ']');
|
||||||
ids.push(item.id);
|
ids.push(item.id);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
await useDeleteData(deleteHost, { ids: ids }, 'commons.msg.delete');
|
opRef.value.acceptParams({
|
||||||
search();
|
title: i18n.global.t('commons.button.delete'),
|
||||||
|
names: names,
|
||||||
|
msg: i18n.global.t('commons.msg.operatorHelper', [
|
||||||
|
i18n.global.t('terminal.host'),
|
||||||
|
i18n.global.t('commons.button.delete'),
|
||||||
|
]),
|
||||||
|
api: deleteHost,
|
||||||
|
params: { ids: ids },
|
||||||
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
const loadGroups = async () => {
|
const loadGroups = async () => {
|
||||||
|
|
|
||||||
|
|
@ -139,17 +139,19 @@
|
||||||
</span>
|
</span>
|
||||||
</template>
|
</template>
|
||||||
</el-drawer>
|
</el-drawer>
|
||||||
|
|
||||||
|
<OpDialog ref="opRef" @search="search" />
|
||||||
<SnapStatus ref="snapStatusRef" @search="search" />
|
<SnapStatus ref="snapStatusRef" @search="search" />
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
|
import OpDialog from '@/components/del-dialog/index.vue';
|
||||||
import TableSetting from '@/components/table-setting/index.vue';
|
import TableSetting from '@/components/table-setting/index.vue';
|
||||||
import DrawerHeader from '@/components/drawer-header/index.vue';
|
import DrawerHeader from '@/components/drawer-header/index.vue';
|
||||||
import { snapshotCreate, searchSnapshotPage, snapshotDelete, updateSnapshotDescription } from '@/api/modules/setting';
|
import { snapshotCreate, searchSnapshotPage, snapshotDelete, updateSnapshotDescription } from '@/api/modules/setting';
|
||||||
import { onMounted, reactive, ref } from 'vue';
|
import { onMounted, reactive, ref } from 'vue';
|
||||||
import { dateFormat } from '@/utils/util';
|
import { dateFormat } from '@/utils/util';
|
||||||
import { useDeleteData } from '@/hooks/use-delete-data';
|
|
||||||
import { ElForm } from 'element-plus';
|
import { ElForm } from 'element-plus';
|
||||||
import { Rules } from '@/global/form-rules';
|
import { Rules } from '@/global/form-rules';
|
||||||
import i18n from '@/lang';
|
import i18n from '@/lang';
|
||||||
|
|
@ -171,6 +173,8 @@ const paginationConfig = reactive({
|
||||||
});
|
});
|
||||||
const searchName = ref();
|
const searchName = ref();
|
||||||
|
|
||||||
|
const opRef = ref();
|
||||||
|
|
||||||
const snapStatusRef = ref();
|
const snapStatusRef = ref();
|
||||||
const recoverStatusRef = ref();
|
const recoverStatusRef = ref();
|
||||||
const importRef = ref();
|
const importRef = ref();
|
||||||
|
|
@ -241,16 +245,27 @@ const loadBackups = async () => {
|
||||||
};
|
};
|
||||||
|
|
||||||
const batchDelete = async (row: Setting.SnapshotInfo | null) => {
|
const batchDelete = async (row: Setting.SnapshotInfo | null) => {
|
||||||
let ids: Array<number> = [];
|
let names = [];
|
||||||
if (row === null) {
|
let ids = [];
|
||||||
|
if (row) {
|
||||||
|
ids.push(row.id);
|
||||||
|
names.push(row.name);
|
||||||
|
} else {
|
||||||
selects.value.forEach((item: Setting.SnapshotInfo) => {
|
selects.value.forEach((item: Setting.SnapshotInfo) => {
|
||||||
ids.push(item.id);
|
ids.push(item.id);
|
||||||
|
names.push(item.name);
|
||||||
});
|
});
|
||||||
} else {
|
|
||||||
ids.push(row.id);
|
|
||||||
}
|
}
|
||||||
await useDeleteData(snapshotDelete, { ids: ids }, 'commons.msg.delete');
|
opRef.value.acceptParams({
|
||||||
search();
|
title: i18n.global.t('commons.button.delete'),
|
||||||
|
names: names,
|
||||||
|
msg: i18n.global.t('commons.msg.operatorHelper', [
|
||||||
|
i18n.global.t('setting.snapshot'),
|
||||||
|
i18n.global.t('commons.button.delete'),
|
||||||
|
]),
|
||||||
|
api: snapshotDelete,
|
||||||
|
params: { ids: ids },
|
||||||
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
function restForm() {
|
function restForm() {
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue