From 913c2bba261b061e5997e07bc4418ea0e42091e3 Mon Sep 17 00:00:00 2001 From: hysyeah Date: Fri, 3 Jan 2025 10:54:36 +0800 Subject: [PATCH] fix: missing app state initializing (#123) --- pkg/apiserver/handler_service.go | 5 +++-- pkg/constants/constants.go | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/pkg/apiserver/handler_service.go b/pkg/apiserver/handler_service.go index 90084c5..68cae24 100644 --- a/pkg/apiserver/handler_service.go +++ b/pkg/apiserver/handler_service.go @@ -146,7 +146,7 @@ func (h *Handler) listBackend(req *restful.Request, resp *restful.Response) { if am.Spec.Type != appv1alpha1.App { continue } - if am.Spec.AppOwner == owner && (am.Status.State == appv1alpha1.Downloading || am.Status.State == appv1alpha1.Installing) { + if am.Spec.AppOwner == owner && (am.Status.State == appv1alpha1.Pending || am.Status.State == appv1alpha1.Downloading || am.Status.State == appv1alpha1.Installing) { var appConfig appinstaller.ApplicationConfig err = json.Unmarshal([]byte(am.Spec.Config), &appConfig) if err != nil { @@ -164,13 +164,14 @@ func (h *Handler) listBackend(req *restful.Request, resp *restful.Response) { Spec: appv1alpha1.ApplicationSpec{ Name: am.Spec.AppName, Appid: utils.GetAppID(am.Spec.AppName), + IsSysApp: userspace.IsSysApp(am.Spec.AppName), Namespace: am.Spec.AppNamespace, Owner: owner, Entrances: appConfig.Entrances, Icon: appConfig.Icon, }, Status: appv1alpha1.ApplicationStatus{ - State: appv1alpha1.Installing.String(), + State: am.Status.State.String(), StatusTime: &now, UpdateTime: &now, }, diff --git a/pkg/constants/constants.go b/pkg/constants/constants.go index 6847936..b0785d4 100644 --- a/pkg/constants/constants.go +++ b/pkg/constants/constants.go @@ -99,7 +99,7 @@ const ( var ( empty = sets.Empty{} // States represents the state for whole application lifecycle. - States = sets.String{"pending": empty, "downloading": empty, "installing": empty, "running": empty, + States = sets.String{"pending": empty, "downloading": empty, "installing": empty, "initializing": empty, "running": empty, "uninstalling": empty, "upgrading": empty, "suspend": empty} // Sources represents the source of the application. Sources = sets.String{"market": empty, "custom": empty, "devbox": empty, "system": empty, "unknown": empty}