From f71ff7d80cdbe40131811f725e1c9e61a32cc5d4 Mon Sep 17 00:00:00 2001 From: zhengkunwang <31820853+zhengkunwang223@users.noreply.github.com> Date: Tue, 4 Mar 2025 15:18:04 +0800 Subject: [PATCH] feat: Restrict abnormal database selection during application installation (#8059) --- agent/app/dto/response/app.go | 1 + agent/app/service/ai.go | 2 +- agent/app/service/app.go | 23 +++++--- agent/app/service/app_install.go | 15 +++--- agent/app/service/app_utils.go | 50 ++++++++--------- agent/app/service/backup_record.go | 1 + agent/app/service/docker.go | 4 +- agent/app/service/snapshot_recover.go | 4 +- agent/app/service/website.go | 2 +- agent/app/service/website_ssl.go | 2 +- agent/constant/app.go | 17 ------ agent/constant/status.go | 54 +++++++++++-------- agent/i18n/lang/en.yaml | 2 +- agent/i18n/lang/ja.yaml | 1 + agent/i18n/lang/ko.yaml | 1 + agent/i18n/lang/ms.yml | 1 + agent/i18n/lang/pt-BR.yaml | 1 + agent/i18n/lang/ru.yaml | 1 + agent/i18n/lang/zh-Hant.yaml | 2 +- agent/i18n/lang/zh.yaml | 1 + agent/init/business/business.go | 2 +- frontend/src/api/interface/app.ts | 1 + frontend/src/components/log/task/index.vue | 3 ++ frontend/src/lang/modules/zh.ts | 6 +-- frontend/src/styles/common.scss | 4 ++ .../views/app-store/detail/params/index.vue | 24 ++++++--- .../src/views/app-store/setting/index.vue | 2 +- .../views/website/runtime/python/index.vue | 2 +- 28 files changed, 132 insertions(+), 97 deletions(-) diff --git a/agent/app/dto/response/app.go b/agent/app/dto/response/app.go index 81dfe8581..017c37efb 100644 --- a/agent/app/dto/response/app.go +++ b/agent/app/dto/response/app.go @@ -141,6 +141,7 @@ type AppService struct { Value string `json:"value"` Config interface{} `json:"config"` From string `json:"from"` + Status string `json:"status"` } type AppParam struct { diff --git a/agent/app/service/ai.go b/agent/app/service/ai.go index 8ce5907bb..c8962ce35 100644 --- a/agent/app/service/ai.go +++ b/agent/app/service/ai.go @@ -358,7 +358,7 @@ func LoadContainerName() (string, error) { if err != nil { return "", fmt.Errorf("ollama service is not found, err: %v", err) } - if ollamaBaseInfo.Status != constant.Running { + if ollamaBaseInfo.Status != constant.StatusRunning { return "", fmt.Errorf("container %s of ollama is not running, please check and retry!", ollamaBaseInfo.ContainerName) } return ollamaBaseInfo.ContainerName, nil diff --git a/agent/app/service/app.go b/agent/app/service/app.go index 561548bd7..733f4e333 100644 --- a/agent/app/service/app.go +++ b/agent/app/service/app.go @@ -373,6 +373,15 @@ func (a AppService) Install(req request.AppInstallCreate) (appInstall *model.App return } } + if hostName, ok := req.Params["PANEL_DB_HOST"]; ok { + database, _ := databaseRepo.Get(repo.WithByName(hostName.(string))) + if database.AppInstallID > 0 { + databaseInstall, _ := appInstallRepo.GetFirst(repo.WithByID(database.AppInstallID)) + if databaseInstall.Status != constant.StatusRunning { + return nil, buserr.WithName("ErrAppIsDown", databaseInstall.Name) + } + } + } if app.Key == "openresty" && app.Resource == "remote" && common.CompareVersion(appDetail.Version, "1.27") { if dir, ok := req.Params["WEBSITE_DIR"]; ok { siteDir := dir.(string) @@ -421,7 +430,7 @@ func (a AppService) Install(req request.AppInstallCreate) (appInstall *model.App AppId: appDetail.AppId, AppDetailId: appDetail.ID, Version: appDetail.Version, - Status: constant.Installing, + Status: constant.StatusInstalling, HttpPort: httpPort, HttpsPort: httpsPort, App: app, @@ -536,7 +545,7 @@ func (a AppService) Install(req request.AppInstallCreate) (appInstall *model.App } handleAppStatus := func(t *task.Task) { - appInstall.Status = constant.UpErr + appInstall.Status = constant.StatusUpErr appInstall.Message = installTask.Task.ErrorMsg _ = appInstallRepo.Save(context.Background(), appInstall) } @@ -545,7 +554,7 @@ func (a AppService) Install(req request.AppInstallCreate) (appInstall *model.App go func() { if taskErr := installTask.Execute(); taskErr != nil { - appInstall.Status = constant.InstallErr + appInstall.Status = constant.StatusInstallErr appInstall.Message = taskErr.Error() if strings.Contains(taskErr.Error(), "Timeout") && strings.Contains(taskErr.Error(), "Pulling") { appInstall.Message = buserr.New("PullImageTimeout").Error() + appInstall.Message @@ -808,7 +817,7 @@ func (a AppService) GetAppUpdate() (*response.AppUpdateRes, error) { if err != nil { return nil, err } - if setting.AppStoreSyncStatus == constant.Syncing { + if setting.AppStoreSyncStatus == constant.StatusSyncing { res.IsSyncing = true return res, nil } @@ -931,7 +940,7 @@ func (a AppService) SyncAppListFromRemote(taskID string) (err error) { list = updateRes.AppList } settingService := NewISettingService() - _ = settingService.Update("AppStoreSyncStatus", constant.Syncing) + _ = settingService.Update("AppStoreSyncStatus", constant.StatusSyncing) setting, err := settingService.GetSettingInfo() if err != nil { @@ -1156,7 +1165,7 @@ func (a AppService) SyncAppListFromRemote(taskID string) (err error) { } tx.Commit() - _ = settingService.Update("AppStoreSyncStatus", constant.SyncSuccess) + _ = settingService.Update("AppStoreSyncStatus", constant.StatusSyncSuccess) _ = settingService.Update("AppStoreLastModified", strconv.Itoa(list.LastModified)) t.Log(i18n.GetMsgByKey("AppStoreSyncSuccess")) return nil @@ -1165,7 +1174,7 @@ func (a AppService) SyncAppListFromRemote(taskID string) (err error) { go func() { if err = syncTask.Execute(); err != nil { _ = NewISettingService().Update("AppStoreLastModified", "0") - _ = NewISettingService().Update("AppStoreSyncStatus", constant.Error) + _ = NewISettingService().Update("AppStoreSyncStatus", constant.StatusError) } }() diff --git a/agent/app/service/app_install.go b/agent/app/service/app_install.go index 74727ec55..a2814b591 100644 --- a/agent/app/service/app_install.go +++ b/agent/app/service/app_install.go @@ -406,11 +406,11 @@ func (a *AppInstallService) Update(req request.AppInstalledUpdate) error { _ = fileOp.WriteFile(installed.GetComposePath(), strings.NewReader(backupDockerCompose), constant.DirPerm) return err } - installed.Status = constant.Running + installed.Status = constant.StatusRunning _ = appInstallRepo.Save(context.Background(), &installed) website, _ := websiteRepo.GetFirst(websiteRepo.WithAppInstallId(installed.ID)) - if changePort && website.ID != 0 && website.Status == constant.Running { + if changePort && website.ID != 0 && website.Status == constant.StatusRunning { go func() { nginxInstall, err := getNginxFull(&website) if err != nil { @@ -455,9 +455,9 @@ func (a *AppInstallService) SyncAll(systemInit bool) error { return err } for _, i := range allList { - if i.Status == constant.Installing || i.Status == constant.Upgrading || i.Status == constant.Rebuilding || i.Status == constant.Uninstalling { + if i.Status == constant.StatusInstalling || i.Status == constant.StatusUpgrading || i.Status == constant.StatusRebuilding || i.Status == constant.StatusUninstalling { if systemInit { - i.Status = constant.Error + i.Status = constant.StatusError i.Message = "1Panel restart causes the task to terminate" _ = appInstallRepo.Save(context.Background(), &i) } @@ -498,8 +498,10 @@ func (a *AppInstallService) GetServices(key string) ([]response.AppService, erro } service.Config = paramMap service.From = constant.AppResourceLocal + service.Status = install.Status } else { service.From = constant.AppResourceRemote + service.Status = constant.StatusRunning } res = append(res, service) } @@ -508,7 +510,7 @@ func (a *AppInstallService) GetServices(key string) ([]response.AppService, erro if err != nil { return nil, err } - installs, err := appInstallRepo.ListBy(appInstallRepo.WithAppId(app.ID), appInstallRepo.WithStatus(constant.Running)) + installs, err := appInstallRepo.ListBy(appInstallRepo.WithAppId(app.ID), appInstallRepo.WithStatus(constant.StatusRunning)) if err != nil { return nil, err } @@ -521,6 +523,7 @@ func (a *AppInstallService) GetServices(key string) ([]response.AppService, erro Label: install.Name, Value: install.ServiceName, Config: paramMap, + Status: install.Status, }) } } @@ -774,7 +777,7 @@ func (a *AppInstallService) GetParams(id uint) (*response.AppConfig, error) { } func syncAppInstallStatus(appInstall *model.AppInstall, force bool) error { - if appInstall.Status == constant.Installing || appInstall.Status == constant.Rebuilding || appInstall.Status == constant.Upgrading || appInstall.Status == constant.Uninstalling { + if appInstall.Status == constant.StatusInstalling || appInstall.Status == constant.StatusRebuilding || appInstall.Status == constant.StatusUpgrading || appInstall.Status == constant.StatusUninstalling { return nil } cli, err := docker.NewClient() diff --git a/agent/app/service/app_utils.go b/agent/app/service/app_utils.go index 627624cbb..df9b48f3a 100644 --- a/agent/app/service/app_utils.go +++ b/agent/app/service/app_utils.go @@ -333,7 +333,7 @@ func deleteAppInstall(deleteReq request.AppInstallDelete) error { } uninstall := func(t *task.Task) error { - install.Status = constant.Uninstalling + install.Status = constant.StatusUninstalling _ = appInstallRepo.Save(context.Background(), &install) dir, _ := os.Stat(appDir) if dir != nil { @@ -434,7 +434,7 @@ func deleteAppInstall(deleteReq request.AppInstallDelete) error { uninstallTask.AddSubTask(task.GetTaskName(install.Name, task.TaskUninstall, task.TaskScopeApp), uninstall, nil) go func() { if err := uninstallTask.Execute(); err != nil && !deleteReq.ForceDelete { - install.Status = constant.Error + install.Status = constant.StatusError _ = appInstallRepo.Save(context.Background(), &install) } }() @@ -554,7 +554,7 @@ func upgradeInstall(req request.AppInstallUpgrade) error { if err != nil { return err } - install.Status = constant.Upgrading + install.Status = constant.StatusUpgrading var ( upErr error @@ -747,7 +747,7 @@ func upgradeInstall(req request.AppInstallUpgrade) error { return err } t.LogSuccess(logStr) - install.Status = constant.Running + install.Status = constant.StatusRunning return appInstallRepo.Save(context.Background(), &install) } @@ -769,8 +769,8 @@ func upgradeInstall(req request.AppInstallUpgrade) error { err = upgradeTask.Execute() if err != nil { existInstall, _ := appInstallRepo.GetFirst(repo.WithByID(req.InstallID)) - if existInstall.ID > 0 && existInstall.Status != constant.Running { - existInstall.Status = constant.UpgradeErr + if existInstall.ID > 0 && existInstall.Status != constant.StatusRunning { + existInstall.Status = constant.StatusUpgradeErr existInstall.Message = err.Error() _ = appInstallRepo.Save(context.Background(), &existInstall) } @@ -889,7 +889,7 @@ func downloadApp(app model.App, appDetail model.AppDetail, appInstall *model.App defer func() { if err != nil { if appInstall != nil { - appInstall.Status = constant.DownloadErr + appInstall.Status = constant.StatusDownloadErr appInstall.Message = err.Error() } } @@ -1105,18 +1105,18 @@ func upApp(task *task.Task, appInstall *model.AppInstall, pullImages bool) error if appInstall.Message == "" { appInstall.Message = err.Error() } - appInstall.Status = constant.UpErr + appInstall.Status = constant.StatusUpErr _ = appInstallRepo.Save(context.Background(), appInstall) return err } else { - appInstall.Status = constant.Running + appInstall.Status = constant.StatusRunning _ = appInstallRepo.Save(context.Background(), appInstall) return nil } } func rebuildApp(appInstall model.AppInstall) error { - appInstall.Status = constant.Rebuilding + appInstall.Status = constant.StatusRebuilding _ = appInstallRepo.Save(context.Background(), &appInstall) go func() { dockerComposePath := appInstall.GetComposePath() @@ -1137,7 +1137,7 @@ func rebuildApp(appInstall model.AppInstall) error { } appInstall.ContainerName = strings.Join(containerNames, ",") - appInstall.Status = constant.Running + appInstall.Status = constant.StatusRunning _ = appInstallRepo.Save(context.Background(), &appInstall) }() return nil @@ -1336,24 +1336,24 @@ func handleErr(install model.AppInstall, err error, out string) error { install.Message = out reErr = errors.New(out) } - install.Status = constant.UpErr + install.Status = constant.StatusUpErr _ = appInstallRepo.Save(context.Background(), &install) return reErr } func doNotNeedSync(installed model.AppInstall) bool { - return installed.Status == constant.Installing || installed.Status == constant.Rebuilding || installed.Status == constant.Upgrading || - installed.Status == constant.Syncing || installed.Status == constant.Uninstalling || installed.Status == constant.InstallErr + return installed.Status == constant.StatusInstalling || installed.Status == constant.StatusRebuilding || installed.Status == constant.StatusUpgrading || + installed.Status == constant.StatusSyncing || installed.Status == constant.StatusUninstalling || installed.Status == constant.StatusInstallErr } func synAppInstall(containers map[string]types.Container, appInstall *model.AppInstall, force bool) { oldStatus := appInstall.Status containerNames := strings.Split(appInstall.ContainerName, ",") if len(containers) == 0 { - if appInstall.Status == constant.UpErr && !force { + if appInstall.Status == constant.StatusUpErr && !force { return } - appInstall.Status = constant.Error + appInstall.Status = constant.StatusError appInstall.Message = buserr.WithName("ErrContainerNotFound", strings.Join(containerNames, ",")).Error() _ = appInstallRepo.Save(context.Background(), appInstall) return @@ -1384,21 +1384,21 @@ func synAppInstall(containers map[string]types.Container, appInstall *model.AppI } switch { case exitedCount == total: - appInstall.Status = constant.Stopped + appInstall.Status = constant.StatusStopped case runningCount == total: - appInstall.Status = constant.Running - if oldStatus == constant.Running { + appInstall.Status = constant.StatusRunning + if oldStatus == constant.StatusRunning { return } case restartingCount == total: - appInstall.Status = constant.Restating + appInstall.Status = constant.StatusRestarting case pausedCount == total: - appInstall.Status = constant.Paused + appInstall.Status = constant.StatusPaused case len(notFoundNames) == total: - if appInstall.Status == constant.UpErr && !force { + if appInstall.Status == constant.StatusUpErr && !force { return } - appInstall.Status = constant.Error + appInstall.Status = constant.StatusError appInstall.Message = buserr.WithName("ErrContainerNotFound", strings.Join(notFoundNames, ",")).Error() default: var msg string @@ -1412,7 +1412,7 @@ func synAppInstall(containers map[string]types.Container, appInstall *model.AppI msg = buserr.New("ErrAppWarn").Error() } appInstall.Message = msg - appInstall.Status = constant.UnHealthy + appInstall.Status = constant.StatusUnHealthy } _ = appInstallRepo.Save(context.Background(), appInstall) } @@ -1761,7 +1761,7 @@ func getMajorVersion(version string) string { } func ignoreUpdate(installed model.AppInstall) bool { - if installed.App.Type == "php" || installed.Status == constant.Installing { + if installed.App.Type == "php" || installed.Status == constant.StatusInstalling { return true } if installed.App.Key == constant.AppMysql { diff --git a/agent/app/service/backup_record.go b/agent/app/service/backup_record.go index 430b74a20..28dcb871a 100644 --- a/agent/app/service/backup_record.go +++ b/agent/app/service/backup_record.go @@ -224,6 +224,7 @@ func (u *BackupRecordService) LoadRecordSize(req dto.SearchForSize) ([]dto.Recor default: _, records, err := backupRepo.PageRecord( req.Page, req.PageSize, + repo.WithOrderBy("created_at desc"), repo.WithByName(req.Name), repo.WithByType(req.Type), repo.WithByDetailName(req.DetailName), diff --git a/agent/app/service/docker.go b/agent/app/service/docker.go index 0997dbd8b..a9285180a 100644 --- a/agent/app/service/docker.go +++ b/agent/app/service/docker.go @@ -55,11 +55,11 @@ type logOption struct { func (u *DockerService) LoadDockerStatus() string { client, err := docker.NewDockerClient() if err != nil { - return constant.Stopped + return constant.StatusStopped } defer client.Close() if _, err := client.Ping(context.Background()); err != nil { - return constant.Stopped + return constant.StatusStopped } return constant.StatusRunning diff --git a/agent/app/service/snapshot_recover.go b/agent/app/service/snapshot_recover.go index 26eeb8d58..b9c3e5c16 100644 --- a/agent/app/service/snapshot_recover.go +++ b/agent/app/service/snapshot_recover.go @@ -303,13 +303,13 @@ func recoverAppData(src string, itemHelper *snapRecoverHelper) error { var wg sync.WaitGroup for i := 0; i < len(appInstalls); i++ { wg.Add(1) - appInstalls[i].Status = constant.Rebuilding + appInstalls[i].Status = constant.StatusRebuilding _ = appInstallRepo.Save(context.Background(), &appInstalls[i]) go func(app model.AppInstall) { defer wg.Done() dockerComposePath := app.GetComposePath() _, _ = compose.Up(dockerComposePath) - app.Status = constant.Running + app.Status = constant.StatusRunning _ = appInstallRepo.Save(context.Background(), &app) }(appInstalls[i]) } diff --git a/agent/app/service/website.go b/agent/app/service/website.go index e292523f0..8b5f5df18 100644 --- a/agent/app/service/website.go +++ b/agent/app/service/website.go @@ -1153,7 +1153,7 @@ func (w WebsiteService) PreInstallCheck(req request.WebsiteInstallCheckReq) ([]r Version: install.Version, AppName: install.App.Name, }) - if install.Status != constant.Running { + if install.Status != constant.StatusRunning { showErr = true } } diff --git a/agent/app/service/website_ssl.go b/agent/app/service/website_ssl.go index 2089735cf..ba7a47ce8 100644 --- a/agent/app/service/website_ssl.go +++ b/agent/app/service/website_ssl.go @@ -377,7 +377,7 @@ func (w WebsiteSSLService) ObtainSSL(apply request.WebsiteSSLApply) error { func handleError(websiteSSL *model.WebsiteSSL, err error) { if websiteSSL.Status == constant.SSLInit || websiteSSL.Status == constant.SSLError { - websiteSSL.Status = constant.Error + websiteSSL.Status = constant.StatusError } else { websiteSSL.Status = constant.SSLApplyError } diff --git a/agent/constant/app.go b/agent/constant/app.go index cec71937b..1dd023ad6 100644 --- a/agent/constant/app.go +++ b/agent/constant/app.go @@ -1,23 +1,6 @@ package constant const ( - Running = "Running" - UnHealthy = "UnHealthy" - Error = "Error" - Stopped = "Stopped" - Installing = "Installing" - DownloadErr = "DownloadErr" - Upgrading = "Upgrading" - UpgradeErr = "UpgradeErr" - Rebuilding = "Rebuilding" - Syncing = "Syncing" - SyncSuccess = "SyncSuccess" - Paused = "Paused" - UpErr = "UpErr" - InstallErr = "InstallErr" - Uninstalling = "Uninstalling" - Restating = "Restarting" - ContainerPrefix = "1Panel-" AppNormal = "Normal" diff --git a/agent/constant/status.go b/agent/constant/status.go index 835bd781f..186664471 100644 --- a/agent/constant/status.go +++ b/agent/constant/status.go @@ -1,27 +1,39 @@ package constant const ( - StatusRunning = "Running" - StatusCanceled = "Canceled" - StatusDone = "Done" - StatusWaiting = "Waiting" - StatusSuccess = "Success" - StatusFailed = "Failed" - StatusUploading = "Uploading" - StatusEnable = "Enable" - StatusDisable = "Disable" - StatusNone = "None" - StatusDeleted = "Deleted" - StatusExecuting = "Executing" - StatusBuilding = "Building" - StatusReCreating = "Recreating" - StatusStopped = "Stopped" - StatusCreating = "Creating" - StatusStartErr = "StartErr" - StatusNormal = "Normal" - StatusError = "Error" - StatusStarting = "Starting" - StatusRestarting = "ReStarting" + StatusRunning = "Running" + StatusCanceled = "Canceled" + StatusDone = "Done" + StatusWaiting = "Waiting" + StatusSuccess = "Success" + StatusFailed = "Failed" + StatusUploading = "Uploading" + StatusEnable = "Enable" + StatusDisable = "Disable" + StatusNone = "None" + StatusDeleted = "Deleted" + StatusExecuting = "Executing" + StatusBuilding = "Building" + StatusReCreating = "Recreating" + StatusStopped = "Stopped" + StatusCreating = "Creating" + StatusStartErr = "StartErr" + StatusNormal = "Normal" + StatusError = "Error" + StatusStarting = "Starting" + StatusRestarting = "ReStarting" + StatusUnHealthy = "UnHealthy" + StatusInstalling = "Installing" + StatusDownloadErr = "DownloadErr" + StatusUpgrading = "Upgrading" + StatusUpgradeErr = "UpgradeErr" + StatusRebuilding = "Rebuilding" + StatusSyncing = "Syncing" + StatusSyncSuccess = "SyncSuccess" + StatusPaused = "Paused" + StatusUpErr = "UpErr" + StatusInstallErr = "InstallErr" + StatusUninstalling = "Uninstalling" OrderDesc = "descending" OrderAsc = "ascending" diff --git a/agent/i18n/lang/en.yaml b/agent/i18n/lang/en.yaml index cba0909ad..8ad6a1b05 100644 --- a/agent/i18n/lang/en.yaml +++ b/agent/i18n/lang/en.yaml @@ -82,7 +82,7 @@ CustomAppStoreNotConfig: "Please configure the offline package address in the ap CustomAppStoreNotFound: "Failed to retrieve app store package, please check if it exists", CustomAppStoreFileValid: "App store package must be in .tar.gz format" PullImageTimeout: "Image pull timeout, please check the network and try again" - +ErrAppIsDown: "{{ .name }} application status is abnormal, please check" #file ErrFileCanNotRead: "File can not read" diff --git a/agent/i18n/lang/ja.yaml b/agent/i18n/lang/ja.yaml index facc6b46c..4d71d6c2a 100644 --- a/agent/i18n/lang/ja.yaml +++ b/agent/i18n/lang/ja.yaml @@ -74,6 +74,7 @@ PullImageStart: "画像の引っ張りを開始{{.name}}" PullImageSuccess: "画像が正常に引っ張られました" UpgradeAppStart: "アプリケーションのアップグレードを起動{{.name}}" UpgradeAppSuccess: "App {{.Name}}アップグレードされました" +ErrAppIsDown: "{{ .name }} アプリケーションの状態が異常です、確認してください" #file ErrFileCanNotRead: "ファイルは読み取れません" diff --git a/agent/i18n/lang/ko.yaml b/agent/i18n/lang/ko.yaml index 47515bfa1..9624cd6dc 100644 --- a/agent/i18n/lang/ko.yaml +++ b/agent/i18n/lang/ko.yaml @@ -75,6 +75,7 @@ PullImageStart: "이미지 {{ .name }} 가져오기 시작" PullImageSuccess: "이미지 가져오기 성공" UpgradeAppStart: "애플리케이션 {{ .name }} 업그레이드 시작" UpgradeAppSuccess: "앱 {{ .name }} 업그레이드 성공" +ErrAppIsDown: "{{ .name }} 애플리케이션 상태가 비정상입니다. 확인하세요" # 파일 ErrFileCanNotRead: "파일을 읽을 수 없습니다" diff --git a/agent/i18n/lang/ms.yml b/agent/i18n/lang/ms.yml index e04581e33..34d78e8b0 100644 --- a/agent/i18n/lang/ms.yml +++ b/agent/i18n/lang/ms.yml @@ -75,6 +75,7 @@ PullImageStart: "Memulakan penarikan imej {{ .name }}" PullImageSuccess: "Imej berjaya ditarik" UpgradeAppStart: "Memulakan peningkatan aplikasi {{ .name }}" UpgradeAppSuccess: "Aplikasi {{ .name }} berjaya dinaik taraf" +ErrAppIsDown: "{{ .name }} status aplikasi tidak normal, sila periksa" #file ErrFileCanNotRead: "Fail tidak boleh dibaca" diff --git a/agent/i18n/lang/pt-BR.yaml b/agent/i18n/lang/pt-BR.yaml index 571ccf604..6e6c80acd 100644 --- a/agent/i18n/lang/pt-BR.yaml +++ b/agent/i18n/lang/pt-BR.yaml @@ -74,6 +74,7 @@ PullImageStart: "Iniciando o download da imagem {{ .name }}" PullImageSuccess: "Imagem baixada com sucesso" UpgradeAppStart: "Iniciando a atualização do aplicativo {{ .name }}" UpgradeAppSuccess: "Aplicativo {{ .name }} atualizado com sucesso" +ErrAppIsDown: "{{ .name }} status do aplicativo é anormal, por favor, verifique" #file ErrFileCanNotRead: "Não foi possível ler o arquivo" diff --git a/agent/i18n/lang/ru.yaml b/agent/i18n/lang/ru.yaml index 55cd3320e..089b8ac8c 100644 --- a/agent/i18n/lang/ru.yaml +++ b/agent/i18n/lang/ru.yaml @@ -75,6 +75,7 @@ PullImageStart: "Начало загрузки образа {{ .name }}" PullImageSuccess: "Образ успешно загружен" UpgradeAppStart: "Начало обновления приложения {{ .name }}" UpgradeAppSuccess: "Приложение {{ .name }} успешно обновлено" +ErrAppIsDown: "{{ .name }} статус приложения аномальный, пожалуйста, проверьте" #file ErrFileCanNotRead: "Файл недоступен для чтения" diff --git a/agent/i18n/lang/zh-Hant.yaml b/agent/i18n/lang/zh-Hant.yaml index fe4e9a7ec..f45c97e26 100644 --- a/agent/i18n/lang/zh-Hant.yaml +++ b/agent/i18n/lang/zh-Hant.yaml @@ -87,7 +87,7 @@ CustomAppStoreNotConfig: "請在應用商店設置離線包地址", CustomAppStoreNotFound: "應用商店包獲取失敗,請檢查是否存在", CustomAppStoreFileValid: "應用商店包需要 .tar.gz 格式" PullImageTimeout: "拉取鏡像超時,請嘗試增加鏡像加速或更換其他鏡像加速" - +ErrAppIsDown: "{{ .name }} 應用狀態異常,請檢查" #file ErrFileCanNotRead: "此文件不支持預覽" diff --git a/agent/i18n/lang/zh.yaml b/agent/i18n/lang/zh.yaml index ec88e5ab4..c3e53d90b 100644 --- a/agent/i18n/lang/zh.yaml +++ b/agent/i18n/lang/zh.yaml @@ -95,6 +95,7 @@ CustomAppStoreNotConfig: "请在应用商店设置离线包地址" CustomAppStoreNotFound: "应用商店包获取失败,请检查是否存在" CustomAppStoreFileValid: "应用商店包需要 .tar.gz 格式" PullImageTimeout: "拉取镜像超时,请尝试增加镜像加速或者更换其他镜像加速" +ErrAppIsDown: "{{ .name }} 应用状态异常,请检查" #file ErrFileCanNotRead: "此文件不支持预览" diff --git a/agent/init/business/business.go b/agent/init/business/business.go index 79836c256..acb7761d2 100644 --- a/agent/init/business/business.go +++ b/agent/init/business/business.go @@ -15,7 +15,7 @@ func Init() { } func syncApp() { - _ = service.NewISettingService().Update("AppStoreSyncStatus", constant.SyncSuccess) + _ = service.NewISettingService().Update("AppStoreSyncStatus", constant.StatusSyncSuccess) if err := service.NewIAppService().SyncAppListFromRemote(""); err != nil { global.LOG.Errorf("App Store synchronization failed") return diff --git a/frontend/src/api/interface/app.ts b/frontend/src/api/interface/app.ts index 2119f4f34..3b3787347 100644 --- a/frontend/src/api/interface/app.ts +++ b/frontend/src/api/interface/app.ts @@ -222,6 +222,7 @@ export namespace App { value: string; config?: Object; from?: string; + status: string; } export interface VersionDetail { diff --git a/frontend/src/components/log/task/index.vue b/frontend/src/components/log/task/index.vue index 8ef5a3ac9..f3c73e2f3 100644 --- a/frontend/src/components/log/task/index.vue +++ b/frontend/src/components/log/task/index.vue @@ -16,6 +16,7 @@