Skip to content

Commit

Permalink
Temp commit
Browse files Browse the repository at this point in the history
  • Loading branch information
Samiul-TheSoccerFan committed Nov 27, 2024
1 parent 6620529 commit a96b55f
Showing 1 changed file with 17 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ const CreateConnectorFlyoutComponent: React.FC<CreateConnectorFlyoutProps> = ({
const [actionType, setActionType] = useState<ActionType | null>(null);
const [hasActionsUpgradeableByTrial, setHasActionsUpgradeableByTrial] = useState<boolean>(false);
const canSave = hasSaveActionsCapability(capabilities);
const [isRequiredFieldError, setIsRequiredFieldError] = useState<boolean>(false);

const [preSubmitValidationErrorMessage, setPreSubmitValidationErrorMessage] =
useState<ReactNode>(null);
Expand Down Expand Up @@ -157,8 +158,15 @@ const CreateConnectorFlyoutComponent: React.FC<CreateConnectorFlyoutProps> = ({
secrets: secrets ?? {},
};

return;

const createdConnector = await createConnector(validConnector);
return createdConnector;
} else {
if (Object.keys(data).length === 0) {
setIsRequiredFieldError(true);
}
return;
}
}, [submit, preSubmitValidator, createConnector]);

Expand Down Expand Up @@ -228,6 +236,15 @@ const CreateConnectorFlyoutComponent: React.FC<CreateConnectorFlyoutProps> = ({
<EuiSpacer size="xs" />
</>
)}
{isRequiredFieldError && (
<p>
<FormattedMessage
id="xpack.triggersActionsUI.sections.actionConnectorAdd.requiredFieldError"
defaultMessage="All fields are required"
/>
<EuiSpacer size="m" />
</p>
)}
<ConnectorForm
actionTypeModel={actionTypeModel}
connector={initialConnector}
Expand Down

0 comments on commit a96b55f

Please sign in to comment.