-
Notifications
You must be signed in to change notification settings - Fork 8.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[UX Dashboard] Enabled inspector panel for ux dashboard (#113118)
Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
- Loading branch information
1 parent
65747e2
commit 25695b5
Showing
3 changed files
with
49 additions
and
4 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
40 changes: 40 additions & 0 deletions
40
x-pack/plugins/apm/public/components/app/RumDashboard/ActionMenu/inpector_link.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,40 @@ | ||
/* | ||
* 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 { EuiHeaderLink } from '@elastic/eui'; | ||
import { i18n } from '@kbn/i18n'; | ||
import React from 'react'; | ||
import { useApmPluginContext } from '../../../../context/apm_plugin/use_apm_plugin_context'; | ||
import { useKibana } from '../../../../../../../../src/plugins/kibana_react/public'; | ||
import { useInspectorContext } from '../../../../context/inspector/use_inspector_context'; | ||
import { enableInspectEsQueries } from '../../../../../../observability/common/ui_settings_keys'; | ||
|
||
export function UxInspectorHeaderLink() { | ||
const { inspector } = useApmPluginContext(); | ||
const { inspectorAdapters } = useInspectorContext(); | ||
const { | ||
services: { uiSettings }, | ||
} = useKibana(); | ||
|
||
const isInspectorEnabled = uiSettings?.get<boolean>(enableInspectEsQueries); | ||
|
||
const inspect = () => { | ||
inspector.open(inspectorAdapters); | ||
}; | ||
|
||
if (!isInspectorEnabled) { | ||
return null; | ||
} | ||
|
||
return ( | ||
<EuiHeaderLink color="primary" onClick={inspect}> | ||
{i18n.translate('xpack.apm.inspectButtonText', { | ||
defaultMessage: 'Inspect', | ||
})} | ||
</EuiHeaderLink> | ||
); | ||
} |