-
Notifications
You must be signed in to change notification settings - Fork 1
Hexa 1441 pipelines list only returns first page #350
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
base: main
Are you sure you want to change the base?
Hexa 1441 pipelines list only returns first page #350
Conversation
yolanfery
left a comment
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.
Looking good, minor comments :-)
| current_version = "Jupyter notebook" | ||
| click.echo(f"* {pipeline.code} - {pipeline.name} ({current_version})") | ||
| page = 1 | ||
| click.echo("Pipelines:") |
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.
[Minor] I am a bit bothered because this is printed before the API call (which takes times). Maybe we should start printing after the API call (even if that means adding a if check)
| for pipeline in response.items: | ||
| if pipeline.type == PipelineType.zipFile: | ||
| version = f"v{pipeline.current_version.version_number}" if pipeline.current_version else "N/A" | ||
| else: # notebook type |
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.
[Minor] instead of this comment, I would elif pipeline.type == PipelineType.notebook
This avoid the need for comment and helps if ever extend the PipelineType type one day with one more type. Drawback is that you might need to add version = "" to use it ou t of the if-else scope
|
|
||
| for pipeline in response.items: | ||
| if pipeline.type == PipelineType.zipFile: | ||
| version = f"v{pipeline.current_version.version_number}" if pipeline.current_version else "N/A" |
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.
Can you use a diffrent naming than version ? It conflicts with from importlib.metadata import version
| click.echo(f"* {pipeline.code} - {pipeline.name} ({version})") | ||
|
|
||
| if page >= response.total_pages or not click.confirm( | ||
| f"\nLoad more? (page {page}/{response.total_pages})", default=True |
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.
[Very-Minor] Show more seems more user friendly than Load more
| click.echo(f"* {pipeline.code} - {pipeline.name} ({current_version})") | ||
| page = 1 | ||
| click.echo("Pipelines:") | ||
|
|
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.
Would be cool also somewhere to show the total number of pipelines
Like Pipelines (56): or something else
Description
The
openhexa pipelines listcommand was only returning the first page of pipelines (max 10 items), even when workspaces contained 50+ pipelines. This PR adds pagination support to fetch and display all pipelines across multiple pages.Core idea: Instead of fetching only the first page, the CLI now iteratively fetches pages and prompts users to load more, ensuring all pipelines are accessible.
Another fix: Corrected notebook pipeline type detection by using the
PipelineTypeenum instead of string comparison.Changes
Pagination Implementation
page = 1and increment after each fetch.pageandper_page=10parameters toclient.pipelines().while Trueloop to fetch multiple pages..itemsto full response object to accesstotal_pagesmetadata.click.confirm()prompt asking users to load next page.page == 1).Type Detection Fix
from openhexa.graphql.graphql_client.enums import PipelineTypepipeline.type == "zipFile"topipeline.type == PipelineType.zipFile.How/what to test
openhexa pipelines list. Confirm all pipelines display immediately with no "Load more?" prompt.openhexa pipelines list. Confirm the first 10 pipelines display with aLoad more? (page 1/N) [Y/n]:prompt. Press Enter to ensure subsequent pages load correctly.openhexa pipelines listand verify it shows as(Jupyter notebook)while standard pipelines show their version (e.g.,v1).Screenshots / screencast