Skip to content

Commit

Permalink
Add icons to the SO results
Browse files Browse the repository at this point in the history
  • Loading branch information
pgayvallet committed Nov 18, 2020
1 parent 47cd1e1 commit bee03aa
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -76,13 +76,10 @@ const resultToOption = (result: GlobalSearchResult): EuiSelectableTemplateSitewi
label: title,
url,
type,
icon: { type: icon ?? 'empty' },
'data-test-subj': `nav-search-option`,
};

if (icon) {
option.icon = { type: icon };
}

if (type === 'application') {
option.meta = [{ text: meta?.categoryLabel as string }];
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ describe('mapToResult', () => {
name: 'dashboard',
management: {
defaultSearchField: 'title',
icon: 'dashboardApp',
getInAppUrl: (obj) => ({ path: `/dashboard/${obj.id}`, uiCapabilitiesPath: '' }),
},
});
Expand All @@ -62,6 +63,7 @@ describe('mapToResult', () => {
title: 'My dashboard',
type: 'dashboard',
url: '/dashboard/dash1',
icon: 'dashboardApp',
score: 42,
});
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ export const mapToResult = (
// so we are forced to cast the attributes to any to access the properties associated with it.
title: (object.attributes as any)[defaultSearchField],
type: object.type,
icon: type.management?.icon ?? undefined,
url: getInAppUrl(object).path,
score: object.score,
};
Expand Down

0 comments on commit bee03aa

Please sign in to comment.