[Fleet] Link to the installed version of an integration from global search (#115736)

* remove version from integrations global search link

* fix tests

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
This commit is contained in:
Mark Hopkin 2021-10-21 17:09:54 +01:00 committed by GitHub
parent c491d8c366
commit eb2b886a39
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 25 additions and 27 deletions

View file

@ -87,22 +87,22 @@ describe('Package search provider', () => {
).toBe('--(a|)', {
a: [
{
id: 'test-test',
id: 'test',
score: 80,
title: 'test',
type: 'integration',
url: {
path: 'undefined/detail/test-test/overview',
path: 'undefined/detail/test/overview',
prependBasePath: false,
},
},
{
id: 'test1-test1',
id: 'test1',
score: 80,
title: 'test1',
type: 'integration',
url: {
path: 'undefined/detail/test1-test1/overview',
path: 'undefined/detail/test1/overview',
prependBasePath: false,
},
},
@ -170,12 +170,12 @@ describe('Package search provider', () => {
).toBe('--(a|)', {
a: [
{
id: 'test1-test1',
id: 'test1',
score: 80,
title: 'test1',
type: 'integration',
url: {
path: 'undefined/detail/test1-test1/overview',
path: 'undefined/detail/test1/overview',
prependBasePath: false,
},
},
@ -226,22 +226,22 @@ describe('Package search provider', () => {
).toBe('--(a|)', {
a: [
{
id: 'test-test',
id: 'test',
score: 80,
title: 'test',
type: 'integration',
url: {
path: 'undefined/detail/test-test/overview',
path: 'undefined/detail/test/overview',
prependBasePath: false,
},
},
{
id: 'test1-test1',
id: 'test1',
score: 80,
title: 'test1',
type: 'integration',
url: {
path: 'undefined/detail/test1-test1/overview',
path: 'undefined/detail/test1/overview',
prependBasePath: false,
},
},
@ -269,12 +269,12 @@ describe('Package search provider', () => {
).toBe('--(a|)', {
a: [
{
id: 'test1-test1',
id: 'test1',
score: 80,
title: 'test1',
type: 'integration',
url: {
path: 'undefined/detail/test1-test1/overview',
path: 'undefined/detail/test1/overview',
prependBasePath: false,
},
},

View file

@ -53,21 +53,19 @@ export const toSearchResult = (
pkg: PackageListItem,
application: ApplicationStart,
basePath: IBasePath
): GlobalSearchProviderResult => {
const pkgkey = `${pkg.name}-${pkg.version}`;
return {
id: pkgkey,
type: packageType,
title: pkg.title,
score: 80,
icon: getEuiIconType(pkg, basePath),
url: {
// prettier-ignore
path: `${application.getUrlForApp(INTEGRATIONS_PLUGIN_ID)}${pagePathGetters.integration_details_overview({ pkgkey })[1]}`,
prependBasePath: false,
},
};
};
): GlobalSearchProviderResult => ({
id: pkg.name,
type: packageType,
title: pkg.title,
score: 80,
icon: getEuiIconType(pkg, basePath),
url: {
path: `${application.getUrlForApp(INTEGRATIONS_PLUGIN_ID)}${
pagePathGetters.integration_details_overview({ pkgkey: pkg.name })[1]
}`,
prependBasePath: false,
},
});
export const createPackageSearchProvider = (core: CoreSetup): GlobalSearchResultProvider => {
const coreStart$ = from(core.getStartServices()).pipe(