Skip to content
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

Add TFC workspace pagination #1587

Merged
merged 7 commits into from
Oct 23, 2023
Merged

Add TFC workspace pagination #1587

merged 7 commits into from
Oct 23, 2023

Conversation

dbanck
Copy link
Member

@dbanck dbanck commented Oct 11, 2023

This PR adds a simple pagination to the workspaces view. We load the next page and append it to the tree view when a user clicks "load more".

Hitting refresh or using the project filter will reset the cache.

UX

I'd like to improve the UX here, but it's not possible to programatically update the scroll position or deselect an item. Also, the current solution is cumbersome for 500+ workspaces, where a user would have to hit "load more" at least 10 times to get to workspaces further down the list. A filter (e.g. by name) might improve this in the future.

2023-10-12 10 31 40

@dbanck dbanck added the enhancement New feature or request label Oct 11, 2023
@dbanck dbanck self-assigned this Oct 11, 2023
@dbanck dbanck force-pushed the f-workspace-pagination branch from 88db6e0 to f532f92 Compare October 11, 2023 13:22
@dbanck dbanck marked this pull request as ready for review October 12, 2023 08:39
@dbanck dbanck requested a review from a team as a code owner October 12, 2023 08:39
try {
return this.getWorkspaces();
this.cache = [...this.cache, ...(await this.getWorkspaces())];
Copy link
Contributor

Choose a reason for hiding this comment

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

If I switch between organizations, I get a Element with id '<long_id> is already registered. I think we need to have the refresh call in the organization switcher somehow indicate we need to clear the cache?

@jpogran
Copy link
Contributor

jpogran commented Oct 12, 2023

I'd like to improve the UX here, but it's not possible to programatically update the scroll position or deselect an item

I've seen this behavior in other extensions that attempt to implement a load more experience, so this is expected if frustrating.

Also, the current solution is cumbersome for 500+ workspaces, where a user would have to hit "load more" at least 10 times to get to workspaces further down the list. A filter (e.g. by name) might improve this in the future.

The Gitlens extension has a 'Load All' button on the 'Load More' item, which would address the multiple waits for more. It would not handle paging through the massive list after clicking, but that is a problem endemic to treeviews not just us.

@jpogran jpogran added the terraform-cloud Features or bugs related to TFC integration in the editor label Oct 12, 2023
@jpogran jpogran linked an issue Oct 12, 2023 that may be closed by this pull request
1 task
@dbanck dbanck requested a review from jpogran October 13, 2023 14:51
Copy link
Contributor

@jpogran jpogran left a comment

Choose a reason for hiding this comment

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

works for me!

@dbanck dbanck merged commit d7c28b7 into f-tfc Oct 23, 2023
17 checks passed
@dbanck dbanck deleted the f-workspace-pagination branch October 23, 2023 14:53
dbanck added a commit that referenced this pull request Oct 24, 2023
* Only refresh runs for workspace items

* Introduce cache and loadmore item

* Clear cache on refresh

* Enable loading indicator on load more

* Fix error on org change

* Reset cache AND workspace count

* Use next-page instead of total-count
dbanck added a commit that referenced this pull request Nov 3, 2023
* Only refresh runs for workspace items

* Introduce cache and loadmore item

* Clear cache on refresh

* Enable loading indicator on load more

* Fix error on org change

* Reset cache AND workspace count

* Use next-page instead of total-count
jpogran pushed a commit that referenced this pull request Nov 6, 2023
* Only refresh runs for workspace items

* Introduce cache and loadmore item

* Clear cache on refresh

* Enable loading indicator on load more

* Fix error on org change

* Reset cache AND workspace count

* Use next-page instead of total-count
Copy link

I'm going to lock this pull request because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues.
If you have found a problem that seems related to this change, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Nov 23, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement New feature or request terraform-cloud Features or bugs related to TFC integration in the editor
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Support searching or paginating through more than 50 workspaces in the TFC view
2 participants