10000 feat: getWorkspaces filter site api by greyscaled · Pull Request #1564 · coder/coder · GitHub
[go: up one dir, main page]

Skip to content

feat: getWorkspaces filter site api #1564

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

Merged
merged 6 commits into from
May 19, 2022
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
fixup! feat: getWorkspaces filter site api
  • Loading branch information
greyscaled committed May 18, 2022
commit bb2d3821e8b382271d5873cfd251cf7be84280d9
6 changes: 3 additions & 3 deletions site/src/api/api.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -118,10 +118,10 @@ describe("api.ts", () => {
it.each<[TypesGen.WorkspaceFilter | undefined, string]>([
[undefined, "/api/v2/workspaces"],

[{ OrganizationID: "1", OwnerID: "" }, "/api/v2/workspaces?organization_id=1"],
[{ OrganizationID: "", OwnerID: "1" }, "/api/v2/workspaces?owner_id=1"],
[{ OrganizationID: "1", Owner: "" }, "/api/v2/workspaces?organization_id=1"],
[{ OrganizationID: "", Owner: "1" }, "/api/v2/workspaces?owner_id=1"],

[{ OrganizationID: "1", OwnerID: "me" }, "/api/v2/workspaces?organization_id=1&owner_id=me"],
[{ OrganizationID: "1", Owner: "me" }, "/api/v2/workspaces?organization_id=1&owner_id=me"],
])(`getWorkspacesURL(%p) returns %p`, (filter, expected) => {
expect(getWorkspacesURL(filter)).toBe(expected)
})
Expand Down
4 changes: 2 additions & 2 deletions site/src/api/api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -127,8 +127,8 @@ export const getWorkspacesURL = (filter?: TypesGen.WorkspaceFilter): string => {
if (filter?.OrganizationID) {
searchParams.append("organization_id", filter.OrganizationID)
}
if (filter?.OwnerID) {
searchParams.append("owner_id", filter.OwnerID)
if (filter?.Owner) {
searchParams.append("owner_id", filter.Owner)
}

const searchString = searchParams.toString()
Expand Down
0