Merge pull request #31935 from binary-baum/feature/set-default-type-filter-for-search
[NFS] set the default search type to all instead of software-catalog
This commit is contained in:
@@ -0,0 +1,5 @@
|
||||
---
|
||||
'@backstage/plugin-search': minor
|
||||
---
|
||||
|
||||
Added support for configuring the default search type in the search page via the `search.defaultType` option in `app-config.yaml`. This applies to both the legacy and new frontend systems. If not set, the default is empty, which means searching for "all" types.
|
||||
@@ -22,7 +22,7 @@ import {
|
||||
Page,
|
||||
useSidebarPinState,
|
||||
} from '@backstage/core-components';
|
||||
import { useApi } from '@backstage/core-plugin-api';
|
||||
import { configApiRef, useApi } from '@backstage/core-plugin-api';
|
||||
import { CatalogSearchResultListItem } from '@backstage/plugin-catalog';
|
||||
import {
|
||||
CATALOG_FILTER_EXISTS,
|
||||
@@ -60,6 +60,7 @@ const SearchPage = () => {
|
||||
const { isMobile } = useSidebarPinState();
|
||||
const { types } = useSearch();
|
||||
const catalogApi = useApi(catalogApiRef);
|
||||
const configApi = useApi(configApiRef);
|
||||
|
||||
return (
|
||||
<Page themeId="home">
|
||||
@@ -73,7 +74,7 @@ const SearchPage = () => {
|
||||
<Grid item xs={3}>
|
||||
<SearchType.Accordion
|
||||
name="Result type"
|
||||
defaultValue="software-catalog"
|
||||
defaultValue={configApi.getOptionalString('search.defaultType')}
|
||||
showCounts
|
||||
types={[
|
||||
{
|
||||
|
||||
@@ -15,6 +15,7 @@ Configure the search query values via `app-config.yaml` to define how it behaves
|
||||
```yaml
|
||||
# app-config.yaml
|
||||
search:
|
||||
defaultType: 'software-catalog'
|
||||
query:
|
||||
pageLimit: 50
|
||||
```
|
||||
|
||||
Vendored
+5
@@ -17,6 +17,11 @@
|
||||
export interface Config {
|
||||
/** Configuration options for the search plugin */
|
||||
search?: {
|
||||
/**
|
||||
* The default search type to be used when no specific type is selected.
|
||||
* @visibility frontend
|
||||
*/
|
||||
defaultType?: string;
|
||||
/**
|
||||
* An object representing the default search query configuration.
|
||||
* By configuring and modifying the values of this object,
|
||||
|
||||
@@ -39,6 +39,7 @@ import {
|
||||
createExtensionInput,
|
||||
PageBlueprint,
|
||||
NavItemBlueprint,
|
||||
configApiRef,
|
||||
} from '@backstage/frontend-plugin-api';
|
||||
|
||||
import {
|
||||
@@ -139,6 +140,7 @@ export const searchPage = PageBlueprint.makeWithOverrides({
|
||||
const { isMobile } = useSidebarPinState();
|
||||
const { types } = useSearch();
|
||||
const catalogApi = useApi(catalogApiRef);
|
||||
const configApi = useApi(configApiRef);
|
||||
|
||||
return (
|
||||
<Page themeId="home">
|
||||
@@ -152,7 +154,9 @@ export const searchPage = PageBlueprint.makeWithOverrides({
|
||||
<Grid item xs={3}>
|
||||
<SearchType.Accordion
|
||||
name="Result Type"
|
||||
defaultValue="software-catalog"
|
||||
defaultValue={configApi.getOptionalString(
|
||||
'search.defaultType',
|
||||
)}
|
||||
showCounts
|
||||
types={[
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user