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

feat(workspaces): change sorting order of the workspace list #7594

Merged
merged 6 commits into from
May 22, 2023

Conversation

rodrimaia
Copy link
Contributor

changes to the sorting order of the workspace list. The new sorting order is as follows:

  1. First, display workspaces that are currently running.
  2. Next, sort by user_name.
  3. Finally, sort by last_used_at in descending order.

That order was suggested in this conversation: #7590 (review).

Copy link
Member

@mtojek mtojek left a comment

Choose a reason for hiding this comment

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

Let's have a second pair of backend eyes on this PR so that we can be sure that we do not need to mangle with database queries instead.

coderd/workspaces.go Show resolved Hide resolved
coderd/workspaces_test.go Outdated Show resolved Hide resolved
@rodrimaia rodrimaia requested a review from mtojek May 19, 2023 14:27
coderd/workspaces_internal_test.go Outdated Show resolved Hide resolved
coderd/workspaces_internal_test.go Outdated Show resolved Hide resolved
coderd/workspaces_test.go Outdated Show resolved Hide resolved
rodrimaia and others added 2 commits May 19, 2023 17:13
@rodrimaia
Copy link
Contributor Author

@mtojek @johnstcn using table tests now

Copy link
Member

@mtojek mtojek left a comment

Choose a reason for hiding this comment

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

👍

@mtojek mtojek self-requested a review May 22, 2023 09:42
Copy link
Member

@mtojek mtojek left a comment

Choose a reason for hiding this comment

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

LGTM, but CI complains about some tests:

=== FAIL: coderd TestSortWorkspaces/then_sort_by_last_used_at_(recent_first) (0.00s)
    workspaces_internal_test.go:173: 
        	Error Trace:	C:/a/coder/coder/coderd/workspaces_internal_test.go:173
        	Error:      	Not equal: 
        	            	expected: []string{"running-userA3", "running-userA2", "running-userA"}
        	            	actual  : []string{"running-userA3", "running-userA", "running-userA2"}
        	            	
        	            	Diff:
        	            	--- Expected
        	            	+++ Actual
        	            	@@ -2,4 +2,4 @@
        	            	  (string) (len=14) "running-userA3",
        	            	- (string) (len=14) "running-userA2",
        	            	- (string) (len=13) "running-userA"
        	            	+ (string) (len=13) "running-userA",
        	            	+ (string) (len=14) "running-userA2"
        	            	 }
        	Test:       	TestSortWorkspaces/then_sort_by_last_used_at_(recent_first)
        	Messages:   	then sort by last used at (recent first)

@BrunoQuaresma BrunoQuaresma removed their request for review May 22, 2023 13:28
@rodrimaia rodrimaia enabled auto-merge (squash) May 22, 2023 20:47
@rodrimaia rodrimaia merged commit 4a32061 into main May 22, 2023
16 checks passed
@rodrimaia rodrimaia deleted the sort_workspace_list branch May 22, 2023 20:51
@github-actions github-actions bot locked and limited conversation to collaborators May 22, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants