Merge branch 'master' into systems-tab
Signed-off-by: sblausten <sam@roadie.io>
This commit is contained in:
@@ -1,5 +1,65 @@
|
||||
# @backstage/plugin-explore
|
||||
|
||||
## 0.3.46-next.0
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies
|
||||
- @backstage/plugin-catalog-react@1.3.0-next.0
|
||||
- @backstage/catalog-model@1.1.6-next.0
|
||||
- @backstage/plugin-explore-react@0.0.25
|
||||
|
||||
## 0.3.45
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- 9f9d279bd1: Updated `README.md` examples
|
||||
- d318d4f659: Makes the `GroupsDiagram` not grown on screen on its own.
|
||||
- Updated dependencies
|
||||
- @backstage/catalog-model@1.1.5
|
||||
- @backstage/plugin-catalog-react@1.2.4
|
||||
- @backstage/core-components@0.12.3
|
||||
- @backstage/plugin-search-react@1.4.0
|
||||
- @backstage/core-plugin-api@1.3.0
|
||||
- @backstage/errors@1.1.4
|
||||
- @backstage/theme@0.2.16
|
||||
- @backstage/plugin-explore-common@0.0.1
|
||||
- @backstage/plugin-explore-react@0.0.25
|
||||
- @backstage/plugin-search-common@1.2.1
|
||||
|
||||
## 0.3.45-next.2
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies
|
||||
- @backstage/plugin-search-react@1.4.0-next.2
|
||||
- @backstage/core-plugin-api@1.3.0-next.1
|
||||
- @backstage/plugin-catalog-react@1.2.4-next.2
|
||||
- @backstage/catalog-model@1.1.5-next.1
|
||||
- @backstage/core-components@0.12.3-next.2
|
||||
- @backstage/errors@1.1.4
|
||||
- @backstage/theme@0.2.16
|
||||
- @backstage/plugin-explore-common@0.0.1
|
||||
- @backstage/plugin-explore-react@0.0.25-next.1
|
||||
- @backstage/plugin-search-common@1.2.1-next.0
|
||||
|
||||
## 0.3.45-next.1
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- 9f9d279bd1: Updated `README.md` examples
|
||||
- Updated dependencies
|
||||
- @backstage/catalog-model@1.1.5-next.1
|
||||
- @backstage/core-components@0.12.3-next.1
|
||||
- @backstage/core-plugin-api@1.2.1-next.0
|
||||
- @backstage/errors@1.1.4
|
||||
- @backstage/theme@0.2.16
|
||||
- @backstage/plugin-catalog-react@1.2.4-next.1
|
||||
- @backstage/plugin-explore-common@0.0.1
|
||||
- @backstage/plugin-explore-react@0.0.25-next.0
|
||||
- @backstage/plugin-search-common@1.2.1-next.0
|
||||
- @backstage/plugin-search-react@1.3.2-next.1
|
||||
|
||||
## 0.3.45-next.0
|
||||
|
||||
### Patch Changes
|
||||
|
||||
@@ -125,9 +125,9 @@ export const ToolExplorerContent: (props: {
|
||||
}) => JSX.Element;
|
||||
|
||||
// @public (undocumented)
|
||||
export function ToolSearchResultListItem(
|
||||
export const ToolSearchResultListItem: (
|
||||
props: ToolSearchResultListItemProps,
|
||||
): JSX.Element;
|
||||
) => JSX.Element | null;
|
||||
|
||||
// @public
|
||||
export interface ToolSearchResultListItemProps {
|
||||
@@ -138,6 +138,6 @@ export interface ToolSearchResultListItemProps {
|
||||
// (undocumented)
|
||||
rank?: number;
|
||||
// (undocumented)
|
||||
result: IndexableDocument;
|
||||
result?: IndexableDocument;
|
||||
}
|
||||
```
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "@backstage/plugin-explore",
|
||||
"description": "A Backstage plugin for building an exploration page of your software ecosystem",
|
||||
"version": "0.3.45-next.0",
|
||||
"version": "0.3.46-next.0",
|
||||
"main": "src/index.ts",
|
||||
"types": "src/index.ts",
|
||||
"license": "Apache-2.0",
|
||||
|
||||
+5
-11
@@ -25,7 +25,6 @@ import {
|
||||
makeStyles,
|
||||
} from '@material-ui/core';
|
||||
import { Link } from '@backstage/core-components';
|
||||
import { useAnalytics } from '@backstage/core-plugin-api';
|
||||
import {
|
||||
IndexableDocument,
|
||||
ResultHighlight,
|
||||
@@ -50,23 +49,18 @@ const useStyles = makeStyles({
|
||||
*/
|
||||
export interface ToolSearchResultListItemProps {
|
||||
icon?: ReactNode;
|
||||
result: IndexableDocument;
|
||||
result?: IndexableDocument;
|
||||
highlight?: ResultHighlight;
|
||||
rank?: number;
|
||||
}
|
||||
|
||||
/** @public */
|
||||
/** @public */
|
||||
export function ToolSearchResultListItem(props: ToolSearchResultListItemProps) {
|
||||
const result = props.result as any;
|
||||
|
||||
const classes = useStyles();
|
||||
const analytics = useAnalytics();
|
||||
const handleClick = () => {
|
||||
analytics.captureEvent('discover', result.title, {
|
||||
attributes: { to: result.location },
|
||||
value: props.rank,
|
||||
});
|
||||
};
|
||||
|
||||
if (!result) return null;
|
||||
|
||||
return (
|
||||
<>
|
||||
@@ -77,7 +71,7 @@ export function ToolSearchResultListItem(props: ToolSearchResultListItemProps) {
|
||||
className={classes.itemText}
|
||||
primaryTypographyProps={{ variant: 'h6' }}
|
||||
primary={
|
||||
<Link noTrack to={result.location} onClick={handleClick}>
|
||||
<Link noTrack to={result.location}>
|
||||
{props.highlight?.fields.title ? (
|
||||
<HighlightedSearchResultText
|
||||
text={props.highlight.fields.title}
|
||||
|
||||
@@ -16,4 +16,3 @@
|
||||
|
||||
export * from './EntityExplorerContent';
|
||||
export * from './ExploreLayout';
|
||||
export * from './ToolSearchResultListItem';
|
||||
|
||||
@@ -23,5 +23,11 @@
|
||||
export * from './api';
|
||||
export * from './components';
|
||||
export * from './extensions';
|
||||
export { explorePlugin, explorePlugin as plugin } from './plugin';
|
||||
export {
|
||||
ToolSearchResultListItem,
|
||||
explorePlugin,
|
||||
explorePlugin as plugin,
|
||||
} from './plugin';
|
||||
export * from './routes';
|
||||
|
||||
export type { ToolSearchResultListItemProps } from './components/ToolSearchResultListItem';
|
||||
|
||||
@@ -22,7 +22,9 @@ import {
|
||||
discoveryApiRef,
|
||||
fetchApiRef,
|
||||
} from '@backstage/core-plugin-api';
|
||||
import { createSearchResultListItemExtension } from '@backstage/plugin-search-react';
|
||||
import { ExploreClient, exploreApiRef } from './api';
|
||||
import { ToolSearchResultListItemProps } from './components/ToolSearchResultListItem';
|
||||
// import { exampleTools } from './util/examples';
|
||||
|
||||
/** @public */
|
||||
@@ -65,3 +67,17 @@ export const explorePlugin = createPlugin({
|
||||
catalogEntity: catalogEntityRouteRef,
|
||||
},
|
||||
});
|
||||
|
||||
/** @public */
|
||||
export const ToolSearchResultListItem: (
|
||||
props: ToolSearchResultListItemProps,
|
||||
) => JSX.Element | null = explorePlugin.provide(
|
||||
createSearchResultListItemExtension({
|
||||
name: 'ToolSearchResultListItem',
|
||||
component: () =>
|
||||
import('./components/ToolSearchResultListItem').then(
|
||||
m => m.ToolSearchResultListItem,
|
||||
),
|
||||
predicate: result => result.type === 'tools',
|
||||
}),
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user