Skip to content

Commit

Permalink
Filter manifest works by name
Browse files Browse the repository at this point in the history
  • Loading branch information
zhujian7 committed Apr 18, 2024
1 parent c05e8a8 commit 1b16814
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions pkg/cmd/get/work/exec.go
Original file line number Diff line number Diff line change
Expand Up @@ -71,10 +71,11 @@ func (o *Options) run() (err error) {
if len(o.workName) > 0 {
listOpts.FieldSelector = fmt.Sprintf("metadata.name=%s", o.workName)
}
works, err := workClient.WorkV1().ManifestWorks(cluster).List(context.TODO(), metav1.ListOptions{})
works, err := workClient.WorkV1().ManifestWorks(cluster).List(context.TODO(), listOpts)
if err != nil {
return err
}

workList.Items = append(workList.Items, works.Items...)
}

Expand All @@ -88,13 +89,12 @@ func (o *Options) convertToTree(obj runtime.Object, tree *printer.TreePrinter) *
for _, work := range workList.Items {
cluster, number, applied, available := getFileds(work)
mp := make(map[string]interface{})
mp[".Cluster"] = cluster
mp[".Number of Manifests"] = number
mp[".Applied"] = applied
mp[".Available"] = available
tree.AddFileds(work.Name, &mp)
tree.AddFileds(fmt.Sprintf("%s.%s", cluster, work.Name), &mp)
workStatus := printer.WorkDetails(".Resources", &work)
tree.AddFileds(work.Name, &workStatus)
tree.AddFileds(fmt.Sprintf("%s.%s", cluster, work.Name), &workStatus)
}
}
return tree
Expand Down

0 comments on commit 1b16814

Please sign in to comment.