From 352e5f62f871c6444954593ee6a4f3052f688c53 Mon Sep 17 00:00:00 2001 From: John Schulz Date: Thu, 12 Mar 2020 10:58:20 -0400 Subject: [PATCH] Missed one in e12a8ad8a4 --- .../list_page/components/create_config.tsx | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/x-pack/plugins/ingest_manager/public/applications/ingest_manager/sections/agent_config/list_page/components/create_config.tsx b/x-pack/plugins/ingest_manager/public/applications/ingest_manager/sections/agent_config/list_page/components/create_config.tsx index 5da9352ee8526..2373d6ad2ad17 100644 --- a/x-pack/plugins/ingest_manager/public/applications/ingest_manager/sections/agent_config/list_page/components/create_config.tsx +++ b/x-pack/plugins/ingest_manager/public/applications/ingest_manager/sections/agent_config/list_page/components/create_config.tsx @@ -19,7 +19,7 @@ import { EuiText, } from '@elastic/eui'; import { NewAgentConfig } from '../../../../types'; -import { useCore, sendCreateAgentConfig } from '../../../../hooks'; +import { useCapabilities, useCore, sendCreateAgentConfig } from '../../../../hooks'; import { AgentConfigForm, agentConfigFormValidation } from '../../components'; interface Props { @@ -27,8 +27,8 @@ interface Props { } export const CreateAgentConfigFlyout: React.FunctionComponent = ({ onClose }) => { - const { application, notifications } = useCore(); - + const { notifications } = useCore(); + const hasWriteCapabilites = useCapabilities().write; const [agentConfig, setAgentConfig] = useState({ name: '', description: '', @@ -93,11 +93,7 @@ export const CreateAgentConfigFlyout: React.FunctionComponent = ({ onClos 0 - } + isDisabled={!hasWriteCapabilites || isLoading || Object.keys(validation).length > 0} onClick={async () => { setIsLoading(true); try {