-
Notifications
You must be signed in to change notification settings - Fork 29
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(marketplace): add optional sorting, filtering, pagination to marketplace api #332
base: main
Are you sure you want to change the base?
feat(marketplace): add optional sorting, filtering, pagination to marketplace api #332
Conversation
Changed Packages
|
Signed-off-by: its-mitesh-kumar <[email protected]>
Signed-off-by: its-mitesh-kumar <[email protected]>
f80409a
to
9885613
Compare
Signed-off-by: its-mitesh-kumar <[email protected]>
Resolves : https://issues.redhat.com/browse/RHIDP-5329 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks! As discussed some improvement ideas :)
workspaces/marketplace/plugins/marketplace-backend/src/router.ts
Outdated
Show resolved
Hide resolved
workspaces/marketplace/plugins/marketplace/src/api/MarketplaceBackendClient.tsx
Outdated
Show resolved
Hide resolved
Signed-off-by: its-mitesh-kumar <[email protected]>
@karthikjeeyar @christoph-jerolimov I have implemented like
|
Signed-off-by: its-mitesh-kumar <[email protected]>
const filter: EntityFilterQuery = query?.filter | ||
? { | ||
...(typeof query.filter === 'string' | ||
? JSON.parse(query.filter) | ||
: query.filter), | ||
...RequiredFilter, | ||
} | ||
: RequiredFilter; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You could reuse decodeFilterParams
from /utils/decodeQueryParams.ts
here.
return params; | ||
}; | ||
|
||
export const convertSearchParamsToGetPluginsRequest = ( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it will be good to extend the generic encodeQueryParams
function to handle more fields, Instead of having it's own version for GetPluginsRequest. This way we can reuse the function for other API like PluginLists, Packages etc.
workspaces/marketplace/plugins/marketplace-common/src/api/MarketplaceCatalogClient.test.ts
Outdated
Show resolved
Hide resolved
workspaces/marketplace/plugins/marketplace-common/src/api/MarketplaceCatalogClient.test.ts
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Small type questions for now. We should also align that with the other utils. But its a good start so far. Please add unit tests for all utils.
workspaces/marketplace/plugins/marketplace-backend/src/router.ts
Outdated
Show resolved
Hide resolved
const DefaultOrderFields: EntityOrderQuery = [ | ||
{ field: 'metadata.name', order: 'asc' }, | ||
]; | ||
const DefaultLimit = 20; | ||
const RequiredFilter = { kind: 'plugin' }; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Don't know if this is needed. But please start consts with lower case characters.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Have changed into lower case . Since we want to get plugins by default we need to pass { kind: 'plugin' } , in queryEntities
. I wanted to get only 20 results by default .
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Without a default limit it will return all entities? Let us not have a limit for now since the UI doesn't support pagination at the moment.
workspaces/marketplace/plugins/marketplace/src/api/MarketplaceBackendClient.tsx
Outdated
Show resolved
Hide resolved
Signed-off-by: its-mitesh-kumar <[email protected]>
Signed-off-by: its-mitesh-kumar <[email protected]>
0704928
to
d311406
Compare
Signed-off-by: its-mitesh-kumar <[email protected]>
cbe9678
to
1390685
Compare
Signed-off-by: its-mitesh-kumar <[email protected]>
Signed-off-by: its-mitesh-kumar <[email protected]>
Signed-off-by: its-mitesh-kumar <[email protected]>
Signed-off-by: its-mitesh-kumar <[email protected]>
Signed-off-by: its-mitesh-kumar <[email protected]>
Signed-off-by: its-mitesh-kumar <[email protected]>
Quality Gate passedIssues Measures |
Hey, I just made a Pull Request!
✔️ Checklist