diff --git a/pkg/kapis/openpitrix/v1/handler.go b/pkg/kapis/openpitrix/v1/handler.go index 761b88f93..ee3d452c9 100644 --- a/pkg/kapis/openpitrix/v1/handler.go +++ b/pkg/kapis/openpitrix/v1/handler.go @@ -406,10 +406,6 @@ func (h *openpitrixHandler) ListApps(req *restful.Request, resp *restful.Respons conditions.Match[openpitrix.WorkspaceLabel] = req.PathParameter("workspace") } - if conditions.Match[openpitrix.WorkspaceLabel] == "" { - conditions.Match[openpitrix.WorkspaceLabel] = req.QueryParameter("workspace") - } - result, err := h.openpitrix.ListApps(conditions, orderBy, reverse, limit, offset) if err != nil { diff --git a/pkg/models/openpitrix/utils.go b/pkg/models/openpitrix/utils.go index ba38f23b0..5352e9570 100644 --- a/pkg/models/openpitrix/utils.go +++ b/pkg/models/openpitrix/utils.go @@ -673,6 +673,17 @@ func filterApps(apps []*v1alpha1.HelmApplication, conditions *params.Conditions) return apps } + // filter app by param app_id + appIdMap := make(map[string]string) + if len(conditions.Match[AppId]) > 0 { + ids := strings.Split(conditions.Match[AppId], "|") + for _, id := range ids { + if len(id) > 0 { + appIdMap[id] = "" + } + } + } + curr := 0 for i := 0; i < len(apps); i++ { if conditions.Match[Keyword] != "" { @@ -682,6 +693,12 @@ func filterApps(apps []*v1alpha1.HelmApplication, conditions *params.Conditions) } } + if len(appIdMap) > 0 { + if _, exists := appIdMap[apps[i].Name]; !exists { + continue + } + } + if conditions.Match[Status] != "" { states := strings.Split(conditions.Match[Status], "|") fv := filterAppByStates(apps[i], states)