mirror of
https://github.com/coder/coder.git
synced 2026-09-24 15:04:27 +08:00
chore: add workspace id filter on api (#12483)
* chore: add workspace id filter on api
This commit is contained in:
@@ -103,6 +103,7 @@ func Workspaces(query string, page codersdk.Pagination, agentInactiveDisconnectT
|
||||
}
|
||||
|
||||
parser := httpapi.NewQueryParamParser()
|
||||
filter.WorkspaceIds = parser.UUIDs(values, []uuid.UUID{}, "id")
|
||||
filter.OwnerUsername = parser.String(values, "", "owner")
|
||||
filter.TemplateName = parser.String(values, "", "template")
|
||||
filter.Name = parser.String(values, "", "name")
|
||||
|
||||
@@ -178,6 +178,10 @@ func TestSearchWorkspace(t *testing.T) {
|
||||
}
|
||||
assert.Contains(t, s.String(), c.ExpectedErrorContains)
|
||||
} else {
|
||||
if len(c.Expected.WorkspaceIds) == len(values.WorkspaceIds) {
|
||||
// nil slice vs 0 len slice is equivalent for our purposes.
|
||||
c.Expected.WorkspaceIds = values.WorkspaceIds
|
||||
}
|
||||
assert.Len(t, errs, 0, "expected no error")
|
||||
assert.Equal(t, c.Expected, values, "expected values")
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user