diff --git a/backend/app/api/v1/database.go b/backend/app/api/v1/database.go
index b28c1817f..55ee76869 100644
--- a/backend/app/api/v1/database.go
+++ b/backend/app/api/v1/database.go
@@ -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 {
diff --git a/backend/app/dto/database.go b/backend/app/dto/database.go
index 589e79042..6317590fa 100644
--- a/backend/app/dto/database.go
+++ b/backend/app/dto/database.go
@@ -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 {
diff --git a/backend/app/service/database.go b/backend/app/service/database.go
index 39a6c541f..0aab85c66 100644
--- a/backend/app/service/database.go
+++ b/backend/app/service/database.go
@@ -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
}
}
diff --git a/backend/app/service/database_mysql.go b/backend/app/service/database_mysql.go
index 768c75732..9caa77c6f 100644
--- a/backend/app/service/database_mysql.go
+++ b/backend/app/service/database_mysql.go
@@ -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
}
diff --git a/cmd/server/docs/docs.go b/cmd/server/docs/docs.go
index 968abdc14..04fd5e1bd 100644
--- a/cmd/server/docs/docs.go
+++ b/cmd/server/docs/docs.go
@@ -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"
}
}
},
diff --git a/cmd/server/docs/swagger.json b/cmd/server/docs/swagger.json
index f84067e80..20bfdf3d9 100644
--- a/cmd/server/docs/swagger.json
+++ b/cmd/server/docs/swagger.json
@@ -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"
}
}
},
diff --git a/cmd/server/docs/swagger.yaml b/cmd/server/docs/swagger.yaml
index e51ee5b3d..2b21b96ae 100644
--- a/cmd/server/docs/swagger.yaml
+++ b/cmd/server/docs/swagger.yaml
@@ -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:
diff --git a/frontend/src/api/interface/database.ts b/frontend/src/api/interface/database.ts
index f18d17b80..ea7b2cd86 100644
--- a/frontend/src/api/interface/database.ts
+++ b/frontend/src/api/interface/database.ts
@@ -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;
diff --git a/frontend/src/lang/modules/en.ts b/frontend/src/lang/modules/en.ts
index 8e834f966..7114bb66c 100644
--- a/frontend/src/lang/modules/en.ts
+++ b/frontend/src/lang/modules/en.ts
@@ -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',
diff --git a/frontend/src/lang/modules/tw.ts b/frontend/src/lang/modules/tw.ts
index d35340f95..bd26e15c6 100644
--- a/frontend/src/lang/modules/tw.ts
+++ b/frontend/src/lang/modules/tw.ts
@@ -313,9 +313,7 @@ const message = {
delete: '刪除操作無法回滾,請輸入 "',
deleteHelper: '" 刪除此數據庫',
create: '創建數據庫',
- noMysql: '當前未檢測到 {0} 數據庫,請進入應用商店點擊安裝!',
- mysqlBadStatus: '當前 mysql 應用狀態異常,請在',
- adjust: '中查看原因或修改配置',
+ noMysql: '數據庫服務 (MySQL 或 MariaDB)',
goInstall: '去應用商店安裝',
source: '來源',
permission: '權限',
diff --git a/frontend/src/lang/modules/zh.ts b/frontend/src/lang/modules/zh.ts
index 9dd8f70ed..7dacdc308 100644
--- a/frontend/src/lang/modules/zh.ts
+++ b/frontend/src/lang/modules/zh.ts
@@ -313,9 +313,7 @@ const message = {
delete: '删除操作无法回滚,请输入 "',
deleteHelper: '" 删除此数据库',
create: '创建数据库',
- noMysql: '当前未检测到 {0} 数据库,请进入应用商店点击安装!',
- mysqlBadStatus: '当前 mysql 应用状态异常,请在',
- adjust: '中查看原因或修改配置',
+ noMysql: '数据库服务 (MySQL 或 MariaDB)',
goInstall: '去应用商店安装',
source: '来源',
permission: '权限',
diff --git a/frontend/src/views/cronjob/operate/index.vue b/frontend/src/views/cronjob/operate/index.vue
index 1f903f20f..3de2d2acc 100644
--- a/frontend/src/views/cronjob/operate/index.vue
+++ b/frontend/src/views/cronjob/operate/index.vue
@@ -135,18 +135,12 @@
-
-
-
-
+
diff --git a/frontend/src/views/cronjob/record/index.vue b/frontend/src/views/cronjob/record/index.vue
index f993f9ad6..9c4832198 100644
--- a/frontend/src/views/cronjob/record/index.vue
+++ b/frontend/src/views/cronjob/record/index.vue
@@ -419,11 +419,7 @@ const acceptParams = async (params: DialogProps): Promise => {
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;
}
}
diff --git a/frontend/src/views/database/mysql/index.vue b/frontend/src/views/database/mysql/index.vue
index 323a70bb8..7bd0d548c 100644
--- a/frontend/src/views/database/mysql/index.vue
+++ b/frontend/src/views/database/mysql/index.vue
@@ -1,6 +1,6 @@
-
+
-
-
+
-
+
{{ $t('commons.table.type') }}
@@ -31,7 +30,7 @@
@@ -40,7 +39,7 @@
@@ -51,17 +50,22 @@
{{ $t('database.create') }}
-
+
{{ $t('database.databaseConnInfo') }}
{{ $t('database.remoteDB') }}
-
- phpMyAdmin
-
+ phpMyAdmin