diff --git a/backend/app/repo/app.go b/backend/app/repo/app.go
index d9d875e23..9eb0c8ece 100644
--- a/backend/app/repo/app.go
+++ b/backend/app/repo/app.go
@@ -17,6 +17,7 @@ type IAppRepo interface {
OrderByRecommend() DBOption
GetRecommend() DBOption
WithResource(resource string) DBOption
+ WithLikeName(name string) DBOption
Page(page, size int, opts ...DBOption) (int64, []model.App, error)
GetFirst(opts ...DBOption) (model.App, error)
GetBy(opts ...DBOption) ([]model.App, error)
@@ -31,6 +32,15 @@ func NewIAppRepo() IAppRepo {
return &AppRepo{}
}
+func (a AppRepo) WithLikeName(name string) DBOption {
+ return func(g *gorm.DB) *gorm.DB {
+ if len(name) == 0 {
+ return g
+ }
+ return g.Where("name like ? or short_desc_zh like ? or short_desc_en like ?", "%"+name+"%", "%"+name+"%", "%"+name+"%")
+ }
+}
+
func (a AppRepo) WithKey(key string) DBOption {
return func(db *gorm.DB) *gorm.DB {
return db.Where("key = ?", key)
diff --git a/backend/app/repo/common.go b/backend/app/repo/common.go
index 9eb8a0a50..e6cf0b23f 100644
--- a/backend/app/repo/common.go
+++ b/backend/app/repo/common.go
@@ -92,7 +92,7 @@ func (c *CommonRepo) WithLikeName(name string) DBOption {
if len(name) == 0 {
return g
}
- return g.Where("name like ? or short_desc_zh like ? or short_desc_en like ?", "%"+name+"%", "%"+name+"%", "%"+name+"%")
+ return g.Where("name like ?", "%"+name+"%")
}
}
diff --git a/backend/app/service/app.go b/backend/app/service/app.go
index f069db890..1f1798334 100644
--- a/backend/app/service/app.go
+++ b/backend/app/service/app.go
@@ -53,7 +53,7 @@ func (a AppService) PageApp(req request.AppSearch) (interface{}, error) {
var opts []repo.DBOption
opts = append(opts, appRepo.OrderByRecommend())
if req.Name != "" {
- opts = append(opts, commonRepo.WithLikeName(req.Name))
+ opts = append(opts, appRepo.WithLikeName(req.Name))
}
if req.Type != "" {
opts = append(opts, appRepo.WithType(req.Type))
diff --git a/backend/app/service/app_install.go b/backend/app/service/app_install.go
index d13c6b152..30ebdd641 100644
--- a/backend/app/service/app_install.go
+++ b/backend/app/service/app_install.go
@@ -432,6 +432,9 @@ func (a *AppInstallService) SyncAll(systemInit bool) error {
func (a *AppInstallService) GetServices(key string) ([]response.AppService, error) {
var res []response.AppService
if DatabaseKeys[key] > 0 {
+ if key == constant.AppPostgres {
+ key = constant.AppPostgresql
+ }
dbs, _ := databaseRepo.GetList(commonRepo.WithByType(key))
if len(dbs) == 0 {
return res, nil
diff --git a/backend/app/service/app_utils.go b/backend/app/service/app_utils.go
index d33f95d7e..85bb7e3d7 100644
--- a/backend/app/service/app_utils.go
+++ b/backend/app/service/app_utils.go
@@ -110,12 +110,13 @@ func checkPortExist(port int) error {
}
var DatabaseKeys = map[string]uint{
- "mysql": 3306,
- "mariadb": 3306,
- "postgresql": 5432,
- "mongodb": 27017,
- "redis": 6379,
- "memcached": 11211,
+ constant.AppMysql: 3306,
+ constant.AppMariaDB: 3306,
+ constant.AppPostgresql: 5432,
+ constant.AppPostgres: 5432,
+ constant.AppMongodb: 27017,
+ constant.AppRedis: 6379,
+ constant.AppMemcached: 11211,
}
var ToolKeys = map[string]uint{
@@ -154,7 +155,7 @@ func createLink(ctx context.Context, app model.App, appInstall *model.AppInstall
}
switch app.Key {
- case "mysql", "mariadb", constant.AppPostgresql, "mongodb":
+ case constant.AppMysql, constant.AppMariaDB, constant.AppPostgresql, constant.AppMongodb:
if password, ok := params["PANEL_DB_ROOT_PASSWORD"]; ok {
if password != "" {
database.Password = password.(string)
@@ -176,7 +177,7 @@ func createLink(ctx context.Context, app model.App, appInstall *model.AppInstall
}
}
- case "redis":
+ case constant.AppRedis:
if password, ok := params["PANEL_REDIS_ROOT_PASSWORD"]; ok {
if password != "" {
authParam := dto.RedisAuthParam{
@@ -234,7 +235,7 @@ func createLink(ctx context.Context, app model.App, appInstall *model.AppInstall
var resourceId uint
if dbConfig.DbName != "" && dbConfig.DbUser != "" && dbConfig.Password != "" {
switch database.Type {
- case constant.AppPostgresql:
+ case constant.AppPostgresql, constant.AppPostgres:
iPostgresqlRepo := repo.NewIPostgresqlRepo()
oldPostgresqlDb, _ := iPostgresqlRepo.Get(commonRepo.WithByName(dbConfig.DbName), iPostgresqlRepo.WithByFrom(constant.ResourceLocal))
resourceId = oldPostgresqlDb.ID
@@ -256,7 +257,7 @@ func createLink(ctx context.Context, app model.App, appInstall *model.AppInstall
}
resourceId = pgdb.ID
}
- case "mysql", "mariadb":
+ case constant.AppMysql, constant.AppMariaDB:
iMysqlRepo := repo.NewIMysqlRepo()
oldMysqlDb, _ := iMysqlRepo.Get(commonRepo.WithByName(dbConfig.DbName), iMysqlRepo.WithByFrom(constant.ResourceLocal))
resourceId = oldMysqlDb.ID
diff --git a/backend/constant/app.go b/backend/constant/app.go
index 21b3b5218..91d27e4e7 100644
--- a/backend/constant/app.go
+++ b/backend/constant/app.go
@@ -19,11 +19,14 @@ const (
AppNormal = "Normal"
AppTakeDown = "TakeDown"
- AppOpenresty = "openresty"
- AppMysql = "mysql"
- AppMariaDB = "mariadb"
+ AppOpenresty = "openresty"
+ AppMysql = "mysql"
+ AppMariaDB = "mariadb"
AppPostgresql = "postgresql"
- AppRedis = "redis"
+ AppRedis = "redis"
+ AppPostgres = "postgres"
+ AppMongodb = "mongodb"
+ AppMemcached = "memcached"
AppResourceLocal = "local"
AppResourceRemote = "remote"
diff --git a/frontend/src/components/app-status/index.vue b/frontend/src/components/app-status/index.vue
index a03e3e942..1fa95a920 100644
--- a/frontend/src/components/app-status/index.vue
+++ b/frontend/src/components/app-status/index.vue
@@ -52,6 +52,7 @@
([]);
const appReq = reactive({
type: 'website',
page: 1,
- pageSize: 20,
+ pageSize: 100,
});
const apps = ref([]);
const appVersions = ref([]);