Signed-off-by: Emma Indal <emma.indahl@gmail.com>
Signed-off-by: Eric Peterson <ericpeterson@spotify.com>
This commit is contained in:
Emma Indal
2021-05-24 09:49:44 +02:00
committed by Eric Peterson
parent b6a633ca31
commit 720fd2f360
5 changed files with 31 additions and 27 deletions
@@ -11,13 +11,19 @@
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* l
imitations under the License.
* limitations under the License.
*/
import React from 'react';
import { Link } from '@backstage/core';
import { Box, Chip, Divider, ListItem, ListItemText, makeStyles } from '@material-ui/core';
import {
Box,
Chip,
Divider,
ListItem,
ListItemText,
makeStyles,
} from '@material-ui/core';
const useStyles = makeStyles({
flexContainer: {
@@ -41,8 +47,10 @@ export const CatalogResultListItem = ({ result }: any) => {
secondary={result.text}
/>
<Box>
{result.kind && (<Chip label={`Kind: ${result.kind}`} size="small" />)}
{result.lifecycle && (<Chip label={`Lifecycle: ${result.lifecycle}`} size="small" />)}
{result.kind && <Chip label={`Kind: ${result.kind}`} size="small" />}
{result.lifecycle && (
<Chip label={`Lifecycle: ${result.lifecycle}`} size="small" />
)}
</Box>
</ListItem>
<Divider component="li" />
@@ -116,14 +116,12 @@ export class LunrSearchEngine implements SearchEngine {
Object.keys(this.lunrIndices).forEach(type => {
try {
results.push(
...this.lunrIndices[type]
.search(lunrQueryString)
.map(result => {
return {
result: result,
type: type,
};
})
...this.lunrIndices[type].search(lunrQueryString).map(result => {
return {
result: result,
type: type,
};
}),
);
} catch (err) {
// if a field does not exist on a index, we can see that as a no-match
@@ -141,14 +139,12 @@ export class LunrSearchEngine implements SearchEngine {
.forEach(type => {
try {
results.push(
...this.lunrIndices[type]
.search(lunrQueryString)
.map(result => {
return {
result: result,
type: type,
};
})
...this.lunrIndices[type].search(lunrQueryString).map(result => {
return {
result: result,
type: type,
};
}),
);
} catch (err) {
// if a field does not exist on a index, we can see that as a no-match