search: browse bounded recent items with kind-only queries
This commit is contained in:
+9
-8
@@ -61,7 +61,6 @@ export function parseSearchQuery(value, selectedKind = DEFAULT_SEARCH_KIND) {
|
||||
return { query, kind, hasType };
|
||||
}
|
||||
|
||||
export const SEARCH_TYPE_HELP = "Add search text after the type filter (for example, t:pipeline plan). This server does not list results by type alone.";
|
||||
|
||||
/**
|
||||
* The orders the search sort control offers. "Relevance" keeps the server's own
|
||||
@@ -337,19 +336,21 @@ export function searchPanelEmptyMessage(state, shown, kind) {
|
||||
if ((shown ?? []).length > 0) return null;
|
||||
if (state?.loading) return null;
|
||||
const query = String(state?.query ?? "");
|
||||
if (query.trim() === "") return null;
|
||||
if (query.trim() === "") {
|
||||
if (!state?.loaded || !kind) return null;
|
||||
const label = searchKindLabel(kind).toLowerCase();
|
||||
return state?.truncated ? `No ${label} found within the server's scan limit.` : `No ${label} yet.`;
|
||||
}
|
||||
if (kind === "" || kind == null) return `No matches for "${query}".`;
|
||||
return `No ${searchKindLabel(kind).toLowerCase()} match "${query}".`;
|
||||
}
|
||||
|
||||
/**
|
||||
* Whether a keystroke's text is worth asking the server about. A blank or
|
||||
* whitespace-only query is cleared locally and never sent, so the server is not
|
||||
* asked to scan for nothing. The one predicate the field's input handler and its
|
||||
* immediate-send path share.
|
||||
* Text searches and valid kind-only browsing are sendable. Empty text with no
|
||||
* supported kind still clears locally, without an all-kind scan.
|
||||
*/
|
||||
export function searchQuerySendable(query) {
|
||||
return String(query ?? "").trim() !== "";
|
||||
export function searchQuerySendable(query, kind = "") {
|
||||
return String(query ?? "").trim() !== "" || SEARCH_KINDS.some((option) => option.value !== "" && option.value === kind);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user