Skip to content

feat: Guard search queries against common mistakes#6404

Merged
Emyrk merged 16 commits into
mainfrom
stevenmasley/search
Mar 2, 2023
Merged

feat: Guard search queries against common mistakes#6404
Emyrk merged 16 commits into
mainfrom
stevenmasley/search

Conversation

@Emyrk
Copy link
Copy Markdown
Member

@Emyrk Emyrk commented Mar 1, 2023

Invalid enums, invalid query parameters, duplicate params, etc.

Fixes some of #5829. Still need more UX to assist.

Demo

A bunch of errors you can get.

Duplicate query params

Screenshot from 2023-03-01 13-50-58

Invalid Params

Screenshot from 2023-03-01 13-52-14

Future Work

Make all search bar pages consistent.

Workspaces page

  • Error above and below search bar, no toast error
  • Refreshes every 5s

Screenshot from 2023-03-01 13-22-02

Users & Audit page

  • Error under search bar
  • Toast error

Screenshot from 2023-03-01 13-22-34

Screenshot from 2023-03-01 13-23-14

@Emyrk Emyrk marked this pull request as ready for review March 1, 2023 19:53
@Emyrk Emyrk requested review from a team, Kira-Pilot and mtojek and removed request for mtojek March 1, 2023 19:59
@deansheather deansheather self-requested a review March 1, 2023 20:00
Comment thread coderd/searchquery/search.go Outdated
Comment thread coderd/searchquery/search.go Outdated
Comment thread coderd/searchquery/search_test.go Outdated
Comment thread coderd/httpapi/queryparams.go
Comment thread site/src/components/SearchBarWithFilter/SearchBarWithFilter.tsx Outdated
Comment thread site/src/components/SearchBarWithFilter/SearchBarWithFilter.tsx Outdated
@Kira-Pilot
Copy link
Copy Markdown
Member

Nice job!

I noticed we have a bit of a bizarre error message on the audit page filter:
Screenshot 2023-03-01 at 4 02 44 PM
Is it an easy fix to normalize this so it matches the error messages on other pages? We can't really be sure a user meant to filter on resource_type.

Another small thing: forgoing a filter totally doesn't yield an error message:
Screenshot 2023-03-01 at 4 00 57 PM

@Emyrk
Copy link
Copy Markdown
Member Author

Emyrk commented Mar 1, 2023

Nice job!

I noticed we have a bit of a bizarre error message on the audit page filter: Screenshot 2023-03-01 at 4 02 44 PM Is it an easy fix to normalize this so it matches the error messages on other pages? We can't really be sure a user meant to filter on resource_type.

Another small thing: forgoing a filter totally doesn't yield an error message: Screenshot 2023-03-01 at 4 00 57 PM

resource_type is the default search parameter if nothing is given. I could make it something else? But as is, if you do not specify a param, then it is implied as resource_type.

Good catch on the empty param

@Emyrk Emyrk merged commit 8cf292f into main Mar 2, 2023
@Emyrk Emyrk deleted the stevenmasley/search branch March 2, 2023 05:28
@github-actions github-actions Bot locked and limited conversation to collaborators Mar 2, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants