Skip to content

Commit

Permalink
maded onTestConnector callback optional
Browse files Browse the repository at this point in the history
  • Loading branch information
gmmorris committed Sep 29, 2020
1 parent 4943c44 commit edd8d49
Showing 1 changed file with 23 additions and 21 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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 = ({
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit edd8d49

Please sign in to comment.