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

fix: 完善系统操作日志 (#536)

This commit is contained in:
ssongliu 2023-04-07 17:46:10 +08:00 committed by GitHub
parent dbe70ecc28
commit fb62ac17e5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 608 additions and 492 deletions

View File

@ -87,7 +87,7 @@ func (b *BaseApi) OperateFirewall(c *gin.Context) {
// @Success 200
// @Security ApiKeyAuth
// @Router /hosts/firewall/port [post]
// @x-panel-log {"bodyKeys":["port","strategy"],"paramKeys":[],"BeforeFuntions":[],"formatZH":"添加端口规则 {[strategy] [port]}","formatEN":"create port rules {[strategy][port]}"}
// @x-panel-log {"bodyKeys":["port","strategy"],"paramKeys":[],"BeforeFuntions":[],"formatZH":"添加端口规则 [strategy] [port]","formatEN":"create port rules [strategy][port]"}
func (b *BaseApi) OperatePortRule(c *gin.Context) {
var req dto.PortRuleOperate
if err := c.ShouldBindJSON(&req); err != nil {
@ -113,7 +113,7 @@ func (b *BaseApi) OperatePortRule(c *gin.Context) {
// @Success 200
// @Security ApiKeyAuth
// @Router /hosts/firewall/ip [post]
// @x-panel-log {"bodyKeys":["strategy","address"],"paramKeys":[],"BeforeFuntions":[],"formatZH":"添加 ip 规则 {[strategy] [address]}","formatEN":"create address rules {[strategy][address]}"}
// @x-panel-log {"bodyKeys":["strategy","address"],"paramKeys":[],"BeforeFuntions":[],"formatZH":"添加 ip 规则 [strategy] [address]","formatEN":"create address rules [strategy][address]"}
func (b *BaseApi) OperateIPRule(c *gin.Context) {
var req dto.AddrRuleOperate
if err := c.ShouldBindJSON(&req); err != nil {

View File

@ -15,7 +15,7 @@ import (
// @Param request body dto.GroupCreate true "request"
// @Success 200
// @Security ApiKeyAuth
// @Router /hosts/group [post]
// @Router /groups [post]
// @x-panel-log {"bodyKeys":["name","type"],"paramKeys":[],"BeforeFuntions":[],"formatZH":"创建组 [name][type]","formatEN":"create group [name][type]"}
func (b *BaseApi) CreateGroup(c *gin.Context) {
var req dto.GroupCreate
@ -41,7 +41,7 @@ func (b *BaseApi) CreateGroup(c *gin.Context) {
// @Param request body dto.OperateByID true "request"
// @Success 200
// @Security ApiKeyAuth
// @Router /hosts/group/del [post]
// @Router /groups/del [post]
// @x-panel-log {"bodyKeys":["id"],"paramKeys":[],"BeforeFuntions":[{"input_colume":"id","input_value":"id","isList":false,"db":"groups","output_colume":"name","output_value":"name"},{"input_colume":"id","input_value":"id","isList":false,"db":"groups","output_colume":"type","output_value":"type"}],"formatZH":"删除组 [type][name]","formatEN":"delete group [type][name]"}
func (b *BaseApi) DeleteGroup(c *gin.Context) {
var req dto.OperateByID
@ -68,7 +68,7 @@ func (b *BaseApi) DeleteGroup(c *gin.Context) {
// @Param request body dto.GroupUpdate true "request"
// @Success 200
// @Security ApiKeyAuth
// @Router /hosts/group/update [post]
// @Router /groups/update [post]
// @x-panel-log {"bodyKeys":["name","type"],"paramKeys":[],"BeforeFuntions":[],"formatZH":"更新组 [name][type]","formatEN":"update group [name][type]"}
func (b *BaseApi) UpdateGroup(c *gin.Context) {
var req dto.GroupUpdate
@ -94,7 +94,7 @@ func (b *BaseApi) UpdateGroup(c *gin.Context) {
// @Param request body dto.GroupSearch true "request"
// @Success 200 {anrry} dto.GroupInfo
// @Security ApiKeyAuth
// @Router /hosts/group/search [post]
// @Router /groups/search [post]
func (b *BaseApi) ListGroup(c *gin.Context) {
var req dto.GroupSearch
if err := c.ShouldBindJSON(&req); err != nil {

View File

@ -291,7 +291,7 @@ func (b *BaseApi) UpdateHost(c *gin.Context) {
// @Param request body dto.ChangeHostGroup true "request"
// @Success 200
// @Security ApiKeyAuth
// @Router /hosts/update [post]
// @Router /hosts/update/group [post]
// @x-panel-log {"bodyKeys":["id","group"],"paramKeys":[],"BeforeFuntions":[{"input_colume":"id","input_value":"id","isList":false,"db":"hosts","output_colume":"addr","output_value":"addr"}],"formatZH":"切换主机[addr]分组 => [group]","formatEN":"change host [addr] group => [group]"}
func (b *BaseApi) UpdateHostGroup(c *gin.Context) {
var req dto.ChangeHostGroup

View File

@ -4838,6 +4838,187 @@ var doc = `{
}
}
},
"/groups": {
"post": {
"security": [
{
"ApiKeyAuth": []
}
],
"description": "创建系统组",
"consumes": [
"application/json"
],
"tags": [
"System Group"
],
"summary": "Create group",
"parameters": [
{
"description": "request",
"name": "request",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/dto.GroupCreate"
}
}
],
"responses": {
"200": {
"description": ""
}
},
"x-panel-log": {
"BeforeFuntions": [],
"bodyKeys": [
"name",
"type"
],
"formatEN": "create group [name][type]",
"formatZH": "创建组 [name][type]",
"paramKeys": []
}
}
},
"/groups/del": {
"post": {
"security": [
{
"ApiKeyAuth": []
}
],
"description": "删除系统组",
"consumes": [
"application/json"
],
"tags": [
"System Group"
],
"summary": "Delete group",
"parameters": [
{
"description": "request",
"name": "request",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/dto.OperateByID"
}
}
],
"responses": {
"200": {
"description": ""
}
},
"x-panel-log": {
"BeforeFuntions": [
{
"db": "groups",
"input_colume": "id",
"input_value": "id",
"isList": false,
"output_colume": "name",
"output_value": "name"
},
{
"db": "groups",
"input_colume": "id",
"input_value": "id",
"isList": false,
"output_colume": "type",
"output_value": "type"
}
],
"bodyKeys": [
"id"
],
"formatEN": "delete group [type][name]",
"formatZH": "删除组 [type][name]",
"paramKeys": []
}
}
},
"/groups/search": {
"post": {
"security": [
{
"ApiKeyAuth": []
}
],
"description": "查询系统组",
"consumes": [
"application/json"
],
"tags": [
"System Group"
],
"summary": "List groups",
"parameters": [
{
"description": "request",
"name": "request",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/dto.GroupSearch"
}
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"type": "anrry"
}
}
}
}
},
"/groups/update": {
"post": {
"security": [
{
"ApiKeyAuth": []
}
],
"description": "更新系统组",
"consumes": [
"application/json"
],
"tags": [
"System Group"
],
"summary": "Update group",
"parameters": [
{
"description": "request",
"name": "request",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/dto.GroupUpdate"
}
}
],
"responses": {
"200": {
"description": ""
}
},
"x-panel-log": {
"BeforeFuntions": [],
"bodyKeys": [
"name",
"type"
],
"formatEN": "update group [name][type]",
"formatZH": "更新组 [name][type]",
"paramKeys": []
}
}
},
"/hosts": {
"post": {
"security": [
@ -5295,8 +5476,8 @@ var doc = `{
"port",
"strategy"
],
"formatEN": "create port rules {[strategy][port]}",
"formatZH": "添加端口规则 {[strategy] [port]}",
"formatEN": "create port rules [strategy][port]",
"formatZH": "添加端口规则 [strategy] [port]",
"paramKeys": []
}
}
@ -5403,187 +5584,6 @@ var doc = `{
}
}
},
"/hosts/group": {
"post": {
"security": [
{
"ApiKeyAuth": []
}
],
"description": "创建系统组",
"consumes": [
"application/json"
],
"tags": [
"System Group"
],
"summary": "Create group",
"parameters": [
{
"description": "request",
"name": "request",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/dto.GroupCreate"
}
}
],
"responses": {
"200": {
"description": ""
}
},
"x-panel-log": {
"BeforeFuntions": [],
"bodyKeys": [
"name",
"type"
],
"formatEN": "create group [name][type]",
"formatZH": "创建组 [name][type]",
"paramKeys": []
}
}
},
"/hosts/group/del": {
"post": {
"security": [
{
"ApiKeyAuth": []
}
],
"description": "删除系统组",
"consumes": [
"application/json"
],
"tags": [
"System Group"
],
"summary": "Delete group",
"parameters": [
{
"description": "request",
"name": "request",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/dto.OperateByID"
}
}
],
"responses": {
"200": {
"description": ""
}
},
"x-panel-log": {
"BeforeFuntions": [
{
"db": "groups",
"input_colume": "id",
"input_value": "id",
"isList": false,
"output_colume": "name",
"output_value": "name"
},
{
"db": "groups",
"input_colume": "id",
"input_value": "id",
"isList": false,
"output_colume": "type",
"output_value": "type"
}
],
"bodyKeys": [
"id"
],
"formatEN": "delete group [type][name]",
"formatZH": "删除组 [type][name]",
"paramKeys": []
}
}
},
"/hosts/group/search": {
"post": {
"security": [
{
"ApiKeyAuth": []
}
],
"description": "查询系统组",
"consumes": [
"application/json"
],
"tags": [
"System Group"
],
"summary": "List groups",
"parameters": [
{
"description": "request",
"name": "request",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/dto.GroupSearch"
}
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"type": "anrry"
}
}
}
}
},
"/hosts/group/update": {
"post": {
"security": [
{
"ApiKeyAuth": []
}
],
"description": "更新系统组",
"consumes": [
"application/json"
],
"tags": [
"System Group"
],
"summary": "Update group",
"parameters": [
{
"description": "request",
"name": "request",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/dto.GroupUpdate"
}
}
],
"responses": {
"200": {
"description": ""
}
},
"x-panel-log": {
"BeforeFuntions": [],
"bodyKeys": [
"name",
"type"
],
"formatEN": "update group [name][type]",
"formatZH": "更新组 [name][type]",
"paramKeys": []
}
}
},
"/hosts/search": {
"post": {
"security": [
@ -5724,6 +5724,49 @@ var doc = `{
}
},
"/hosts/update": {
"post": {
"security": [
{
"ApiKeyAuth": []
}
],
"description": "更新主机",
"consumes": [
"application/json"
],
"tags": [
"Host"
],
"summary": "Update host",
"parameters": [
{
"description": "request",
"name": "request",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/dto.HostOperate"
}
}
],
"responses": {
"200": {
"description": ""
}
},
"x-panel-log": {
"BeforeFuntions": [],
"bodyKeys": [
"name",
"addr"
],
"formatEN": "update host [name][addr]",
"formatZH": "更新主机信息 [name][addr]",
"paramKeys": []
}
}
},
"/hosts/update/group": {
"post": {
"security": [
{

View File

@ -4824,6 +4824,187 @@
}
}
},
"/groups": {
"post": {
"security": [
{
"ApiKeyAuth": []
}
],
"description": "创建系统组",
"consumes": [
"application/json"
],
"tags": [
"System Group"
],
"summary": "Create group",
"parameters": [
{
"description": "request",
"name": "request",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/dto.GroupCreate"
}
}
],
"responses": {
"200": {
"description": ""
}
},
"x-panel-log": {
"BeforeFuntions": [],
"bodyKeys": [
"name",
"type"
],
"formatEN": "create group [name][type]",
"formatZH": "创建组 [name][type]",
"paramKeys": []
}
}
},
"/groups/del": {
"post": {
"security": [
{
"ApiKeyAuth": []
}
],
"description": "删除系统组",
"consumes": [
"application/json"
],
"tags": [
"System Group"
],
"summary": "Delete group",
"parameters": [
{
"description": "request",
"name": "request",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/dto.OperateByID"
}
}
],
"responses": {
"200": {
"description": ""
}
},
"x-panel-log": {
"BeforeFuntions": [
{
"db": "groups",
"input_colume": "id",
"input_value": "id",
"isList": false,
"output_colume": "name",
"output_value": "name"
},
{
"db": "groups",
"input_colume": "id",
"input_value": "id",
"isList": false,
"output_colume": "type",
"output_value": "type"
}
],
"bodyKeys": [
"id"
],
"formatEN": "delete group [type][name]",
"formatZH": "删除组 [type][name]",
"paramKeys": []
}
}
},
"/groups/search": {
"post": {
"security": [
{
"ApiKeyAuth": []
}
],
"description": "查询系统组",
"consumes": [
"application/json"
],
"tags": [
"System Group"
],
"summary": "List groups",
"parameters": [
{
"description": "request",
"name": "request",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/dto.GroupSearch"
}
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"type": "anrry"
}
}
}
}
},
"/groups/update": {
"post": {
"security": [
{
"ApiKeyAuth": []
}
],
"description": "更新系统组",
"consumes": [
"application/json"
],
"tags": [
"System Group"
],
"summary": "Update group",
"parameters": [
{
"description": "request",
"name": "request",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/dto.GroupUpdate"
}
}
],
"responses": {
"200": {
"description": ""
}
},
"x-panel-log": {
"BeforeFuntions": [],
"bodyKeys": [
"name",
"type"
],
"formatEN": "update group [name][type]",
"formatZH": "更新组 [name][type]",
"paramKeys": []
}
}
},
"/hosts": {
"post": {
"security": [
@ -5281,8 +5462,8 @@
"port",
"strategy"
],
"formatEN": "create port rules {[strategy][port]}",
"formatZH": "添加端口规则 {[strategy] [port]}",
"formatEN": "create port rules [strategy][port]",
"formatZH": "添加端口规则 [strategy] [port]",
"paramKeys": []
}
}
@ -5389,187 +5570,6 @@
}
}
},
"/hosts/group": {
"post": {
"security": [
{
"ApiKeyAuth": []
}
],
"description": "创建系统组",
"consumes": [
"application/json"
],
"tags": [
"System Group"
],
"summary": "Create group",
"parameters": [
{
"description": "request",
"name": "request",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/dto.GroupCreate"
}
}
],
"responses": {
"200": {
"description": ""
}
},
"x-panel-log": {
"BeforeFuntions": [],
"bodyKeys": [
"name",
"type"
],
"formatEN": "create group [name][type]",
"formatZH": "创建组 [name][type]",
"paramKeys": []
}
}
},
"/hosts/group/del": {
"post": {
"security": [
{
"ApiKeyAuth": []
}
],
"description": "删除系统组",
"consumes": [
"application/json"
],
"tags": [
"System Group"
],
"summary": "Delete group",
"parameters": [
{
"description": "request",
"name": "request",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/dto.OperateByID"
}
}
],
"responses": {
"200": {
"description": ""
}
},
"x-panel-log": {
"BeforeFuntions": [
{
"db": "groups",
"input_colume": "id",
"input_value": "id",
"isList": false,
"output_colume": "name",
"output_value": "name"
},
{
"db": "groups",
"input_colume": "id",
"input_value": "id",
"isList": false,
"output_colume": "type",
"output_value": "type"
}
],
"bodyKeys": [
"id"
],
"formatEN": "delete group [type][name]",
"formatZH": "删除组 [type][name]",
"paramKeys": []
}
}
},
"/hosts/group/search": {
"post": {
"security": [
{
"ApiKeyAuth": []
}
],
"description": "查询系统组",
"consumes": [
"application/json"
],
"tags": [
"System Group"
],
"summary": "List groups",
"parameters": [
{
"description": "request",
"name": "request",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/dto.GroupSearch"
}
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"type": "anrry"
}
}
}
}
},
"/hosts/group/update": {
"post": {
"security": [
{
"ApiKeyAuth": []
}
],
"description": "更新系统组",
"consumes": [
"application/json"
],
"tags": [
"System Group"
],
"summary": "Update group",
"parameters": [
{
"description": "request",
"name": "request",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/dto.GroupUpdate"
}
}
],
"responses": {
"200": {
"description": ""
}
},
"x-panel-log": {
"BeforeFuntions": [],
"bodyKeys": [
"name",
"type"
],
"formatEN": "update group [name][type]",
"formatZH": "更新组 [name][type]",
"paramKeys": []
}
}
},
"/hosts/search": {
"post": {
"security": [
@ -5710,6 +5710,49 @@
}
},
"/hosts/update": {
"post": {
"security": [
{
"ApiKeyAuth": []
}
],
"description": "更新主机",
"consumes": [
"application/json"
],
"tags": [
"Host"
],
"summary": "Update host",
"parameters": [
{
"description": "request",
"name": "request",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/dto.HostOperate"
}
}
],
"responses": {
"200": {
"description": ""
}
},
"x-panel-log": {
"BeforeFuntions": [],
"bodyKeys": [
"name",
"addr"
],
"formatEN": "update host [name][addr]",
"formatZH": "更新主机信息 [name][addr]",
"paramKeys": []
}
}
},
"/hosts/update/group": {
"post": {
"security": [
{

View File

@ -5862,6 +5862,123 @@ paths:
formatEN: Download url => [path]/[name]
formatZH: 下载 url => [path]/[name]
paramKeys: []
/groups:
post:
consumes:
- application/json
description: 创建系统组
parameters:
- description: request
in: body
name: request
required: true
schema:
$ref: '#/definitions/dto.GroupCreate'
responses:
"200":
description: ""
security:
- ApiKeyAuth: []
summary: Create group
tags:
- System Group
x-panel-log:
BeforeFuntions: []
bodyKeys:
- name
- type
formatEN: create group [name][type]
formatZH: 创建组 [name][type]
paramKeys: []
/groups/del:
post:
consumes:
- application/json
description: 删除系统组
parameters:
- description: request
in: body
name: request
required: true
schema:
$ref: '#/definitions/dto.OperateByID'
responses:
"200":
description: ""
security:
- ApiKeyAuth: []
summary: Delete group
tags:
- System Group
x-panel-log:
BeforeFuntions:
- db: groups
input_colume: id
input_value: id
isList: false
output_colume: name
output_value: name
- db: groups
input_colume: id
input_value: id
isList: false
output_colume: type
output_value: type
bodyKeys:
- id
formatEN: delete group [type][name]
formatZH: 删除组 [type][name]
paramKeys: []
/groups/search:
post:
consumes:
- application/json
description: 查询系统组
parameters:
- description: request
in: body
name: request
required: true
schema:
$ref: '#/definitions/dto.GroupSearch'
responses:
"200":
description: OK
schema:
type: anrry
security:
- ApiKeyAuth: []
summary: List groups
tags:
- System Group
/groups/update:
post:
consumes:
- application/json
description: 更新系统组
parameters:
- description: request
in: body
name: request
required: true
schema:
$ref: '#/definitions/dto.GroupUpdate'
responses:
"200":
description: ""
security:
- ApiKeyAuth: []
summary: Update group
tags:
- System Group
x-panel-log:
BeforeFuntions: []
bodyKeys:
- name
- type
formatEN: update group [name][type]
formatZH: 更新组 [name][type]
paramKeys: []
/hosts:
post:
consumes:
@ -6153,8 +6270,8 @@ paths:
bodyKeys:
- port
- strategy
formatEN: create port rules {[strategy][port]}
formatZH: 添加端口规则 {[strategy] [port]}
formatEN: create port rules [strategy][port]
formatZH: 添加端口规则 [strategy] [port]
paramKeys: []
/hosts/firewall/search:
post:
@ -6218,123 +6335,6 @@ paths:
summary: Create group
tags:
- Firewall
/hosts/group:
post:
consumes:
- application/json
description: 创建系统组
parameters:
- description: request
in: body
name: request
required: true
schema:
$ref: '#/definitions/dto.GroupCreate'
responses:
"200":
description: ""
security:
- ApiKeyAuth: []
summary: Create group
tags:
- System Group
x-panel-log:
BeforeFuntions: []
bodyKeys:
- name
- type
formatEN: create group [name][type]
formatZH: 创建组 [name][type]
paramKeys: []
/hosts/group/del:
post:
consumes:
- application/json
description: 删除系统组
parameters:
- description: request
in: body
name: request
required: true
schema:
$ref: '#/definitions/dto.OperateByID'
responses:
"200":
description: ""
security:
- ApiKeyAuth: []
summary: Delete group
tags:
- System Group
x-panel-log:
BeforeFuntions:
- db: groups
input_colume: id
input_value: id
isList: false
output_colume: name
output_value: name
- db: groups
input_colume: id
input_value: id
isList: false
output_colume: type
output_value: type
bodyKeys:
- id
formatEN: delete group [type][name]
formatZH: 删除组 [type][name]
paramKeys: []
/hosts/group/search:
post:
consumes:
- application/json
description: 查询系统组
parameters:
- description: request
in: body
name: request
required: true
schema:
$ref: '#/definitions/dto.GroupSearch'
responses:
"200":
description: OK
schema:
type: anrry
security:
- ApiKeyAuth: []
summary: List groups
tags:
- System Group
/hosts/group/update:
post:
consumes:
- application/json
description: 更新系统组
parameters:
- description: request
in: body
name: request
required: true
schema:
$ref: '#/definitions/dto.GroupUpdate'
responses:
"200":
description: ""
security:
- ApiKeyAuth: []
summary: Update group
tags:
- System Group
x-panel-log:
BeforeFuntions: []
bodyKeys:
- name
- type
formatEN: update group [name][type]
formatZH: 更新组 [name][type]
paramKeys: []
/hosts/search:
post:
consumes:
@ -6421,6 +6421,34 @@ paths:
tags:
- Host
/hosts/update:
post:
consumes:
- application/json
description: 更新主机
parameters:
- description: request
in: body
name: request
required: true
schema:
$ref: '#/definitions/dto.HostOperate'
responses:
"200":
description: ""
security:
- ApiKeyAuth: []
summary: Update host
tags:
- Host
x-panel-log:
BeforeFuntions: []
bodyKeys:
- name
- addr
formatEN: update host [name][addr]
formatZH: 更新主机信息 [name][addr]
paramKeys: []
/hosts/update/group:
post:
consumes:
- application/json

View File

@ -694,6 +694,7 @@ const message = {
apps: 'App',
websites: 'Website',
containers: 'Container',
runtimes: 'Runtime',
commands: 'Command',
groups: 'System Group',
files: 'File Manage',

View File

@ -694,6 +694,7 @@ const message = {
apps: '应用',
websites: '网站',
containers: '容器',
runtimes: '运行环境',
groups: '系统组',
commands: '快捷命令',
files: '文件管理',