Remove searchfilter select and mention according as optional

Signed-off-by: Steve Cprek <steve.cprek@favordelivery.com>
This commit is contained in:
Steve Cprek
2023-02-23 14:40:37 -06:00
parent 7650bdf408
commit 77fa1b6c22
+23 -44
View File
@@ -28,7 +28,7 @@ yarn --cwd packages/app add @backstage/plugin-adr
import { EntityAdrContent, isAdrAvailable } from '@backstage/plugin-adr';
...
// Note: Add to any other Pages as well (e.g. defaultEntityPage and websiteEntityPage)
const serviceEntityPage = (
<EntityLayout>
{/* other tabs... */}
@@ -72,7 +72,7 @@ import { AdrSearchResultListItem } from '@backstage/plugin-adr';
import { AdrDocument } from '@backstage/plugin-adr-common';
...
// Optional - Add type to side pane
<SearchType.Accordion
name="Result Type"
defaultValue="software-catalog"
@@ -85,53 +85,32 @@ import { AdrDocument } from '@backstage/plugin-adr-common';
},
]}
/>
...
// In filters
<Paper className={classes.filters}>
...
// ADR specific type
{types.includes('adr') && (
<SearchFilter.Select
className={classes.filter}
label="Entity"
name="name"
values={async () => {
// Return a list of entities which have ADRs.
const { items } = await catalogApi.getEntities({
fields: ['metadata.name'],
filter: {
'metadata.annotations.backstage.io/adr-location':
CATALOG_FILTER_EXISTS,
},
});
const names = items.map(entity => entity.metadata.name);
names.sort();
return names;
}}
/>
)}
...
// In results
<Grid item xs={9}>
<SearchResult>
{({ results }) => (
case 'adr':
return (
<AdrSearchResultListItem
key={document.location}
// Note the cast to AdrDocument is not required if you're leveraging the new search results extensions available in v1.11 + : https://backstage.io/docs/features/search/how-to-guides#2-using-an-extension-in-your-backstage-app
result={document as AdrDocument}
/>
);
<SearchResult>
{({ results }) => (
<List>
{results.map(({ type, document, highlight, rank }) => {
switch (type) {
...
case 'adr':
return (
<AdrSearchResultListItem
key={document.location}
// Not required if you're leveraging the new search results extensions available in v1.11+
// https://backstage.io/docs/features/search/how-to-guides#2-using-an-extension-in-your-backstage-app
result={document as AdrDocument}
/>
);
...
}
})}
</List>
)}
</SearchResult>
```
## Custom ADR formats
By default, this plugin will parse ADRs according to the format specified by the [Markdown Architecture Decision Record (MADR) v2.x template](https://github.com/adr/madr/tree/2.1.2). If your ADRs are written using a different format, you can apply the following customizations to correctly identify and parse your documents: