-
Notifications
You must be signed in to change notification settings - Fork 8.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into heatmap-small-multiples
- Loading branch information
Showing
12 changed files
with
254 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
75 changes: 75 additions & 0 deletions
75
...re/server/integration_tests/saved_objects/migrations/group3/default_search_fields.test.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License | ||
* 2.0 and the Server Side Public License, v 1; you may not use this file except | ||
* in compliance with, at your election, the Elastic License 2.0 or the Server | ||
* Side Public License, v 1. | ||
*/ | ||
|
||
import { createRoot } from '@kbn/core-test-helpers-kbn-server'; | ||
|
||
describe('SO default search fields', () => { | ||
let root: ReturnType<typeof createRoot>; | ||
|
||
afterEach(() => { | ||
try { | ||
root?.shutdown(); | ||
} catch (e) { | ||
/* trap */ | ||
} | ||
}); | ||
|
||
interface InvalidMappingTuple { | ||
type: string; | ||
field: string; | ||
} | ||
|
||
// identify / avoid scenarios of https://github.com/elastic/kibana/issues/130616 | ||
it('make sure management types have the correct mappings for default search fields', async () => { | ||
root = createRoot({}, { oss: false }); | ||
await root.preboot(); | ||
const setup = await root.setup(); | ||
|
||
const allTypes = setup.savedObjects.getTypeRegistry().getAllTypes(); | ||
|
||
const defaultSearchFields = [ | ||
...allTypes.reduce((fieldSet, type) => { | ||
if (type.management?.defaultSearchField) { | ||
fieldSet.add(type.management.defaultSearchField); | ||
} | ||
return fieldSet; | ||
}, new Set<string>()), | ||
]; | ||
|
||
const invalidMappings: InvalidMappingTuple[] = []; | ||
|
||
const managementTypes = setup.savedObjects | ||
.getTypeRegistry() | ||
.getImportableAndExportableTypes() | ||
.filter((type) => type.management!.visibleInManagement ?? true); | ||
|
||
managementTypes.forEach((type) => { | ||
const mappingProps = type.mappings.properties; | ||
defaultSearchFields.forEach((searchField) => { | ||
if (mappingProps[searchField]) { | ||
const fieldDef = mappingProps[searchField]; | ||
if (fieldDef.type !== 'text') { | ||
invalidMappings.push({ | ||
type: type.name, | ||
field: searchField, | ||
}); | ||
} | ||
} | ||
}); | ||
}); | ||
|
||
if (invalidMappings.length > 0) { | ||
// `fail()` no longer exists... | ||
expect( | ||
`fields registered as defaultSearchField by any type must be registered as text. Invalid mappings found: ${JSON.stringify( | ||
invalidMappings | ||
)}` | ||
).toEqual(''); | ||
} | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
52 changes: 52 additions & 0 deletions
52
.../public/pages/metrics/hosts/components/host_details_flyout/links/link_to_apm_services.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License | ||
* 2.0; you may not use this file except in compliance with the Elastic License | ||
* 2.0. | ||
*/ | ||
import React from 'react'; | ||
import { stringify } from 'querystring'; | ||
import { encode } from '@kbn/rison'; | ||
import { css } from '@emotion/react'; | ||
import { RedirectAppLinks } from '@kbn/shared-ux-link-redirect-app'; | ||
import { EuiIcon, EuiLink, useEuiTheme } from '@elastic/eui'; | ||
import { FormattedMessage } from '@kbn/i18n-react'; | ||
import { useKibanaContextForPlugin } from '../../../../../../hooks/use_kibana'; | ||
|
||
interface LinkToApmServicesProps { | ||
hostName: string; | ||
apmField: string; | ||
} | ||
|
||
export const LinkToApmServices = ({ hostName, apmField }: LinkToApmServicesProps) => { | ||
const { services } = useKibanaContextForPlugin(); | ||
const { http } = services; | ||
const { euiTheme } = useEuiTheme(); | ||
|
||
const queryString = new URLSearchParams( | ||
encode( | ||
stringify({ | ||
kuery: `${apmField}:"${hostName}"`, | ||
}) | ||
) | ||
); | ||
|
||
const linkToApmServices = http.basePath.prepend(`/app/apm/services?${queryString}`); | ||
|
||
return ( | ||
<RedirectAppLinks coreStart={services}> | ||
<EuiLink href={linkToApmServices} data-test-subj="hostsView-flyout-apm-services-link"> | ||
<EuiIcon | ||
type="popout" | ||
css={css` | ||
margin-right: ${euiTheme.size.xs}; | ||
`} | ||
/> | ||
<FormattedMessage | ||
id="xpack.infra.hostsViewPage.flyout.apmServicesLinkLabel" | ||
defaultMessage="APM Services" | ||
/> | ||
</EuiLink> | ||
</RedirectAppLinks> | ||
); | ||
}; |
47 changes: 47 additions & 0 deletions
47
.../infra/public/pages/metrics/hosts/components/host_details_flyout/links/link_to_uptime.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License | ||
* 2.0; you may not use this file except in compliance with the Elastic License | ||
* 2.0. | ||
*/ | ||
|
||
import React from 'react'; | ||
import { EuiLink, EuiIcon, useEuiTheme } from '@elastic/eui'; | ||
import { css } from '@emotion/react'; | ||
import { FormattedMessage } from '@kbn/i18n-react'; | ||
import { uptimeOverviewLocatorID } from '@kbn/observability-plugin/public'; | ||
import { useKibanaContextForPlugin } from '../../../../../../hooks/use_kibana'; | ||
import type { InventoryItemType } from '../../../../../../../common/inventory_models/types'; | ||
import type { HostNodeRow } from '../../../hooks/use_hosts_table'; | ||
|
||
interface LinkTUptimeProps { | ||
nodeType: InventoryItemType; | ||
node: HostNodeRow; | ||
} | ||
|
||
export const LinkToUptime = ({ nodeType, node }: LinkTUptimeProps) => { | ||
const { share } = useKibanaContextForPlugin().services; | ||
const { euiTheme } = useEuiTheme(); | ||
|
||
return ( | ||
<EuiLink | ||
data-test-subj="hostsView-flyout-uptime-link" | ||
onClick={() => | ||
share.url.locators | ||
.get(uptimeOverviewLocatorID)! | ||
.navigate({ [nodeType]: node.name, ip: node.ip }) | ||
} | ||
> | ||
<EuiIcon | ||
type="popout" | ||
css={css` | ||
margin-right: ${euiTheme.size.xs}; | ||
`} | ||
/> | ||
<FormattedMessage | ||
id="xpack.infra.hostsViewPage.flyout.uptimeLinkLabel" | ||
defaultMessage="Uptime" | ||
/> | ||
</EuiLink> | ||
); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters