-
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 remote-tracking branch 'upstream/main' into per-fields-diffs-tour
- Loading branch information
Showing
39 changed files
with
615 additions
and
80 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
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
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
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
41 changes: 41 additions & 0 deletions
41
x-pack/plugins/infra/public/components/asset_details/components/services_tooltip_content.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,41 @@ | ||
/* | ||
* 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 { EuiText, EuiLink } from '@elastic/eui'; | ||
import { RedirectAppLinks } from '@kbn/shared-ux-link-redirect-app'; | ||
import { FormattedMessage } from '@kbn/i18n-react'; | ||
import { useLinkProps } from '@kbn/observability-shared-plugin/public'; | ||
import { useKibanaContextForPlugin } from '../../../hooks/use_kibana'; | ||
|
||
export const ServicesTooltipContent = () => { | ||
const { services } = useKibanaContextForPlugin(); | ||
const linkProps = useLinkProps({ | ||
app: 'home', | ||
hash: '/tutorial/apm', | ||
}); | ||
return ( | ||
<EuiText size="xs"> | ||
<FormattedMessage | ||
id="xpack.infra.assetDetails.services.tooltip.servicesLabel" | ||
defaultMessage="Showing {apmTutorialLink} services detected on this host." | ||
values={{ | ||
apmTutorialLink: ( | ||
<RedirectAppLinks coreStart={services} style={{ display: 'inline-block' }}> | ||
<EuiLink data-test-subj="assetDetailsTooltipApmTutorialLink" href={linkProps.href}> | ||
<FormattedMessage | ||
id="xpack.infra.assetDetails.table.services.tooltip.tutorialLink" | ||
defaultMessage="APM-instrumented" | ||
/> | ||
</EuiLink> | ||
</RedirectAppLinks> | ||
), | ||
}} | ||
/> | ||
</EuiText> | ||
); | ||
}; |
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
58 changes: 58 additions & 0 deletions
58
x-pack/plugins/infra/public/components/asset_details/hooks/use_services.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,58 @@ | ||
/* | ||
* 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 { fold } from 'fp-ts/lib/Either'; | ||
import { identity } from 'fp-ts/lib/function'; | ||
import { pipe } from 'fp-ts/lib/pipeable'; | ||
import { useEffect, useMemo } from 'react'; | ||
import { | ||
ServicesAPIResponse, | ||
ServicesAPIResponseRT, | ||
ServicesAPIRequest, | ||
} from '../../../../common/http_api/host_details'; | ||
import { throwErrors, createPlainError } from '../../../../common/runtime_types'; | ||
import { useHTTPRequest } from '../../../hooks/use_http_request'; | ||
import { useRequestObservable } from './use_request_observable'; | ||
|
||
export function useServices(params: ServicesAPIRequest) { | ||
const { request$ } = useRequestObservable(); | ||
const decodeResponse = (response: any) => { | ||
return pipe( | ||
ServicesAPIResponseRT.decode(response), | ||
fold(throwErrors(createPlainError), identity) | ||
); | ||
}; | ||
const fetchOptions = useMemo( | ||
() => ({ query: { ...params, filters: JSON.stringify(params.filters) } }), | ||
[params] | ||
); | ||
const { error, loading, response, makeRequest } = useHTTPRequest<ServicesAPIResponse>( | ||
`/api/infra/services`, | ||
'GET', | ||
undefined, | ||
decodeResponse, | ||
undefined, | ||
undefined, | ||
true, | ||
fetchOptions | ||
); | ||
|
||
useEffect(() => { | ||
if (request$) { | ||
request$.next(makeRequest); | ||
} else { | ||
makeRequest(); | ||
} | ||
}, [makeRequest, request$]); | ||
|
||
return { | ||
error, | ||
loading, | ||
response, | ||
makeRequest, | ||
}; | ||
} |
Oops, something went wrong.