diff --git a/x-pack/plugins/fleet/public/applications/fleet/sections/settings/components/logstash_instructions/index.tsx b/x-pack/plugins/fleet/public/applications/fleet/sections/settings/components/logstash_instructions/index.tsx index 675aa6cdfd28c..b03d4cb700530 100644 --- a/x-pack/plugins/fleet/public/applications/fleet/sections/settings/components/logstash_instructions/index.tsx +++ b/x-pack/plugins/fleet/public/applications/fleet/sections/settings/components/logstash_instructions/index.tsx @@ -21,7 +21,8 @@ import type { EuiCallOutProps } from '@elastic/eui'; import { FormattedMessage } from '@kbn/i18n-react'; import { i18n } from '@kbn/i18n'; -import { useStartServices } from '../../../../hooks'; +import { useStartServices, useAuthz } from '../../../../hooks'; +import { MissingPrivilegesToolTip } from '../../../../../../components/missing_privileges_tooltip'; import { getLogstashPipeline, LOGSTASH_CONFIG_PIPELINES } from './helpers'; import { useLogstashApiKey } from './hooks'; @@ -64,7 +65,8 @@ export const LogstashInstructions = () => { const CollapsibleCallout: React.FunctionComponent = ({ children, ...props }) => { const [isOpen, setIsOpen] = useState(false); - + const authz = useAuthz(); + const hasAllSettings = authz.fleet.allSettings; return ( @@ -76,12 +78,17 @@ const CollapsibleCallout: React.FunctionComponent = ({ children /> ) : ( - setIsOpen(true)} fill={true}> - - + + setIsOpen(true)} fill={true} disabled={!hasAllSettings}> + + + )} {isOpen && ( <> @@ -96,6 +103,8 @@ const CollapsibleCallout: React.FunctionComponent = ({ children const LogstashInstructionSteps = () => { const { docLinks } = useStartServices(); const logstashApiKey = useLogstashApiKey(); + const authz = useAuthz(); + const hasAllSettings = authz.fleet.allSettings; const steps = useMemo( () => [ @@ -120,6 +129,7 @@ const LogstashInstructionSteps = () => { onClick={copy} iconType="copyClipboard" color="text" + disabled={!hasAllSettings} aria-label={i18n.translate( 'xpack.fleet.settings.logstashInstructions.copyApiKeyButtonLabel', { @@ -136,6 +146,7 @@ const LogstashInstructionSteps = () => { { ), }, ], - [logstashApiKey, docLinks] + [logstashApiKey, docLinks, hasAllSettings] ); return (