diff --git a/backend/app/service/app.go b/backend/app/service/app.go index cc7196b75..afb9b9a3d 100644 --- a/backend/app/service/app.go +++ b/backend/app/service/app.go @@ -390,7 +390,11 @@ func (a AppService) SyncAppListFromLocal() { if dirEntry.IsDir() { appDir := path.Join(localAppDir, dirEntry.Name()) appDirEntries, err := os.ReadDir(appDir) - app, err := handleLocalApp(localAppDir) + if err != nil { + global.LOG.Errorf(i18n.GetMsgWithMap("ErrAppDirNull", map[string]interface{}{"name": dirEntry.Name(), "err": err.Error()})) + continue + } + app, err := handleLocalApp(appDir) if err != nil { global.LOG.Errorf(i18n.GetMsgWithMap("LocalAppErr", map[string]interface{}{"name": dirEntry.Name(), "err": err.Error()})) continue @@ -491,29 +495,27 @@ func (a AppService) SyncAppListFromLocal() { tx, ctx := getTxAndContext() defer tx.Rollback() if len(newApps) > 0 { - if err := appRepo.BatchCreate(ctx, newApps); err != nil { + if err = appRepo.BatchCreate(ctx, newApps); err != nil { return } } for _, update := range updateApps { - if err := appRepo.Save(ctx, &update); err != nil { + if err = appRepo.Save(ctx, &update); err != nil { return } } if len(deleteApps) > 0 { - if err := appRepo.BatchDelete(ctx, deleteApps); err != nil { + if err = appRepo.BatchDelete(ctx, deleteApps); err != nil { return } - if err := appDetailRepo.DeleteByAppIds(ctx, deleteAppIds); err != nil { + if err = appDetailRepo.DeleteByAppIds(ctx, deleteAppIds); err != nil { return } } - if err := appTagRepo.DeleteByAppIds(ctx, oldAppIds); err != nil { + if err = appTagRepo.DeleteByAppIds(ctx, oldAppIds); err != nil { return } - var () - for _, newApp := range newApps { if newApp.ID > 0 { for _, detail := range newApp.Details { @@ -551,31 +553,31 @@ func (a AppService) SyncAppListFromLocal() { } if len(newAppDetails) > 0 { - if err := appDetailRepo.BatchCreate(ctx, newAppDetails); err != nil { + if err = appDetailRepo.BatchCreate(ctx, newAppDetails); err != nil { return } } for _, updateAppDetail := range updateDetails { - if err := appDetailRepo.Update(ctx, updateAppDetail); err != nil { + if err = appDetailRepo.Update(ctx, updateAppDetail); err != nil { return } } if len(deleteAppDetails) > 0 { - if err := appDetailRepo.BatchDelete(ctx, deleteAppDetails); err != nil { + if err = appDetailRepo.BatchDelete(ctx, deleteAppDetails); err != nil { return } } if len(oldAppIds) > 0 { - if err := appTagRepo.DeleteByAppIds(ctx, oldAppIds); err != nil { + if err = appTagRepo.DeleteByAppIds(ctx, oldAppIds); err != nil { return } } if len(appTags) > 0 { - if err := appTagRepo.BatchCreate(ctx, appTags); err != nil { + if err = appTagRepo.BatchCreate(ctx, appTags); err != nil { return } } diff --git a/backend/app/service/app_utils.go b/backend/app/service/app_utils.go index 86bbdb618..f96418798 100644 --- a/backend/app/service/app_utils.go +++ b/backend/app/service/app_utils.go @@ -664,11 +664,6 @@ func handleLocalAppDetail(versionDir string, appDetail *model.AppDetail) error { func handleLocalApp(appDir string) (app *model.App, err error) { fileOp := files.NewFileOp() - appDirEntries, err := os.ReadDir(appDir) - if err != nil || len(appDirEntries) == 0 { - err = errors.New("ErrAppDirNull") - return - } configYamlPath := path.Join(appDir, "data.yml") if !fileOp.Stat(configYamlPath) { err = errors.New(i18n.GetMsgWithMap("ErrFileNotFound", map[string]interface{}{"name": "data.yml"})) diff --git a/frontend/src/components/status/index.vue b/frontend/src/components/status/index.vue index 6788024fa..384d96c4e 100644 --- a/frontend/src/components/status/index.vue +++ b/frontend/src/components/status/index.vue @@ -27,6 +27,8 @@ const getType = (status: string) => { return 'success'; case 'stopped': return 'danger'; + case 'unhealthy': + return 'warning'; default: return ''; } diff --git a/frontend/src/views/app-store/installed/index.vue b/frontend/src/views/app-store/installed/index.vue index f56a52acf..4ef8c8b91 100644 --- a/frontend/src/views/app-store/installed/index.vue +++ b/frontend/src/views/app-store/installed/index.vue @@ -448,7 +448,7 @@ const openParam = (row: any) => { }; const isAppErr = (row: any) => { - return row.status.includes('Err') || row.status.includes('Error'); + return row.status.includes('Err') || row.status.includes('Error') || row.status.includes('UnHealthy'); }; const quickJump = () => {