Skip to content
This repository has been archived by the owner on Jul 16, 2021. It is now read-only.

Add search endpoint #609

Merged
merged 6 commits into from
Mar 11, 2019
Merged

Add search endpoint #609

merged 6 commits into from
Mar 11, 2019

Conversation

andresmgot
Copy link
Contributor

@andresmgot andresmgot commented Mar 7, 2019

Requires #605

This PR adds a /search endpoint to the chartsvc to mimic the same behavior that monocular does in the client side:

https://github.com/helm/monocular/blob/master/frontend/src/app/shared/services/charts.service.ts#L75

I have tested the changes manually but since the function is mostly a mongodb query there is nothing valuable that we can add as unit tests.

@helm-bot helm-bot added the size/M label Mar 7, 2019
Signed-off-by: Andres Martinez Gotor <[email protected]>
if params["repo"] != "" {
conditions["repo.name"] = params["repo"]
}
if err := db.C(chartCollection).Find(conditions).All(&charts); err != nil {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So if there are no matches MongoDB returns an error? Doesn't it just return an empty list with no error?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it doesn't return an error, it logs that the query didn't return any chart and it returns an empty list

cmd/chartsvc/main.go Outdated Show resolved Hide resolved
@prydonius
Copy link
Member

Looks like this PR is based on #605 as it's looking for uniqChartList?

cmd/chartsvc/handler.go:261:29: undefined: uniqChartList

cpoole pushed a commit to cpoole/monocular that referenced this pull request Mar 7, 2019
andresmgot and others added 3 commits March 8, 2019 12:22
* chartsvc: add support for pagination

Signed-off-by: Andres Martinez Gotor <[email protected]>

* Apply review changes. Pre-filter unique charts

Signed-off-by: Andres Martinez Gotor <[email protected]>

* Update kubeapps/common dep

Signed-off-by: Andres Martinez Gotor <[email protected]>

* Use aggregation to query unique charts. Apply other review comments

Signed-off-by: Andres Martinez Gotor <[email protected]>

* Count using the pipeline

Signed-off-by: Andres Martinez Gotor <[email protected]>

* Update common dep. Minor review

Signed-off-by: Andres Martinez Gotor <[email protected]>
* Signed-off-by: Himanshu Pandey <[email protected]>

Added check for empty charts

* Added Test case for Empty Charts

Signed-off-by: Himanshu Pandey <[email protected]>

* Corrected the test case

Signed-off-by: Himanshu Pandey <[email protected]>
Signed-off-by: Andres Martinez Gotor <[email protected]>
@helm-bot helm-bot added size/L and removed size/M labels Mar 8, 2019
@andresmgot
Copy link
Contributor Author

Looks like this PR is based on #605 as it's looking for uniqChartList?

Yes, I have rebased master now that that PR is merged.

Signed-off-by: Andres Martinez Gotor <[email protected]>
@helm-bot helm-bot added size/M and removed size/L labels Mar 8, 2019
Copy link
Member

@prydonius prydonius left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm, thanks!

cmd/chartsvc/handler.go Outdated Show resolved Hide resolved
Signed-off-by: Andres Martinez Gotor <[email protected]>
@helm-bot helm-bot added size/M and removed size/M labels Mar 11, 2019
@andresmgot
Copy link
Contributor Author

Merging this. Thanks for the review!

@andresmgot andresmgot merged commit 1d33d76 into helm:master Mar 11, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants