-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Remove free text search on contextURL #8503
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -68,27 +68,19 @@ export function WorkspaceSearch(props: Props) { | |
const search = async () => { | ||
setSearching(true); | ||
try { | ||
let searchTerm: string | undefined = queryTerm; | ||
const query: AdminGetWorkspacesQuery = { | ||
ownerId: props?.user?.id, | ||
}; | ||
if (matchesInstanceIdOrLegacyWorkspaceIdExactly(searchTerm)) { | ||
query.instanceIdOrWorkspaceId = searchTerm; | ||
} else if (matchesNewWorkspaceIdExactly(searchTerm)) { | ||
query.workspaceId = searchTerm; | ||
} | ||
if (query.workspaceId || query.instanceId || query.instanceIdOrWorkspaceId) { | ||
searchTerm = undefined; | ||
const query: AdminGetWorkspacesQuery = {}; | ||
if (matchesInstanceIdOrLegacyWorkspaceIdExactly(queryTerm)) { | ||
query.instanceIdOrWorkspaceId = queryTerm; | ||
} else if (matchesNewWorkspaceIdExactly(queryTerm)) { | ||
query.workspaceId = queryTerm; | ||
} | ||
|
||
// const searchTerm = searchTerm; | ||
const result = await getGitpodService().server.adminGetWorkspaces({ | ||
limit: 100, | ||
orderBy: 'instanceCreationTime', | ||
offset: 0, | ||
orderDir: "desc", | ||
...query, | ||
searchTerm, | ||
}); | ||
setSearchResult(result); | ||
} finally { | ||
|
@@ -104,7 +96,9 @@ export function WorkspaceSearch(props: Props) { | |
<path fillRule="evenodd" clipRule="evenodd" d="M6 2a4 4 0 100 8 4 4 0 000-8zM0 6a6 6 0 1110.89 3.477l4.817 4.816a1 1 0 01-1.414 1.414l-4.816-4.816A6 6 0 010 6z" fill="#A8A29E" /> | ||
</svg> | ||
</div> | ||
<input type="search" placeholder="Search Workspaces" onKeyDown={(ke) => ke.key === 'Enter' && search() } onChange={(v) => { setQueryTerm(v.target.value) }} /> | ||
<input type="search" placeholder="Search Workspace IDs" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. thought: I still think that long-term using more descriptive placeholders like Search by name as described in the last point in #8453 (comment) could be better. The suggestion: However, let's go with the current change as this looks obviously good and helpful and improve this if needed in a future iteration. ✔️ There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Initially I thought that Admins surely know that those are workspace IDs, but I realize that that was my biased assumption and the fact that we don't reference the term |
||
onKeyDown={(ke) => ke.key === 'Enter' && search() } | ||
onChange={(v) => { setQueryTerm((v.target.value).trim()) }} /> | ||
</div> | ||
<button disabled={searching} onClick={search}>Search</button> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. question: Although out of the scope of the changes in this PR, what do you think of dropping this search button here and other pages within the admin dashboard? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. thinking When there is no button, would the expectation be that the search result gets updated with every key change? Or would the user be expected to hit Enter? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. thought: There are cases where searching or filtering on key change is valid and useful like projects or members which usually are a finite and small data set. However, it sounds optimal to not search on key change when filtering large datasets like instance users, workspaces, etc but require enter to perform the search. 💭 Thinking out loud, we added the search button back in #3723 because we require the enter key to perform a search here but seems harmless to drop the button. Your call, feel free to move this discussion in a follow up issue. 🏓 |
||
</div> | ||
|
Uh oh!
There was an error while loading. Please reload this page.