- Notifications
You must be signed in to change notification settings - Fork929
feat: Workspaces filtering#1972
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Merged
Uh oh!
There was an error while loading.Please reload this page.
Merged
Changes from1 commit
Commits
Show all changes
23 commits Select commitHold shift + click to select a range
d7c1318
feat: Workspaces filtering
f0ssel5cb62d5
Remove error handling
f0ssel09011d9
styling
f0ssel11836ea
Apply suggestions from code review
f0ssel568e3a6
pr fixes
f0sself1409b2
language
f0sself8e09e6
push up what I have
f0ssel424e933
Add name filter to backend
f0ssel5dbf5b4
Add name filter
f0ssel2912d03
add backend
f0ssel9ea5c14
fix
f0ssel93a7d3c
Apply suggestions from code review
f0ssel79e71f1
fmt
f0ssel5f1ae06
Merge branch 'f0ssel/workspace-filter' of github.com:coder/coder into…
f0ssel6b2999d
trim query
f0ssel57fe5db
skip invalid key pairs
f0ssel0a5d972
fix pq type
f0ssel4aea7a0
fix tests
f0ssel0dd5552
make gen
f0ssel5d0d9bb
fix test
f0ssel59e7d5e
flicker less
f0ssel912b65c
some styling ideas (#2010)
Kira-Pilot30a17e9
fix lower comparison
f0sselFile filter
Filter by extension
Conversations
Failed to load comments.
Loading
Uh oh!
There was an error while loading.Please reload this page.
Jump to
Jump to file
Failed to load files.
Loading
Uh oh!
There was an error while loading.Please reload this page.
Diff view
Diff view
add backend
- Loading branch information
Uh oh!
There was an error while loading.Please reload this page.
commit2912d038889ca09d6783b37183ec5d463f399ec8
There are no files selected for viewing
19 changes: 6 additions & 13 deletionscoderd/workspaces.go
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -142,13 +142,9 @@ func (api *API) workspaces(rw http.ResponseWriter, r *http.Request) { | ||
filter := database.GetWorkspacesWithFilterParams{Deleted: false} | ||
if orgFilter != "" { | ||
orgID, err := uuid.Parse(orgFilter) | ||
if err == nil { | ||
f0ssel marked this conversation as resolved. Show resolvedHide resolvedUh oh!There was an error while loading.Please reload this page. | ||
filter.OrganizationID = orgID | ||
} | ||
} | ||
if ownerFilter == "me" { | ||
filter.OwnerID = apiKey.UserID | ||
@@ -161,15 +157,12 @@ func (api *API) workspaces(rw http.ResponseWriter, r *http.Request) { | ||
Username: ownerFilter, | ||
Email: ownerFilter, | ||
}) | ||
if err == nil { | ||
filter.OwnerID = user.ID | ||
} | ||
} else { | ||
filter.OwnerID = userID | ||
} | ||
} | ||
if nameFilter != "" { | ||
filter.Name = nameFilter | ||
11 changes: 3 additions & 8 deletionscodersdk/workspaces.go
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -5,7 +5,6 @@ import ( | ||
"encoding/json" | ||
"fmt" | ||
"net/http" | ||
"time" | ||
"github.com/google/uuid" | ||
@@ -199,11 +198,10 @@ func (c *Client) PutExtendWorkspace(ctx context.Context, id uuid.UUID, req PutEx | ||
} | ||
type WorkspaceFilter struct { | ||
OrganizationID uuid.UUID `json:"organization_id,omitempty"` | ||
// Owner can be a user_id (uuid), "me", or a username | ||
Owner string `json:"owner,omitempty"` | ||
Name string `json:"name,omitempty"` | ||
f0ssel marked this conversation as resolved. Show resolvedHide resolvedUh oh!There was an error while loading.Please reload this page. | ||
} | ||
// asRequestOption returns a function that can be used in (*Client).Request. | ||
@@ -220,9 +218,6 @@ func (f WorkspaceFilter) asRequestOption() requestOption { | ||
if f.Name != "" { | ||
q.Set("name", f.Name) | ||
} | ||
r.URL.RawQuery = q.Encode() | ||
} | ||
} | ||
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.