From edd8d491f79390dd90d77ed6db121f8ac65ffcc5 Mon Sep 17 00:00:00 2001
From: Gidi Meir Morris <github@gidi.io>
Date: Tue, 29 Sep 2020 11:38:11 +0100
Subject: [PATCH] maded onTestConnector callback optional

---
 .../connector_add_flyout.tsx                  | 44 ++++++++++---------
 1 file changed, 23 insertions(+), 21 deletions(-)

diff --git a/x-pack/plugins/triggers_actions_ui/public/application/sections/action_connector_form/connector_add_flyout.tsx b/x-pack/plugins/triggers_actions_ui/public/application/sections/action_connector_form/connector_add_flyout.tsx
index 73174d57fd583..9bb9d07307e13 100644
--- a/x-pack/plugins/triggers_actions_ui/public/application/sections/action_connector_form/connector_add_flyout.tsx
+++ b/x-pack/plugins/triggers_actions_ui/public/application/sections/action_connector_form/connector_add_flyout.tsx
@@ -37,7 +37,7 @@ export interface ConnectorAddFlyoutProps {
   addFlyoutVisible: boolean;
   setAddFlyoutVisibility: React.Dispatch<React.SetStateAction<boolean>>;
   actionTypes?: ActionType[];
-  onTestConnector: (connector: ActionConnector) => void;
+  onTestConnector?: (connector: ActionConnector) => void;
 }
 
 export const ConnectorAddFlyout = ({
@@ -264,26 +264,28 @@ export const ConnectorAddFlyout = ({
             <EuiFlexGroup justifyContent="spaceBetween">
               {canSave && actionTypeModel && actionType ? (
                 <Fragment>
-                  <EuiFlexItem grow={false}>
-                    <EuiButton
-                      color="secondary"
-                      data-test-subj="saveAndTestNewActionButton"
-                      type="submit"
-                      isDisabled={hasErrors}
-                      isLoading={isSaving}
-                      onClick={async () => {
-                        const savedConnector = await onSaveClicked();
-                        if (savedConnector) {
-                          onTestConnector(savedConnector);
-                        }
-                      }}
-                    >
-                      <FormattedMessage
-                        id="xpack.triggersActionsUI.sections.actionConnectorAdd.saveAndTestButtonLabel"
-                        defaultMessage="Save & Test"
-                      />
-                    </EuiButton>
-                  </EuiFlexItem>
+                  {onTestConnector && (
+                    <EuiFlexItem grow={false}>
+                      <EuiButton
+                        color="secondary"
+                        data-test-subj="saveAndTestNewActionButton"
+                        type="submit"
+                        isDisabled={hasErrors}
+                        isLoading={isSaving}
+                        onClick={async () => {
+                          const savedConnector = await onSaveClicked();
+                          if (savedConnector) {
+                            onTestConnector(savedConnector);
+                          }
+                        }}
+                      >
+                        <FormattedMessage
+                          id="xpack.triggersActionsUI.sections.actionConnectorAdd.saveAndTestButtonLabel"
+                          defaultMessage="Save & Test"
+                        />
+                      </EuiButton>
+                    </EuiFlexItem>
+                  )}
                   <EuiFlexItem grow={false}>
                     <EuiButton
                       fill