2
0
mirror of https://github.com/acepanel/panel.git synced 2026-02-07 11:57:17 +08:00

feat: 同步前端更改

This commit is contained in:
耗子
2023-10-30 03:25:27 +08:00
parent 462b2f96d3
commit f757862ebe
4 changed files with 50 additions and 21 deletions

View File

@@ -256,16 +256,23 @@ func (c *Postgresql15Controller) DatabaseList(ctx http.Context) http.Response {
return controllers.Error(ctx, http.StatusInternalServerError, "PostgreSQL 已停止运行")
}
raw := tools.Exec(`echo "\l" | su - postgres -c "psql"`)
databases := strings.Split(raw, "\n")
databases = databases[3 : len(databases)-1]
type database struct {
Name string `json:"name"`
Owner string `json:"owner"`
Encoding string `json:"encoding"`
}
raw := tools.Exec(`echo "\l" | su - postgres -c "psql"`)
databases := strings.Split(raw, "\n")
if len(databases) >= 4 {
databases = databases[3 : len(databases)-1]
} else {
return controllers.Success(ctx, http.Json{
"total": 0,
"items": []database{},
})
}
var databaseList []database
for _, db := range databases {
parts := strings.Split(db, "|")