mirror of
https://github.com/coder/coder.git
synced 2025-07-21 01:28:49 +00:00
fix: Allow spaces in searches (#2723)
This commit is contained in:
@ -33,6 +33,15 @@ func TestSearchUsers(t *testing.T) {
|
||||
RbacRole: []string{},
|
||||
},
|
||||
},
|
||||
{
|
||||
Name: "UsernameWithSpaces",
|
||||
Query: " user-name ",
|
||||
Expected: database.GetUsersParams{
|
||||
Search: "user-name",
|
||||
Status: []database.UserStatus{},
|
||||
RbacRole: []string{},
|
||||
},
|
||||
},
|
||||
{
|
||||
Name: "Username+Param",
|
||||
Query: "usEr-name stAtus:actiVe",
|
||||
|
@ -31,6 +31,14 @@ func TestSearchWorkspace(t *testing.T) {
|
||||
Name: "bar",
|
||||
},
|
||||
},
|
||||
{
|
||||
Name: "Owner/NameWithSpaces",
|
||||
Query: " Foo/Bar ",
|
||||
Expected: database.GetWorkspacesParams{
|
||||
OwnerUsername: "foo",
|
||||
Name: "bar",
|
||||
},
|
||||
},
|
||||
{
|
||||
Name: "Name",
|
||||
Query: "workspace-name",
|
||||
|
@ -9,7 +9,7 @@ import SearchIcon from "@material-ui/icons/Search"
|
||||
import { FormikErrors, useFormik } from "formik"
|
||||
import { useState } from "react"
|
||||
import { getValidationErrorMessage } from "../../api/errors"
|
||||
import { getFormHelpers, onChangeTrimmed } from "../../util/formUtils"
|
||||
import { getFormHelpers } from "../../util/formUtils"
|
||||
import { CloseDropdown, OpenDropdown } from "../DropdownArrows/DropdownArrows"
|
||||
import { Stack } from "../Stack/Stack"
|
||||
|
||||
@ -91,7 +91,7 @@ export const SearchBarWithFilter: React.FC<SearchBarWithFilterProps> = ({
|
||||
<TextField
|
||||
{...getFieldHelpers("query")}
|
||||
className={styles.textFieldRoot}
|
||||
onChange={onChangeTrimmed(form)}
|
||||
onChange={form.handleChange}
|
||||
fullWidth
|
||||
variant="outlined"
|
||||
InputProps={{
|
||||
|
Reference in New Issue
Block a user