mirror of
https://github.com/coder/coder.git
synced 2025-07-13 21:36:50 +00:00
fix: support substring search on workspace name (#2096)
This commit is contained in:
@ -330,7 +330,7 @@ func (q *fakeQuerier) GetWorkspacesWithFilter(_ context.Context, arg database.Ge
|
||||
if !arg.Deleted && workspace.Deleted {
|
||||
continue
|
||||
}
|
||||
if arg.Name != "" && workspace.Name != arg.Name {
|
||||
if arg.Name != "" && !strings.Contains(workspace.Name, arg.Name) {
|
||||
continue
|
||||
}
|
||||
workspaces = append(workspaces, workspace)
|
||||
|
@ -3658,10 +3658,10 @@ WHERE
|
||||
owner_id = $3
|
||||
ELSE true
|
||||
END
|
||||
-- Filter by name
|
||||
-- Filter by name, matching on substring
|
||||
AND CASE
|
||||
WHEN $4 :: text != '' THEN
|
||||
LOWER(name) = LOWER($4)
|
||||
LOWER(name) LIKE '%' || LOWER($4) || '%'
|
||||
ELSE true
|
||||
END
|
||||
`
|
||||
|
@ -28,10 +28,10 @@ WHERE
|
||||
owner_id = @owner_id
|
||||
ELSE true
|
||||
END
|
||||
-- Filter by name
|
||||
-- Filter by name, matching on substring
|
||||
AND CASE
|
||||
WHEN @name :: text != '' THEN
|
||||
LOWER(name) = LOWER(@name)
|
||||
LOWER(name) LIKE '%' || LOWER(@name) || '%'
|
||||
ELSE true
|
||||
END
|
||||
;
|
||||
|
Reference in New Issue
Block a user