mirror of https://github.com/1Panel-dev/1Panel
fix: 数据库样式调整 (#2136)
parent
3da1b22a1b
commit
a948ece792
|
@ -9,14 +9,14 @@ import (
|
|||
)
|
||||
|
||||
// @Tags Database
|
||||
// @Summary Create remote database
|
||||
// @Summary Create database
|
||||
// @Description 创建远程数据库
|
||||
// @Accept json
|
||||
// @Param request body dto.DatabaseCreate true "request"
|
||||
// @Success 200
|
||||
// @Security ApiKeyAuth
|
||||
// @Router /databases/remote [post]
|
||||
// @x-panel-log {"bodyKeys":["name", "type"],"paramKeys":[],"BeforeFuntions":[],"formatZH":"创建远程数据库 [name][type]","formatEN":"create remote database [name][type]"}
|
||||
// @Router /databases/db [post]
|
||||
// @x-panel-log {"bodyKeys":["name", "type"],"paramKeys":[],"BeforeFuntions":[],"formatZH":"创建远程数据库 [name][type]","formatEN":"create database [name][type]"}
|
||||
func (b *BaseApi) CreateDatabase(c *gin.Context) {
|
||||
var req dto.DatabaseCreate
|
||||
if err := c.ShouldBindJSON(&req); err != nil {
|
||||
|
@ -35,14 +35,14 @@ func (b *BaseApi) CreateDatabase(c *gin.Context) {
|
|||
}
|
||||
|
||||
// @Tags Database
|
||||
// @Summary Check remote database
|
||||
// @Summary Check database
|
||||
// @Description 检测远程数据库连接性
|
||||
// @Accept json
|
||||
// @Param request body dto.DatabaseCreate true "request"
|
||||
// @Success 200
|
||||
// @Security ApiKeyAuth
|
||||
// @Router /databases/remote/check [post]
|
||||
// @x-panel-log {"bodyKeys":["name", "type"],"paramKeys":[],"BeforeFuntions":[],"formatZH":"检测远程数据库 [name][type] 连接性","formatEN":"check if remote database [name][type] is connectable"}
|
||||
// @Router /databases/db/check [post]
|
||||
// @x-panel-log {"bodyKeys":["name", "type"],"paramKeys":[],"BeforeFuntions":[],"formatZH":"检测远程数据库 [name][type] 连接性","formatEN":"check if database [name][type] is connectable"}
|
||||
func (b *BaseApi) CheckDatabase(c *gin.Context) {
|
||||
var req dto.DatabaseCreate
|
||||
if err := c.ShouldBindJSON(&req); err != nil {
|
||||
|
@ -57,13 +57,13 @@ func (b *BaseApi) CheckDatabase(c *gin.Context) {
|
|||
}
|
||||
|
||||
// @Tags Database
|
||||
// @Summary Page remote databases
|
||||
// @Summary Page databases
|
||||
// @Description 获取远程数据库列表分页
|
||||
// @Accept json
|
||||
// @Param request body dto.DatabaseSearch true "request"
|
||||
// @Success 200 {object} dto.PageResult
|
||||
// @Security ApiKeyAuth
|
||||
// @Router /databases/remote/search [post]
|
||||
// @Router /databases/db/search [post]
|
||||
func (b *BaseApi) SearchDatabase(c *gin.Context) {
|
||||
var req dto.DatabaseSearch
|
||||
if err := c.ShouldBindJSON(&req); err != nil {
|
||||
|
@ -84,11 +84,11 @@ func (b *BaseApi) SearchDatabase(c *gin.Context) {
|
|||
}
|
||||
|
||||
// @Tags Database
|
||||
// @Summary List remote databases
|
||||
// @Summary List databases
|
||||
// @Description 获取远程数据库列表
|
||||
// @Success 200 {array} dto.DatabaseOption
|
||||
// @Security ApiKeyAuth
|
||||
// @Router /databases/remote/list/:type [get]
|
||||
// @Router /databases/db/list/:type [get]
|
||||
func (b *BaseApi) ListDatabase(c *gin.Context) {
|
||||
dbType, err := helper.GetStrParamByKey(c, "type")
|
||||
if err != nil {
|
||||
|
@ -105,11 +105,11 @@ func (b *BaseApi) ListDatabase(c *gin.Context) {
|
|||
}
|
||||
|
||||
// @Tags Database
|
||||
// @Summary Get remote databases
|
||||
// @Summary Get databases
|
||||
// @Description 获取远程数据库
|
||||
// @Success 200 {object} dto.DatabaseInfo
|
||||
// @Security ApiKeyAuth
|
||||
// @Router /databases/remote/:name [get]
|
||||
// @Router /databases/db/:name [get]
|
||||
func (b *BaseApi) GetDatabase(c *gin.Context) {
|
||||
name, err := helper.GetStrParamByKey(c, "name")
|
||||
if err != nil {
|
||||
|
@ -126,14 +126,14 @@ func (b *BaseApi) GetDatabase(c *gin.Context) {
|
|||
}
|
||||
|
||||
// @Tags Database
|
||||
// @Summary Delete remote database
|
||||
// @Summary Delete database
|
||||
// @Description 删除远程数据库
|
||||
// @Accept json
|
||||
// @Param request body dto.OperateByID true "request"
|
||||
// @Success 200
|
||||
// @Security ApiKeyAuth
|
||||
// @Router /databases/remote/del [post]
|
||||
// @x-panel-log {"bodyKeys":["ids"],"paramKeys":[],"BeforeFuntions":[{"input_column":"id","input_value":"ids","isList":true,"db":"databases","output_column":"name","output_value":"names"}],"formatZH":"删除远程数据库 [names]","formatEN":"delete remote database [names]"}
|
||||
// @Router /databases/db/del [post]
|
||||
// @x-panel-log {"bodyKeys":["ids"],"paramKeys":[],"BeforeFuntions":[{"input_column":"id","input_value":"ids","isList":true,"db":"databases","output_column":"name","output_value":"names"}],"formatZH":"删除远程数据库 [names]","formatEN":"delete database [names]"}
|
||||
func (b *BaseApi) DeleteDatabase(c *gin.Context) {
|
||||
var req dto.OperateByID
|
||||
if err := c.ShouldBindJSON(&req); err != nil {
|
||||
|
@ -153,14 +153,14 @@ func (b *BaseApi) DeleteDatabase(c *gin.Context) {
|
|||
}
|
||||
|
||||
// @Tags Database
|
||||
// @Summary Update remote database
|
||||
// @Summary Update database
|
||||
// @Description 更新远程数据库
|
||||
// @Accept json
|
||||
// @Param request body dto.DatabaseUpdate true "request"
|
||||
// @Success 200
|
||||
// @Security ApiKeyAuth
|
||||
// @Router /databases/remote/update [post]
|
||||
// @x-panel-log {"bodyKeys":["name"],"paramKeys":[],"BeforeFuntions":[],"formatZH":"更新远程数据库 [name]","formatEN":"update remote database [name]"}
|
||||
// @Router /databases/db/update [post]
|
||||
// @x-panel-log {"bodyKeys":["name"],"paramKeys":[],"BeforeFuntions":[],"formatZH":"更新远程数据库 [name]","formatEN":"update database [name]"}
|
||||
func (b *BaseApi) UpdateDatabase(c *gin.Context) {
|
||||
var req dto.DatabaseUpdate
|
||||
if err := c.ShouldBindJSON(&req); err != nil {
|
||||
|
|
|
@ -28,6 +28,7 @@ type MysqlOption struct {
|
|||
ID uint `json:"id"`
|
||||
From string `json:"from"`
|
||||
Database string `json:"database"`
|
||||
Name string `json:"name"`
|
||||
}
|
||||
|
||||
type MysqlDBCreate struct {
|
||||
|
|
|
@ -124,7 +124,7 @@ func (u *DatabaseService) Delete(id uint) error {
|
|||
return err
|
||||
}
|
||||
if db.From != "local" {
|
||||
if err := mysqlRepo.Delete(context.Background(), databaseRepo.WithByFrom(db.Name)); err != nil {
|
||||
if err := mysqlRepo.Delete(context.Background(), mysqlRepo.WithByMysqlName(db.Name)); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
|
|
@ -80,6 +80,7 @@ func (u *MysqlService) ListDBOption() ([]dto.MysqlOption, error) {
|
|||
if err := copier.Copy(&item, &mysql); err != nil {
|
||||
return nil, errors.WithMessage(constant.ErrStructTransform, err.Error())
|
||||
}
|
||||
item.Database = mysql.MysqlName
|
||||
dbs = append(dbs, item)
|
||||
}
|
||||
return dbs, err
|
||||
|
@ -146,7 +147,7 @@ func (u *MysqlService) LoadFromRemote(req dto.MysqlLodaDB) error {
|
|||
for _, data := range datas {
|
||||
hasOld := false
|
||||
for _, oldData := range databases {
|
||||
if strings.EqualFold(oldData.Name, data.Name) {
|
||||
if strings.EqualFold(oldData.Name, data.Name) && strings.EqualFold(oldData.MysqlName, data.MysqlName) {
|
||||
hasOld = true
|
||||
break
|
||||
}
|
||||
|
|
|
@ -3882,6 +3882,268 @@ const docTemplate = `{
|
|||
}
|
||||
}
|
||||
},
|
||||
"/databases/db": {
|
||||
"post": {
|
||||
"security": [
|
||||
{
|
||||
"ApiKeyAuth": []
|
||||
}
|
||||
],
|
||||
"description": "创建远程数据库",
|
||||
"consumes": [
|
||||
"application/json"
|
||||
],
|
||||
"tags": [
|
||||
"Database"
|
||||
],
|
||||
"summary": "Create database",
|
||||
"parameters": [
|
||||
{
|
||||
"description": "request",
|
||||
"name": "request",
|
||||
"in": "body",
|
||||
"required": true,
|
||||
"schema": {
|
||||
"$ref": "#/definitions/dto.DatabaseCreate"
|
||||
}
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "OK"
|
||||
}
|
||||
},
|
||||
"x-panel-log": {
|
||||
"BeforeFuntions": [],
|
||||
"bodyKeys": [
|
||||
"name",
|
||||
"type"
|
||||
],
|
||||
"formatEN": "create database [name][type]",
|
||||
"formatZH": "创建远程数据库 [name][type]",
|
||||
"paramKeys": []
|
||||
}
|
||||
}
|
||||
},
|
||||
"/databases/db/:name": {
|
||||
"get": {
|
||||
"security": [
|
||||
{
|
||||
"ApiKeyAuth": []
|
||||
}
|
||||
],
|
||||
"description": "获取远程数据库",
|
||||
"tags": [
|
||||
"Database"
|
||||
],
|
||||
"summary": "Get databases",
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "OK",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/dto.DatabaseInfo"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/databases/db/check": {
|
||||
"post": {
|
||||
"security": [
|
||||
{
|
||||
"ApiKeyAuth": []
|
||||
}
|
||||
],
|
||||
"description": "检测远程数据库连接性",
|
||||
"consumes": [
|
||||
"application/json"
|
||||
],
|
||||
"tags": [
|
||||
"Database"
|
||||
],
|
||||
"summary": "Check database",
|
||||
"parameters": [
|
||||
{
|
||||
"description": "request",
|
||||
"name": "request",
|
||||
"in": "body",
|
||||
"required": true,
|
||||
"schema": {
|
||||
"$ref": "#/definitions/dto.DatabaseCreate"
|
||||
}
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "OK"
|
||||
}
|
||||
},
|
||||
"x-panel-log": {
|
||||
"BeforeFuntions": [],
|
||||
"bodyKeys": [
|
||||
"name",
|
||||
"type"
|
||||
],
|
||||
"formatEN": "check if database [name][type] is connectable",
|
||||
"formatZH": "检测远程数据库 [name][type] 连接性",
|
||||
"paramKeys": []
|
||||
}
|
||||
}
|
||||
},
|
||||
"/databases/db/del": {
|
||||
"post": {
|
||||
"security": [
|
||||
{
|
||||
"ApiKeyAuth": []
|
||||
}
|
||||
],
|
||||
"description": "删除远程数据库",
|
||||
"consumes": [
|
||||
"application/json"
|
||||
],
|
||||
"tags": [
|
||||
"Database"
|
||||
],
|
||||
"summary": "Delete database",
|
||||
"parameters": [
|
||||
{
|
||||
"description": "request",
|
||||
"name": "request",
|
||||
"in": "body",
|
||||
"required": true,
|
||||
"schema": {
|
||||
"$ref": "#/definitions/dto.OperateByID"
|
||||
}
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "OK"
|
||||
}
|
||||
},
|
||||
"x-panel-log": {
|
||||
"BeforeFuntions": [
|
||||
{
|
||||
"db": "databases",
|
||||
"input_column": "id",
|
||||
"input_value": "ids",
|
||||
"isList": true,
|
||||
"output_column": "name",
|
||||
"output_value": "names"
|
||||
}
|
||||
],
|
||||
"bodyKeys": [
|
||||
"ids"
|
||||
],
|
||||
"formatEN": "delete database [names]",
|
||||
"formatZH": "删除远程数据库 [names]",
|
||||
"paramKeys": []
|
||||
}
|
||||
}
|
||||
},
|
||||
"/databases/db/list/:type": {
|
||||
"get": {
|
||||
"security": [
|
||||
{
|
||||
"ApiKeyAuth": []
|
||||
}
|
||||
],
|
||||
"description": "获取远程数据库列表",
|
||||
"tags": [
|
||||
"Database"
|
||||
],
|
||||
"summary": "List databases",
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "OK",
|
||||
"schema": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"$ref": "#/definitions/dto.DatabaseOption"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/databases/db/search": {
|
||||
"post": {
|
||||
"security": [
|
||||
{
|
||||
"ApiKeyAuth": []
|
||||
}
|
||||
],
|
||||
"description": "获取远程数据库列表分页",
|
||||
"consumes": [
|
||||
"application/json"
|
||||
],
|
||||
"tags": [
|
||||
"Database"
|
||||
],
|
||||
"summary": "Page databases",
|
||||
"parameters": [
|
||||
{
|
||||
"description": "request",
|
||||
"name": "request",
|
||||
"in": "body",
|
||||
"required": true,
|
||||
"schema": {
|
||||
"$ref": "#/definitions/dto.DatabaseSearch"
|
||||
}
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "OK",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/dto.PageResult"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/databases/db/update": {
|
||||
"post": {
|
||||
"security": [
|
||||
{
|
||||
"ApiKeyAuth": []
|
||||
}
|
||||
],
|
||||
"description": "更新远程数据库",
|
||||
"consumes": [
|
||||
"application/json"
|
||||
],
|
||||
"tags": [
|
||||
"Database"
|
||||
],
|
||||
"summary": "Update database",
|
||||
"parameters": [
|
||||
{
|
||||
"description": "request",
|
||||
"name": "request",
|
||||
"in": "body",
|
||||
"required": true,
|
||||
"schema": {
|
||||
"$ref": "#/definitions/dto.DatabaseUpdate"
|
||||
}
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "OK"
|
||||
}
|
||||
},
|
||||
"x-panel-log": {
|
||||
"BeforeFuntions": [],
|
||||
"bodyKeys": [
|
||||
"name"
|
||||
],
|
||||
"formatEN": "update database [name]",
|
||||
"formatZH": "更新远程数据库 [name]",
|
||||
"paramKeys": []
|
||||
}
|
||||
}
|
||||
},
|
||||
"/databases/del": {
|
||||
"post": {
|
||||
"security": [
|
||||
|
@ -4423,225 +4685,6 @@ const docTemplate = `{
|
|||
}
|
||||
}
|
||||
},
|
||||
"/databases/remote/:name": {
|
||||
"get": {
|
||||
"security": [
|
||||
{
|
||||
"ApiKeyAuth": []
|
||||
}
|
||||
],
|
||||
"description": "获取远程数据库",
|
||||
"tags": [
|
||||
"Database"
|
||||
],
|
||||
"summary": "Get remote databases",
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "OK",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/dto.DatabaseInfo"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/databases/remote/check": {
|
||||
"post": {
|
||||
"security": [
|
||||
{
|
||||
"ApiKeyAuth": []
|
||||
}
|
||||
],
|
||||
"description": "检测远程数据库连接性",
|
||||
"consumes": [
|
||||
"application/json"
|
||||
],
|
||||
"tags": [
|
||||
"Database"
|
||||
],
|
||||
"summary": "Check remote database",
|
||||
"parameters": [
|
||||
{
|
||||
"description": "request",
|
||||
"name": "request",
|
||||
"in": "body",
|
||||
"required": true,
|
||||
"schema": {
|
||||
"$ref": "#/definitions/dto.DatabaseCreate"
|
||||
}
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "OK"
|
||||
}
|
||||
},
|
||||
"x-panel-log": {
|
||||
"BeforeFuntions": [],
|
||||
"bodyKeys": [
|
||||
"name",
|
||||
"type"
|
||||
],
|
||||
"formatEN": "check if remote database [name][type] is connectable",
|
||||
"formatZH": "检测远程数据库 [name][type] 连接性",
|
||||
"paramKeys": []
|
||||
}
|
||||
}
|
||||
},
|
||||
"/databases/remote/del": {
|
||||
"post": {
|
||||
"security": [
|
||||
{
|
||||
"ApiKeyAuth": []
|
||||
}
|
||||
],
|
||||
"description": "删除远程数据库",
|
||||
"consumes": [
|
||||
"application/json"
|
||||
],
|
||||
"tags": [
|
||||
"Database"
|
||||
],
|
||||
"summary": "Delete remote database",
|
||||
"parameters": [
|
||||
{
|
||||
"description": "request",
|
||||
"name": "request",
|
||||
"in": "body",
|
||||
"required": true,
|
||||
"schema": {
|
||||
"$ref": "#/definitions/dto.OperateByID"
|
||||
}
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "OK"
|
||||
}
|
||||
},
|
||||
"x-panel-log": {
|
||||
"BeforeFuntions": [
|
||||
{
|
||||
"db": "databases",
|
||||
"input_column": "id",
|
||||
"input_value": "ids",
|
||||
"isList": true,
|
||||
"output_column": "name",
|
||||
"output_value": "names"
|
||||
}
|
||||
],
|
||||
"bodyKeys": [
|
||||
"ids"
|
||||
],
|
||||
"formatEN": "delete remote database [names]",
|
||||
"formatZH": "删除远程数据库 [names]",
|
||||
"paramKeys": []
|
||||
}
|
||||
}
|
||||
},
|
||||
"/databases/remote/list/:type": {
|
||||
"get": {
|
||||
"security": [
|
||||
{
|
||||
"ApiKeyAuth": []
|
||||
}
|
||||
],
|
||||
"description": "获取远程数据库列表",
|
||||
"tags": [
|
||||
"Database"
|
||||
],
|
||||
"summary": "List remote databases",
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "OK",
|
||||
"schema": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"$ref": "#/definitions/dto.DatabaseOption"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/databases/remote/search": {
|
||||
"post": {
|
||||
"security": [
|
||||
{
|
||||
"ApiKeyAuth": []
|
||||
}
|
||||
],
|
||||
"description": "获取远程数据库列表分页",
|
||||
"consumes": [
|
||||
"application/json"
|
||||
],
|
||||
"tags": [
|
||||
"Database"
|
||||
],
|
||||
"summary": "Page remote databases",
|
||||
"parameters": [
|
||||
{
|
||||
"description": "request",
|
||||
"name": "request",
|
||||
"in": "body",
|
||||
"required": true,
|
||||
"schema": {
|
||||
"$ref": "#/definitions/dto.DatabaseSearch"
|
||||
}
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "OK",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/dto.PageResult"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/databases/remote/update": {
|
||||
"post": {
|
||||
"security": [
|
||||
{
|
||||
"ApiKeyAuth": []
|
||||
}
|
||||
],
|
||||
"description": "更新远程数据库",
|
||||
"consumes": [
|
||||
"application/json"
|
||||
],
|
||||
"tags": [
|
||||
"Database"
|
||||
],
|
||||
"summary": "Update remote database",
|
||||
"parameters": [
|
||||
{
|
||||
"description": "request",
|
||||
"name": "request",
|
||||
"in": "body",
|
||||
"required": true,
|
||||
"schema": {
|
||||
"$ref": "#/definitions/dto.DatabaseUpdate"
|
||||
}
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "OK"
|
||||
}
|
||||
},
|
||||
"x-panel-log": {
|
||||
"BeforeFuntions": [],
|
||||
"bodyKeys": [
|
||||
"name"
|
||||
],
|
||||
"formatEN": "update remote database [name]",
|
||||
"formatZH": "更新远程数据库 [name]",
|
||||
"paramKeys": []
|
||||
}
|
||||
}
|
||||
},
|
||||
"/databases/search": {
|
||||
"post": {
|
||||
"security": [
|
||||
|
@ -13642,6 +13685,9 @@ const docTemplate = `{
|
|||
},
|
||||
"id": {
|
||||
"type": "integer"
|
||||
},
|
||||
"name": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
},
|
||||
|
@ -14783,6 +14829,9 @@ const docTemplate = `{
|
|||
"accept",
|
||||
"drop"
|
||||
]
|
||||
},
|
||||
"type": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
},
|
||||
|
@ -16259,6 +16308,9 @@ const docTemplate = `{
|
|||
"type": "object",
|
||||
"additionalProperties": true
|
||||
},
|
||||
"rebuild": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"version": {
|
||||
"type": "string"
|
||||
}
|
||||
|
@ -16624,6 +16676,12 @@ const docTemplate = `{
|
|||
},
|
||||
"operate": {
|
||||
"type": "string"
|
||||
},
|
||||
"page": {
|
||||
"type": "integer"
|
||||
},
|
||||
"pageSize": {
|
||||
"type": "integer"
|
||||
}
|
||||
}
|
||||
},
|
||||
|
@ -17578,6 +17636,9 @@ const docTemplate = `{
|
|||
},
|
||||
"enable": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"end": {
|
||||
"type": "boolean"
|
||||
}
|
||||
}
|
||||
},
|
||||
|
|
|
@ -3875,6 +3875,268 @@
|
|||
}
|
||||
}
|
||||
},
|
||||
"/databases/db": {
|
||||
"post": {
|
||||
"security": [
|
||||
{
|
||||
"ApiKeyAuth": []
|
||||
}
|
||||
],
|
||||
"description": "创建远程数据库",
|
||||
"consumes": [
|
||||
"application/json"
|
||||
],
|
||||
"tags": [
|
||||
"Database"
|
||||
],
|
||||
"summary": "Create database",
|
||||
"parameters": [
|
||||
{
|
||||
"description": "request",
|
||||
"name": "request",
|
||||
"in": "body",
|
||||
"required": true,
|
||||
"schema": {
|
||||
"$ref": "#/definitions/dto.DatabaseCreate"
|
||||
}
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "OK"
|
||||
}
|
||||
},
|
||||
"x-panel-log": {
|
||||
"BeforeFuntions": [],
|
||||
"bodyKeys": [
|
||||
"name",
|
||||
"type"
|
||||
],
|
||||
"formatEN": "create database [name][type]",
|
||||
"formatZH": "创建远程数据库 [name][type]",
|
||||
"paramKeys": []
|
||||
}
|
||||
}
|
||||
},
|
||||
"/databases/db/:name": {
|
||||
"get": {
|
||||
"security": [
|
||||
{
|
||||
"ApiKeyAuth": []
|
||||
}
|
||||
],
|
||||
"description": "获取远程数据库",
|
||||
"tags": [
|
||||
"Database"
|
||||
],
|
||||
"summary": "Get databases",
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "OK",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/dto.DatabaseInfo"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/databases/db/check": {
|
||||
"post": {
|
||||
"security": [
|
||||
{
|
||||
"ApiKeyAuth": []
|
||||
}
|
||||
],
|
||||
"description": "检测远程数据库连接性",
|
||||
"consumes": [
|
||||
"application/json"
|
||||
],
|
||||
"tags": [
|
||||
"Database"
|
||||
],
|
||||
"summary": "Check database",
|
||||
"parameters": [
|
||||
{
|
||||
"description": "request",
|
||||
"name": "request",
|
||||
"in": "body",
|
||||
"required": true,
|
||||
"schema": {
|
||||
"$ref": "#/definitions/dto.DatabaseCreate"
|
||||
}
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "OK"
|
||||
}
|
||||
},
|
||||
"x-panel-log": {
|
||||
"BeforeFuntions": [],
|
||||
"bodyKeys": [
|
||||
"name",
|
||||
"type"
|
||||
],
|
||||
"formatEN": "check if database [name][type] is connectable",
|
||||
"formatZH": "检测远程数据库 [name][type] 连接性",
|
||||
"paramKeys": []
|
||||
}
|
||||
}
|
||||
},
|
||||
"/databases/db/del": {
|
||||
"post": {
|
||||
"security": [
|
||||
{
|
||||
"ApiKeyAuth": []
|
||||
}
|
||||
],
|
||||
"description": "删除远程数据库",
|
||||
"consumes": [
|
||||
"application/json"
|
||||
],
|
||||
"tags": [
|
||||
"Database"
|
||||
],
|
||||
"summary": "Delete database",
|
||||
"parameters": [
|
||||
{
|
||||
"description": "request",
|
||||
"name": "request",
|
||||
"in": "body",
|
||||
"required": true,
|
||||
"schema": {
|
||||
"$ref": "#/definitions/dto.OperateByID"
|
||||
}
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "OK"
|
||||
}
|
||||
},
|
||||
"x-panel-log": {
|
||||
"BeforeFuntions": [
|
||||
{
|
||||
"db": "databases",
|
||||
"input_column": "id",
|
||||
"input_value": "ids",
|
||||
"isList": true,
|
||||
"output_column": "name",
|
||||
"output_value": "names"
|
||||
}
|
||||
],
|
||||
"bodyKeys": [
|
||||
"ids"
|
||||
],
|
||||
"formatEN": "delete database [names]",
|
||||
"formatZH": "删除远程数据库 [names]",
|
||||
"paramKeys": []
|
||||
}
|
||||
}
|
||||
},
|
||||
"/databases/db/list/:type": {
|
||||
"get": {
|
||||
"security": [
|
||||
{
|
||||
"ApiKeyAuth": []
|
||||
}
|
||||
],
|
||||
"description": "获取远程数据库列表",
|
||||
"tags": [
|
||||
"Database"
|
||||
],
|
||||
"summary": "List databases",
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "OK",
|
||||
"schema": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"$ref": "#/definitions/dto.DatabaseOption"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/databases/db/search": {
|
||||
"post": {
|
||||
"security": [
|
||||
{
|
||||
"ApiKeyAuth": []
|
||||
}
|
||||
],
|
||||
"description": "获取远程数据库列表分页",
|
||||
"consumes": [
|
||||
"application/json"
|
||||
],
|
||||
"tags": [
|
||||
"Database"
|
||||
],
|
||||
"summary": "Page databases",
|
||||
"parameters": [
|
||||
{
|
||||
"description": "request",
|
||||
"name": "request",
|
||||
"in": "body",
|
||||
"required": true,
|
||||
"schema": {
|
||||
"$ref": "#/definitions/dto.DatabaseSearch"
|
||||
}
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "OK",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/dto.PageResult"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/databases/db/update": {
|
||||
"post": {
|
||||
"security": [
|
||||
{
|
||||
"ApiKeyAuth": []
|
||||
}
|
||||
],
|
||||
"description": "更新远程数据库",
|
||||
"consumes": [
|
||||
"application/json"
|
||||
],
|
||||
"tags": [
|
||||
"Database"
|
||||
],
|
||||
"summary": "Update database",
|
||||
"parameters": [
|
||||
{
|
||||
"description": "request",
|
||||
"name": "request",
|
||||
"in": "body",
|
||||
"required": true,
|
||||
"schema": {
|
||||
"$ref": "#/definitions/dto.DatabaseUpdate"
|
||||
}
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "OK"
|
||||
}
|
||||
},
|
||||
"x-panel-log": {
|
||||
"BeforeFuntions": [],
|
||||
"bodyKeys": [
|
||||
"name"
|
||||
],
|
||||
"formatEN": "update database [name]",
|
||||
"formatZH": "更新远程数据库 [name]",
|
||||
"paramKeys": []
|
||||
}
|
||||
}
|
||||
},
|
||||
"/databases/del": {
|
||||
"post": {
|
||||
"security": [
|
||||
|
@ -4416,225 +4678,6 @@
|
|||
}
|
||||
}
|
||||
},
|
||||
"/databases/remote/:name": {
|
||||
"get": {
|
||||
"security": [
|
||||
{
|
||||
"ApiKeyAuth": []
|
||||
}
|
||||
],
|
||||
"description": "获取远程数据库",
|
||||
"tags": [
|
||||
"Database"
|
||||
],
|
||||
"summary": "Get remote databases",
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "OK",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/dto.DatabaseInfo"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/databases/remote/check": {
|
||||
"post": {
|
||||
"security": [
|
||||
{
|
||||
"ApiKeyAuth": []
|
||||
}
|
||||
],
|
||||
"description": "检测远程数据库连接性",
|
||||
"consumes": [
|
||||
"application/json"
|
||||
],
|
||||
"tags": [
|
||||
"Database"
|
||||
],
|
||||
"summary": "Check remote database",
|
||||
"parameters": [
|
||||
{
|
||||
"description": "request",
|
||||
"name": "request",
|
||||
"in": "body",
|
||||
"required": true,
|
||||
"schema": {
|
||||
"$ref": "#/definitions/dto.DatabaseCreate"
|
||||
}
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "OK"
|
||||
}
|
||||
},
|
||||
"x-panel-log": {
|
||||
"BeforeFuntions": [],
|
||||
"bodyKeys": [
|
||||
"name",
|
||||
"type"
|
||||
],
|
||||
"formatEN": "check if remote database [name][type] is connectable",
|
||||
"formatZH": "检测远程数据库 [name][type] 连接性",
|
||||
"paramKeys": []
|
||||
}
|
||||
}
|
||||
},
|
||||
"/databases/remote/del": {
|
||||
"post": {
|
||||
"security": [
|
||||
{
|
||||
"ApiKeyAuth": []
|
||||
}
|
||||
],
|
||||
"description": "删除远程数据库",
|
||||
"consumes": [
|
||||
"application/json"
|
||||
],
|
||||
"tags": [
|
||||
"Database"
|
||||
],
|
||||
"summary": "Delete remote database",
|
||||
"parameters": [
|
||||
{
|
||||
"description": "request",
|
||||
"name": "request",
|
||||
"in": "body",
|
||||
"required": true,
|
||||
"schema": {
|
||||
"$ref": "#/definitions/dto.OperateByID"
|
||||
}
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "OK"
|
||||
}
|
||||
},
|
||||
"x-panel-log": {
|
||||
"BeforeFuntions": [
|
||||
{
|
||||
"db": "databases",
|
||||
"input_column": "id",
|
||||
"input_value": "ids",
|
||||
"isList": true,
|
||||
"output_column": "name",
|
||||
"output_value": "names"
|
||||
}
|
||||
],
|
||||
"bodyKeys": [
|
||||
"ids"
|
||||
],
|
||||
"formatEN": "delete remote database [names]",
|
||||
"formatZH": "删除远程数据库 [names]",
|
||||
"paramKeys": []
|
||||
}
|
||||
}
|
||||
},
|
||||
"/databases/remote/list/:type": {
|
||||
"get": {
|
||||
"security": [
|
||||
{
|
||||
"ApiKeyAuth": []
|
||||
}
|
||||
],
|
||||
"description": "获取远程数据库列表",
|
||||
"tags": [
|
||||
"Database"
|
||||
],
|
||||
"summary": "List remote databases",
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "OK",
|
||||
"schema": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"$ref": "#/definitions/dto.DatabaseOption"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/databases/remote/search": {
|
||||
"post": {
|
||||
"security": [
|
||||
{
|
||||
"ApiKeyAuth": []
|
||||
}
|
||||
],
|
||||
"description": "获取远程数据库列表分页",
|
||||
"consumes": [
|
||||
"application/json"
|
||||
],
|
||||
"tags": [
|
||||
"Database"
|
||||
],
|
||||
"summary": "Page remote databases",
|
||||
"parameters": [
|
||||
{
|
||||
"description": "request",
|
||||
"name": "request",
|
||||
"in": "body",
|
||||
"required": true,
|
||||
"schema": {
|
||||
"$ref": "#/definitions/dto.DatabaseSearch"
|
||||
}
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "OK",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/dto.PageResult"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/databases/remote/update": {
|
||||
"post": {
|
||||
"security": [
|
||||
{
|
||||
"ApiKeyAuth": []
|
||||
}
|
||||
],
|
||||
"description": "更新远程数据库",
|
||||
"consumes": [
|
||||
"application/json"
|
||||
],
|
||||
"tags": [
|
||||
"Database"
|
||||
],
|
||||
"summary": "Update remote database",
|
||||
"parameters": [
|
||||
{
|
||||
"description": "request",
|
||||
"name": "request",
|
||||
"in": "body",
|
||||
"required": true,
|
||||
"schema": {
|
||||
"$ref": "#/definitions/dto.DatabaseUpdate"
|
||||
}
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "OK"
|
||||
}
|
||||
},
|
||||
"x-panel-log": {
|
||||
"BeforeFuntions": [],
|
||||
"bodyKeys": [
|
||||
"name"
|
||||
],
|
||||
"formatEN": "update remote database [name]",
|
||||
"formatZH": "更新远程数据库 [name]",
|
||||
"paramKeys": []
|
||||
}
|
||||
}
|
||||
},
|
||||
"/databases/search": {
|
||||
"post": {
|
||||
"security": [
|
||||
|
@ -13635,6 +13678,9 @@
|
|||
},
|
||||
"id": {
|
||||
"type": "integer"
|
||||
},
|
||||
"name": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
},
|
||||
|
@ -14776,6 +14822,9 @@
|
|||
"accept",
|
||||
"drop"
|
||||
]
|
||||
},
|
||||
"type": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
},
|
||||
|
@ -16252,6 +16301,9 @@
|
|||
"type": "object",
|
||||
"additionalProperties": true
|
||||
},
|
||||
"rebuild": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"version": {
|
||||
"type": "string"
|
||||
}
|
||||
|
@ -16617,6 +16669,12 @@
|
|||
},
|
||||
"operate": {
|
||||
"type": "string"
|
||||
},
|
||||
"page": {
|
||||
"type": "integer"
|
||||
},
|
||||
"pageSize": {
|
||||
"type": "integer"
|
||||
}
|
||||
}
|
||||
},
|
||||
|
@ -17571,6 +17629,9 @@
|
|||
},
|
||||
"enable": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"end": {
|
||||
"type": "boolean"
|
||||
}
|
||||
}
|
||||
},
|
||||
|
|
|
@ -1357,6 +1357,8 @@ definitions:
|
|||
type: string
|
||||
id:
|
||||
type: integer
|
||||
name:
|
||||
type: string
|
||||
type: object
|
||||
dto.MysqlStatus:
|
||||
properties:
|
||||
|
@ -2117,6 +2119,8 @@ definitions:
|
|||
- accept
|
||||
- drop
|
||||
type: string
|
||||
type:
|
||||
type: string
|
||||
required:
|
||||
- strategy
|
||||
type: object
|
||||
|
@ -3102,6 +3106,8 @@ definitions:
|
|||
params:
|
||||
additionalProperties: true
|
||||
type: object
|
||||
rebuild:
|
||||
type: boolean
|
||||
version:
|
||||
type: string
|
||||
type: object
|
||||
|
@ -3346,6 +3352,10 @@ definitions:
|
|||
type: string
|
||||
operate:
|
||||
type: string
|
||||
page:
|
||||
type: integer
|
||||
pageSize:
|
||||
type: integer
|
||||
required:
|
||||
- id
|
||||
- logType
|
||||
|
@ -3986,6 +3996,8 @@ definitions:
|
|||
type: string
|
||||
enable:
|
||||
type: boolean
|
||||
end:
|
||||
type: boolean
|
||||
type: object
|
||||
response.WebsiteNginxConfig:
|
||||
properties:
|
||||
|
@ -6476,6 +6488,172 @@ paths:
|
|||
formatEN: update the mysql database configuration information
|
||||
formatZH: 更新 mysql 数据库配置信息
|
||||
paramKeys: []
|
||||
/databases/db:
|
||||
post:
|
||||
consumes:
|
||||
- application/json
|
||||
description: 创建远程数据库
|
||||
parameters:
|
||||
- description: request
|
||||
in: body
|
||||
name: request
|
||||
required: true
|
||||
schema:
|
||||
$ref: '#/definitions/dto.DatabaseCreate'
|
||||
responses:
|
||||
"200":
|
||||
description: OK
|
||||
security:
|
||||
- ApiKeyAuth: []
|
||||
summary: Create database
|
||||
tags:
|
||||
- Database
|
||||
x-panel-log:
|
||||
BeforeFuntions: []
|
||||
bodyKeys:
|
||||
- name
|
||||
- type
|
||||
formatEN: create database [name][type]
|
||||
formatZH: 创建远程数据库 [name][type]
|
||||
paramKeys: []
|
||||
/databases/db/:name:
|
||||
get:
|
||||
description: 获取远程数据库
|
||||
responses:
|
||||
"200":
|
||||
description: OK
|
||||
schema:
|
||||
$ref: '#/definitions/dto.DatabaseInfo'
|
||||
security:
|
||||
- ApiKeyAuth: []
|
||||
summary: Get databases
|
||||
tags:
|
||||
- Database
|
||||
/databases/db/check:
|
||||
post:
|
||||
consumes:
|
||||
- application/json
|
||||
description: 检测远程数据库连接性
|
||||
parameters:
|
||||
- description: request
|
||||
in: body
|
||||
name: request
|
||||
required: true
|
||||
schema:
|
||||
$ref: '#/definitions/dto.DatabaseCreate'
|
||||
responses:
|
||||
"200":
|
||||
description: OK
|
||||
security:
|
||||
- ApiKeyAuth: []
|
||||
summary: Check database
|
||||
tags:
|
||||
- Database
|
||||
x-panel-log:
|
||||
BeforeFuntions: []
|
||||
bodyKeys:
|
||||
- name
|
||||
- type
|
||||
formatEN: check if database [name][type] is connectable
|
||||
formatZH: 检测远程数据库 [name][type] 连接性
|
||||
paramKeys: []
|
||||
/databases/db/del:
|
||||
post:
|
||||
consumes:
|
||||
- application/json
|
||||
description: 删除远程数据库
|
||||
parameters:
|
||||
- description: request
|
||||
in: body
|
||||
name: request
|
||||
required: true
|
||||
schema:
|
||||
$ref: '#/definitions/dto.OperateByID'
|
||||
responses:
|
||||
"200":
|
||||
description: OK
|
||||
security:
|
||||
- ApiKeyAuth: []
|
||||
summary: Delete database
|
||||
tags:
|
||||
- Database
|
||||
x-panel-log:
|
||||
BeforeFuntions:
|
||||
- db: databases
|
||||
input_column: id
|
||||
input_value: ids
|
||||
isList: true
|
||||
output_column: name
|
||||
output_value: names
|
||||
bodyKeys:
|
||||
- ids
|
||||
formatEN: delete database [names]
|
||||
formatZH: 删除远程数据库 [names]
|
||||
paramKeys: []
|
||||
/databases/db/list/:type:
|
||||
get:
|
||||
description: 获取远程数据库列表
|
||||
responses:
|
||||
"200":
|
||||
description: OK
|
||||
schema:
|
||||
items:
|
||||
$ref: '#/definitions/dto.DatabaseOption'
|
||||
type: array
|
||||
security:
|
||||
- ApiKeyAuth: []
|
||||
summary: List databases
|
||||
tags:
|
||||
- Database
|
||||
/databases/db/search:
|
||||
post:
|
||||
consumes:
|
||||
- application/json
|
||||
description: 获取远程数据库列表分页
|
||||
parameters:
|
||||
- description: request
|
||||
in: body
|
||||
name: request
|
||||
required: true
|
||||
schema:
|
||||
$ref: '#/definitions/dto.DatabaseSearch'
|
||||
responses:
|
||||
"200":
|
||||
description: OK
|
||||
schema:
|
||||
$ref: '#/definitions/dto.PageResult'
|
||||
security:
|
||||
- ApiKeyAuth: []
|
||||
summary: Page databases
|
||||
tags:
|
||||
- Database
|
||||
/databases/db/update:
|
||||
post:
|
||||
consumes:
|
||||
- application/json
|
||||
description: 更新远程数据库
|
||||
parameters:
|
||||
- description: request
|
||||
in: body
|
||||
name: request
|
||||
required: true
|
||||
schema:
|
||||
$ref: '#/definitions/dto.DatabaseUpdate'
|
||||
responses:
|
||||
"200":
|
||||
description: OK
|
||||
security:
|
||||
- ApiKeyAuth: []
|
||||
summary: Update database
|
||||
tags:
|
||||
- Database
|
||||
x-panel-log:
|
||||
BeforeFuntions: []
|
||||
bodyKeys:
|
||||
- name
|
||||
formatEN: update database [name]
|
||||
formatZH: 更新远程数据库 [name]
|
||||
paramKeys: []
|
||||
/databases/del:
|
||||
post:
|
||||
consumes:
|
||||
|
@ -6816,144 +6994,6 @@ paths:
|
|||
summary: Load mysql remote access
|
||||
tags:
|
||||
- Database Mysql
|
||||
/databases/remote/:name:
|
||||
get:
|
||||
description: 获取远程数据库
|
||||
responses:
|
||||
"200":
|
||||
description: OK
|
||||
schema:
|
||||
$ref: '#/definitions/dto.DatabaseInfo'
|
||||
security:
|
||||
- ApiKeyAuth: []
|
||||
summary: Get remote databases
|
||||
tags:
|
||||
- Database
|
||||
/databases/remote/check:
|
||||
post:
|
||||
consumes:
|
||||
- application/json
|
||||
description: 检测远程数据库连接性
|
||||
parameters:
|
||||
- description: request
|
||||
in: body
|
||||
name: request
|
||||
required: true
|
||||
schema:
|
||||
$ref: '#/definitions/dto.DatabaseCreate'
|
||||
responses:
|
||||
"200":
|
||||
description: OK
|
||||
security:
|
||||
- ApiKeyAuth: []
|
||||
summary: Check remote database
|
||||
tags:
|
||||
- Database
|
||||
x-panel-log:
|
||||
BeforeFuntions: []
|
||||
bodyKeys:
|
||||
- name
|
||||
- type
|
||||
formatEN: check if remote database [name][type] is connectable
|
||||
formatZH: 检测远程数据库 [name][type] 连接性
|
||||
paramKeys: []
|
||||
/databases/remote/del:
|
||||
post:
|
||||
consumes:
|
||||
- application/json
|
||||
description: 删除远程数据库
|
||||
parameters:
|
||||
- description: request
|
||||
in: body
|
||||
name: request
|
||||
required: true
|
||||
schema:
|
||||
$ref: '#/definitions/dto.OperateByID'
|
||||
responses:
|
||||
"200":
|
||||
description: OK
|
||||
security:
|
||||
- ApiKeyAuth: []
|
||||
summary: Delete remote database
|
||||
tags:
|
||||
- Database
|
||||
x-panel-log:
|
||||
BeforeFuntions:
|
||||
- db: databases
|
||||
input_column: id
|
||||
input_value: ids
|
||||
isList: true
|
||||
output_column: name
|
||||
output_value: names
|
||||
bodyKeys:
|
||||
- ids
|
||||
formatEN: delete remote database [names]
|
||||
formatZH: 删除远程数据库 [names]
|
||||
paramKeys: []
|
||||
/databases/remote/list/:type:
|
||||
get:
|
||||
description: 获取远程数据库列表
|
||||
responses:
|
||||
"200":
|
||||
description: OK
|
||||
schema:
|
||||
items:
|
||||
$ref: '#/definitions/dto.DatabaseOption'
|
||||
type: array
|
||||
security:
|
||||
- ApiKeyAuth: []
|
||||
summary: List remote databases
|
||||
tags:
|
||||
- Database
|
||||
/databases/remote/search:
|
||||
post:
|
||||
consumes:
|
||||
- application/json
|
||||
description: 获取远程数据库列表分页
|
||||
parameters:
|
||||
- description: request
|
||||
in: body
|
||||
name: request
|
||||
required: true
|
||||
schema:
|
||||
$ref: '#/definitions/dto.DatabaseSearch'
|
||||
responses:
|
||||
"200":
|
||||
description: OK
|
||||
schema:
|
||||
$ref: '#/definitions/dto.PageResult'
|
||||
security:
|
||||
- ApiKeyAuth: []
|
||||
summary: Page remote databases
|
||||
tags:
|
||||
- Database
|
||||
/databases/remote/update:
|
||||
post:
|
||||
consumes:
|
||||
- application/json
|
||||
description: 更新远程数据库
|
||||
parameters:
|
||||
- description: request
|
||||
in: body
|
||||
name: request
|
||||
required: true
|
||||
schema:
|
||||
$ref: '#/definitions/dto.DatabaseUpdate'
|
||||
responses:
|
||||
"200":
|
||||
description: OK
|
||||
security:
|
||||
- ApiKeyAuth: []
|
||||
summary: Update remote database
|
||||
tags:
|
||||
- Database
|
||||
x-panel-log:
|
||||
BeforeFuntions: []
|
||||
bodyKeys:
|
||||
- name
|
||||
formatEN: update remote database [name]
|
||||
formatZH: 更新远程数据库 [name]
|
||||
paramKeys: []
|
||||
/databases/search:
|
||||
post:
|
||||
consumes:
|
||||
|
|
|
@ -133,8 +133,9 @@ export namespace Database {
|
|||
}
|
||||
export interface MysqlOption {
|
||||
id: number;
|
||||
name: string;
|
||||
from: string;
|
||||
database: string;
|
||||
name: string;
|
||||
}
|
||||
export interface ChangeInfo {
|
||||
id: number;
|
||||
|
|
|
@ -317,7 +317,7 @@ const message = {
|
|||
delete: 'Delete operation cannot be rolled back, please input "',
|
||||
deleteHelper: '" to delete this database',
|
||||
create: 'Create database',
|
||||
noMysql: 'No {0} database is detected, please go to App Store and click Install!',
|
||||
noMysql: 'Database service (MySQL or MariaDB)',
|
||||
goInstall: 'Go to install',
|
||||
source: 'Source',
|
||||
permission: 'Permission',
|
||||
|
|
|
@ -313,9 +313,7 @@ const message = {
|
|||
delete: '刪除操作無法回滾,請輸入 "',
|
||||
deleteHelper: '" 刪除此數據庫',
|
||||
create: '創建數據庫',
|
||||
noMysql: '當前未檢測到 {0} 數據庫,請進入應用商店點擊安裝!',
|
||||
mysqlBadStatus: '當前 mysql 應用狀態異常,請在',
|
||||
adjust: '中查看原因或修改配置',
|
||||
noMysql: '數據庫服務 (MySQL 或 MariaDB)',
|
||||
goInstall: '去應用商店安裝',
|
||||
source: '來源',
|
||||
permission: '權限',
|
||||
|
|
|
@ -313,9 +313,7 @@ const message = {
|
|||
delete: '删除操作无法回滚,请输入 "',
|
||||
deleteHelper: '" 删除此数据库',
|
||||
create: '创建数据库',
|
||||
noMysql: '当前未检测到 {0} 数据库,请进入应用商店点击安装!',
|
||||
mysqlBadStatus: '当前 mysql 应用状态异常,请在',
|
||||
adjust: '中查看原因或修改配置',
|
||||
noMysql: '数据库服务 (MySQL 或 MariaDB)',
|
||||
goInstall: '去应用商店安装',
|
||||
source: '来源',
|
||||
permission: '权限',
|
||||
|
|
|
@ -135,18 +135,12 @@
|
|||
<el-form-item :label="$t('cronjob.database')" prop="dbName">
|
||||
<el-select class="selectClass" clearable v-model="dialogData.rowData!.dbName">
|
||||
<el-option :label="$t('commons.table.all')" value="all" />
|
||||
<div v-for="item in mysqlInfo.dbs" :key="item.id">
|
||||
<el-option
|
||||
v-if="item.from === 'local'"
|
||||
:label="$t('database.localDB') + ' [' + item.name + ']'"
|
||||
:value="item.id + ''"
|
||||
/>
|
||||
<el-option
|
||||
v-else
|
||||
:label="item.from + ' [' + item.name + ']'"
|
||||
:value="item.id + ''"
|
||||
/>
|
||||
</div>
|
||||
<el-option
|
||||
v-for="item in mysqlInfo.dbs"
|
||||
:key="item.id"
|
||||
:label="item.database + ' [' + item.name + ']'"
|
||||
:value="item.id + ''"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</div>
|
||||
|
|
|
@ -419,11 +419,7 @@ const acceptParams = async (params: DialogProps): Promise<void> => {
|
|||
let itemDBs = data.data || [];
|
||||
for (const item of itemDBs) {
|
||||
if (item.id == dialogData.value.rowData.dbName) {
|
||||
if (item.from === 'local') {
|
||||
dialogData.value.rowData.dbName = i18n.global.t('database.localDB') + ' [' + item.name + ']';
|
||||
} else {
|
||||
dialogData.value.rowData.dbName = item.from + ' [' + item.name + ']';
|
||||
}
|
||||
dialogData.value.rowData.dbName = item.database + ' [' + item.name + ']';
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
<template>
|
||||
<div v-loading="loading">
|
||||
<div class="app-status" style="margin-top: 20px" v-if="!isLocal()">
|
||||
<div class="app-status" style="margin-top: 20px" v-if="currentDB?.from === 'remote'">
|
||||
<el-card>
|
||||
<div>
|
||||
<el-tag style="float: left" effect="dark" type="success">
|
||||
|
@ -10,9 +10,8 @@
|
|||
</div>
|
||||
</el-card>
|
||||
</div>
|
||||
|
||||
<LayoutContent :title="'MySQL ' + $t('menu.database')">
|
||||
<template #app v-if="mysqlIsExist && isLocal()">
|
||||
<template #app v-if="currentDB?.from === 'local'">
|
||||
<AppStatus
|
||||
:app-key="appKey"
|
||||
:app-name="appName"
|
||||
|
@ -23,7 +22,7 @@
|
|||
></AppStatus>
|
||||
</template>
|
||||
|
||||
<template #search>
|
||||
<template #search v-if="currentDB">
|
||||
<el-select v-model="currentDBName" @change="changeDatabase()">
|
||||
<template #prefix>{{ $t('commons.table.type') }}</template>
|
||||
<el-option-group :label="$t('database.local')" v-if="dbOptionsLocal.length !== 0">
|
||||
|
@ -31,7 +30,7 @@
|
|||
<el-option
|
||||
v-if="item.from === 'local'"
|
||||
:value="item.database"
|
||||
:label="item.database"
|
||||
:label="item.type + ' [' + item.database + ']'"
|
||||
></el-option>
|
||||
</div>
|
||||
</el-option-group>
|
||||
|
@ -40,7 +39,7 @@
|
|||
<el-option
|
||||
v-if="item.from === 'remote'"
|
||||
:value="item.database"
|
||||
:label="item.database"
|
||||
:label="item.type + ' [' + item.database + ']'"
|
||||
></el-option>
|
||||
</div>
|
||||
</el-option-group>
|
||||
|
@ -51,17 +50,22 @@
|
|||
<el-row>
|
||||
<el-col :xs="24" :sm="20" :md="20" :lg="20" :xl="20">
|
||||
<el-button
|
||||
v-if="(mysqlIsExist && mysqlStatus === 'Running') || !isLocal()"
|
||||
v-if="currentDB && (currentDB.from !== 'local' || mysqlStatus === 'Running')"
|
||||
type="primary"
|
||||
@click="onOpenDialog()"
|
||||
>
|
||||
{{ $t('database.create') }}
|
||||
</el-button>
|
||||
<el-button v-if="mysqlIsExist || !isLocal()" @click="onChangeConn" type="primary" plain>
|
||||
<el-button
|
||||
v-if="currentDB && (currentDB.from !== 'local' || mysqlStatus === 'Running')"
|
||||
@click="onChangeConn"
|
||||
type="primary"
|
||||
plain
|
||||
>
|
||||
{{ $t('database.databaseConnInfo') }}
|
||||
</el-button>
|
||||
<el-button
|
||||
v-if="(mysqlIsExist && mysqlStatus === 'Running') || !isLocal()"
|
||||
v-if="currentDB && (currentDB.from !== 'local' || mysqlStatus === 'Running')"
|
||||
@click="loadDB"
|
||||
type="primary"
|
||||
plain
|
||||
|
@ -71,15 +75,7 @@
|
|||
<el-button @click="goRemoteDB" type="primary" plain>
|
||||
{{ $t('database.remoteDB') }}
|
||||
</el-button>
|
||||
<el-button
|
||||
v-if="mysqlIsExist && mysqlStatus === 'Running' && isLocal()"
|
||||
@click="goDashboard"
|
||||
icon="Position"
|
||||
type="primary"
|
||||
plain
|
||||
>
|
||||
phpMyAdmin
|
||||
</el-button>
|
||||
<el-button @click="goDashboard" icon="Position" type="primary" plain>phpMyAdmin</el-button>
|
||||
</el-col>
|
||||
<el-col :xs="24" :sm="4" :md="4" :lg="4" :xl="4">
|
||||
<div class="search-button">
|
||||
|
@ -96,14 +92,8 @@
|
|||
</el-col>
|
||||
</el-row>
|
||||
</template>
|
||||
<template #main v-if="mysqlIsExist || !isLocal()">
|
||||
<ComplexTable
|
||||
:pagination-config="paginationConfig"
|
||||
@sort-change="search"
|
||||
@search="search"
|
||||
:data="data"
|
||||
:class="{ mask: mysqlStatus != 'Running' && isLocal() }"
|
||||
>
|
||||
<template #main v-if="currentDB">
|
||||
<ComplexTable :pagination-config="paginationConfig" @sort-change="search" @search="search" :data="data">
|
||||
<el-table-column :label="$t('commons.table.name')" prop="name" sortable />
|
||||
<el-table-column :label="$t('commons.login.username')" prop="username" />
|
||||
<el-table-column :label="$t('commons.login.password')" prop="password">
|
||||
|
@ -160,12 +150,12 @@
|
|||
</template>
|
||||
</LayoutContent>
|
||||
|
||||
<div v-if="!mysqlIsExist && isLocal()">
|
||||
<div v-if="!currentDB">
|
||||
<LayoutContent :title="'MySQL ' + $t('menu.database')" :divider="true">
|
||||
<template #main>
|
||||
<div class="app-warn">
|
||||
<div>
|
||||
<span>{{ $t('app.checkInstalledWarn', ['Mysql']) }}</span>
|
||||
<span>{{ $t('app.checkInstalledWarn', [$t('database.noMysql')]) }}</span>
|
||||
<span @click="goRouter">
|
||||
<el-icon><Position /></el-icon>
|
||||
{{ $t('database.goInstall') }}
|
||||
|
@ -179,10 +169,6 @@
|
|||
</LayoutContent>
|
||||
</div>
|
||||
|
||||
<el-card v-if="mysqlStatus != 'Running' && mysqlIsExist && !loading && maskShow && isLocal" class="mask-prompt">
|
||||
<span>{{ $t('commons.service.serviceNotStarted', ['MySQL']) }}</span>
|
||||
</el-card>
|
||||
|
||||
<el-dialog
|
||||
v-model="phpVisiable"
|
||||
:title="$t('app.checkTitle')"
|
||||
|
@ -273,7 +259,6 @@ const paginationConfig = reactive({
|
|||
});
|
||||
const searchName = ref();
|
||||
|
||||
const mysqlIsExist = ref(true);
|
||||
const mysqlContainer = ref();
|
||||
const mysqlStatus = ref();
|
||||
const mysqlVersion = ref();
|
||||
|
@ -304,13 +289,6 @@ const goRemoteDB = async () => {
|
|||
router.push({ name: 'MySQL-Remote' });
|
||||
};
|
||||
|
||||
function isLocal() {
|
||||
if (!currentDB.value) {
|
||||
return false;
|
||||
}
|
||||
return currentDB.value.from === 'local';
|
||||
}
|
||||
|
||||
const passwordRef = ref();
|
||||
|
||||
const onSetting = async () => {
|
||||
|
@ -402,14 +380,9 @@ const loadDashboardPort = async () => {
|
|||
};
|
||||
|
||||
const checkExist = (data: App.CheckInstalled) => {
|
||||
mysqlIsExist.value = data.isExist;
|
||||
mysqlStatus.value = data.status;
|
||||
mysqlVersion.value = data.version;
|
||||
mysqlContainer.value = data.containerName;
|
||||
if (mysqlIsExist.value) {
|
||||
search();
|
||||
loadDashboardPort();
|
||||
}
|
||||
};
|
||||
|
||||
const loadDBOptions = async () => {
|
||||
|
@ -430,6 +403,13 @@ const loadDBOptions = async () => {
|
|||
appKey.value = dbOptionsLocal.value[0].type;
|
||||
appName.value = dbOptionsLocal.value[0].database;
|
||||
}
|
||||
if (!currentDB.value && dbOptionsRemote.value.length !== 0) {
|
||||
currentDB.value = dbOptionsRemote.value[0];
|
||||
currentDBName.value = dbOptionsRemote.value[0].database;
|
||||
}
|
||||
if (currentDB.value) {
|
||||
search();
|
||||
}
|
||||
};
|
||||
|
||||
const onCopy = async (row: any) => {
|
||||
|
@ -539,6 +519,7 @@ const buttons = [
|
|||
|
||||
onMounted(() => {
|
||||
loadDBOptions();
|
||||
loadDashboardPort();
|
||||
});
|
||||
</script>
|
||||
|
||||
|
|
Loading…
Reference in New Issue