Merge pull request #3721 from xyz-li/app-fix1
Fix: filter app by app_id
This commit is contained in:
@@ -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 {
|
||||
|
||||
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user